Commit 8dfebbc3 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[objects] Turn {PromiseCapability} into a {Tuple3}.

R=gsathya@chromium.org
BUG=v8:6792

Change-Id: I68a5f9e7e52dbc9512e6919fce2064d748a3e7c4
Reviewed-on: https://chromium-review.googlesource.com/730726
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48824}
parent 3df35d81
......@@ -110,7 +110,7 @@ Node* PromiseBuiltinsAssembler::NewPromiseCapability(Node* context,
Node* native_context = LoadNativeContext(context);
Node* map = LoadRoot(Heap::kPromiseCapabilityMapRootIndex);
Node* map = LoadRoot(Heap::kTuple3MapRootIndex);
Node* capability = AllocateStruct(map);
VARIABLE(var_result, MachineRepresentation::kTagged);
......
......@@ -236,7 +236,6 @@ Type::bitset BitsetType::Lub(i::Map* map) {
case JS_WEAK_MAP_TYPE:
case JS_WEAK_SET_TYPE:
case PROMISE_CAPABILITY_TYPE:
case JS_PROMISE_TYPE:
case WASM_MODULE_TYPE:
case WASM_INSTANCE_TYPE:
......@@ -306,6 +305,7 @@ Type::bitset BitsetType::Lub(i::Map* map) {
case TUPLE3_TYPE:
case CONTEXT_EXTENSION_TYPE:
case ASYNC_GENERATOR_REQUEST_TYPE:
case UNUSED_AND_RESERVED_TYPE:
UNREACHABLE();
}
UNREACHABLE();
......
......@@ -3907,7 +3907,7 @@ Handle<Object> TranslatedState::MaterializeCapturedObjectAt(
case JS_MAP_TYPE:
case JS_WEAK_MAP_TYPE:
case JS_WEAK_SET_TYPE:
case PROMISE_CAPABILITY_TYPE:
case UNUSED_AND_RESERVED_TYPE:
case JS_PROMISE_TYPE:
case JS_PROXY_TYPE:
case MAP_TYPE:
......
......@@ -312,6 +312,8 @@ bool HeapObject::IsJSWeakCollection() const {
bool HeapObject::IsJSCollection() const { return IsJSMap() || IsJSSet(); }
bool HeapObject::IsPromiseCapability() const { return IsTuple3(); }
bool HeapObject::IsDescriptorArray() const { return IsFixedArray(); }
bool HeapObject::IsPropertyDescriptorObject() const { return IsFixedArray(); }
......
......@@ -356,7 +356,6 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
V(ALIASED_ARGUMENTS_ENTRY_TYPE) \
V(PROMISE_RESOLVE_THENABLE_JOB_INFO_TYPE) \
V(PROMISE_REACTION_JOB_INFO_TYPE) \
V(PROMISE_CAPABILITY_TYPE) \
V(DEBUG_INFO_TYPE) \
V(STACK_FRAME_INFO_TYPE) \
V(PROTOTYPE_INFO_TYPE) \
......@@ -377,6 +376,7 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
V(PROPERTY_CELL_TYPE) \
V(SMALL_ORDERED_HASH_MAP_TYPE) \
V(SMALL_ORDERED_HASH_SET_TYPE) \
V(UNUSED_AND_RESERVED_TYPE) \
\
V(JS_PROXY_TYPE) \
V(JS_GLOBAL_OBJECT_TYPE) \
......@@ -539,7 +539,6 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
promise_resolve_thenable_job_info) \
V(PROMISE_REACTION_JOB_INFO, PromiseReactionJobInfo, \
promise_reaction_job_info) \
V(PROMISE_CAPABILITY, PromiseCapability, promise_capability) \
V(DEBUG_INFO, DebugInfo, debug_info) \
V(STACK_FRAME_INFO, StackFrameInfo, stack_frame_info) \
V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) \
......@@ -709,7 +708,6 @@ enum InstanceType : uint8_t {
ALIASED_ARGUMENTS_ENTRY_TYPE,
PROMISE_RESOLVE_THENABLE_JOB_INFO_TYPE,
PROMISE_REACTION_JOB_INFO_TYPE,
PROMISE_CAPABILITY_TYPE,
DEBUG_INFO_TYPE,
STACK_FRAME_INFO_TYPE,
PROTOTYPE_INFO_TYPE,
......@@ -730,6 +728,8 @@ enum InstanceType : uint8_t {
PROPERTY_CELL_TYPE,
SMALL_ORDERED_HASH_MAP_TYPE,
SMALL_ORDERED_HASH_SET_TYPE,
// TODO(mstarzinger,v8::6792): Will be used for code data container.
UNUSED_AND_RESERVED_TYPE,
// All the following types are subtypes of JSReceiver, which corresponds to
// objects in the JS sense. The first and the last type in this range are
......@@ -1064,6 +1064,7 @@ template <class C> inline bool Is(Object* obj);
V(ObjectHashTable) \
V(Oddball) \
V(PreParsedScopeData) \
V(PromiseCapability) \
V(PropertyArray) \
V(PropertyCell) \
V(PropertyDescriptorObject) \
......@@ -3358,7 +3359,45 @@ class Struct: public HeapObject {
void BriefPrintDetails(std::ostream& os);
};
class PromiseCapability : public Struct {
class Tuple2 : public Struct {
public:
DECL_ACCESSORS(value1, Object)
DECL_ACCESSORS(value2, Object)
DECL_CAST(Tuple2)
// Dispatched behavior.
DECL_PRINTER(Tuple2)
DECL_VERIFIER(Tuple2)
void BriefPrintDetails(std::ostream& os);
static const int kValue1Offset = HeapObject::kHeaderSize;
static const int kValue2Offset = kValue1Offset + kPointerSize;
static const int kSize = kValue2Offset + kPointerSize;
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(Tuple2);
};
class Tuple3 : public Tuple2 {
public:
DECL_ACCESSORS(value3, Object)
DECL_CAST(Tuple3)
// Dispatched behavior.
DECL_PRINTER(Tuple3)
DECL_VERIFIER(Tuple3)
void BriefPrintDetails(std::ostream& os);
static const int kValue3Offset = Tuple2::kSize;
static const int kSize = kValue3Offset + kPointerSize;
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(Tuple3);
};
class PromiseCapability : public Tuple3 {
public:
DECL_CAST(PromiseCapability)
DECL_PRINTER(PromiseCapability)
......@@ -3368,10 +3407,10 @@ class PromiseCapability : public Struct {
DECL_ACCESSORS(resolve, Object)
DECL_ACCESSORS(reject, Object)
static const int kPromiseOffset = Struct::kHeaderSize;
static const int kResolveOffset = kPromiseOffset + kPointerSize;
static const int kRejectOffset = kResolveOffset + kPointerSize;
static const int kSize = kRejectOffset + kPointerSize;
static const int kPromiseOffset = Tuple3::kValue1Offset;
static const int kResolveOffset = Tuple3::kValue2Offset;
static const int kRejectOffset = Tuple3::kValue3Offset;
static const int kSize = Tuple3::kSize;
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(PromiseCapability);
......@@ -3518,44 +3557,6 @@ class PrototypeInfo : public Struct {
DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeInfo);
};
class Tuple2 : public Struct {
public:
DECL_ACCESSORS(value1, Object)
DECL_ACCESSORS(value2, Object)
DECL_CAST(Tuple2)
// Dispatched behavior.
DECL_PRINTER(Tuple2)
DECL_VERIFIER(Tuple2)
void BriefPrintDetails(std::ostream& os);
static const int kValue1Offset = HeapObject::kHeaderSize;
static const int kValue2Offset = kValue1Offset + kPointerSize;
static const int kSize = kValue2Offset + kPointerSize;
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(Tuple2);
};
class Tuple3 : public Tuple2 {
public:
DECL_ACCESSORS(value3, Object)
DECL_CAST(Tuple3)
// Dispatched behavior.
DECL_PRINTER(Tuple3)
DECL_VERIFIER(Tuple3)
void BriefPrintDetails(std::ostream& os);
static const int kValue3Offset = Tuple2::kSize;
static const int kSize = kValue3Offset + kPointerSize;
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(Tuple3);
};
// Pair used to store both a ScopeInfo and an extension object in the extension
// slot of a block, catch, or with context. Needed in the rare case where a
// declaration block scope (a "varblock" as used to desugar parameter
......
......@@ -2284,7 +2284,7 @@ TEST(CreatePromiseGetCapabilitiesExecutorContext) {
Node* const context = m.Parameter(kNumParams + 2);
Node* const native_context = m.LoadNativeContext(context);
Node* const map = m.LoadRoot(Heap::kPromiseCapabilityMapRootIndex);
Node* const map = m.LoadRoot(Heap::kTuple3MapRootIndex);
Node* const capability = m.AllocateStruct(map);
m.StoreObjectFieldNoWriteBarrier(
capability, PromiseCapability::kPromiseOffset, m.UndefinedConstant());
......@@ -2631,7 +2631,7 @@ TEST(AllocateStruct) {
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
Handle<Map> maps[] = {
handle(isolate->heap()->promise_capability_map(), isolate),
handle(isolate->heap()->tuple3_map(), isolate),
handle(isolate->heap()->tuple2_map(), isolate),
};
......
......@@ -63,27 +63,27 @@ INSTANCE_TYPES = {
159: "ALIASED_ARGUMENTS_ENTRY_TYPE",
160: "PROMISE_RESOLVE_THENABLE_JOB_INFO_TYPE",
161: "PROMISE_REACTION_JOB_INFO_TYPE",
162: "PROMISE_CAPABILITY_TYPE",
163: "DEBUG_INFO_TYPE",
164: "STACK_FRAME_INFO_TYPE",
165: "PROTOTYPE_INFO_TYPE",
166: "TUPLE2_TYPE",
167: "TUPLE3_TYPE",
168: "CONTEXT_EXTENSION_TYPE",
169: "MODULE_TYPE",
170: "MODULE_INFO_ENTRY_TYPE",
171: "ASYNC_GENERATOR_REQUEST_TYPE",
172: "FIXED_ARRAY_TYPE",
173: "HASH_TABLE_TYPE",
174: "FEEDBACK_VECTOR_TYPE",
175: "TRANSITION_ARRAY_TYPE",
176: "PROPERTY_ARRAY_TYPE",
177: "SHARED_FUNCTION_INFO_TYPE",
178: "CELL_TYPE",
179: "WEAK_CELL_TYPE",
180: "PROPERTY_CELL_TYPE",
181: "SMALL_ORDERED_HASH_MAP_TYPE",
182: "SMALL_ORDERED_HASH_SET_TYPE",
162: "DEBUG_INFO_TYPE",
163: "STACK_FRAME_INFO_TYPE",
164: "PROTOTYPE_INFO_TYPE",
165: "TUPLE2_TYPE",
166: "TUPLE3_TYPE",
167: "CONTEXT_EXTENSION_TYPE",
168: "MODULE_TYPE",
169: "MODULE_INFO_ENTRY_TYPE",
170: "ASYNC_GENERATOR_REQUEST_TYPE",
171: "FIXED_ARRAY_TYPE",
172: "HASH_TABLE_TYPE",
173: "FEEDBACK_VECTOR_TYPE",
174: "TRANSITION_ARRAY_TYPE",
175: "PROPERTY_ARRAY_TYPE",
176: "SHARED_FUNCTION_INFO_TYPE",
177: "CELL_TYPE",
178: "WEAK_CELL_TYPE",
179: "PROPERTY_CELL_TYPE",
180: "SMALL_ORDERED_HASH_MAP_TYPE",
181: "SMALL_ORDERED_HASH_SET_TYPE",
182: "UNUSED_AND_RESERVED_TYPE",
183: "JS_PROXY_TYPE",
184: "JS_GLOBAL_OBJECT_TYPE",
185: "JS_GLOBAL_PROXY_TYPE",
......@@ -164,7 +164,7 @@ KNOWN_MAPS = {
0x02201: (138, "FreeSpaceMap"),
0x02251: (132, "MetaMap"),
0x022a1: (131, "NullMap"),
0x022f1: (172, "FixedArrayMap"),
0x022f1: (171, "FixedArrayMap"),
0x02341: (149, "OnePointerFillerMap"),
0x02391: (149, "TwoPointerFillerMap"),
0x023e1: (131, "UninitializedMap"),
......@@ -174,44 +174,44 @@ KNOWN_MAPS = {
0x02521: (131, "TheHoleMap"),
0x02571: (131, "BooleanMap"),
0x025c1: (136, "ByteArrayMap"),
0x02611: (172, "FixedCOWArrayMap"),
0x02661: (173, "HashTableMap"),
0x02611: (171, "FixedCOWArrayMap"),
0x02661: (172, "HashTableMap"),
0x026b1: (128, "SymbolMap"),
0x02701: (72, "OneByteStringMap"),
0x02751: (172, "ScopeInfoMap"),
0x027a1: (177, "SharedFunctionInfoMap"),
0x02751: (171, "ScopeInfoMap"),
0x027a1: (176, "SharedFunctionInfoMap"),
0x027f1: (133, "CodeMap"),
0x02841: (172, "FunctionContextMap"),
0x02891: (178, "CellMap"),
0x028e1: (179, "WeakCellMap"),
0x02931: (180, "GlobalPropertyCellMap"),
0x02841: (171, "FunctionContextMap"),
0x02891: (177, "CellMap"),
0x028e1: (178, "WeakCellMap"),
0x02931: (179, "GlobalPropertyCellMap"),
0x02981: (135, "ForeignMap"),
0x029d1: (175, "TransitionArrayMap"),
0x029d1: (174, "TransitionArrayMap"),
0x02a21: (131, "ArgumentsMarkerMap"),
0x02a71: (131, "ExceptionMap"),
0x02ac1: (131, "TerminationExceptionMap"),
0x02b11: (131, "OptimizedOutMap"),
0x02b61: (131, "StaleRegisterMap"),
0x02bb1: (172, "NativeContextMap"),
0x02c01: (172, "ModuleContextMap"),
0x02c51: (172, "EvalContextMap"),
0x02ca1: (172, "ScriptContextMap"),
0x02cf1: (172, "BlockContextMap"),
0x02d41: (172, "CatchContextMap"),
0x02d91: (172, "WithContextMap"),
0x02bb1: (171, "NativeContextMap"),
0x02c01: (171, "ModuleContextMap"),
0x02c51: (171, "EvalContextMap"),
0x02ca1: (171, "ScriptContextMap"),
0x02cf1: (171, "BlockContextMap"),
0x02d41: (171, "CatchContextMap"),
0x02d91: (171, "WithContextMap"),
0x02de1: (148, "FixedDoubleArrayMap"),
0x02e31: (134, "MutableHeapNumberMap"),
0x02e81: (173, "OrderedHashTableMap"),
0x02ed1: (172, "SloppyArgumentsElementsMap"),
0x02f21: (181, "SmallOrderedHashMapMap"),
0x02f71: (182, "SmallOrderedHashSetMap"),
0x02e81: (172, "OrderedHashTableMap"),
0x02ed1: (171, "SloppyArgumentsElementsMap"),
0x02f21: (180, "SmallOrderedHashMapMap"),
0x02f71: (181, "SmallOrderedHashSetMap"),
0x02fc1: (189, "JSMessageObjectMap"),
0x03011: (137, "BytecodeArrayMap"),
0x03061: (172, "ModuleInfoMap"),
0x030b1: (178, "NoClosuresCellMap"),
0x03101: (178, "OneClosureCellMap"),
0x03151: (178, "ManyClosuresCellMap"),
0x031a1: (176, "PropertyArrayMap"),
0x03061: (171, "ModuleInfoMap"),
0x030b1: (177, "NoClosuresCellMap"),
0x03101: (177, "OneClosureCellMap"),
0x03151: (177, "ManyClosuresCellMap"),
0x031a1: (175, "PropertyArrayMap"),
0x031f1: (130, "BigIntMap"),
0x03241: (64, "StringMap"),
0x03291: (73, "ConsOneByteStringMap"),
......@@ -243,13 +243,13 @@ KNOWN_MAPS = {
0x03ab1: (146, "FixedFloat64ArrayMap"),
0x03b01: (147, "FixedUint8ClampedArrayMap"),
0x03b51: (158, "ScriptMap"),
0x03ba1: (174, "FeedbackVectorMap"),
0x03bf1: (172, "DebugEvaluateContextMap"),
0x03c41: (172, "ScriptContextTableMap"),
0x03c91: (173, "UnseededNumberDictionaryMap"),
0x03ba1: (173, "FeedbackVectorMap"),
0x03bf1: (171, "DebugEvaluateContextMap"),
0x03c41: (171, "ScriptContextTableMap"),
0x03c91: (172, "UnseededNumberDictionaryMap"),
0x03ce1: (192, "ExternalMap"),
0x03d31: (106, "NativeSourceStringMap"),
0x03d81: (166, "Tuple2Map"),
0x03d81: (165, "Tuple2Map"),
0x03dd1: (153, "InterceptorInfoMap"),
0x03e21: (150, "AccessorInfoMap"),
0x03e71: (151, "AccessorPairMap"),
......@@ -261,15 +261,14 @@ KNOWN_MAPS = {
0x04051: (159, "AliasedArgumentsEntryMap"),
0x040a1: (160, "PromiseResolveThenableJobInfoMap"),
0x040f1: (161, "PromiseReactionJobInfoMap"),
0x04141: (162, "PromiseCapabilityMap"),
0x04191: (163, "DebugInfoMap"),
0x041e1: (164, "StackFrameInfoMap"),
0x04231: (165, "PrototypeInfoMap"),
0x04281: (167, "Tuple3Map"),
0x042d1: (168, "ContextExtensionMap"),
0x04321: (169, "ModuleMap"),
0x04371: (170, "ModuleInfoEntryMap"),
0x043c1: (171, "AsyncGeneratorRequestMap"),
0x04141: (162, "DebugInfoMap"),
0x04191: (163, "StackFrameInfoMap"),
0x041e1: (164, "PrototypeInfoMap"),
0x04231: (166, "Tuple3Map"),
0x04281: (167, "ContextExtensionMap"),
0x042d1: (168, "ModuleMap"),
0x04321: (169, "ModuleInfoEntryMap"),
0x04371: (170, "AsyncGeneratorRequestMap"),
}
# List of known V8 objects.
......
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