Commit d2061e53 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[ptr-compr] Add Xxx::yyy(Isolate*) accessors

... in addition to existing Xxx::yyy().

The idea is to use these getters in hot C++ code since passing isolate
explicitly makes it trivial to compute isolate root value and reduces
the C++ code size.

For full-pointer mode the unused isolate argument will be optimized
away by the compiler, so full-pointer mode should not be affected
in any sense.

Bug: v8:9353
Change-Id: If6c43e3d5b3cbfc0db8b9eccee49dd8c4d168822
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1674035Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62348}
parent 18fcd0b4
......@@ -30,8 +30,11 @@ namespace internal {
OBJECT_CONSTRUCTORS_IMPL(Map, HeapObject)
CAST_ACCESSOR(Map)
DescriptorArray Map::instance_descriptors() const {
return TaggedField<DescriptorArray, kInstanceDescriptorsOffset>::load(*this);
ISOLATELESS_GETTER(Map, instance_descriptors, DescriptorArray)
DescriptorArray Map::instance_descriptors(Isolate* isolate) const {
return TaggedField<DescriptorArray, kInstanceDescriptorsOffset>::load(isolate,
*this);
}
SYNCHRONIZED_ACCESSORS(Map, synchronized_instance_descriptors, DescriptorArray,
......
......@@ -588,7 +588,7 @@ class Map : public HeapObject {
// [instance descriptors]: describes the object.
inline DescriptorArray instance_descriptors() const;
inline DescriptorArray synchronized_instance_descriptors() const;
inline DescriptorArray instance_descriptors(Isolate* isolate) const;
V8_EXPORT_PRIVATE void SetInstanceDescriptors(Isolate* isolate,
DescriptorArray descriptors,
int number_of_own_descriptors);
......@@ -966,13 +966,13 @@ class Map : public HeapObject {
MaybeHandle<FieldType> new_field_type, MaybeHandle<Object> new_value);
// Use the high-level instance_descriptors/SetInstanceDescriptors instead.
inline void set_synchronized_instance_descriptors(
DescriptorArray array, WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
DECL_ACCESSORS(synchronized_instance_descriptors, DescriptorArray)
static const int kFastPropertiesSoftLimit = 12;
static const int kMaxFastProperties = 128;
friend class MapUpdater;
friend class ConcurrentMarkingVisitor;
OBJECT_CONSTRUCTORS(Map, HeapObject);
};
......
......@@ -65,9 +65,10 @@
inline uint8_t name() const; \
inline void set_##name(int value);
#define DECL_ACCESSORS(name, type) \
inline type name() const; \
inline void set_##name(type value, \
#define DECL_ACCESSORS(name, type) \
inline type name() const; \
inline type name(Isolate* isolate) const; \
inline void set_##name(type value, \
WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
#define DECL_CAST(Type) \
......@@ -122,8 +123,9 @@
#define ACCESSORS_CHECKED2(holder, name, type, offset, get_condition, \
set_condition) \
type holder::name() const { \
type value = TaggedField<type, offset>::load(*this); \
ISOLATELESS_GETTER(holder, name, type) \
type holder::name(Isolate* isolate) const { \
type value = TaggedField<type, offset>::load(isolate, *this); \
DCHECK(get_condition); \
return value; \
} \
......@@ -143,17 +145,18 @@
#define ACCESSORS(holder, name, type, offset) \
ACCESSORS_CHECKED(holder, name, type, offset, true)
#define SYNCHRONIZED_ACCESSORS_CHECKED2(holder, name, type, offset, \
get_condition, set_condition) \
type holder::name() const { \
type value = TaggedField<type, offset>::Acquire_Load(*this); \
DCHECK(get_condition); \
return value; \
} \
void holder::set_##name(type value, WriteBarrierMode mode) { \
DCHECK(set_condition); \
TaggedField<type, offset>::Release_Store(*this, value); \
CONDITIONAL_WRITE_BARRIER(*this, offset, value, mode); \
#define SYNCHRONIZED_ACCESSORS_CHECKED2(holder, name, type, offset, \
get_condition, set_condition) \
ISOLATELESS_GETTER(holder, name, type) \
type holder::name(Isolate* isolate) const { \
type value = TaggedField<type, offset>::Acquire_Load(isolate, *this); \
DCHECK(get_condition); \
return value; \
} \
void holder::set_##name(type value, WriteBarrierMode mode) { \
DCHECK(set_condition); \
TaggedField<type, offset>::Release_Store(*this, value); \
CONDITIONAL_WRITE_BARRIER(*this, offset, value, mode); \
}
#define SYNCHRONIZED_ACCESSORS_CHECKED(holder, name, type, offset, condition) \
......@@ -165,8 +168,10 @@
#define WEAK_ACCESSORS_CHECKED2(holder, name, offset, get_condition, \
set_condition) \
MaybeObject holder::name() const { \
MaybeObject value = READ_WEAK_FIELD(*this, offset); \
ISOLATELESS_GETTER(holder, name, MaybeObject) \
MaybeObject holder::name(Isolate* isolate) const { \
MaybeObject value = \
TaggedField<MaybeObject, offset>::load(isolate, *this); \
DCHECK(get_condition); \
return value; \
} \
......
......@@ -573,8 +573,10 @@ void ConsString::set_second(Isolate* isolate, String value,
ACCESSORS(ThinString, actual, String, kActualOffset)
HeapObject ThinString::unchecked_actual() const {
return HeapObject::unchecked_cast(READ_FIELD(*this, kActualOffset));
ISOLATELESS_GETTER(ThinString, unchecked_actual, HeapObject)
HeapObject ThinString::unchecked_actual(Isolate* isolate) const {
return TaggedField<HeapObject, kActualOffset>::load(isolate, *this);
}
bool ExternalString::is_uncached() const {
......
......@@ -640,10 +640,10 @@ class ConsString : public String {
class ThinString : public String {
public:
// Actual string that this ThinString refers to.
inline String actual() const;
DECL_ACCESSORS(actual, String)
inline HeapObject unchecked_actual() const;
inline void set_actual(String s,
WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
inline HeapObject unchecked_actual(Isolate* isolate) const;
V8_EXPORT_PRIVATE uint16_t Get(int index);
......
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