Commit 29af4273 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[isolate] Revert oddball checks to non-const Isolate*

Looks like even the small amount of logic needed to extract ReadOnlyRoots
from a const Isolate* (e.g. a HeapObject check) is enough to cause
regressions.

Revert these predicates to take non-const Isolate*, while keeping const
Isolate* elsewhere. If we ever need const Isolate* for the oddball
predicates, we can add it in addition to the non-const one.

Bug: chromium:1029457
Bug: chromium:1030001
Bug: chromium:1030003
Bug: chromium:1030102
Change-Id: Ia6fa45f282a1a1961c0afa8ed973baebf6fbafd3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1948721Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65331}
parent 3088ca86
...@@ -109,7 +109,7 @@ class AccessCheckInfo ...@@ -109,7 +109,7 @@ class AccessCheckInfo
// Dispatched behavior. // Dispatched behavior.
DECL_PRINTER(AccessCheckInfo) DECL_PRINTER(AccessCheckInfo)
static AccessCheckInfo Get(const Isolate* isolate, Handle<JSObject> receiver); static AccessCheckInfo Get(Isolate* isolate, Handle<JSObject> receiver);
TQ_OBJECT_CONSTRUCTORS(AccessCheckInfo) TQ_OBJECT_CONSTRUCTORS(AccessCheckInfo)
}; };
......
...@@ -84,9 +84,9 @@ class HeapObject : public Object { ...@@ -84,9 +84,9 @@ class HeapObject : public Object {
// Oddball checks are faster when they are raw pointer comparisons, so the // Oddball checks are faster when they are raw pointer comparisons, so the
// isolate/read-only roots overloads should be preferred where possible. // isolate/read-only roots overloads should be preferred where possible.
#define IS_TYPE_FUNCTION_DECL(Type, Value) \ #define IS_TYPE_FUNCTION_DECL(Type, Value) \
V8_INLINE bool Is##Type(const Isolate* isolate) const; \ V8_INLINE bool Is##Type(Isolate* isolate) const; \
V8_INLINE bool Is##Type(ReadOnlyRoots roots) const; \ V8_INLINE bool Is##Type(ReadOnlyRoots roots) const; \
V8_INLINE bool Is##Type() const; V8_INLINE bool Is##Type() const;
ODDBALL_LIST(IS_TYPE_FUNCTION_DECL) ODDBALL_LIST(IS_TYPE_FUNCTION_DECL)
IS_TYPE_FUNCTION_DECL(NullOrUndefined, /* unused */) IS_TYPE_FUNCTION_DECL(NullOrUndefined, /* unused */)
......
...@@ -86,28 +86,28 @@ IS_TYPE_FUNCTION_DEF(HashTableBase) ...@@ -86,28 +86,28 @@ IS_TYPE_FUNCTION_DEF(HashTableBase)
IS_TYPE_FUNCTION_DEF(SmallOrderedHashTable) IS_TYPE_FUNCTION_DEF(SmallOrderedHashTable)
#undef IS_TYPE_FUNCTION_DEF #undef IS_TYPE_FUNCTION_DEF
#define IS_TYPE_FUNCTION_DEF(Type, Value) \ #define IS_TYPE_FUNCTION_DEF(Type, Value) \
bool Object::Is##Type(const Isolate* isolate) const { \ bool Object::Is##Type(Isolate* isolate) const { \
return IsHeapObject() && HeapObject::cast(*this).Is##Type(isolate); \ return Is##Type(ReadOnlyRoots(isolate)); \
} \ } \
bool Object::Is##Type(ReadOnlyRoots roots) const { \ bool Object::Is##Type(ReadOnlyRoots roots) const { \
return *this == roots.Value(); \ return *this == roots.Value(); \
} \ } \
bool Object::Is##Type() const { \ bool Object::Is##Type() const { \
return IsHeapObject() && HeapObject::cast(*this).Is##Type(); \ return IsHeapObject() && HeapObject::cast(*this).Is##Type(); \
} \ } \
bool HeapObject::Is##Type(const Isolate* isolate) const { \ bool HeapObject::Is##Type(Isolate* isolate) const { \
return Is##Type(GetReadOnlyRoots(isolate)); \ return Object::Is##Type(isolate); \
} \ } \
bool HeapObject::Is##Type(ReadOnlyRoots roots) const { \ bool HeapObject::Is##Type(ReadOnlyRoots roots) const { \
return Object::Is##Type(roots); \ return Object::Is##Type(roots); \
} \ } \
bool HeapObject::Is##Type() const { return Is##Type(GetReadOnlyRoots()); } bool HeapObject::Is##Type() const { return Is##Type(GetReadOnlyRoots()); }
ODDBALL_LIST(IS_TYPE_FUNCTION_DEF) ODDBALL_LIST(IS_TYPE_FUNCTION_DEF)
#undef IS_TYPE_FUNCTION_DEF #undef IS_TYPE_FUNCTION_DEF
bool Object::IsNullOrUndefined(const Isolate* isolate) const { bool Object::IsNullOrUndefined(Isolate* isolate) const {
return IsHeapObject() && HeapObject::cast(*this).IsNullOrUndefined(isolate); return IsNullOrUndefined(ReadOnlyRoots(isolate));
} }
bool Object::IsNullOrUndefined(ReadOnlyRoots roots) const { bool Object::IsNullOrUndefined(ReadOnlyRoots roots) const {
...@@ -131,8 +131,8 @@ bool Object::IsNoSharedNameSentinel() const { ...@@ -131,8 +131,8 @@ bool Object::IsNoSharedNameSentinel() const {
return *this == SharedFunctionInfo::kNoSharedNameSentinel; return *this == SharedFunctionInfo::kNoSharedNameSentinel;
} }
bool HeapObject::IsNullOrUndefined(const Isolate* isolate) const { bool HeapObject::IsNullOrUndefined(Isolate* isolate) const {
return IsNullOrUndefined(GetReadOnlyRoots(isolate)); return IsNullOrUndefined(ReadOnlyRoots(isolate));
} }
bool HeapObject::IsNullOrUndefined(ReadOnlyRoots roots) const { bool HeapObject::IsNullOrUndefined(ReadOnlyRoots roots) const {
......
...@@ -7872,7 +7872,7 @@ int JSGeneratorObject::source_position() const { ...@@ -7872,7 +7872,7 @@ int JSGeneratorObject::source_position() const {
} }
// static // static
AccessCheckInfo AccessCheckInfo::Get(const Isolate* isolate, AccessCheckInfo AccessCheckInfo::Get(Isolate* isolate,
Handle<JSObject> receiver) { Handle<JSObject> receiver) {
DisallowHeapAllocation no_gc; DisallowHeapAllocation no_gc;
DCHECK(receiver->map().is_access_check_needed()); DCHECK(receiver->map().is_access_check_needed());
......
...@@ -284,9 +284,9 @@ class Object : public TaggedImpl<HeapObjectReferenceType::STRONG, Address> { ...@@ -284,9 +284,9 @@ class Object : public TaggedImpl<HeapObjectReferenceType::STRONG, Address> {
// Oddball checks are faster when they are raw pointer comparisons, so the // Oddball checks are faster when they are raw pointer comparisons, so the
// isolate/read-only roots overloads should be preferred where possible. // isolate/read-only roots overloads should be preferred where possible.
#define IS_TYPE_FUNCTION_DECL(Type, Value) \ #define IS_TYPE_FUNCTION_DECL(Type, Value) \
V8_INLINE bool Is##Type(const Isolate* isolate) const; \ V8_INLINE bool Is##Type(Isolate* isolate) const; \
V8_INLINE bool Is##Type(ReadOnlyRoots roots) const; \ V8_INLINE bool Is##Type(ReadOnlyRoots roots) const; \
V8_INLINE bool Is##Type() const; V8_INLINE bool Is##Type() const;
ODDBALL_LIST(IS_TYPE_FUNCTION_DECL) ODDBALL_LIST(IS_TYPE_FUNCTION_DECL)
IS_TYPE_FUNCTION_DECL(NullOrUndefined, /* unused */) IS_TYPE_FUNCTION_DECL(NullOrUndefined, /* unused */)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment