summaryrefslogtreecommitdiff
path: root/chromium/v8/src/objects/map-inl.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-07-31 15:50:41 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-08-30 12:35:23 +0000
commit7b2ffa587235a47d4094787d72f38102089f402a (patch)
tree30e82af9cbab08a7fa028bb18f4f2987a3f74dfa /chromium/v8/src/objects/map-inl.h
parentd94af01c90575348c4e81a418257f254b6f8d225 (diff)
downloadqtwebengine-chromium-7b2ffa587235a47d4094787d72f38102089f402a.tar.gz
BASELINE: Update Chromium to 76.0.3809.94
Change-Id: I321c3f5f929c105aec0f98c5091ef6108822e647 Reviewed-by: Michael Brüning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/v8/src/objects/map-inl.h')
-rw-r--r--chromium/v8/src/objects/map-inl.h142
1 files changed, 68 insertions, 74 deletions
diff --git a/chromium/v8/src/objects/map-inl.h b/chromium/v8/src/objects/map-inl.h
index 792e12d1262..8c26196fb50 100644
--- a/chromium/v8/src/objects/map-inl.h
+++ b/chromium/v8/src/objects/map-inl.h
@@ -7,19 +7,19 @@
#include "src/objects/map.h"
-#include "src/field-type.h"
#include "src/heap/heap-write-barrier-inl.h"
-#include "src/layout-descriptor-inl.h"
-#include "src/objects-inl.h"
#include "src/objects/api-callbacks-inl.h"
#include "src/objects/cell-inl.h"
#include "src/objects/descriptor-array-inl.h"
+#include "src/objects/field-type.h"
#include "src/objects/instance-type-inl.h"
+#include "src/objects/layout-descriptor-inl.h"
+#include "src/objects/objects-inl.h"
+#include "src/objects/property.h"
#include "src/objects/prototype-info-inl.h"
#include "src/objects/shared-function-info.h"
#include "src/objects/templates-inl.h"
-#include "src/property.h"
-#include "src/transitions.h"
+#include "src/objects/transitions-inl.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
@@ -31,17 +31,18 @@ OBJECT_CONSTRUCTORS_IMPL(Map, HeapObject)
CAST_ACCESSOR(Map)
DescriptorArray Map::instance_descriptors() const {
- return DescriptorArray::cast(READ_FIELD(*this, kDescriptorsOffset));
+ return DescriptorArray::cast(READ_FIELD(*this, kInstanceDescriptorsOffset));
}
DescriptorArray Map::synchronized_instance_descriptors() const {
- return DescriptorArray::cast(ACQUIRE_READ_FIELD(*this, kDescriptorsOffset));
+ return DescriptorArray::cast(
+ ACQUIRE_READ_FIELD(*this, kInstanceDescriptorsOffset));
}
void Map::set_synchronized_instance_descriptors(DescriptorArray value,
WriteBarrierMode mode) {
- RELEASE_WRITE_FIELD(*this, kDescriptorsOffset, value);
- CONDITIONAL_WRITE_BARRIER(*this, kDescriptorsOffset, value, mode);
+ RELEASE_WRITE_FIELD(*this, kInstanceDescriptorsOffset, value);
+ CONDITIONAL_WRITE_BARRIER(*this, kInstanceDescriptorsOffset, value, mode);
}
// A freshly allocated layout descriptor can be set on an existing map.
@@ -75,14 +76,14 @@ BIT_FIELD_ACCESSORS(Map, relaxed_bit_field, has_prototype_slot,
// |bit_field2| fields.
BIT_FIELD_ACCESSORS(Map, bit_field2, is_extensible, Map::IsExtensibleBit)
BIT_FIELD_ACCESSORS(Map, bit_field2, is_prototype_map, Map::IsPrototypeMapBit)
-BIT_FIELD_ACCESSORS(Map, bit_field2, is_in_retained_map_list,
- Map::IsInRetainedMapListBit)
+BIT_FIELD_ACCESSORS(Map, bit_field2, has_hidden_prototype,
+ Map::HasHiddenPrototypeBit)
// |bit_field3| fields.
BIT_FIELD_ACCESSORS(Map, bit_field3, owns_descriptors, Map::OwnsDescriptorsBit)
-BIT_FIELD_ACCESSORS(Map, bit_field3, has_hidden_prototype,
- Map::HasHiddenPrototypeBit)
BIT_FIELD_ACCESSORS(Map, bit_field3, is_deprecated, Map::IsDeprecatedBit)
+BIT_FIELD_ACCESSORS(Map, bit_field3, is_in_retained_map_list,
+ Map::IsInRetainedMapListBit)
BIT_FIELD_ACCESSORS(Map, bit_field3, is_migration_target,
Map::IsMigrationTargetBit)
BIT_FIELD_ACCESSORS(Map, bit_field3, is_immutable_proto,
@@ -97,18 +98,18 @@ BIT_FIELD_ACCESSORS(Map, bit_field3, construction_counter,
InterceptorInfo Map::GetNamedInterceptor() {
DCHECK(has_named_interceptor());
FunctionTemplateInfo info = GetFunctionTemplateInfo();
- return InterceptorInfo::cast(info->GetNamedPropertyHandler());
+ return InterceptorInfo::cast(info.GetNamedPropertyHandler());
}
InterceptorInfo Map::GetIndexedInterceptor() {
DCHECK(has_indexed_interceptor());
FunctionTemplateInfo info = GetFunctionTemplateInfo();
- return InterceptorInfo::cast(info->GetIndexedPropertyHandler());
+ return InterceptorInfo::cast(info.GetIndexedPropertyHandler());
}
bool Map::IsMostGeneralFieldType(Representation representation,
FieldType field_type) {
- return !representation.IsHeapObject() || field_type->IsAny();
+ return !representation.IsHeapObject() || field_type.IsAny();
}
bool Map::CanHaveFastTransitionableElementsKind(InstanceType instance_type) {
@@ -122,26 +123,23 @@ bool Map::CanHaveFastTransitionableElementsKind() const {
// static
void Map::GeneralizeIfCanHaveTransitionableFastElementsKind(
- Isolate* isolate, InstanceType instance_type, PropertyConstness* constness,
+ Isolate* isolate, InstanceType instance_type,
Representation* representation, Handle<FieldType>* field_type) {
if (CanHaveFastTransitionableElementsKind(instance_type)) {
// We don't support propagation of field generalization through elements
// kind transitions because they are inserted into the transition tree
// before field transitions. In order to avoid complexity of handling
// such a case we ensure that all maps with transitionable elements kinds
- // have the most general field type.
- if (representation->IsHeapObject()) {
- // The field type is either already Any or should become Any if it was
- // something else.
- *field_type = FieldType::Any(isolate);
- }
+ // have the most general field representation and type.
+ *field_type = FieldType::Any(isolate);
+ *representation = Representation::Tagged();
}
}
bool Map::IsUnboxedDoubleField(FieldIndex index) const {
if (!FLAG_unbox_double_fields) return false;
- if (index.is_hidden_field() || !index.is_inobject()) return false;
- return !layout_descriptor()->IsTagged(index.property_index());
+ if (!index.is_inobject()) return false;
+ return !layout_descriptor().IsTagged(index.property_index());
}
bool Map::TooManyFastProperties(StoreOrigin store_origin) const {
@@ -163,7 +161,7 @@ bool Map::TooManyFastProperties(StoreOrigin store_origin) const {
}
PropertyDetails Map::GetLastDescriptorDetails() const {
- return instance_descriptors()->GetDetails(LastAdded());
+ return instance_descriptors().GetDetails(LastAdded());
}
int Map::LastAdded() const {
@@ -177,7 +175,7 @@ int Map::NumberOfOwnDescriptors() const {
}
void Map::SetNumberOfOwnDescriptors(int number) {
- DCHECK_LE(number, instance_descriptors()->number_of_descriptors());
+ DCHECK_LE(number, instance_descriptors().number_of_descriptors());
CHECK_LE(static_cast<unsigned>(number),
static_cast<unsigned>(kMaxNumberOfDescriptors));
set_bit_field3(NumberOfOwnDescriptorsBits::update(bit_field3(), number));
@@ -200,9 +198,8 @@ FixedArrayBase Map::GetInitialElements() const {
result = GetReadOnlyRoots().empty_fixed_array();
} else if (has_fast_sloppy_arguments_elements()) {
result = GetReadOnlyRoots().empty_sloppy_arguments_elements();
- } else if (has_fixed_typed_array_elements()) {
- result =
- GetReadOnlyRoots().EmptyFixedTypedArrayForTypedArray(elements_kind());
+ } else if (has_typed_array_elements()) {
+ result = GetReadOnlyRoots().empty_byte_array();
} else if (has_dictionary_elements()) {
result = GetReadOnlyRoots().empty_slow_element_dictionary();
} else {
@@ -293,12 +290,11 @@ Handle<Map> Map::AddMissingTransitionsForTesting(
}
InstanceType Map::instance_type() const {
- return static_cast<InstanceType>(
- READ_UINT16_FIELD(*this, kInstanceTypeOffset));
+ return static_cast<InstanceType>(ReadField<uint16_t>(kInstanceTypeOffset));
}
void Map::set_instance_type(InstanceType value) {
- WRITE_UINT16_FIELD(*this, kInstanceTypeOffset, value);
+ WriteField<uint16_t>(kInstanceTypeOffset, value);
}
int Map::UnusedPropertyFields() const {
@@ -373,19 +369,19 @@ void Map::SetOutOfObjectUnusedPropertyFields(int value) {
void Map::CopyUnusedPropertyFields(Map map) {
set_used_or_unused_instance_size_in_words(
- map->used_or_unused_instance_size_in_words());
- DCHECK_EQ(UnusedPropertyFields(), map->UnusedPropertyFields());
+ map.used_or_unused_instance_size_in_words());
+ DCHECK_EQ(UnusedPropertyFields(), map.UnusedPropertyFields());
}
void Map::CopyUnusedPropertyFieldsAdjustedForInstanceSize(Map map) {
- int value = map->used_or_unused_instance_size_in_words();
+ int value = map.used_or_unused_instance_size_in_words();
if (value >= JSValue::kFieldsAdded) {
// Unused in-object fields. Adjust the offset from the object’s start
// so it matches the distance to the object’s end.
- value += instance_size_in_words() - map->instance_size_in_words();
+ value += instance_size_in_words() - map.instance_size_in_words();
}
set_used_or_unused_instance_size_in_words(value);
- DCHECK_EQ(UnusedPropertyFields(), map->UnusedPropertyFields());
+ DCHECK_EQ(UnusedPropertyFields(), map.UnusedPropertyFields());
}
void Map::AccountAddedPropertyField() {
@@ -420,10 +416,10 @@ void Map::AccountAddedOutOfObjectPropertyField(int unused_in_property_array) {
DCHECK_EQ(unused_in_property_array, UnusedPropertyFields());
}
-byte Map::bit_field() const { return READ_BYTE_FIELD(*this, kBitFieldOffset); }
+byte Map::bit_field() const { return ReadField<byte>(kBitFieldOffset); }
void Map::set_bit_field(byte value) {
- WRITE_BYTE_FIELD(*this, kBitFieldOffset, value);
+ WriteField<byte>(kBitFieldOffset, value);
}
byte Map::relaxed_bit_field() const {
@@ -434,12 +430,10 @@ void Map::set_relaxed_bit_field(byte value) {
RELAXED_WRITE_BYTE_FIELD(*this, kBitFieldOffset, value);
}
-byte Map::bit_field2() const {
- return READ_BYTE_FIELD(*this, kBitField2Offset);
-}
+byte Map::bit_field2() const { return ReadField<byte>(kBitField2Offset); }
void Map::set_bit_field2(byte value) {
- WRITE_BYTE_FIELD(*this, kBitField2Offset, value);
+ WriteField<byte>(kBitField2Offset, value);
}
bool Map::is_abandoned_prototype_map() const {
@@ -447,8 +441,8 @@ bool Map::is_abandoned_prototype_map() const {
}
bool Map::should_be_fast_prototype_map() const {
- if (!prototype_info()->IsPrototypeInfo()) return false;
- return PrototypeInfo::cast(prototype_info())->should_be_fast_map();
+ if (!prototype_info().IsPrototypeInfo()) return false;
+ return PrototypeInfo::cast(prototype_info()).should_be_fast_map();
}
void Map::set_elements_kind(ElementsKind elements_kind) {
@@ -492,8 +486,8 @@ bool Map::has_fast_string_wrapper_elements() const {
return elements_kind() == FAST_STRING_WRAPPER_ELEMENTS;
}
-bool Map::has_fixed_typed_array_elements() const {
- return IsFixedTypedArrayElementsKind(elements_kind());
+bool Map::has_typed_array_elements() const {
+ return IsTypedArrayElementsKind(elements_kind());
}
bool Map::has_dictionary_elements() const {
@@ -501,7 +495,7 @@ bool Map::has_dictionary_elements() const {
}
bool Map::has_frozen_or_sealed_elements() const {
- return IsPackedFrozenOrSealedElementsKind(elements_kind());
+ return IsFrozenOrSealedElementsKind(elements_kind());
}
bool Map::has_sealed_elements() const {
@@ -531,7 +525,7 @@ bool Map::is_stable() const { return !IsUnstableBit::decode(bit_field3()); }
bool Map::CanBeDeprecated() const {
int descriptor = LastAdded();
for (int i = 0; i <= descriptor; i++) {
- PropertyDetails details = instance_descriptors()->GetDetails(i);
+ PropertyDetails details = instance_descriptors().GetDetails(i);
if (details.representation().IsNone()) return true;
if (details.representation().IsSmi()) return true;
if (details.representation().IsDouble()) return true;
@@ -546,7 +540,7 @@ bool Map::CanBeDeprecated() const {
void Map::NotifyLeafMapLayoutChange(Isolate* isolate) {
if (is_stable()) {
mark_unstable();
- dependent_code()->DeoptimizeDependentCodeGroup(
+ dependent_code().DeoptimizeDependentCodeGroup(
isolate, DependentCode::kPrototypeCheckGroup);
}
}
@@ -581,7 +575,7 @@ HeapObject Map::prototype() const {
}
void Map::set_prototype(HeapObject value, WriteBarrierMode mode) {
- DCHECK(value->IsNull() || value->IsJSReceiver());
+ DCHECK(value.IsNull() || value.IsJSReceiver());
WRITE_FIELD(*this, kPrototypeOffset, value);
CONDITIONAL_WRITE_BARRIER(*this, kPrototypeOffset, value, mode);
}
@@ -608,13 +602,13 @@ void Map::UpdateDescriptors(Isolate* isolate, DescriptorArray descriptors,
int number_of_own_descriptors) {
SetInstanceDescriptors(isolate, descriptors, number_of_own_descriptors);
if (FLAG_unbox_double_fields) {
- if (layout_descriptor()->IsSlowLayout()) {
+ if (layout_descriptor().IsSlowLayout()) {
set_layout_descriptor(layout_desc);
}
#ifdef VERIFY_HEAP
// TODO(ishell): remove these checks from VERIFY_HEAP mode.
if (FLAG_verify_heap) {
- CHECK(layout_descriptor()->IsConsistentWithMap(*this));
+ CHECK(layout_descriptor().IsConsistentWithMap(*this));
CHECK_EQ(Map::GetVisitorId(*this), visitor_id());
}
#else
@@ -627,14 +621,14 @@ void Map::UpdateDescriptors(Isolate* isolate, DescriptorArray descriptors,
void Map::InitializeDescriptors(Isolate* isolate, DescriptorArray descriptors,
LayoutDescriptor layout_desc) {
SetInstanceDescriptors(isolate, descriptors,
- descriptors->number_of_descriptors());
+ descriptors.number_of_descriptors());
if (FLAG_unbox_double_fields) {
set_layout_descriptor(layout_desc);
#ifdef VERIFY_HEAP
// TODO(ishell): remove these checks from VERIFY_HEAP mode.
if (FLAG_verify_heap) {
- CHECK(layout_descriptor()->IsConsistentWithMap(*this));
+ CHECK(layout_descriptor().IsConsistentWithMap(*this));
}
#else
SLOW_DCHECK(layout_descriptor()->IsConsistentWithMap(*this));
@@ -666,11 +660,11 @@ LayoutDescriptor Map::GetLayoutDescriptor() const {
void Map::AppendDescriptor(Isolate* isolate, Descriptor* desc) {
DescriptorArray descriptors = instance_descriptors();
int number_of_own_descriptors = NumberOfOwnDescriptors();
- DCHECK(descriptors->number_of_descriptors() == number_of_own_descriptors);
+ DCHECK(descriptors.number_of_descriptors() == number_of_own_descriptors);
{
// The following two operations need to happen before the marking write
// barrier.
- descriptors->Append(desc);
+ descriptors.Append(desc);
SetNumberOfOwnDescriptors(number_of_own_descriptors + 1);
MarkingBarrierForDescriptorArray(isolate->heap(), *this, descriptors,
number_of_own_descriptors + 1);
@@ -694,7 +688,7 @@ void Map::AppendDescriptor(Isolate* isolate, Descriptor* desc) {
HeapObject Map::GetBackPointer() const {
Object object = constructor_or_backpointer();
- if (object->IsMap()) {
+ if (object.IsMap()) {
return Map::cast(object);
}
return GetReadOnlyRoots().undefined_value();
@@ -723,10 +717,10 @@ void Map::set_prototype_info(Object value, WriteBarrierMode mode) {
void Map::SetBackPointer(Object value, WriteBarrierMode mode) {
CHECK_GE(instance_type(), FIRST_JS_RECEIVER_TYPE);
- CHECK(value->IsMap());
- CHECK(GetBackPointer()->IsUndefined());
- CHECK_IMPLIES(value->IsMap(), Map::cast(value)->GetConstructor() ==
- constructor_or_backpointer());
+ CHECK(value.IsMap());
+ CHECK(GetBackPointer().IsUndefined());
+ CHECK_IMPLIES(value.IsMap(), Map::cast(value).GetConstructor() ==
+ constructor_or_backpointer());
set_constructor_or_backpointer(value, mode);
}
@@ -737,34 +731,34 @@ ACCESSORS(Map, constructor_or_backpointer, Object,
bool Map::IsPrototypeValidityCellValid() const {
Object validity_cell = prototype_validity_cell();
- Object value = validity_cell->IsSmi() ? Smi::cast(validity_cell)
- : Cell::cast(validity_cell)->value();
+ Object value = validity_cell.IsSmi() ? Smi::cast(validity_cell)
+ : Cell::cast(validity_cell).value();
return value == Smi::FromInt(Map::kPrototypeChainValid);
}
Object Map::GetConstructor() const {
Object maybe_constructor = constructor_or_backpointer();
// Follow any back pointers.
- while (maybe_constructor->IsMap()) {
+ while (maybe_constructor.IsMap()) {
maybe_constructor =
- Map::cast(maybe_constructor)->constructor_or_backpointer();
+ Map::cast(maybe_constructor).constructor_or_backpointer();
}
return maybe_constructor;
}
FunctionTemplateInfo Map::GetFunctionTemplateInfo() const {
Object constructor = GetConstructor();
- if (constructor->IsJSFunction()) {
- DCHECK(JSFunction::cast(constructor)->shared()->IsApiFunction());
- return JSFunction::cast(constructor)->shared()->get_api_func_data();
+ if (constructor.IsJSFunction()) {
+ DCHECK(JSFunction::cast(constructor).shared().IsApiFunction());
+ return JSFunction::cast(constructor).shared().get_api_func_data();
}
- DCHECK(constructor->IsFunctionTemplateInfo());
+ DCHECK(constructor.IsFunctionTemplateInfo());
return FunctionTemplateInfo::cast(constructor);
}
void Map::SetConstructor(Object constructor, WriteBarrierMode mode) {
// Never overwrite a back pointer with a constructor.
- CHECK(!constructor_or_backpointer()->IsMap());
+ CHECK(!constructor_or_backpointer().IsMap());
set_constructor_or_backpointer(constructor, mode);
}
@@ -780,7 +774,7 @@ bool Map::IsInobjectSlackTrackingInProgress() const {
void Map::InobjectSlackTrackingStep(Isolate* isolate) {
// Slack tracking should only be performed on an initial map.
- DCHECK(GetBackPointer()->IsUndefined());
+ DCHECK(GetBackPointer().IsUndefined());
if (!IsInobjectSlackTrackingInProgress()) return;
int counter = construction_counter();
set_construction_counter(counter - 1);
@@ -813,7 +807,7 @@ int NormalizedMapCache::GetIndex(Handle<Map> map) {
bool HeapObject::IsNormalizedMapCache() const {
if (!IsWeakFixedArray()) return false;
- if (WeakFixedArray::cast(*this)->length() != NormalizedMapCache::kEntries) {
+ if (WeakFixedArray::cast(*this).length() != NormalizedMapCache::kEntries) {
return false;
}
return true;