[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/+/1948721
Reviewed-by: Igor 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}
This commit is contained in:
Leszek Swirski 2019-12-04 13:54:42 +01:00 committed by Commit Bot
parent 3088ca86cb
commit 29af4273a5
5 changed files with 28 additions and 28 deletions

View File

@ -109,7 +109,7 @@ class AccessCheckInfo
// Dispatched behavior.
DECL_PRINTER(AccessCheckInfo)
static AccessCheckInfo Get(const Isolate* isolate, Handle<JSObject> receiver);
static AccessCheckInfo Get(Isolate* isolate, Handle<JSObject> receiver);
TQ_OBJECT_CONSTRUCTORS(AccessCheckInfo)
};

View File

@ -85,7 +85,7 @@ class HeapObject : public Object {
// Oddball checks are faster when they are raw pointer comparisons, so the
// isolate/read-only roots overloads should be preferred where possible.
#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() const;
ODDBALL_LIST(IS_TYPE_FUNCTION_DECL)

View File

@ -87,8 +87,8 @@ IS_TYPE_FUNCTION_DEF(SmallOrderedHashTable)
#undef IS_TYPE_FUNCTION_DEF
#define IS_TYPE_FUNCTION_DEF(Type, Value) \
bool Object::Is##Type(const Isolate* isolate) const { \
return IsHeapObject() && HeapObject::cast(*this).Is##Type(isolate); \
bool Object::Is##Type(Isolate* isolate) const { \
return Is##Type(ReadOnlyRoots(isolate)); \
} \
bool Object::Is##Type(ReadOnlyRoots roots) const { \
return *this == roots.Value(); \
@ -96,8 +96,8 @@ IS_TYPE_FUNCTION_DEF(SmallOrderedHashTable)
bool Object::Is##Type() const { \
return IsHeapObject() && HeapObject::cast(*this).Is##Type(); \
} \
bool HeapObject::Is##Type(const Isolate* isolate) const { \
return Is##Type(GetReadOnlyRoots(isolate)); \
bool HeapObject::Is##Type(Isolate* isolate) const { \
return Object::Is##Type(isolate); \
} \
bool HeapObject::Is##Type(ReadOnlyRoots roots) const { \
return Object::Is##Type(roots); \
@ -106,8 +106,8 @@ IS_TYPE_FUNCTION_DEF(SmallOrderedHashTable)
ODDBALL_LIST(IS_TYPE_FUNCTION_DEF)
#undef IS_TYPE_FUNCTION_DEF
bool Object::IsNullOrUndefined(const Isolate* isolate) const {
return IsHeapObject() && HeapObject::cast(*this).IsNullOrUndefined(isolate);
bool Object::IsNullOrUndefined(Isolate* isolate) const {
return IsNullOrUndefined(ReadOnlyRoots(isolate));
}
bool Object::IsNullOrUndefined(ReadOnlyRoots roots) const {
@ -131,8 +131,8 @@ bool Object::IsNoSharedNameSentinel() const {
return *this == SharedFunctionInfo::kNoSharedNameSentinel;
}
bool HeapObject::IsNullOrUndefined(const Isolate* isolate) const {
return IsNullOrUndefined(GetReadOnlyRoots(isolate));
bool HeapObject::IsNullOrUndefined(Isolate* isolate) const {
return IsNullOrUndefined(ReadOnlyRoots(isolate));
}
bool HeapObject::IsNullOrUndefined(ReadOnlyRoots roots) const {

View File

@ -7872,7 +7872,7 @@ int JSGeneratorObject::source_position() const {
}
// static
AccessCheckInfo AccessCheckInfo::Get(const Isolate* isolate,
AccessCheckInfo AccessCheckInfo::Get(Isolate* isolate,
Handle<JSObject> receiver) {
DisallowHeapAllocation no_gc;
DCHECK(receiver->map().is_access_check_needed());

View File

@ -285,7 +285,7 @@ class Object : public TaggedImpl<HeapObjectReferenceType::STRONG, Address> {
// Oddball checks are faster when they are raw pointer comparisons, so the
// isolate/read-only roots overloads should be preferred where possible.
#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() const;
ODDBALL_LIST(IS_TYPE_FUNCTION_DECL)