Commit 634a0fd6 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by V8 LUCI CQ

[compiler] Make NeverEverSerialized the default for NeverSerialized

Also:
* Remove forward declare and As##Name for never serialized Data classes
* Remove the Data classes
* Refactor macro list to encode being background or never serialized

Bug: v8:7790
Change-Id: Ide29d89072b247311f29948f04c4147c5c1103cc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3056458
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76032}
parent 3a401f3b
......@@ -32,10 +32,6 @@ namespace compiler {
#define TRACE(broker, x) TRACE_BROKER(broker, x)
#define TRACE_MISSING(broker, x) TRACE_BROKER_MISSING(broker, x)
#define FORWARD_DECL(Name, ...) class Name##Data;
HEAP_BROKER_OBJECT_LIST(FORWARD_DECL)
#undef FORWARD_DECL
// There are several kinds of ObjectData values.
//
// kSmi: The underlying V8 object is a Smi and the data is an instance of the
......@@ -129,12 +125,12 @@ class ObjectData : public ZoneObject {
HeapObject::cast(*object)));
}
#define DECLARE_IS(Name, ...) bool Is##Name() const;
#define DECLARE_IS(Name) bool Is##Name() const;
HEAP_BROKER_OBJECT_LIST(DECLARE_IS)
#undef DECLARE_IS
#define DECLARE_AS(Name, ...) Name##Data* As##Name();
HEAP_BROKER_OBJECT_LIST(DECLARE_AS)
#define DECLARE_AS(Name) Name##Data* As##Name();
HEAP_BROKER_BACKGROUND_SERIALIZED_OBJECT_LIST(DECLARE_AS)
#undef DECLARE_AS
Handle<Object> object() const { return object_; }
......@@ -203,30 +199,6 @@ class PropertyCellData : public HeapObjectData {
bool serialized() const { return value_ != nullptr; }
};
class FunctionTemplateInfoData : public HeapObjectData {
public:
FunctionTemplateInfoData(JSHeapBroker* broker, ObjectData** storage,
Handle<FunctionTemplateInfo> object)
: HeapObjectData(broker, storage, object) {
// FunctionTemplateInfoData is NeverEverSerialize.
// TODO(solanes, v8:7790): Remove this class once all kNeverSerialized types
// are NeverEverSerialize.
UNREACHABLE();
}
};
class CallHandlerInfoData : public HeapObjectData {
public:
CallHandlerInfoData(JSHeapBroker* broker, ObjectData** storage,
Handle<CallHandlerInfo> object)
: HeapObjectData(broker, storage, object) {
// CallHandlerInfoData is NeverEverSerialize.
// TODO(solanes, v8:7790): Remove this class once all kNeverSerialized types
// are NeverEverSerialize.
UNREACHABLE();
}
};
namespace {
ZoneVector<Address> GetCFunctions(FixedArray function_overloads, Zone* zone) {
......@@ -638,18 +610,6 @@ void JSTypedArrayData::Serialize(JSHeapBroker* broker,
}
}
class ArrayBoilerplateDescriptionData : public HeapObjectData {
public:
ArrayBoilerplateDescriptionData(JSHeapBroker* broker, ObjectData** storage,
Handle<ArrayBoilerplateDescription> object)
: HeapObjectData(broker, storage, object) {
// ArrayBoilerplateDescriptionData is NeverEverSerialize.
// TODO(solanes, v8:7790): Remove this class once all kNeverSerialized types
// are NeverEverSerialize.
UNREACHABLE();
}
};
class JSDataViewData : public JSObjectData {
public:
JSDataViewData(JSHeapBroker* broker, ObjectData** storage,
......@@ -792,121 +752,6 @@ class JSFunctionData : public JSObjectData {
ObjectData* function_data_ = nullptr;
};
class RegExpBoilerplateDescriptionData : public HeapObjectData {
public:
RegExpBoilerplateDescriptionData(JSHeapBroker* broker, ObjectData** storage,
Handle<RegExpBoilerplateDescription> object)
: HeapObjectData(broker, storage, object) {
// RegExpBoilerplateDescription is NeverEverSerialize.
// TODO(jgruber): Remove this class once all kNeverSerialized types are
// NeverEverSerialize.
UNREACHABLE();
}
};
class HeapNumberData : public HeapObjectData {
public:
HeapNumberData(JSHeapBroker* broker, ObjectData** storage,
Handle<HeapNumber> object,
ObjectDataKind kind = ObjectDataKind::kSerializedHeapObject)
: HeapObjectData(broker, storage, object, kind) {
// TODO(jgruber): Remove this class once all kNeverSerialized types are
// NeverEverSerialize.
UNREACHABLE();
}
};
class ContextData : public HeapObjectData {
public:
ContextData(JSHeapBroker* broker, ObjectData** storage,
Handle<Context> object)
: HeapObjectData(broker, storage, object) {
// TODO(v8:7790): Remove this class once all kNeverSerialized types are
// NeverEverSerialize.
UNREACHABLE();
}
};
class NativeContextData : public ContextData {
public:
NativeContextData(JSHeapBroker* broker, ObjectData** storage,
Handle<NativeContext> object)
: ContextData(broker, storage, object) {
// TODO(v8:7790): Remove this class once all kNeverSerialized types are
// NeverEverSerialize.
UNREACHABLE();
}
};
class NameData : public HeapObjectData {
public:
NameData(JSHeapBroker* broker, ObjectData** storage, Handle<Name> object)
: HeapObjectData(broker, storage, object) {
// StringData is NeverEverSerialize.
// TODO(solanes, v8:7790): Remove this class once all kNeverSerialized types
// are NeverEverSerialize.
UNREACHABLE();
}
};
class StringData : public NameData {
public:
StringData(JSHeapBroker* broker, ObjectData** storage, Handle<String> object)
: NameData(broker, storage, object) {
// StringData is NeverEverSerialize.
// TODO(solanes, v8:7790): Remove this class once all kNeverSerialized types
// are NeverEverSerialize.
UNREACHABLE();
}
};
class SymbolData : public NameData {
public:
SymbolData(JSHeapBroker* broker, ObjectData** storage, Handle<Symbol> object)
: NameData(broker, storage, object) {
// StringData is NeverEverSerialize.
// TODO(solanes, v8:7790): Remove this class once all kNeverSerialized types
// are NeverEverSerialize.
UNREACHABLE();
}
};
class InternalizedStringData : public StringData {
public:
InternalizedStringData(JSHeapBroker* broker, ObjectData** storage,
Handle<InternalizedString> object)
: StringData(broker, storage, object) {
// InternalizedStringData is NeverEverSerialize.
// TODO(solanes, v8:7790): Remove this class once all kNeverSerialized types
// are NeverEverSerialize.
UNREACHABLE();
}
};
class AccessorInfoData : public HeapObjectData {
public:
AccessorInfoData(JSHeapBroker* broker, ObjectData** storage,
Handle<AccessorInfo> object)
: HeapObjectData(broker, storage, object) {
// AccessorInfoData is NeverEverSerialize.
// TODO(solanes, v8:7790): Remove this class once all kNeverSerialized types
// are NeverEverSerialize.
UNREACHABLE();
}
};
class AllocationSiteData : public HeapObjectData {
public:
AllocationSiteData(JSHeapBroker* broker, ObjectData** storage,
Handle<AllocationSite> object)
: HeapObjectData(broker, storage, object) {
// AllocationSiteData is NeverEverSerialize.
// TODO(solanes, v8:7790): Remove this class once all kNeverSerialized types
// are NeverEverSerialize.
UNREACHABLE();
}
};
class BigIntData : public HeapObjectData {
public:
BigIntData(JSHeapBroker* broker, ObjectData** storage, Handle<BigInt> object,
......@@ -1390,41 +1235,6 @@ MapData::MapData(JSHeapBroker* broker, ObjectData** storage, Handle<Map> object,
}
}
class DescriptorArrayData : public HeapObjectData {
public:
DescriptorArrayData(JSHeapBroker* broker, ObjectData** storage,
Handle<DescriptorArray> object)
: HeapObjectData(broker, storage, object) {
// DescriptorArrayData is NeverEverSerialize.
// TODO(solanes, v8:7790): Remove this class once all kNeverSerialized types
// are NeverEverSerialize.
UNREACHABLE();
}
};
class FeedbackCellData : public HeapObjectData {
public:
FeedbackCellData(JSHeapBroker* broker, ObjectData** storage,
Handle<FeedbackCell> object)
: HeapObjectData(broker, storage, object) {
// FeedbackCellData is NeverEverSerialize.
// TODO(solanes, v8:7790): Remove this class once all kNeverSerialized types
// are NeverEverSerialize.
UNREACHABLE();
}
};
class FeedbackVectorData : public HeapObjectData {
public:
FeedbackVectorData(JSHeapBroker* broker, ObjectData** storage,
Handle<FeedbackVector> object)
: HeapObjectData(broker, storage, object) {
// TODO(solanes, v8:7790): Remove this class once all kNeverSerialized types
// are NeverEverSerialize.
UNREACHABLE();
}
};
class FixedArrayBaseData : public HeapObjectData {
public:
FixedArrayBaseData(JSHeapBroker* broker, ObjectData** storage,
......@@ -1445,20 +1255,6 @@ class FixedArrayData : public FixedArrayBaseData {
: FixedArrayBaseData(broker, storage, object, kind) {}
};
class ObjectBoilerplateDescriptionData : public FixedArrayData {
public:
ObjectBoilerplateDescriptionData(
JSHeapBroker* broker, ObjectData** storage,
Handle<ObjectBoilerplateDescription> object,
ObjectDataKind kind = ObjectDataKind::kSerializedHeapObject)
: FixedArrayData(broker, storage, object, kind) {
// ObjectBoilerplateDescriptionData is NeverEverSerialize.
// TODO(solanes, v8:7790): Remove this class once all kNeverSerialized types
// are NeverEverSerialize.
UNREACHABLE();
}
};
// Only used in JSNativeContextSpecialization.
class ScriptContextTableData : public FixedArrayData {
public:
......@@ -1516,32 +1312,6 @@ JSObjectData::JSObjectData(JSHeapBroker* broker, ObjectData** storage,
own_constant_elements_(broker->zone()),
own_properties_(broker->zone()) {}
class FixedDoubleArrayData : public FixedArrayBaseData {
public:
FixedDoubleArrayData(
JSHeapBroker* broker, ObjectData** storage,
Handle<FixedDoubleArray> object,
ObjectDataKind kind = ObjectDataKind::kNeverSerializedHeapObject)
: FixedArrayBaseData(broker, storage, object, kind) {
// TODO(solanes, v8:7790): Remove this class once all kNeverSerialized types
// are NeverEverSerialize.
UNREACHABLE();
}
};
class BytecodeArrayData : public FixedArrayBaseData {
public:
BytecodeArrayData(JSHeapBroker* broker, ObjectData** storage,
Handle<BytecodeArray> object)
: FixedArrayBaseData(broker, storage, object,
ObjectDataKind::kNeverSerializedHeapObject) {
// BytecodeArrayData is NeverEverSerialize.
// TODO(solanes, v8:7790): Remove this class once all kNeverSerialized types
// are NeverEverSerialize.
UNREACHABLE();
}
};
class JSArrayData : public JSObjectData {
public:
JSArrayData(JSHeapBroker* broker, ObjectData** storage,
......@@ -1601,51 +1371,6 @@ ObjectData* JSArrayData::GetOwnElement(JSHeapBroker* broker, uint32_t index,
return result;
}
class ScopeInfoData : public HeapObjectData {
public:
ScopeInfoData(JSHeapBroker* broker, ObjectData** storage,
Handle<ScopeInfo> object)
: HeapObjectData(broker, storage, object) {
// TODO(v8:7790): Remove this class once all kNeverSerialized types are
// NeverEverSerialize.
UNREACHABLE();
}
};
class SharedFunctionInfoData : public HeapObjectData {
public:
SharedFunctionInfoData(JSHeapBroker* broker, ObjectData** storage,
Handle<SharedFunctionInfo> object)
: HeapObjectData(broker, storage, object) {
// TODO(v8:7790): Remove this class once all kNeverSerialized types are
// NeverEverSerialize.
UNREACHABLE();
}
};
class SourceTextModuleData : public HeapObjectData {
public:
SourceTextModuleData(JSHeapBroker* broker, ObjectData** storage,
Handle<SourceTextModule> object)
: HeapObjectData(broker, storage, object) {
// SourceTextModuleData is NeverEverSerialize.
// TODO(solanes, v8:7790): Remove this class once all kNeverSerialized types
// are NeverEverSerialize.
UNREACHABLE();
}
};
class CellData : public HeapObjectData {
public:
CellData(JSHeapBroker* broker, ObjectData** storage, Handle<Cell> object)
: HeapObjectData(broker, storage, object) {
// CellData is NeverEverSerialize.
// TODO(solanes, v8:7790): Remove this class once all kNeverSerialized types
// are NeverEverSerialize.
UNREACHABLE();
}
};
class JSGlobalObjectData : public JSObjectData {
public:
JSGlobalObjectData(JSHeapBroker* broker, ObjectData** storage,
......@@ -1729,40 +1454,7 @@ ObjectData* JSGlobalObjectData::GetPropertyCell(JSHeapBroker* broker,
return result;
}
class TemplateObjectDescriptionData : public HeapObjectData {
public:
TemplateObjectDescriptionData(JSHeapBroker* broker, ObjectData** storage,
Handle<TemplateObjectDescription> object)
: HeapObjectData(broker, storage, object) {
// TemplateObjectDescriptionData is NeverEverSerialize.
// TODO(solanes, v8:7790): Remove this class once all kNeverSerialized types
// are NeverEverSerialize.
UNREACHABLE();
}
};
class CodeData : public HeapObjectData {
public:
CodeData(JSHeapBroker* broker, ObjectData** storage, Handle<Code> object)
: HeapObjectData(broker, storage, object) {
// TODO(solanes, v8:7790): Remove this class once all kNeverSerialized types
// are NeverEverSerialize.
UNREACHABLE();
}
};
class CodeDataContainerData : public HeapObjectData {
public:
CodeDataContainerData(JSHeapBroker* broker, ObjectData** storage,
Handle<CodeDataContainer> object)
: HeapObjectData(broker, storage, object) {
// TODO(solanes, v8:7790): Remove this class once all kNeverSerialized types
// are NeverEverSerialize.
UNREACHABLE();
}
};
#define DEFINE_IS(Name, ...) \
#define DEFINE_IS(Name) \
bool ObjectData::Is##Name() const { \
if (should_access_heap()) { \
return object()->Is##Name(); \
......@@ -1775,14 +1467,14 @@ class CodeDataContainerData : public HeapObjectData {
HEAP_BROKER_OBJECT_LIST(DEFINE_IS)
#undef DEFINE_IS
#define DEFINE_AS(Name, Kind) \
#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_OBJECT_LIST(DEFINE_AS)
HEAP_BROKER_BACKGROUND_SERIALIZED_OBJECT_LIST(DEFINE_AS)
#undef DEFINE_AS
ObjectData* JSObjectData::GetInobjectField(int property_index) const {
......@@ -2143,7 +1835,7 @@ namespace {
template <RefSerializationKind Kind, class DataT, class ObjectT>
struct CreateDataFunctor {
bool operator()(JSHeapBroker* broker, RefsMap* refs, Handle<Object> object,
void operator()(JSHeapBroker* broker, RefsMap* refs, Handle<Object> object,
RefsMap::Entry** entry_out, ObjectData** object_data_out) {
USE(broker, refs, object, entry_out, object_data_out);
UNREACHABLE();
......@@ -2153,83 +1845,25 @@ struct CreateDataFunctor {
template <class DataT, class ObjectT>
struct CreateDataFunctor<RefSerializationKind::kBackgroundSerialized, DataT,
ObjectT> {
bool operator()(JSHeapBroker* broker, RefsMap* refs, Handle<Object> object,
void operator()(JSHeapBroker* broker, RefsMap* refs, Handle<Object> object,
RefsMap::Entry** entry_out, ObjectData** object_data_out) {
RefsMap::Entry* entry = refs->LookupOrInsert(object.address());
*object_data_out = broker->zone()->New<DataT>(
broker, &entry->value, Handle<ObjectT>::cast(object),
kBackgroundSerializedHeapObject);
*entry_out = entry;
return true;
}
};
template <class T>
bool NeverEverSerialize() {
return false;
}
// This list is to help with the transition of kNeverSerialize types (which are
// currently still serialized if concurrent inlining is disabled) to actually
// be never serialized. It should be removed once all types have been migrated
// here.
#define NEVER_EVER_SERIALIZE(Type) \
template <> \
bool NeverEverSerialize<Type>() { \
return true; \
}
NEVER_EVER_SERIALIZE(AccessorInfo)
NEVER_EVER_SERIALIZE(AllocationSite)
NEVER_EVER_SERIALIZE(ArrayBoilerplateDescription)
NEVER_EVER_SERIALIZE(BytecodeArray)
NEVER_EVER_SERIALIZE(Cell)
NEVER_EVER_SERIALIZE(CallHandlerInfo)
NEVER_EVER_SERIALIZE(Code)
NEVER_EVER_SERIALIZE(CodeDataContainer)
NEVER_EVER_SERIALIZE(Context)
NEVER_EVER_SERIALIZE(DescriptorArray)
NEVER_EVER_SERIALIZE(FeedbackCell)
NEVER_EVER_SERIALIZE(FeedbackVector)
NEVER_EVER_SERIALIZE(FixedDoubleArray)
NEVER_EVER_SERIALIZE(FunctionTemplateInfo)
NEVER_EVER_SERIALIZE(HeapNumber)
NEVER_EVER_SERIALIZE(InternalizedString)
NEVER_EVER_SERIALIZE(Name)
NEVER_EVER_SERIALIZE(NativeContext)
NEVER_EVER_SERIALIZE(ObjectBoilerplateDescription)
NEVER_EVER_SERIALIZE(RegExpBoilerplateDescription)
NEVER_EVER_SERIALIZE(SharedFunctionInfo)
NEVER_EVER_SERIALIZE(ScopeInfo)
NEVER_EVER_SERIALIZE(SourceTextModule)
NEVER_EVER_SERIALIZE(String)
NEVER_EVER_SERIALIZE(Symbol)
NEVER_EVER_SERIALIZE(TemplateObjectDescription)
#undef NEVER_EVER_SERIALIZE
template <class DataT, class ObjectT>
struct CreateDataFunctor<RefSerializationKind::kNeverSerialized, DataT,
template <class ObjectT>
struct CreateDataFunctor<RefSerializationKind::kNeverSerialized, ObjectData,
ObjectT> {
bool operator()(JSHeapBroker* broker, RefsMap* refs, Handle<Object> object,
void operator()(JSHeapBroker* broker, RefsMap* refs, Handle<Object> object,
RefsMap::Entry** entry_out, ObjectData** object_data_out) {
// TODO(solanes, v8:10866): Remove the `(mode() == kSerializing)` case
// below when all classes skip serialization. Same for similar spots if we
// end up keeping them.
if (broker->is_concurrent_inlining() || NeverEverSerialize<ObjectT>()) {
RefsMap::Entry* entry = refs->LookupOrInsert(object.address());
*object_data_out = broker->zone()->New<ObjectData>(
broker, &entry->value, object, kNeverSerializedHeapObject);
*entry_out = entry;
return true;
} else if (broker->mode() == JSHeapBroker::kSerializing) {
RefsMap::Entry* entry = refs->LookupOrInsert(object.address());
*object_data_out = broker->zone()->New<DataT>(
broker, &entry->value, Handle<ObjectT>::cast(object));
*entry_out = entry;
return true;
}
return false;
RefsMap::Entry* entry = refs->LookupOrInsert(object.address());
*object_data_out = broker->zone()->New<ObjectData>(
broker, &entry->value, object, kNeverSerializedHeapObject);
*entry_out = entry;
}
};
......@@ -2296,14 +1930,13 @@ ObjectData* JSHeapBroker::TryGetOrCreateData(Handle<Object> object,
kUnserializedReadOnlyHeapObject);
}
#define CREATE_DATA(Name, Kind) \
if (object->Is##Name()) { \
CreateDataFunctor<Kind, Name##Data, Name> f; \
if (!f(this, refs_, object, &entry, &object_data)) { \
CHECK_WITH_MSG(!crash_on_error, #Name "Ref construction failed"); \
return nullptr; \
} \
/* NOLINTNEXTLINE(readability/braces) */ \
#define CREATE_DATA(Name) \
if (object->Is##Name()) { \
CreateDataFunctor<ref_traits<Name>::ref_serialization_kind, \
ref_traits<Name>::data_type, Name> \
f; \
f(this, refs_, object, &entry, &object_data); \
/* NOLINTNEXTLINE(readability/braces) */ \
} else
HEAP_BROKER_OBJECT_LIST(CREATE_DATA)
#undef CREATE_DATA
......@@ -2316,7 +1949,7 @@ ObjectData* JSHeapBroker::TryGetOrCreateData(Handle<Object> object,
return object_data;
}
#define DEFINE_IS_AND_AS(Name, ...) \
#define DEFINE_IS_AND_AS(Name) \
bool ObjectRef::Is##Name() const { return data()->Is##Name(); } \
Name##Ref ObjectRef::As##Name() const { \
DCHECK(Is##Name()); \
......@@ -3556,7 +3189,7 @@ Handle<Object> ObjectRef::object() const {
}
#ifdef DEBUG
#define DEF_OBJECT_GETTER(T, ...) \
#define DEF_OBJECT_GETTER(T) \
Handle<T> T##Ref::object() const { \
if (broker()->mode() == JSHeapBroker::kSerialized && \
data_->used_status == ObjectData::Usage::kUnused) { \
......@@ -3565,7 +3198,7 @@ Handle<Object> ObjectRef::object() const {
return Handle<T>(reinterpret_cast<Address*>(data_->object().address())); \
}
#else
#define DEF_OBJECT_GETTER(T, ...) \
#define DEF_OBJECT_GETTER(T) \
Handle<T> T##Ref::object() const { \
return Handle<T>(reinterpret_cast<Address*>(data_->object().address())); \
}
......
......@@ -75,8 +75,7 @@ enum class OddballType : uint8_t {
};
enum class RefSerializationKind {
// Will skip serialization when --concurrent-inlining is on. Otherwise, they
// might get serialized. (The cake is a lie.)
// Skips serialization.
kNeverSerialized,
// Can be serialized on demand from the background thread.
kBackgroundSerialized,
......@@ -84,60 +83,65 @@ enum class RefSerializationKind {
// This list is sorted such that subtypes appear before their supertypes.
// DO NOT VIOLATE THIS PROPERTY!
#define HEAP_BROKER_OBJECT_LIST(V) \
/* Subtypes of JSObject */ \
V(JSArray, RefSerializationKind::kBackgroundSerialized) \
V(JSBoundFunction, RefSerializationKind::kBackgroundSerialized) \
V(JSDataView, RefSerializationKind::kBackgroundSerialized) \
V(JSFunction, RefSerializationKind::kBackgroundSerialized) \
V(JSGlobalObject, RefSerializationKind::kBackgroundSerialized) \
V(JSGlobalProxy, RefSerializationKind::kBackgroundSerialized) \
V(JSTypedArray, RefSerializationKind::kBackgroundSerialized) \
/* Subtypes of Context */ \
V(NativeContext, RefSerializationKind::kNeverSerialized) \
/* Subtypes of FixedArray */ \
V(ObjectBoilerplateDescription, RefSerializationKind::kNeverSerialized) \
V(ScriptContextTable, RefSerializationKind::kBackgroundSerialized) \
/* Subtypes of String */ \
V(InternalizedString, RefSerializationKind::kNeverSerialized) \
/* Subtypes of FixedArrayBase */ \
V(BytecodeArray, RefSerializationKind::kNeverSerialized) \
V(FixedArray, RefSerializationKind::kBackgroundSerialized) \
V(FixedDoubleArray, RefSerializationKind::kNeverSerialized) \
/* Subtypes of Name */ \
V(String, RefSerializationKind::kNeverSerialized) \
V(Symbol, RefSerializationKind::kNeverSerialized) \
/* Subtypes of JSReceiver */ \
V(JSObject, RefSerializationKind::kBackgroundSerialized) \
/* Subtypes of HeapObject */ \
V(AccessorInfo, RefSerializationKind::kNeverSerialized) \
V(AllocationSite, RefSerializationKind::kNeverSerialized) \
V(ArrayBoilerplateDescription, RefSerializationKind::kNeverSerialized) \
V(BigInt, RefSerializationKind::kBackgroundSerialized) \
V(CallHandlerInfo, RefSerializationKind::kNeverSerialized) \
V(Cell, RefSerializationKind::kNeverSerialized) \
V(Code, RefSerializationKind::kNeverSerialized) \
V(CodeDataContainer, RefSerializationKind::kNeverSerialized) \
V(Context, RefSerializationKind::kNeverSerialized) \
V(DescriptorArray, RefSerializationKind::kNeverSerialized) \
V(FeedbackCell, RefSerializationKind::kNeverSerialized) \
V(FeedbackVector, RefSerializationKind::kNeverSerialized) \
V(FixedArrayBase, RefSerializationKind::kBackgroundSerialized) \
V(FunctionTemplateInfo, RefSerializationKind::kNeverSerialized) \
V(HeapNumber, RefSerializationKind::kNeverSerialized) \
V(JSReceiver, RefSerializationKind::kBackgroundSerialized) \
V(Map, RefSerializationKind::kBackgroundSerialized) \
V(Name, RefSerializationKind::kNeverSerialized) \
V(PropertyCell, RefSerializationKind::kBackgroundSerialized) \
V(RegExpBoilerplateDescription, RefSerializationKind::kNeverSerialized) \
V(ScopeInfo, RefSerializationKind::kNeverSerialized) \
V(SharedFunctionInfo, RefSerializationKind::kNeverSerialized) \
V(SourceTextModule, RefSerializationKind::kNeverSerialized) \
V(TemplateObjectDescription, RefSerializationKind::kNeverSerialized) \
/* Subtypes of Object */ \
V(HeapObject, RefSerializationKind::kBackgroundSerialized)
#define FORWARD_DECL(Name, ...) class Name##Ref;
#define HEAP_BROKER_OBJECT_LIST_BASE(BACKGROUND_SERIALIZED, NEVER_SERIALIZED) \
/* Subtypes of JSObject */ \
BACKGROUND_SERIALIZED(JSArray) \
BACKGROUND_SERIALIZED(JSBoundFunction) \
BACKGROUND_SERIALIZED(JSDataView) \
BACKGROUND_SERIALIZED(JSFunction) \
BACKGROUND_SERIALIZED(JSGlobalObject) \
BACKGROUND_SERIALIZED(JSGlobalProxy) \
BACKGROUND_SERIALIZED(JSTypedArray) \
/* Subtypes of Context */ \
NEVER_SERIALIZED(NativeContext) \
/* Subtypes of FixedArray */ \
NEVER_SERIALIZED(ObjectBoilerplateDescription) \
BACKGROUND_SERIALIZED(ScriptContextTable) \
/* Subtypes of String */ \
NEVER_SERIALIZED(InternalizedString) \
/* Subtypes of FixedArrayBase */ \
NEVER_SERIALIZED(BytecodeArray) \
BACKGROUND_SERIALIZED(FixedArray) \
NEVER_SERIALIZED(FixedDoubleArray) \
/* Subtypes of Name */ \
NEVER_SERIALIZED(String) \
NEVER_SERIALIZED(Symbol) \
/* Subtypes of JSReceiver */ \
BACKGROUND_SERIALIZED(JSObject) \
/* Subtypes of HeapObject */ \
NEVER_SERIALIZED(AccessorInfo) \
NEVER_SERIALIZED(AllocationSite) \
NEVER_SERIALIZED(ArrayBoilerplateDescription) \
BACKGROUND_SERIALIZED(BigInt) \
NEVER_SERIALIZED(CallHandlerInfo) \
NEVER_SERIALIZED(Cell) \
NEVER_SERIALIZED(Code) \
NEVER_SERIALIZED(CodeDataContainer) \
NEVER_SERIALIZED(Context) \
NEVER_SERIALIZED(DescriptorArray) \
NEVER_SERIALIZED(FeedbackCell) \
NEVER_SERIALIZED(FeedbackVector) \
BACKGROUND_SERIALIZED(FixedArrayBase) \
NEVER_SERIALIZED(FunctionTemplateInfo) \
NEVER_SERIALIZED(HeapNumber) \
BACKGROUND_SERIALIZED(JSReceiver) \
BACKGROUND_SERIALIZED(Map) \
NEVER_SERIALIZED(Name) \
BACKGROUND_SERIALIZED(PropertyCell) \
NEVER_SERIALIZED(RegExpBoilerplateDescription) \
NEVER_SERIALIZED(ScopeInfo) \
NEVER_SERIALIZED(SharedFunctionInfo) \
NEVER_SERIALIZED(SourceTextModule) \
NEVER_SERIALIZED(TemplateObjectDescription) \
/* Subtypes of Object */ \
BACKGROUND_SERIALIZED(HeapObject)
#define HEAP_BROKER_OBJECT_LIST(V) HEAP_BROKER_OBJECT_LIST_BASE(V, V)
#define IGNORE_CASE(...)
#define HEAP_BROKER_BACKGROUND_SERIALIZED_OBJECT_LIST(V) \
HEAP_BROKER_OBJECT_LIST_BASE(V, IGNORE_CASE)
#define FORWARD_DECL(Name) class Name##Ref;
HEAP_BROKER_OBJECT_LIST(FORWARD_DECL)
#undef FORWARD_DECL
......@@ -146,14 +150,32 @@ class ObjectRef;
template <class T>
struct ref_traits;
#define REF_TRAITS(Name, Kind) \
template <> \
struct ref_traits<Name> { \
using ref_type = Name##Ref; \
static constexpr RefSerializationKind ref_serialization_kind = Kind; \
#define FORWARD_DECL(Name) class Name##Data;
HEAP_BROKER_BACKGROUND_SERIALIZED_OBJECT_LIST(FORWARD_DECL)
#undef FORWARD_DECL
#define BACKGROUND_SERIALIZED_REF_TRAITS(Name) \
template <> \
struct ref_traits<Name> { \
using ref_type = Name##Ref; \
using data_type = Name##Data; \
static constexpr RefSerializationKind ref_serialization_kind = \
RefSerializationKind::kBackgroundSerialized; \
};
HEAP_BROKER_OBJECT_LIST(REF_TRAITS)
#undef REF_TYPE
#define NEVER_SERIALIZED_REF_TRAITS(Name) \
template <> \
struct ref_traits<Name> { \
using ref_type = Name##Ref; \
using data_type = ObjectData; \
static constexpr RefSerializationKind ref_serialization_kind = \
RefSerializationKind::kNeverSerialized; \
};
HEAP_BROKER_OBJECT_LIST_BASE(BACKGROUND_SERIALIZED_REF_TRAITS,
NEVER_SERIALIZED_REF_TRAITS)
#undef NEVER_SERIALIZED_REF_TRAITS
#undef BACKGROUND_SERIALIZED_REF_TRAITS
template <>
struct ref_traits<Object> {
......@@ -179,11 +201,11 @@ class V8_EXPORT_PRIVATE ObjectRef {
bool IsSmi() const;
int AsSmi() const;
#define HEAP_IS_METHOD_DECL(Name, ...) bool Is##Name() const;
#define HEAP_IS_METHOD_DECL(Name) bool Is##Name() const;
HEAP_BROKER_OBJECT_LIST(HEAP_IS_METHOD_DECL)
#undef HEAP_IS_METHOD_DECL
#define HEAP_AS_METHOD_DECL(Name, ...) Name##Ref As##Name() const;
#define HEAP_AS_METHOD_DECL(Name) Name##Ref As##Name() const;
HEAP_BROKER_OBJECT_LIST(HEAP_AS_METHOD_DECL)
#undef HEAP_AS_METHOD_DECL
......
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