Commit ee801761 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[compiler] Replace FixedDoubleArrayData with direct reads

It does a direct access iff the FLAG_turbo_direct_heap_access is
enabled. Otherwise, it uses the Data classes as it did before.

Bug: v8:7790
Change-Id: I4f42e5734fdb2c91dbe9ef08869aec621c9d04c3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2382311
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69737}
parent 3f4f4a0d
...@@ -47,6 +47,17 @@ enum class OddballType : uint8_t { ...@@ -47,6 +47,17 @@ enum class OddballType : uint8_t {
kOther // Oddball, but none of the above. kOther // Oddball, but none of the above.
}; };
// This list is sorted such that subtypes appear before their supertypes.
// This list must not contain a type if it doesn't contain all of its subtypes
// too. For example, it CANNOT contain FixedArrayBase if it doesn't contain
// FixedDoubleArray, BytecodeArray and FixedArray.
// DO NOT VIOLATE THESE TWO PROPERTIES!
// Classes on this list will skip serialization when
// FLAG_turbo_direct_heap_access is on. Otherwise, they might get serialized.
#define HEAP_BROKER_NEVER_SERIALIZED_OBJECT_LIST(V) \
/* Subtypes of FixedArrayBase */ \
V(FixedDoubleArray)
// This list is sorted such that subtypes appear before their supertypes. // This list is sorted such that subtypes appear before their supertypes.
// DO NOT VIOLATE THIS PROPERTY! // DO NOT VIOLATE THIS PROPERTY!
#define HEAP_BROKER_SERIALIZED_OBJECT_LIST(V) \ #define HEAP_BROKER_SERIALIZED_OBJECT_LIST(V) \
...@@ -69,7 +80,6 @@ enum class OddballType : uint8_t { ...@@ -69,7 +80,6 @@ enum class OddballType : uint8_t {
/* Subtypes of FixedArrayBase */ \ /* Subtypes of FixedArrayBase */ \
V(BytecodeArray) \ V(BytecodeArray) \
V(FixedArray) \ V(FixedArray) \
V(FixedDoubleArray) \
/* Subtypes of Name */ \ /* Subtypes of Name */ \
V(InternalizedString) \ V(InternalizedString) \
V(String) \ V(String) \
...@@ -100,10 +110,6 @@ enum class OddballType : uint8_t { ...@@ -100,10 +110,6 @@ enum class OddballType : uint8_t {
/* Subtypes of Object */ \ /* Subtypes of Object */ \
V(HeapObject) V(HeapObject)
// Classes on this list will skip serialization when
// FLAG_turbo_direct_heap_access is on. Otherwise, they might get serialized.
#define HEAP_BROKER_NEVER_SERIALIZED_OBJECT_LIST(V)
class CompilationDependencies; class CompilationDependencies;
struct FeedbackSource; struct FeedbackSource;
class JSHeapBroker; class JSHeapBroker;
......
...@@ -1560,7 +1560,9 @@ class FixedDoubleArrayData : public FixedArrayBaseData { ...@@ -1560,7 +1560,9 @@ class FixedDoubleArrayData : public FixedArrayBaseData {
FixedDoubleArrayData::FixedDoubleArrayData(JSHeapBroker* broker, FixedDoubleArrayData::FixedDoubleArrayData(JSHeapBroker* broker,
ObjectData** storage, ObjectData** storage,
Handle<FixedDoubleArray> object) Handle<FixedDoubleArray> object)
: FixedArrayBaseData(broker, storage, object), contents_(broker->zone()) {} : FixedArrayBaseData(broker, storage, object), contents_(broker->zone()) {
DCHECK(!FLAG_turbo_direct_heap_access);
}
void FixedDoubleArrayData::SerializeContents(JSHeapBroker* broker) { void FixedDoubleArrayData::SerializeContents(JSHeapBroker* broker) {
if (serialized_contents_) return; if (serialized_contents_) return;
...@@ -2257,6 +2259,7 @@ void JSObjectData::SerializeRecursiveAsBoilerplate(JSHeapBroker* broker, ...@@ -2257,6 +2259,7 @@ void JSObjectData::SerializeRecursiveAsBoilerplate(JSHeapBroker* broker,
} else { } else {
CHECK(boilerplate->HasDoubleElements()); CHECK(boilerplate->HasDoubleElements());
CHECK_LE(elements_object->Size(), kMaxRegularHeapObjectSize); CHECK_LE(elements_object->Size(), kMaxRegularHeapObjectSize);
DCHECK_EQ(elements_->kind(), ObjectDataKind::kSerializedHeapObject);
elements_->AsFixedDoubleArray()->SerializeContents(broker); elements_->AsFixedDoubleArray()->SerializeContents(broker);
} }
...@@ -3223,22 +3226,28 @@ ObjectRef FixedArrayRef::get(int i) const { ...@@ -3223,22 +3226,28 @@ ObjectRef FixedArrayRef::get(int i) const {
} }
bool FixedDoubleArrayRef::is_the_hole(int i) const { bool FixedDoubleArrayRef::is_the_hole(int i) const {
if (data_->should_access_heap()) { if (FLAG_turbo_direct_heap_access) {
return object()->is_the_hole(i);
} else if (data_->should_access_heap()) {
AllowHandleDereferenceIf allow_handle_dereference(data()->kind(), AllowHandleDereferenceIf allow_handle_dereference(data()->kind(),
broker()->mode()); broker()->mode());
return object()->is_the_hole(i); return object()->is_the_hole(i);
} else {
return data()->AsFixedDoubleArray()->Get(i).is_hole_nan();
} }
return data()->AsFixedDoubleArray()->Get(i).is_hole_nan();
} }
double FixedDoubleArrayRef::get_scalar(int i) const { double FixedDoubleArrayRef::get_scalar(int i) const {
if (data_->should_access_heap()) { if (FLAG_turbo_direct_heap_access) {
return object()->get_scalar(i);
} else if (data_->should_access_heap()) {
AllowHandleDereferenceIf allow_handle_dereference(data()->kind(), AllowHandleDereferenceIf allow_handle_dereference(data()->kind(),
broker()->mode()); broker()->mode());
return object()->get_scalar(i); return object()->get_scalar(i);
} else {
CHECK(!data()->AsFixedDoubleArray()->Get(i).is_hole_nan());
return data()->AsFixedDoubleArray()->Get(i).get_scalar();
} }
CHECK(!data()->AsFixedDoubleArray()->Get(i).is_hole_nan());
return data()->AsFixedDoubleArray()->Get(i).get_scalar();
} }
uint8_t BytecodeArrayRef::get(int index) const { return object()->get(index); } uint8_t BytecodeArrayRef::get(int index) const { return object()->get(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