Commit b5772192 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

Revert "[compiler] Clean up ObjectDataKind"

This reverts commit 5cc7bfd0.

Reason for revert: Need to revert dependency.

Original change's description:
> [compiler] Clean up ObjectDataKind
>
> In particular: remove PossiblyBackgroundSerializedHeapObject in favor of
> either SerializedHeapObject or BackgroundSerializedHeapObject, depending
> on the (existing) argument to the ObjectRef constructor.
>
> Bug: v8:7790
> Change-Id: I0a67872c377107799233742cc7774bea62811d0f
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2681946
> Commit-Queue: Georg Neis <neis@chromium.org>
> Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
> Reviewed-by: Santiago Aboy Solanes <solanes@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#72591}

TBR=neis@chromium.org,solanes@chromium.org,nicohartmann@chromium.org

Change-Id: I48a96504c29851587529d7d12cb15e569aec196b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:7790
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2685124Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72617}
parent ddb7d307
......@@ -51,7 +51,7 @@ HEAP_BROKER_BACKGROUND_SERIALIZED_OBJECT_LIST(FORWARD_DECL)
HEAP_BROKER_NEVER_SERIALIZED_OBJECT_LIST(FORWARD_DECL)
#undef FORWARD_DECL
// There are several kinds of ObjectData values.
// There are five kinds of ObjectData values.
//
// kSmi: The underlying V8 object is a Smi and the data is an instance of the
// base class (ObjectData), i.e. it's basically just the handle. Because the
......@@ -62,8 +62,9 @@ HEAP_BROKER_NEVER_SERIALIZED_OBJECT_LIST(FORWARD_DECL)
// data is an instance of the corresponding (most-specific) subclass, e.g.
// JSFunctionData, which provides serialized information about the object.
//
// kBackgroundSerializedHeapObject: Like kSerializedHeapObject, but
// allows serialization from the background thread.
// kPossiblyBackgroundSerializedHeapObject: Like kSerializedHeapObject, but
// allows serialization from the background thread where this is safe
// (indicated by corresponding ObjectRef constructor argument).
//
// kUnserializedHeapObject: The underlying V8 object is a HeapObject and the
// data is an instance of the base class (ObjectData), i.e. it basically
......@@ -82,6 +83,7 @@ HEAP_BROKER_NEVER_SERIALIZED_OBJECT_LIST(FORWARD_DECL)
enum ObjectDataKind {
kSmi,
kSerializedHeapObject,
kPossiblyBackgroundSerializedHeapObject,
kBackgroundSerializedHeapObject,
kUnserializedHeapObject,
kNeverSerializedHeapObject,
......@@ -137,6 +139,7 @@ class ObjectData : public ZoneObject {
CHECK_IMPLIES(broker->mode() == JSHeapBroker::kSerialized,
kind == kUnserializedReadOnlyHeapObject || kind == kSmi ||
kind == kNeverSerializedHeapObject ||
kind == kPossiblyBackgroundSerializedHeapObject ||
kind == kBackgroundSerializedHeapObject);
CHECK_IMPLIES(kind == kUnserializedReadOnlyHeapObject,
IsReadOnlyHeapObject(*object));
......@@ -767,9 +770,9 @@ class RegExpBoilerplateDescriptionData : public HeapObjectData {
class HeapNumberData : public HeapObjectData {
public:
HeapNumberData(JSHeapBroker* broker, ObjectData** storage,
Handle<HeapNumber> object,
ObjectDataKind kind = ObjectDataKind::kSerializedHeapObject)
: HeapObjectData(broker, storage, object, kind),
Handle<HeapNumber> object)
: HeapObjectData(broker, storage, object,
kPossiblyBackgroundSerializedHeapObject),
value_(object->value()) {}
double value() const { return value_; }
......@@ -1072,9 +1075,9 @@ class AllocationSiteData : public HeapObjectData {
class BigIntData : public HeapObjectData {
public:
BigIntData(JSHeapBroker* broker, ObjectData** storage, Handle<BigInt> object,
ObjectDataKind kind = ObjectDataKind::kSerializedHeapObject)
: HeapObjectData(broker, storage, object, kind),
BigIntData(JSHeapBroker* broker, ObjectData** storage, Handle<BigInt> object)
: HeapObjectData(broker, storage, object,
ObjectDataKind::kPossiblyBackgroundSerializedHeapObject),
as_uint64_(object->AsUint64(nullptr)) {}
uint64_t AsUint64() const { return as_uint64_; }
......@@ -1103,8 +1106,7 @@ struct PropertyDescriptor {
class MapData : public HeapObjectData {
public:
MapData(JSHeapBroker* broker, ObjectData** storage, Handle<Map> object,
ObjectDataKind kind = ObjectDataKind::kSerializedHeapObject);
MapData(JSHeapBroker* broker, ObjectData** storage, Handle<Map> object);
InstanceType instance_type() const { return instance_type_; }
int instance_size() const { return instance_size_; }
......@@ -1275,6 +1277,7 @@ HeapObjectData::HeapObjectData(JSHeapBroker* broker, ObjectData** storage,
CHECK_IMPLIES(kind == kSerializedHeapObject,
broker->mode() == JSHeapBroker::kSerializing);
CHECK_IMPLIES(broker->mode() == JSHeapBroker::kSerialized,
kind == kPossiblyBackgroundSerializedHeapObject ||
kind == kBackgroundSerializedHeapObject);
}
......@@ -1311,9 +1314,9 @@ bool SupportsFastArrayResize(Isolate* isolate, Handle<Map> map) {
}
} // namespace
MapData::MapData(JSHeapBroker* broker, ObjectData** storage, Handle<Map> object,
ObjectDataKind kind)
: HeapObjectData(broker, storage, object, kind),
MapData::MapData(JSHeapBroker* broker, ObjectData** storage, Handle<Map> object)
: HeapObjectData(broker, storage, object,
ObjectDataKind::kPossiblyBackgroundSerializedHeapObject),
instance_type_(object->instance_type()),
instance_size_(object->instance_size()),
bit_field_(object->bit_field()),
......@@ -2194,11 +2197,27 @@ HEAP_BROKER_NEVER_SERIALIZED_OBJECT_LIST(DEFINE_IS)
Name##Data* ObjectData::As##Name() { \
CHECK(Is##Name()); \
CHECK(kind_ == kSerializedHeapObject || \
kind_ == kPossiblyBackgroundSerializedHeapObject || \
kind_ == kBackgroundSerializedHeapObject); \
return static_cast<Name##Data*>(this); \
}
HEAP_BROKER_SERIALIZED_OBJECT_LIST(DEFINE_AS)
#undef DEFINE_AS
#define DEFINE_AS(Name) \
Name##Data* ObjectData::As##Name() { \
CHECK(Is##Name()); \
CHECK_EQ(kind_, kPossiblyBackgroundSerializedHeapObject); \
return static_cast<Name##Data*>(this); \
}
HEAP_BROKER_POSSIBLY_BACKGROUND_SERIALIZED_OBJECT_LIST(DEFINE_AS)
#undef DEFINE_AS
#define DEFINE_AS(Name) \
Name##Data* ObjectData::As##Name() { \
CHECK(Is##Name()); \
CHECK(kind_ == kSerializedHeapObject || \
kind_ == kBackgroundSerializedHeapObject); \
return static_cast<Name##Data*>(this); \
}
HEAP_BROKER_BACKGROUND_SERIALIZED_OBJECT_LIST(DEFINE_AS)
#undef DEFINE_AS
......@@ -2469,7 +2488,8 @@ bool ObjectRef::equals(const ObjectRef& other) const {
bool ObjectRef::ShouldHaveBeenSerialized() const {
return broker()->mode() == JSHeapBroker::kSerialized &&
data()->kind() == kSerializedHeapObject;
(data()->kind() == kSerializedHeapObject ||
data()->kind() == kPossiblyBackgroundSerializedHeapObject);
}
Isolate* ObjectRef::isolate() const { return broker()->isolate(); }
......@@ -2910,15 +2930,10 @@ ObjectData* JSHeapBroker::TryGetOrCreateData(Handle<Object> object,
return nullptr; \
} \
entry = refs_->LookupOrInsert(object.address()); \
ObjectDataKind kind = (background_serialization == \
ObjectRef::BackgroundSerialization::kAllowed) \
? kBackgroundSerializedHeapObject \
: kSerializedHeapObject; \
object_data = zone()->New<name##Data>(this, &(entry->value), \
Handle<name>::cast(object), \
kind);
HEAP_BROKER_POSSIBLY_BACKGROUND_SERIALIZED_OBJECT_LIST(
CREATE_DATA_FOR_POSSIBLE_SERIALIZATION)
Handle<name>::cast(object));
HEAP_BROKER_POSSIBLY_BACKGROUND_SERIALIZED_OBJECT_LIST(
CREATE_DATA_FOR_POSSIBLE_SERIALIZATION)
#undef CREATE_DATA_FOR_POSSIBLE_SERIALIZATION
#define CREATE_DATA_FOR_BACKGROUND_SERIALIZATION(name) \
} else if (object->Is##name()) { \
......
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