[isolate] Make field getters use a const Isolate*

To indicate that the Isolate* in getters might not be a "real" isolate,
but rather a calculated one from GetIsolateForPtrCompr only used for
calculating the isolate root, make that function return a const Isolate*
and change field getters, Object::IsFoo predicates, and related
functions to all take a const Isolate* instead of an Isolate*

With this change, we can slightly more confidently use Objects that are
in OffThreadSpace, without having to worry too much about having an
Isolate* floating around that could accidentally be used.

This is a slight abuse of const semantics, but it allows implicit
conversion from Isolate* arguments to the const Isolate* parameter.

Bug: v8:7703
Bug: chromium:1011762
Change-Id: I54d4a65d2299477195f4d754cabe64ce34fdaa4c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1939455
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65199}
This commit is contained in:
Leszek Swirski 2019-11-27 12:00:05 +01:00 committed by Commit Bot
parent 4fd2a24b33
commit 42a56e038b
41 changed files with 184 additions and 185 deletions

View File

@ -19,12 +19,7 @@ V8_INLINE Tagged_t CompressTagged(Address tagged) {
return static_cast<Tagged_t>(static_cast<uint32_t>(tagged));
}
// Calculates isolate root value from any on-heap address.
template <typename TOnHeapAddress>
V8_INLINE Address GetIsolateRoot(TOnHeapAddress on_heap_addr);
template <>
V8_INLINE Address GetIsolateRoot<Address>(Address on_heap_addr) {
V8_INLINE Address GetIsolateRoot(Address on_heap_addr) {
// We subtract 1 here in order to let the compiler generate addition of 32-bit
// signed constant instead of 64-bit constant (the problem is that 2Gb looks
// like a negative 32-bit value). It's correct because we will never use
@ -32,8 +27,7 @@ V8_INLINE Address GetIsolateRoot<Address>(Address on_heap_addr) {
return RoundDown<kPtrComprIsolateRootAlignment>(on_heap_addr);
}
template <>
V8_INLINE Address GetIsolateRoot<Isolate*>(Isolate* isolate) {
V8_INLINE Address GetIsolateRoot(const Isolate* isolate) {
Address isolate_root = isolate->isolate_root();
#ifdef V8_COMPRESS_POINTERS
isolate_root = reinterpret_cast<Address>(V8_ASSUME_ALIGNED(

View File

@ -308,7 +308,7 @@ USE_TORQUE_VERIFIER(FeedbackVector)
USE_TORQUE_VERIFIER(JSReceiver)
bool JSObject::ElementsAreSafeToExamine(Isolate* isolate) const {
bool JSObject::ElementsAreSafeToExamine(const Isolate* isolate) const {
// If a GC was caused while constructing this object, the elements
// pointer may point to a one pointer filler map.
return elements(isolate) !=

View File

@ -14,7 +14,7 @@
namespace v8 {
namespace internal {
inline Isolate* GetIsolateForPtrCompr(HeapObject object) {
inline const Isolate* GetIsolateForPtrCompr(HeapObject object) {
#ifdef V8_COMPRESS_POINTERS
return Isolate::FromRoot(GetIsolateRoot(object.ptr()));
#else

View File

@ -14,7 +14,7 @@ namespace internal {
// value is intended to be used only as a hoisted computation of isolate root
// inside trivial accessors for optmizing value decompression.
// When pointer compression is disabled this function always returns nullptr.
V8_INLINE Isolate* GetIsolateForPtrCompr(HeapObject object);
V8_INLINE const Isolate* GetIsolateForPtrCompr(HeapObject object);
V8_INLINE Heap* GetHeapFromWritableObject(HeapObject object);

View File

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

View File

@ -316,7 +316,7 @@ int Code::SizeIncludingMetadata() const {
}
ByteArray Code::unchecked_relocation_info() const {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return ByteArray::unchecked_cast(
TaggedField<HeapObject, kRelocationInfoOffset>::load(isolate, *this));
}

View File

@ -53,11 +53,11 @@ SMI_ACCESSORS(Context, length, kLengthOffset)
CAST_ACCESSOR(NativeContext)
Object Context::get(int index) const {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return get(isolate, index);
}
Object Context::get(Isolate* isolate, int index) const {
Object Context::get(const Isolate* isolate, int index) const {
DCHECK_LT(static_cast<unsigned>(index),
static_cast<unsigned>(this->length()));
return TaggedField<Object>::Relaxed_Load(isolate, *this,

View File

@ -473,7 +473,7 @@ class Context : public HeapObject {
// Setter and getter for elements.
V8_INLINE Object get(int index) const;
V8_INLINE Object get(Isolate* isolate, int index) const;
V8_INLINE Object get(const Isolate* isolate, int index) const;
V8_INLINE void set(int index, Object value);
// Setter with explicit barrier mode.
V8_INLINE void set(int index, Object value, WriteBarrierMode mode);

View File

@ -105,11 +105,11 @@ ObjectSlot DescriptorArray::GetDescriptorSlot(int descriptor) {
}
Name DescriptorArray::GetKey(InternalIndex descriptor_number) const {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return GetKey(isolate, descriptor_number);
}
Name DescriptorArray::GetKey(Isolate* isolate,
Name DescriptorArray::GetKey(const Isolate* isolate,
InternalIndex descriptor_number) const {
DCHECK_LT(descriptor_number.as_int(), number_of_descriptors());
int entry_offset = OffsetOfDescriptorAt(descriptor_number.as_int());
@ -128,11 +128,12 @@ int DescriptorArray::GetSortedKeyIndex(int descriptor_number) {
}
Name DescriptorArray::GetSortedKey(int descriptor_number) {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return GetSortedKey(isolate, descriptor_number);
}
Name DescriptorArray::GetSortedKey(Isolate* isolate, int descriptor_number) {
Name DescriptorArray::GetSortedKey(const Isolate* isolate,
int descriptor_number) {
return GetKey(isolate, InternalIndex(GetSortedKeyIndex(descriptor_number)));
}
@ -142,11 +143,11 @@ void DescriptorArray::SetSortedKey(int descriptor_number, int pointer) {
}
Object DescriptorArray::GetStrongValue(InternalIndex descriptor_number) {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return GetStrongValue(isolate, descriptor_number);
}
Object DescriptorArray::GetStrongValue(Isolate* isolate,
Object DescriptorArray::GetStrongValue(const Isolate* isolate,
InternalIndex descriptor_number) {
return GetValue(isolate, descriptor_number).cast<Object>();
}
@ -160,11 +161,11 @@ void DescriptorArray::SetValue(InternalIndex descriptor_number,
}
MaybeObject DescriptorArray::GetValue(InternalIndex descriptor_number) {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return GetValue(isolate, descriptor_number);
}
MaybeObject DescriptorArray::GetValue(Isolate* isolate,
MaybeObject DescriptorArray::GetValue(const Isolate* isolate,
InternalIndex descriptor_number) {
DCHECK_LT(descriptor_number.as_int(), number_of_descriptors());
int entry_offset = OffsetOfDescriptorAt(descriptor_number.as_int());
@ -191,11 +192,11 @@ int DescriptorArray::GetFieldIndex(InternalIndex descriptor_number) {
}
FieldType DescriptorArray::GetFieldType(InternalIndex descriptor_number) {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return GetFieldType(isolate, descriptor_number);
}
FieldType DescriptorArray::GetFieldType(Isolate* isolate,
FieldType DescriptorArray::GetFieldType(const Isolate* isolate,
InternalIndex descriptor_number) {
DCHECK_EQ(GetDetails(descriptor_number).location(), kField);
MaybeObject wrapped_type = GetValue(isolate, descriptor_number);

View File

@ -66,21 +66,22 @@ class DescriptorArray : public HeapObject {
// Accessors for fetching instance descriptor at descriptor number.
inline Name GetKey(InternalIndex descriptor_number) const;
inline Name GetKey(Isolate* isolate, InternalIndex descriptor_number) const;
inline Name GetKey(const Isolate* isolate,
InternalIndex descriptor_number) const;
inline Object GetStrongValue(InternalIndex descriptor_number);
inline Object GetStrongValue(Isolate* isolate,
inline Object GetStrongValue(const Isolate* isolate,
InternalIndex descriptor_number);
inline MaybeObject GetValue(InternalIndex descriptor_number);
inline MaybeObject GetValue(Isolate* isolate,
inline MaybeObject GetValue(const Isolate* isolate,
InternalIndex descriptor_number);
inline PropertyDetails GetDetails(InternalIndex descriptor_number);
inline int GetFieldIndex(InternalIndex descriptor_number);
inline FieldType GetFieldType(InternalIndex descriptor_number);
inline FieldType GetFieldType(Isolate* isolate,
inline FieldType GetFieldType(const Isolate* isolate,
InternalIndex descriptor_number);
inline Name GetSortedKey(int descriptor_number);
inline Name GetSortedKey(Isolate* isolate, int descriptor_number);
inline Name GetSortedKey(const Isolate* isolate, int descriptor_number);
inline int GetSortedKeyIndex(int descriptor_number);
// Accessor for complete descriptor.

View File

@ -31,12 +31,12 @@ Dictionary<Derived, Shape>::Dictionary(Address ptr)
template <typename Derived, typename Shape>
Object Dictionary<Derived, Shape>::ValueAt(InternalIndex entry) {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return ValueAt(isolate, entry);
}
template <typename Derived, typename Shape>
Object Dictionary<Derived, Shape>::ValueAt(Isolate* isolate,
Object Dictionary<Derived, Shape>::ValueAt(const Isolate* isolate,
InternalIndex entry) {
return this->get(isolate, DerivedHashTable::EntryToIndex(entry) +
Derived::kEntryValueIndex);
@ -178,11 +178,11 @@ RootIndex GlobalDictionaryShape::GetMapRootIndex() {
}
Name NameDictionary::NameAt(InternalIndex entry) {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return NameAt(isolate, entry);
}
Name NameDictionary::NameAt(Isolate* isolate, InternalIndex entry) {
Name NameDictionary::NameAt(const Isolate* isolate, InternalIndex entry) {
return Name::cast(KeyAt(isolate, entry));
}
@ -191,11 +191,12 @@ RootIndex NameDictionaryShape::GetMapRootIndex() {
}
PropertyCell GlobalDictionary::CellAt(InternalIndex entry) {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return CellAt(isolate, entry);
}
PropertyCell GlobalDictionary::CellAt(Isolate* isolate, InternalIndex entry) {
PropertyCell GlobalDictionary::CellAt(const Isolate* isolate,
InternalIndex entry) {
DCHECK(KeyAt(isolate, entry).IsPropertyCell(isolate));
return PropertyCell::cast(KeyAt(isolate, entry));
}
@ -210,20 +211,20 @@ bool GlobalDictionaryShape::IsKey(ReadOnlyRoots roots, Object k) {
}
Name GlobalDictionary::NameAt(InternalIndex entry) {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return NameAt(isolate, entry);
}
Name GlobalDictionary::NameAt(Isolate* isolate, InternalIndex entry) {
Name GlobalDictionary::NameAt(const Isolate* isolate, InternalIndex entry) {
return CellAt(isolate, entry).name(isolate);
}
Object GlobalDictionary::ValueAt(InternalIndex entry) {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return ValueAt(isolate, entry);
}
Object GlobalDictionary::ValueAt(Isolate* isolate, InternalIndex entry) {
Object GlobalDictionary::ValueAt(const Isolate* isolate, InternalIndex entry) {
return CellAt(isolate, entry).value(isolate);
}

View File

@ -32,7 +32,7 @@ class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) Dictionary
using Key = typename Shape::Key;
// Returns the value at entry.
inline Object ValueAt(InternalIndex entry);
inline Object ValueAt(Isolate* isolate, InternalIndex entry);
inline Object ValueAt(const Isolate* isolate, InternalIndex entry);
// Set the value for entry.
inline void ValueAtPut(InternalIndex entry, Object value);
@ -183,7 +183,7 @@ class V8_EXPORT_PRIVATE NameDictionary
static const int kInitialCapacity = 2;
inline Name NameAt(InternalIndex entry);
inline Name NameAt(Isolate* isolate, InternalIndex entry);
inline Name NameAt(const Isolate* isolate, InternalIndex entry);
inline void set_hash(int hash);
inline int hash() const;
@ -223,13 +223,13 @@ class V8_EXPORT_PRIVATE GlobalDictionary
DECL_CAST(GlobalDictionary)
inline Object ValueAt(InternalIndex entry);
inline Object ValueAt(Isolate* isolate, InternalIndex entry);
inline Object ValueAt(const Isolate* isolate, InternalIndex entry);
inline PropertyCell CellAt(InternalIndex entry);
inline PropertyCell CellAt(Isolate* isolate, InternalIndex entry);
inline PropertyCell CellAt(const Isolate* isolate, InternalIndex entry);
inline void SetEntry(Isolate* isolate, InternalIndex entry, Object key,
Object value, PropertyDetails details);
inline Name NameAt(InternalIndex entry);
inline Name NameAt(Isolate* isolate, InternalIndex entry);
inline Name NameAt(const Isolate* isolate, InternalIndex entry);
inline void ValueAtPut(InternalIndex entry, Object value);
OBJECT_CONSTRUCTORS(

View File

@ -155,20 +155,21 @@ FeedbackSlot FeedbackVector::ToSlot(int index) {
}
MaybeObject FeedbackVector::Get(FeedbackSlot slot) const {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return Get(isolate, slot);
}
MaybeObject FeedbackVector::Get(Isolate* isolate, FeedbackSlot slot) const {
MaybeObject FeedbackVector::Get(const Isolate* isolate,
FeedbackSlot slot) const {
return get(isolate, GetIndex(slot));
}
MaybeObject FeedbackVector::get(int index) const {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return get(isolate, index);
}
MaybeObject FeedbackVector::get(Isolate* isolate, int index) const {
MaybeObject FeedbackVector::get(const Isolate* isolate, int index) const {
DCHECK_LT(static_cast<unsigned>(index), static_cast<unsigned>(length()));
int offset = OffsetOfElementAt(index);
return RELAXED_READ_WEAK_FIELD(*this, offset);

View File

@ -234,9 +234,9 @@ class FeedbackVector : public HeapObject {
// Conversion from an integer index to the underlying array to a slot.
static inline FeedbackSlot ToSlot(int index);
inline MaybeObject Get(FeedbackSlot slot) const;
inline MaybeObject Get(Isolate* isolate, FeedbackSlot slot) const;
inline MaybeObject Get(const Isolate* isolate, FeedbackSlot slot) const;
inline MaybeObject get(int index) const;
inline MaybeObject get(Isolate* isolate, int index) const;
inline MaybeObject get(const Isolate* isolate, int index) const;
inline void Set(FeedbackSlot slot, MaybeObject value,
WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
inline void set(int index, MaybeObject value,

View File

@ -61,11 +61,11 @@ int FieldIndex::GetLoadByFieldIndex() const {
}
FieldIndex FieldIndex::ForDescriptor(Map map, InternalIndex descriptor_index) {
Isolate* isolate = GetIsolateForPtrCompr(map);
const Isolate* isolate = GetIsolateForPtrCompr(map);
return ForDescriptor(isolate, map, descriptor_index);
}
FieldIndex FieldIndex::ForDescriptor(Isolate* isolate, Map map,
FieldIndex FieldIndex::ForDescriptor(const Isolate* isolate, Map map,
InternalIndex descriptor_index) {
PropertyDetails details =
map.instance_descriptors(isolate).GetDetails(descriptor_index);

View File

@ -31,7 +31,7 @@ class FieldIndex final {
static inline FieldIndex ForInObjectOffset(int offset, Encoding encoding);
static inline FieldIndex ForDescriptor(Map map,
InternalIndex descriptor_index);
static inline FieldIndex ForDescriptor(Isolate* isolate, Map map,
static inline FieldIndex ForDescriptor(const Isolate* isolate, Map map,
InternalIndex descriptor_index);
inline int GetLoadByFieldIndex() const;

View File

@ -90,11 +90,11 @@ bool FixedArray::ContainsOnlySmisOrHoles() {
}
Object FixedArray::get(int index) const {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return get(isolate, index);
}
Object FixedArray::get(Isolate* isolate, int index) const {
Object FixedArray::get(const Isolate* isolate, int index) const {
DCHECK_LT(static_cast<unsigned>(index), static_cast<unsigned>(length()));
return TaggedField<Object>::Relaxed_Load(isolate, *this,
OffsetOfElementAt(index));
@ -183,9 +183,7 @@ void FixedArray::FillWithHoles(int from, int to) {
}
}
ObjectSlot FixedArray::data_start() {
return RawField(OffsetOfElementAt(0));
}
ObjectSlot FixedArray::data_start() { return RawField(OffsetOfElementAt(0)); }
ObjectSlot FixedArray::RawFieldOfElementAt(int index) {
return RawField(OffsetOfElementAt(index));
@ -388,11 +386,11 @@ void FixedDoubleArray::FillWithHoles(int from, int to) {
}
MaybeObject WeakFixedArray::Get(int index) const {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return Get(isolate, index);
}
MaybeObject WeakFixedArray::Get(Isolate* isolate, int index) const {
MaybeObject WeakFixedArray::Get(const Isolate* isolate, int index) const {
DCHECK_LT(static_cast<unsigned>(index), static_cast<unsigned>(length()));
return TaggedField<MaybeObject>::Relaxed_Load(isolate, *this,
OffsetOfElementAt(index));
@ -436,11 +434,11 @@ void WeakFixedArray::CopyElements(Isolate* isolate, int dst_index,
}
MaybeObject WeakArrayList::Get(int index) const {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return Get(isolate, index);
}
MaybeObject WeakArrayList::Get(Isolate* isolate, int index) const {
MaybeObject WeakArrayList::Get(const Isolate* isolate, int index) const {
DCHECK_LT(static_cast<unsigned>(index), static_cast<unsigned>(capacity()));
return TaggedField<MaybeObject>::Relaxed_Load(isolate, *this,
OffsetOfElementAt(index));
@ -496,7 +494,7 @@ Object ArrayList::Get(int index) const {
return FixedArray::cast(*this).get(kFirstIndex + index);
}
Object ArrayList::Get(Isolate* isolate, int index) const {
Object ArrayList::Get(const Isolate* isolate, int index) const {
return FixedArray::cast(*this).get(isolate, kFirstIndex + index);
}
@ -621,7 +619,7 @@ Object TemplateList::get(int index) const {
return FixedArray::cast(*this).get(kFirstElementIndex + index);
}
Object TemplateList::get(Isolate* isolate, int index) const {
Object TemplateList::get(const Isolate* isolate, int index) const {
return FixedArray::cast(*this).get(isolate, kFirstElementIndex + index);
}

View File

@ -112,7 +112,7 @@ class FixedArray : public FixedArrayBase {
public:
// Setter and getter for elements.
inline Object get(int index) const;
inline Object get(Isolate* isolate, int index) const;
inline Object get(const Isolate* isolate, int index) const;
static inline Handle<Object> get(FixedArray array, int index,
Isolate* isolate);
@ -271,7 +271,7 @@ class WeakFixedArray : public HeapObject {
DECL_CAST(WeakFixedArray)
inline MaybeObject Get(int index) const;
inline MaybeObject Get(Isolate* isolate, int index) const;
inline MaybeObject Get(const Isolate* isolate, int index) const;
// Setter that uses write barrier.
inline void Set(int index, MaybeObject value);
@ -345,7 +345,7 @@ class WeakArrayList : public HeapObject {
const MaybeObjectHandle& value1, const MaybeObjectHandle& value2);
inline MaybeObject Get(int index) const;
inline MaybeObject Get(Isolate* isolate, int index) const;
inline MaybeObject Get(const Isolate* isolate, int index) const;
// Set the element at index to obj. The underlying array must be large enough.
// If you need to grow the WeakArrayList, use the static AddToEnd() method
@ -444,7 +444,7 @@ class ArrayList : public FixedArray {
// storage capacity, i.e., length().
inline void SetLength(int length);
inline Object Get(int index) const;
inline Object Get(Isolate* isolate, int index) const;
inline Object Get(const Isolate* isolate, int index) const;
inline ObjectSlot Slot(int index);
// Set the element at index to obj. The underlying array must be large enough.
@ -592,7 +592,7 @@ class TemplateList : public FixedArray {
static Handle<TemplateList> New(Isolate* isolate, int size);
inline int length() const;
inline Object get(int index) const;
inline Object get(Isolate* isolate, int index) const;
inline Object get(const Isolate* isolate, int index) const;
inline void set(int index, Object value);
static Handle<TemplateList> Add(Isolate* isolate, Handle<TemplateList> list,
Handle<Object> value);

View File

@ -180,12 +180,13 @@ bool HashTable<Derived, Shape>::ToKey(Isolate* isolate, InternalIndex entry,
template <typename Derived, typename Shape>
Object HashTable<Derived, Shape>::KeyAt(InternalIndex entry) {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return KeyAt(isolate, entry);
}
template <typename Derived, typename Shape>
Object HashTable<Derived, Shape>::KeyAt(Isolate* isolate, InternalIndex entry) {
Object HashTable<Derived, Shape>::KeyAt(const Isolate* isolate,
InternalIndex entry) {
return get(isolate, EntryToIndex(entry) + kEntryKeyIndex);
}

View File

@ -156,7 +156,7 @@ class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) HashTable
// Returns the key at entry.
inline Object KeyAt(InternalIndex entry);
inline Object KeyAt(Isolate* isolate, InternalIndex entry);
inline Object KeyAt(const Isolate* isolate, InternalIndex entry);
static const int kElementsStartIndex = kPrefixStartIndex + Shape::kPrefixSize;
static const int kEntrySize = Shape::kEntrySize;

View File

@ -70,11 +70,11 @@ class HeapObject : public Object {
inline ReadOnlyRoots GetReadOnlyRoots() const;
// This version is intended to be used for the isolate values produced by
// i::GetIsolateForPtrCompr(HeapObject) function which may return nullptr.
inline ReadOnlyRoots GetReadOnlyRoots(Isolate* isolate) const;
inline ReadOnlyRoots GetReadOnlyRoots(const Isolate* isolate) const;
#define IS_TYPE_FUNCTION_DECL(Type) \
V8_INLINE bool Is##Type() const; \
V8_INLINE bool Is##Type(Isolate* isolate) const;
V8_INLINE bool Is##Type(const Isolate* isolate) const;
HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
IS_TYPE_FUNCTION_DECL(HashTableBase)
IS_TYPE_FUNCTION_DECL(SmallOrderedHashTable)
@ -84,9 +84,9 @@ 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(Isolate* isolate) const; \
V8_INLINE bool Is##Type(ReadOnlyRoots roots) const; \
#define IS_TYPE_FUNCTION_DECL(Type, Value) \
V8_INLINE bool Is##Type(const Isolate* isolate) const; \
V8_INLINE bool Is##Type(ReadOnlyRoots roots) const; \
V8_INLINE bool Is##Type() const;
ODDBALL_LIST(IS_TYPE_FUNCTION_DECL)
IS_TYPE_FUNCTION_DECL(NullOrUndefined, /* unused */)
@ -94,7 +94,7 @@ class HeapObject : public Object {
#define DECL_STRUCT_PREDICATE(NAME, Name, name) \
V8_INLINE bool Is##Name() const; \
V8_INLINE bool Is##Name(Isolate* isolate) const;
V8_INLINE bool Is##Name(const Isolate* isolate) const;
STRUCT_LIST(DECL_STRUCT_PREDICATE)
#undef DECL_STRUCT_PREDICATE

View File

@ -123,7 +123,7 @@ void JSTypedArray::set_external_pointer(Address value) {
}
Address JSTypedArray::ExternalPointerCompensationForOnHeapArray(
Isolate* isolate) {
const Isolate* isolate) {
#ifdef V8_COMPRESS_POINTERS
return GetIsolateRoot(isolate);
#else
@ -133,7 +133,7 @@ Address JSTypedArray::ExternalPointerCompensationForOnHeapArray(
void JSTypedArray::RemoveExternalPointerCompensationForSerialization() {
DCHECK(is_on_heap());
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
set_external_pointer(external_pointer() -
ExternalPointerCompensationForOnHeapArray(isolate));
}
@ -158,7 +158,7 @@ void JSTypedArray::SetOffHeapDataPtr(void* base, Address offset) {
void JSTypedArray::SetOnHeapDataPtr(HeapObject base, Address offset) {
set_base_pointer(base);
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
set_external_pointer(offset +
ExternalPointerCompensationForOnHeapArray(isolate));
DCHECK_EQ(base.ptr() + offset, reinterpret_cast<Address>(DataPtr()));

View File

@ -205,7 +205,7 @@ class JSTypedArray : public JSArrayBufferView {
// as Tagged_t value and an |external_pointer| value.
// For full-pointer mode the compensation value is zero.
static inline Address ExternalPointerCompensationForOnHeapArray(
Isolate* isolate);
const Isolate* isolate);
// Subtracts external pointer compensation from the external pointer value.
inline void RemoveExternalPointerCompensationForSerialization();

View File

@ -302,11 +302,12 @@ void JSObject::SetEmbedderField(int index, Smi value) {
}
bool JSObject::IsUnboxedDoubleField(FieldIndex index) const {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return IsUnboxedDoubleField(isolate, index);
}
bool JSObject::IsUnboxedDoubleField(Isolate* isolate, FieldIndex index) const {
bool JSObject::IsUnboxedDoubleField(const Isolate* isolate,
FieldIndex index) const {
if (!FLAG_unbox_double_fields) return false;
return map(isolate).IsUnboxedDoubleField(isolate, index);
}
@ -315,11 +316,12 @@ bool JSObject::IsUnboxedDoubleField(Isolate* isolate, FieldIndex index) const {
// is needed to correctly distinguish between properties stored in-object and
// properties stored in the properties array.
Object JSObject::RawFastPropertyAt(FieldIndex index) const {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return RawFastPropertyAt(isolate, index);
}
Object JSObject::RawFastPropertyAt(Isolate* isolate, FieldIndex index) const {
Object JSObject::RawFastPropertyAt(const Isolate* isolate,
FieldIndex index) const {
DCHECK(!IsUnboxedDoubleField(isolate, index));
if (index.is_inobject()) {
return TaggedField<Object>::load(isolate, *this, index.offset());

View File

@ -615,14 +615,16 @@ class JSObject : public TorqueGeneratedJSObject<JSObject, JSReceiver> {
const char* reason);
inline bool IsUnboxedDoubleField(FieldIndex index) const;
inline bool IsUnboxedDoubleField(Isolate* isolate, FieldIndex index) const;
inline bool IsUnboxedDoubleField(const Isolate* isolate,
FieldIndex index) const;
// Access fast-case object properties at index.
static Handle<Object> FastPropertyAt(Handle<JSObject> object,
Representation representation,
FieldIndex index);
inline Object RawFastPropertyAt(FieldIndex index) const;
inline Object RawFastPropertyAt(Isolate* isolate, FieldIndex index) const;
inline Object RawFastPropertyAt(const Isolate* isolate,
FieldIndex index) const;
inline double RawFastDoublePropertyAt(FieldIndex index) const;
inline uint64_t RawFastDoublePropertyAsBitsAt(FieldIndex index) const;
@ -717,7 +719,7 @@ class JSObject : public TorqueGeneratedJSObject<JSObject, JSReceiver> {
// If a GC was caused while constructing this object, the elements pointer
// may point to a one pointer filler map. The object won't be rooted, but
// our heap verification code could stumble across it.
V8_EXPORT_PRIVATE bool ElementsAreSafeToExamine(Isolate* isolate) const;
V8_EXPORT_PRIVATE bool ElementsAreSafeToExamine(const Isolate* isolate) const;
#endif
Object SlowReverseLookup(Object value);

View File

@ -27,11 +27,12 @@ SMI_ACCESSORS(ObjectBoilerplateDescription, flags,
FixedArray::OffsetOfElementAt(kLiteralTypeOffset))
Object ObjectBoilerplateDescription::name(int index) const {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return name(isolate, index);
}
Object ObjectBoilerplateDescription::name(Isolate* isolate, int index) const {
Object ObjectBoilerplateDescription::name(const Isolate* isolate,
int index) const {
// get() already checks for out of bounds access, but we do not want to allow
// access to the last element, if it is the number of properties.
DCHECK_NE(size(), index);
@ -39,11 +40,12 @@ Object ObjectBoilerplateDescription::name(Isolate* isolate, int index) const {
}
Object ObjectBoilerplateDescription::value(int index) const {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return value(isolate, index);
}
Object ObjectBoilerplateDescription::value(Isolate* isolate, int index) const {
Object ObjectBoilerplateDescription::value(const Isolate* isolate,
int index) const {
return get(isolate, 2 * index + 1 + kDescriptionStartIndex);
}

View File

@ -26,10 +26,10 @@ class ClassLiteral;
class ObjectBoilerplateDescription : public FixedArray {
public:
inline Object name(int index) const;
inline Object name(Isolate* isolate, int index) const;
inline Object name(const Isolate* isolate, int index) const;
inline Object value(int index) const;
inline Object value(Isolate* isolate, int index) const;
inline Object value(const Isolate* isolate, int index) const;
inline void set_key_value(int index, Object key, Object value);

View File

@ -145,11 +145,11 @@ bool Map::EquivalentToForNormalization(const Map other,
}
bool Map::IsUnboxedDoubleField(FieldIndex index) const {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return IsUnboxedDoubleField(isolate, index);
}
bool Map::IsUnboxedDoubleField(Isolate* isolate, FieldIndex index) const {
bool Map::IsUnboxedDoubleField(const Isolate* isolate, FieldIndex index) const {
if (!FLAG_unbox_double_fields) return false;
if (!index.is_inobject()) return false;
return !layout_descriptor(isolate).IsTagged(index.property_index());

View File

@ -863,7 +863,8 @@ class Map : public HeapObject {
// Returns true if given field is unboxed double.
inline bool IsUnboxedDoubleField(FieldIndex index) const;
inline bool IsUnboxedDoubleField(Isolate* isolate, FieldIndex index) const;
inline bool IsUnboxedDoubleField(const Isolate* isolate,
FieldIndex index) const;
void PrintMapDetails(std::ostream& os);
@ -1006,7 +1007,7 @@ class NormalizedMapCache : public WeakFixedArray {
DECL_VERIFIER(NormalizedMapCache)
private:
friend bool HeapObject::IsNormalizedMapCache(Isolate* isolate) const;
friend bool HeapObject::IsNormalizedMapCache(const Isolate* isolate) const;
static const int kEntries = 64;

View File

@ -39,25 +39,20 @@ class Name : public TorqueGeneratedName<Name, PrimitiveHeapObject> {
// We optimize this by setting a flag on the object's map when such
// symbol properties are added, so we can optimize lookups on objects
// that don't have the flag.
inline bool IsInterestingSymbol() const;
inline bool IsInterestingSymbol(Isolate* isolate) const;
DECL_GETTER(IsInterestingSymbol, bool)
// If the name is private, it can only name own properties.
inline bool IsPrivate() const;
inline bool IsPrivate(Isolate* isolate) const;
DECL_GETTER(IsPrivate, bool)
// If the name is a private name, it should behave like a private
// symbol but also throw on property access miss.
inline bool IsPrivateName() const;
inline bool IsPrivateName(Isolate* isolate) const;
DECL_GETTER(IsPrivateName, bool)
// If the name is a private brand, it should behave like a private name
// symbol but is filtered out when generating list of private fields.
inline bool IsPrivateBrand() const;
inline bool IsPrivateBrand(Isolate* isolate) const;
DECL_GETTER(IsPrivateBrand, bool)
inline bool IsUniqueName() const;
inline bool IsUniqueName(Isolate* isolate) const;
DECL_GETTER(IsUniqueName, bool)
static inline bool ContainsCachedArrayIndex(uint32_t hash);

View File

@ -82,14 +82,14 @@
// parameter.
#define DECL_GETTER(name, type) \
inline type name() const; \
inline type name(Isolate* isolate) const;
inline type name(const Isolate* isolate) const;
#define DEF_GETTER(holder, name, type) \
type holder::name() const { \
Isolate* isolate = GetIsolateForPtrCompr(*this); \
return holder::name(isolate); \
} \
type holder::name(Isolate* isolate) const
#define DEF_GETTER(holder, name, type) \
type holder::name() const { \
const Isolate* isolate = GetIsolateForPtrCompr(*this); \
return holder::name(isolate); \
} \
type holder::name(const Isolate* isolate) const
#define DECL_ACCESSORS(name, type) \
DECL_GETTER(name, type) \

View File

@ -78,7 +78,7 @@ DEF_GETTER(HeapObject, IsClassBoilerplate, bool) {
bool Object::Is##type_() const { \
return IsHeapObject() && HeapObject::cast(*this).Is##type_(); \
} \
bool Object::Is##type_(Isolate* isolate) const { \
bool Object::Is##type_(const Isolate* isolate) const { \
return IsHeapObject() && HeapObject::cast(*this).Is##type_(isolate); \
}
HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DEF)
@ -86,28 +86,28 @@ IS_TYPE_FUNCTION_DEF(HashTableBase)
IS_TYPE_FUNCTION_DEF(SmallOrderedHashTable)
#undef IS_TYPE_FUNCTION_DEF
#define IS_TYPE_FUNCTION_DEF(Type, Value) \
bool Object::Is##Type(Isolate* isolate) const { \
return Is##Type(ReadOnlyRoots(isolate->heap())); \
} \
bool Object::Is##Type(ReadOnlyRoots roots) const { \
return *this == roots.Value(); \
} \
bool Object::Is##Type() const { \
return IsHeapObject() && HeapObject::cast(*this).Is##Type(); \
} \
bool HeapObject::Is##Type(Isolate* isolate) const { \
return Object::Is##Type(isolate); \
} \
bool HeapObject::Is##Type(ReadOnlyRoots roots) const { \
return Object::Is##Type(roots); \
} \
#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(ReadOnlyRoots roots) const { \
return *this == roots.Value(); \
} \
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(ReadOnlyRoots roots) const { \
return Object::Is##Type(roots); \
} \
bool HeapObject::Is##Type() const { return Is##Type(GetReadOnlyRoots()); }
ODDBALL_LIST(IS_TYPE_FUNCTION_DEF)
#undef IS_TYPE_FUNCTION_DEF
bool Object::IsNullOrUndefined(Isolate* isolate) const {
return IsNullOrUndefined(ReadOnlyRoots(isolate));
bool Object::IsNullOrUndefined(const Isolate* isolate) const {
return IsHeapObject() && HeapObject::cast(*this).IsNullOrUndefined(isolate);
}
bool Object::IsNullOrUndefined(ReadOnlyRoots roots) const {
@ -131,8 +131,8 @@ bool Object::IsNoSharedNameSentinel() const {
return *this == SharedFunctionInfo::kNoSharedNameSentinel;
}
bool HeapObject::IsNullOrUndefined(Isolate* isolate) const {
return Object::IsNullOrUndefined(isolate);
bool HeapObject::IsNullOrUndefined(const Isolate* isolate) const {
return IsNullOrUndefined(GetReadOnlyRoots(isolate));
}
bool HeapObject::IsNullOrUndefined(ReadOnlyRoots roots) const {
@ -231,23 +231,23 @@ DEF_GETTER(HeapObject, IsExternalTwoByteString, bool) {
bool Object::IsNumber() const {
if (IsSmi()) return true;
HeapObject this_heap_object = HeapObject::cast(*this);
Isolate* isolate = GetIsolateForPtrCompr(this_heap_object);
const Isolate* isolate = GetIsolateForPtrCompr(this_heap_object);
return this_heap_object.IsHeapNumber(isolate);
}
bool Object::IsNumber(Isolate* isolate) const {
bool Object::IsNumber(const Isolate* isolate) const {
return IsSmi() || IsHeapNumber(isolate);
}
bool Object::IsNumeric() const {
if (IsSmi()) return true;
HeapObject this_heap_object = HeapObject::cast(*this);
Isolate* isolate = GetIsolateForPtrCompr(this_heap_object);
const Isolate* isolate = GetIsolateForPtrCompr(this_heap_object);
return this_heap_object.IsHeapNumber(isolate) ||
this_heap_object.IsBigInt(isolate);
}
bool Object::IsNumeric(Isolate* isolate) const {
bool Object::IsNumeric(const Isolate* isolate) const {
return IsNumber(isolate) || IsBigInt(isolate);
}
@ -275,11 +275,11 @@ DEF_GETTER(HeapObject, IsRegExpMatchInfo, bool) {
bool Object::IsLayoutDescriptor() const {
if (IsSmi()) return true;
HeapObject this_heap_object = HeapObject::cast(*this);
Isolate* isolate = GetIsolateForPtrCompr(this_heap_object);
const Isolate* isolate = GetIsolateForPtrCompr(this_heap_object);
return this_heap_object.IsByteArray(isolate);
}
bool Object::IsLayoutDescriptor(Isolate* isolate) const {
bool Object::IsLayoutDescriptor(const Isolate* isolate) const {
return IsSmi() || IsByteArray(isolate);
}
@ -384,11 +384,11 @@ DEF_GETTER(HeapObject, IsWasmExceptionPackage, bool) {
bool Object::IsPrimitive() const {
if (IsSmi()) return true;
HeapObject this_heap_object = HeapObject::cast(*this);
Isolate* isolate = GetIsolateForPtrCompr(this_heap_object);
const Isolate* isolate = GetIsolateForPtrCompr(this_heap_object);
return this_heap_object.map(isolate).IsPrimitiveMap();
}
bool Object::IsPrimitive(Isolate* isolate) const {
bool Object::IsPrimitive(const Isolate* isolate) const {
return IsSmi() || HeapObject::cast(*this).map(isolate).IsPrimitiveMap();
}
@ -418,7 +418,7 @@ DEF_GETTER(HeapObject, IsAccessCheckNeeded, bool) {
bool Object::Is##Name() const { \
return IsHeapObject() && HeapObject::cast(*this).Is##Name(); \
} \
bool Object::Is##Name(Isolate* isolate) const { \
bool Object::Is##Name(const Isolate* isolate) const { \
return IsHeapObject() && HeapObject::cast(*this).Is##Name(isolate); \
}
STRUCT_LIST(MAKE_STRUCT_PREDICATE)
@ -484,7 +484,7 @@ bool Object::FilterKey(PropertyFilter filter) {
return false;
}
Representation Object::OptimalRepresentation(Isolate* isolate) const {
Representation Object::OptimalRepresentation(const Isolate* isolate) const {
if (!FLAG_track_fields) return Representation::Tagged();
if (IsSmi()) {
return Representation::Smi();
@ -503,7 +503,7 @@ Representation Object::OptimalRepresentation(Isolate* isolate) const {
}
}
ElementsKind Object::OptimalElementsKind(Isolate* isolate) const {
ElementsKind Object::OptimalElementsKind(const Isolate* isolate) const {
if (IsSmi()) return PACKED_SMI_ELEMENTS;
if (IsNumber(isolate)) return PACKED_DOUBLE_ELEMENTS;
return PACKED_ELEMENTS;
@ -685,9 +685,10 @@ ReadOnlyRoots HeapObject::GetReadOnlyRoots() const {
return ReadOnlyHeap::GetReadOnlyRoots(*this);
}
ReadOnlyRoots HeapObject::GetReadOnlyRoots(Isolate* isolate) const {
ReadOnlyRoots HeapObject::GetReadOnlyRoots(const Isolate* isolate) const {
#ifdef V8_COMPRESS_POINTERS
return ReadOnlyRoots(isolate);
DCHECK_NOT_NULL(isolate);
return ReadOnlyRoots(const_cast<Isolate*>(isolate));
#else
return GetReadOnlyRoots();
#endif

View File

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

View File

@ -275,7 +275,7 @@ class Object : public TaggedImpl<HeapObjectReferenceType::STRONG, Address> {
#define IS_TYPE_FUNCTION_DECL(Type) \
V8_INLINE bool Is##Type() const; \
V8_INLINE bool Is##Type(Isolate* isolate) const;
V8_INLINE bool Is##Type(const Isolate* isolate) const;
OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
IS_TYPE_FUNCTION_DECL(HashTableBase)
@ -284,9 +284,9 @@ 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(Isolate* isolate) const; \
V8_INLINE bool Is##Type(ReadOnlyRoots roots) const; \
#define IS_TYPE_FUNCTION_DECL(Type, Value) \
V8_INLINE bool Is##Type(const Isolate* isolate) const; \
V8_INLINE bool Is##Type(ReadOnlyRoots roots) const; \
V8_INLINE bool Is##Type() const;
ODDBALL_LIST(IS_TYPE_FUNCTION_DECL)
IS_TYPE_FUNCTION_DECL(NullOrUndefined, /* unused */)
@ -301,7 +301,7 @@ class Object : public TaggedImpl<HeapObjectReferenceType::STRONG, Address> {
#define DECL_STRUCT_PREDICATE(NAME, Name, name) \
V8_INLINE bool Is##Name() const; \
V8_INLINE bool Is##Name(Isolate* isolate) const;
V8_INLINE bool Is##Name(const Isolate* isolate) const;
STRUCT_LIST(DECL_STRUCT_PREDICATE)
#undef DECL_STRUCT_PREDICATE
@ -316,9 +316,9 @@ class Object : public TaggedImpl<HeapObjectReferenceType::STRONG, Address> {
V8_EXPORT_PRIVATE bool ToInt32(int32_t* value);
inline bool ToUint32(uint32_t* value) const;
inline Representation OptimalRepresentation(Isolate* isolate) const;
inline Representation OptimalRepresentation(const Isolate* isolate) const;
inline ElementsKind OptimalElementsKind(Isolate* isolate) const;
inline ElementsKind OptimalElementsKind(const Isolate* isolate) const;
inline bool FitsRepresentation(Representation representation);

View File

@ -25,11 +25,11 @@ SMI_ACCESSORS(PropertyArray, length_and_hash, kLengthAndHashOffset)
SYNCHRONIZED_SMI_ACCESSORS(PropertyArray, length_and_hash, kLengthAndHashOffset)
Object PropertyArray::get(int index) const {
Isolate* isolate = GetIsolateForPtrCompr(*this);
const Isolate* isolate = GetIsolateForPtrCompr(*this);
return get(isolate, index);
}
Object PropertyArray::get(Isolate* isolate, int index) const {
Object PropertyArray::get(const Isolate* isolate, int index) const {
DCHECK_LT(static_cast<unsigned>(index),
static_cast<unsigned>(this->length()));
return TaggedField<Object>::Relaxed_Load(isolate, *this,

View File

@ -30,7 +30,7 @@ class PropertyArray : public HeapObject {
inline int Hash() const;
inline Object get(int index) const;
inline Object get(Isolate* isolate, int index) const;
inline Object get(const Isolate* isolate, int index) const;
inline void set(int index, Object value);
// Setter with explicit barrier mode.

View File

@ -75,7 +75,7 @@ Descriptor Descriptor::DataField(Handle<Name> key, int field_index,
Descriptor Descriptor::DataConstant(Handle<Name> key, Handle<Object> value,
PropertyAttributes attributes) {
Isolate* isolate = GetIsolateForPtrCompr(*key);
const Isolate* isolate = GetIsolateForPtrCompr(*key);
return Descriptor(key, MaybeObjectHandle(value), kData, attributes,
kDescriptor, PropertyConstness::kConst,
value->OptimalRepresentation(isolate), 0);

View File

@ -169,10 +169,8 @@ class String : public TorqueGeneratedString<String, Name> {
// be one-byte encoded. This might be the case even if the string is
// two-byte. Such strings may appear when the embedder prefers
// two-byte external representations even for one-byte data.
inline bool IsOneByteRepresentation() const;
inline bool IsOneByteRepresentation(Isolate* isolate) const;
inline bool IsTwoByteRepresentation() const;
inline bool IsTwoByteRepresentation(Isolate* isolate) const;
DECL_GETTER(IsOneByteRepresentation, bool)
DECL_GETTER(IsTwoByteRepresentation, bool)
// Cons and slices have an encoding flag that may not represent the actual
// encoding of the underlying string. This is taken into account here.
@ -636,8 +634,7 @@ class ConsString : public TorqueGeneratedConsString<ConsString, String> {
// ThinStrings can be thought of as "one-part cons strings".
class ThinString : public TorqueGeneratedThinString<ThinString, String> {
public:
inline HeapObject unchecked_actual() const;
inline HeapObject unchecked_actual(Isolate* isolate) const;
DECL_GETTER(unchecked_actual, HeapObject)
V8_EXPORT_PRIVATE uint16_t Get(int index);

View File

@ -61,7 +61,7 @@ T TaggedField<T, kFieldOffset>::load(HeapObject host, int offset) {
// static
template <typename T, int kFieldOffset>
T TaggedField<T, kFieldOffset>::load(Isolate* isolate, HeapObject host,
T TaggedField<T, kFieldOffset>::load(const Isolate* isolate, HeapObject host,
int offset) {
Tagged_t value = *location(host, offset);
return T(tagged_to_full(isolate, value));
@ -96,8 +96,8 @@ T TaggedField<T, kFieldOffset>::Relaxed_Load(HeapObject host, int offset) {
// static
template <typename T, int kFieldOffset>
T TaggedField<T, kFieldOffset>::Relaxed_Load(Isolate* isolate, HeapObject host,
int offset) {
T TaggedField<T, kFieldOffset>::Relaxed_Load(const Isolate* isolate,
HeapObject host, int offset) {
AtomicTagged_t value = AsAtomicTagged::Relaxed_Load(location(host, offset));
return T(tagged_to_full(isolate, value));
}
@ -125,8 +125,8 @@ T TaggedField<T, kFieldOffset>::Acquire_Load(HeapObject host, int offset) {
// static
template <typename T, int kFieldOffset>
T TaggedField<T, kFieldOffset>::Acquire_Load(Isolate* isolate, HeapObject host,
int offset) {
T TaggedField<T, kFieldOffset>::Acquire_Load(const Isolate* isolate,
HeapObject host, int offset) {
AtomicTagged_t value = AsAtomicTagged::Acquire_Load(location(host, offset));
return T(tagged_to_full(isolate, value));
}

View File

@ -38,20 +38,20 @@ class TaggedField : public AllStatic {
static inline Address address(HeapObject host, int offset = 0);
static inline T load(HeapObject host, int offset = 0);
static inline T load(Isolate* isolate, HeapObject host, int offset = 0);
static inline T load(const Isolate* isolate, HeapObject host, int offset = 0);
static inline void store(HeapObject host, T value);
static inline void store(HeapObject host, int offset, T value);
static inline T Relaxed_Load(HeapObject host, int offset = 0);
static inline T Relaxed_Load(Isolate* isolate, HeapObject host,
static inline T Relaxed_Load(const Isolate* isolate, HeapObject host,
int offset = 0);
static inline void Relaxed_Store(HeapObject host, T value);
static inline void Relaxed_Store(HeapObject host, int offset, T value);
static inline T Acquire_Load(HeapObject host, int offset = 0);
static inline T Acquire_Load(Isolate* isolate, HeapObject host,
static inline T Acquire_Load(const Isolate* isolate, HeapObject host,
int offset = 0);
static inline void Release_Store(HeapObject host, T value);

View File

@ -999,8 +999,9 @@ namespace {
std::string FormatAssertSource(const std::string& str) {
// Replace all whitespace characters with a space character.
std::string str_no_newlines = str;
std::replace_if(str_no_newlines.begin(), str_no_newlines.end(),
[](unsigned char c) { return isspace(c); }, ' ');
std::replace_if(
str_no_newlines.begin(), str_no_newlines.end(),
[](unsigned char c) { return isspace(c); }, ' ');
// str might include indentation, squash multiple space characters into one.
std::string result;
@ -3215,7 +3216,7 @@ void CppClassGenerator::GenerateClassConstructors() {
inl_ << "template<class D, class P>\n";
inl_ << "inline " << gen_name_T_ << "::" << gen_name_ << "(Address ptr)\n";
inl_ << " : P(ptr) {\n";
inl_ << " SLOW_DCHECK(this->Is" << name_ << "());\n";
inl_ << " SLOW_DCHECK(this->Is" << name_ << "());\n";
inl_ << "}\n";
}
@ -3313,7 +3314,8 @@ void CppClassGenerator::GenerateFieldAccessorForObject(const Field& f) {
hdr_ << " // Torque type: " << field_type->ToString() << "\n";
}
hdr_ << " inline " << type << " " << name << "() const;\n";
hdr_ << " inline " << type << " " << name << "(Isolate* isolate) const;\n";
hdr_ << " inline " << type << " " << name
<< "(const Isolate* isolate) const;\n";
hdr_ << " inline void set_" << name << "(" << type
<< " value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER);\n\n";
@ -3326,13 +3328,13 @@ void CppClassGenerator::GenerateFieldAccessorForObject(const Field& f) {
// Generate implementation in inline header.
inl_ << "template <class D, class P>\n";
inl_ << type << " " << gen_name_ << "<D, P>::" << name << "() const {\n";
inl_ << " Isolate* isolate = GetIsolateForPtrCompr(*this);\n";
inl_ << " const Isolate* isolate = GetIsolateForPtrCompr(*this);\n";
inl_ << " return " << gen_name_ << "::" << name << "(isolate);\n";
inl_ << "}\n";
inl_ << "template <class D, class P>\n";
inl_ << type << " " << gen_name_ << "<D, P>::" << name
<< "(Isolate* isolate) const {\n";
<< "(const Isolate* isolate) const {\n";
if (class_type) {
inl_ << " return TaggedField<" << type << ", " << offset
<< ">::load(isolate, *this);\n";
@ -3686,7 +3688,7 @@ void ImplementationVisitor::GenerateClassVerifiers(
}
// Second, verify that this object is what it claims to be.
cc_contents << " CHECK(o.Is" << name << "());\n";
cc_contents << " CHECK(o.Is" << name << "());\n";
// Third, verify its properties.
for (auto f : type->fields()) {