Commit b4aadaec authored by gsathya's avatar gsathya Committed by Commit bot

[promisehook] Store promise in PromiseReactionJob

This will be used in PromiseHook.

BUG=v8:4643

Review-Url: https://codereview.chromium.org/2581503003
Cr-Commit-Position: refs/heads/master@{#41730}
parent 80b8a3c1
...@@ -1925,7 +1925,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, ...@@ -1925,7 +1925,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
{ // Internal: PromiseHandle { // Internal: PromiseHandle
Handle<JSFunction> function = SimpleCreateFunction( Handle<JSFunction> function = SimpleCreateFunction(
isolate, factory->empty_string(), Builtins::kPromiseHandle, 3, true); isolate, factory->empty_string(), Builtins::kPromiseHandle, 4, true);
InstallWithIntrinsicDefaultProto(isolate, function, InstallWithIntrinsicDefaultProto(isolate, function,
Context::PROMISE_HANDLE_INDEX); Context::PROMISE_HANDLE_INDEX);
// Set up catch prediction // Set up catch prediction
......
...@@ -500,8 +500,8 @@ compiler::Node* InternalPerformPromiseThen(CodeStubAssembler* a, ...@@ -500,8 +500,8 @@ compiler::Node* InternalPerformPromiseThen(CodeStubAssembler* a,
&reject); &reject);
// TODO(gsathya): Move this to TF. // TODO(gsathya): Move this to TF.
a->CallRuntime(Runtime::kEnqueuePromiseReactionJob, context, result, a->CallRuntime(Runtime::kEnqueuePromiseReactionJob, context, promise,
var_on_resolve.value(), deferred, result, var_on_resolve.value(), deferred,
a->SmiConstant(kPromiseFulfilled)); a->SmiConstant(kPromiseFulfilled));
a->Goto(&out); a->Goto(&out);
...@@ -517,8 +517,8 @@ compiler::Node* InternalPerformPromiseThen(CodeStubAssembler* a, ...@@ -517,8 +517,8 @@ compiler::Node* InternalPerformPromiseThen(CodeStubAssembler* a,
a->Bind(&enqueue); a->Bind(&enqueue);
{ {
a->CallRuntime(Runtime::kEnqueuePromiseReactionJob, context, result, a->CallRuntime(Runtime::kEnqueuePromiseReactionJob, context, promise,
var_on_reject.value(), deferred, result, var_on_reject.value(), deferred,
a->SmiConstant(kPromiseRejected)); a->SmiConstant(kPromiseRejected));
a->Goto(&out); a->Goto(&out);
...@@ -909,17 +909,17 @@ void Builtins::Generate_PromiseHandle(compiler::CodeAssemblerState* state) { ...@@ -909,17 +909,17 @@ void Builtins::Generate_PromiseHandle(compiler::CodeAssemblerState* state) {
typedef CodeStubAssembler::Label Label; typedef CodeStubAssembler::Label Label;
typedef CodeStubAssembler::Variable Variable; typedef CodeStubAssembler::Variable Variable;
Node* const value = a.Parameter(1); Node* const value = a.Parameter(2);
Node* const handler = a.Parameter(2); Node* const handler = a.Parameter(3);
Node* const deferred = a.Parameter(3); Node* const deferred = a.Parameter(4);
Node* const context = a.Parameter(6); Node* const context = a.Parameter(7);
Isolate* isolate = a.isolate(); Isolate* isolate = a.isolate();
// Get promise from deferred // Get promise from deferred
// TODO(gsathya): Remove this lookup by getting rid of the deferred object. // TODO(gsathya): Remove this lookup by getting rid of the deferred object.
Callable getproperty_callable = CodeFactory::GetProperty(isolate); Callable getproperty_callable = CodeFactory::GetProperty(isolate);
Node* const key = a.HeapConstant(isolate->factory()->promise_string()); Node* const key = a.HeapConstant(isolate->factory()->promise_string());
Node* const promise = Node* const deferred_promise =
a.CallStub(getproperty_callable, context, deferred, key); a.CallStub(getproperty_callable, context, deferred, key);
Variable var_reason(&a, MachineRepresentation::kTagged); Variable var_reason(&a, MachineRepresentation::kTagged);
...@@ -931,7 +931,7 @@ void Builtins::Generate_PromiseHandle(compiler::CodeAssemblerState* state) { ...@@ -931,7 +931,7 @@ void Builtins::Generate_PromiseHandle(compiler::CodeAssemblerState* state) {
a.Bind(&debug_push); a.Bind(&debug_push);
{ {
a.CallRuntime(Runtime::kDebugPushPromise, context, promise); a.CallRuntime(Runtime::kDebugPushPromise, context, deferred_promise);
a.Goto(&run_handler); a.Goto(&run_handler);
} }
...@@ -953,7 +953,7 @@ void Builtins::Generate_PromiseHandle(compiler::CodeAssemblerState* state) { ...@@ -953,7 +953,7 @@ void Builtins::Generate_PromiseHandle(compiler::CodeAssemblerState* state) {
a.Branch(a.IsUndefined(on_resolve), &if_internalhandler, &if_customhandler); a.Branch(a.IsUndefined(on_resolve), &if_internalhandler, &if_customhandler);
a.Bind(&if_internalhandler); a.Bind(&if_internalhandler);
InternalResolvePromise(&a, context, promise, result, &debug_pop); InternalResolvePromise(&a, context, deferred_promise, result, &debug_pop);
a.Bind(&if_customhandler); a.Bind(&if_customhandler);
{ {
...@@ -972,7 +972,7 @@ void Builtins::Generate_PromiseHandle(compiler::CodeAssemblerState* state) { ...@@ -972,7 +972,7 @@ void Builtins::Generate_PromiseHandle(compiler::CodeAssemblerState* state) {
a.CallStub(getproperty_callable, context, deferred, key); a.CallStub(getproperty_callable, context, deferred, key);
Callable promise_handle_reject = CodeFactory::PromiseHandleReject(isolate); Callable promise_handle_reject = CodeFactory::PromiseHandleReject(isolate);
a.CallStub(promise_handle_reject, context, promise, on_reject, a.CallStub(promise_handle_reject, context, deferred_promise, on_reject,
var_reason.value()); var_reason.value());
a.Goto(&debug_pop); a.Goto(&debug_pop);
} }
......
...@@ -576,7 +576,7 @@ namespace internal { ...@@ -576,7 +576,7 @@ namespace internal {
TFJ(PerformPromiseThen, 4) \ TFJ(PerformPromiseThen, 4) \
TFJ(ResolvePromise, 2) \ TFJ(ResolvePromise, 2) \
TFS(PromiseHandleReject, BUILTIN, kNoExtraICState, PromiseHandleReject) \ TFS(PromiseHandleReject, BUILTIN, kNoExtraICState, PromiseHandleReject) \
TFJ(PromiseHandle, 3) \ TFJ(PromiseHandle, 4) \
\ \
/* Proxy */ \ /* Proxy */ \
CPP(ProxyConstructor) \ CPP(ProxyConstructor) \
......
...@@ -8273,12 +8273,12 @@ void CodeStubAssembler::PromiseSet(Node* promise, Node* status, Node* result) { ...@@ -8273,12 +8273,12 @@ void CodeStubAssembler::PromiseSet(Node* promise, Node* status, Node* result) {
StoreObjectField(promise, JSPromise::kFlagsOffset, SmiConstant(0)); StoreObjectField(promise, JSPromise::kFlagsOffset, SmiConstant(0));
} }
Node* CodeStubAssembler::AllocatePromiseReactionJobInfo(Node* value, Node* CodeStubAssembler::AllocatePromiseReactionJobInfo(
Node* tasks, Node* value, Node* promise, Node* tasks, Node* deferred, Node* context) {
Node* deferred,
Node* context) {
Node* const result = Allocate(PromiseReactionJobInfo::kSize); Node* const result = Allocate(PromiseReactionJobInfo::kSize);
StoreMapNoWriteBarrier(result, Heap::kPromiseReactionJobInfoMapRootIndex); StoreMapNoWriteBarrier(result, Heap::kPromiseReactionJobInfoMapRootIndex);
StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kPromiseOffset,
promise);
StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kValueOffset, StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kValueOffset,
value); value);
StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kTasksOffset, StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kTasksOffset,
......
...@@ -1096,8 +1096,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { ...@@ -1096,8 +1096,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
// provides a helper for certain init patterns. // provides a helper for certain init patterns.
void PromiseSet(Node* promise, Node* status, Node* result); void PromiseSet(Node* promise, Node* status, Node* result);
Node* AllocatePromiseReactionJobInfo(Node* value, Node* tasks, Node* deferred, Node* AllocatePromiseReactionJobInfo(Node* value, Node* promise, Node* tasks,
Node* context); Node* deferred, Node* context);
protected: protected:
void DescriptorLookupLinear(Node* unique_name, Node* descriptors, Node* nof, void DescriptorLookupLinear(Node* unique_name, Node* descriptors, Node* nof,
......
...@@ -1011,11 +1011,12 @@ Handle<PromiseResolveThenableJobInfo> Factory::NewPromiseResolveThenableJobInfo( ...@@ -1011,11 +1011,12 @@ Handle<PromiseResolveThenableJobInfo> Factory::NewPromiseResolveThenableJobInfo(
} }
Handle<PromiseReactionJobInfo> Factory::NewPromiseReactionJobInfo( Handle<PromiseReactionJobInfo> Factory::NewPromiseReactionJobInfo(
Handle<Object> value, Handle<Object> tasks, Handle<Object> deferred, Handle<JSPromise> promise, Handle<Object> value, Handle<Object> tasks,
Handle<Object> debug_id, Handle<Object> debug_name, Handle<Object> deferred, Handle<Object> debug_id, Handle<Object> debug_name,
Handle<Context> context) { Handle<Context> context) {
Handle<PromiseReactionJobInfo> result = Handle<PromiseReactionJobInfo>::cast( Handle<PromiseReactionJobInfo> result = Handle<PromiseReactionJobInfo>::cast(
NewStruct(PROMISE_REACTION_JOB_INFO_TYPE)); NewStruct(PROMISE_REACTION_JOB_INFO_TYPE));
result->set_promise(*promise);
result->set_value(*value); result->set_value(*value);
result->set_tasks(*tasks); result->set_tasks(*tasks);
result->set_deferred(*deferred); result->set_deferred(*deferred);
......
...@@ -71,9 +71,9 @@ class V8_EXPORT_PRIVATE Factory final { ...@@ -71,9 +71,9 @@ class V8_EXPORT_PRIVATE Factory final {
// Create a new PromiseReactionJobInfo struct. // Create a new PromiseReactionJobInfo struct.
Handle<PromiseReactionJobInfo> NewPromiseReactionJobInfo( Handle<PromiseReactionJobInfo> NewPromiseReactionJobInfo(
Handle<Object> value, Handle<Object> tasks, Handle<Object> deferred, Handle<JSPromise> promise, Handle<Object> value, Handle<Object> tasks,
Handle<Object> debug_id, Handle<Object> debug_name, Handle<Object> deferred, Handle<Object> debug_id,
Handle<Context> context); Handle<Object> debug_name, Handle<Context> context);
// Create a new PromiseResolveThenableJobInfo struct. // Create a new PromiseResolveThenableJobInfo struct.
Handle<PromiseResolveThenableJobInfo> NewPromiseResolveThenableJobInfo( Handle<PromiseResolveThenableJobInfo> NewPromiseResolveThenableJobInfo(
......
...@@ -3227,6 +3227,7 @@ void Isolate::PromiseReactionJob(Handle<PromiseReactionJobInfo> info, ...@@ -3227,6 +3227,7 @@ void Isolate::PromiseReactionJob(Handle<PromiseReactionJobInfo> info,
MaybeHandle<Object>* maybe_exception) { MaybeHandle<Object>* maybe_exception) {
PromiseDebugEventScope helper(this, info->debug_id(), info->debug_name()); PromiseDebugEventScope helper(this, info->debug_id(), info->debug_name());
Handle<JSPromise> promise(info->promise(), this);
Handle<Object> value(info->value(), this); Handle<Object> value(info->value(), this);
Handle<Object> tasks(info->tasks(), this); Handle<Object> tasks(info->tasks(), this);
Handle<JSFunction> promise_handle_fn = promise_handle(); Handle<JSFunction> promise_handle_fn = promise_handle();
...@@ -3238,7 +3239,7 @@ void Isolate::PromiseReactionJob(Handle<PromiseReactionJobInfo> info, ...@@ -3238,7 +3239,7 @@ void Isolate::PromiseReactionJob(Handle<PromiseReactionJobInfo> info,
Handle<FixedArray> deferred_arr = Handle<FixedArray>::cast(deferred); Handle<FixedArray> deferred_arr = Handle<FixedArray>::cast(deferred);
Handle<FixedArray> tasks_arr = Handle<FixedArray>::cast(tasks); Handle<FixedArray> tasks_arr = Handle<FixedArray>::cast(tasks);
for (int i = 0; i < deferred_arr->length(); i++) { for (int i = 0; i < deferred_arr->length(); i++) {
Handle<Object> argv[] = {value, handle(tasks_arr->get(i), this), Handle<Object> argv[] = {promise, value, handle(tasks_arr->get(i), this),
handle(deferred_arr->get(i), this)}; handle(deferred_arr->get(i), this)};
*result = Execution::TryCall(this, promise_handle_fn, undefined, *result = Execution::TryCall(this, promise_handle_fn, undefined,
arraysize(argv), argv, maybe_exception); arraysize(argv), argv, maybe_exception);
...@@ -3248,7 +3249,7 @@ void Isolate::PromiseReactionJob(Handle<PromiseReactionJobInfo> info, ...@@ -3248,7 +3249,7 @@ void Isolate::PromiseReactionJob(Handle<PromiseReactionJobInfo> info,
} }
} }
} else { } else {
Handle<Object> argv[] = {value, tasks, deferred}; Handle<Object> argv[] = {promise, value, tasks, deferred};
*result = Execution::TryCall(this, promise_handle_fn, undefined, *result = Execution::TryCall(this, promise_handle_fn, undefined,
arraysize(argv), argv, maybe_exception); arraysize(argv), argv, maybe_exception);
} }
......
...@@ -1025,6 +1025,7 @@ void PromiseResolveThenableJobInfo::PromiseResolveThenableJobInfoVerify() { ...@@ -1025,6 +1025,7 @@ void PromiseResolveThenableJobInfo::PromiseResolveThenableJobInfoVerify() {
void PromiseReactionJobInfo::PromiseReactionJobInfoVerify() { void PromiseReactionJobInfo::PromiseReactionJobInfoVerify() {
Isolate* isolate = GetIsolate(); Isolate* isolate = GetIsolate();
CHECK(IsPromiseReactionJobInfo()); CHECK(IsPromiseReactionJobInfo());
CHECK(promise()->IsJSPromise());
CHECK(value()->IsObject()); CHECK(value()->IsObject());
CHECK(tasks()->IsFixedArray() || tasks()->IsCallable()); CHECK(tasks()->IsFixedArray() || tasks()->IsCallable());
CHECK(deferred()->IsFixedArray() || deferred()->IsJSObject()); CHECK(deferred()->IsFixedArray() || deferred()->IsJSObject());
......
...@@ -5746,6 +5746,7 @@ ACCESSORS(PromiseResolveThenableJobInfo, debug_id, Object, kDebugIdOffset) ...@@ -5746,6 +5746,7 @@ ACCESSORS(PromiseResolveThenableJobInfo, debug_id, Object, kDebugIdOffset)
ACCESSORS(PromiseResolveThenableJobInfo, debug_name, Object, kDebugNameOffset) ACCESSORS(PromiseResolveThenableJobInfo, debug_name, Object, kDebugNameOffset)
ACCESSORS(PromiseResolveThenableJobInfo, context, Context, kContextOffset); ACCESSORS(PromiseResolveThenableJobInfo, context, Context, kContextOffset);
ACCESSORS(PromiseReactionJobInfo, promise, JSPromise, kPromiseOffset);
ACCESSORS(PromiseReactionJobInfo, value, Object, kValueOffset); ACCESSORS(PromiseReactionJobInfo, value, Object, kValueOffset);
ACCESSORS(PromiseReactionJobInfo, tasks, Object, kTasksOffset); ACCESSORS(PromiseReactionJobInfo, tasks, Object, kTasksOffset);
ACCESSORS(PromiseReactionJobInfo, deferred, Object, kDeferredOffset); ACCESSORS(PromiseReactionJobInfo, deferred, Object, kDeferredOffset);
......
...@@ -1242,6 +1242,7 @@ void PromiseResolveThenableJobInfo::PromiseResolveThenableJobInfoPrint( ...@@ -1242,6 +1242,7 @@ void PromiseResolveThenableJobInfo::PromiseResolveThenableJobInfoPrint(
void PromiseReactionJobInfo::PromiseReactionJobInfoPrint( void PromiseReactionJobInfo::PromiseReactionJobInfoPrint(
std::ostream& os) { // NOLINT std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "PromiseReactionJobInfo"); HeapObject::PrintHeader(os, "PromiseReactionJobInfo");
os << "\n - promise: " << Brief(promise());
os << "\n - value: " << Brief(value()); os << "\n - value: " << Brief(value());
os << "\n - tasks: " << Brief(tasks()); os << "\n - tasks: " << Brief(tasks());
os << "\n - deferred: " << Brief(deferred()); os << "\n - deferred: " << Brief(deferred());
......
...@@ -6893,9 +6893,12 @@ class PromiseResolveThenableJobInfo : public Struct { ...@@ -6893,9 +6893,12 @@ class PromiseResolveThenableJobInfo : public Struct {
DISALLOW_IMPLICIT_CONSTRUCTORS(PromiseResolveThenableJobInfo); DISALLOW_IMPLICIT_CONSTRUCTORS(PromiseResolveThenableJobInfo);
}; };
class JSPromise;
// Struct to hold state required for PromiseReactionJob. // Struct to hold state required for PromiseReactionJob.
class PromiseReactionJobInfo : public Struct { class PromiseReactionJobInfo : public Struct {
public: public:
DECL_ACCESSORS(promise, JSPromise)
DECL_ACCESSORS(value, Object) DECL_ACCESSORS(value, Object)
DECL_ACCESSORS(tasks, Object) DECL_ACCESSORS(tasks, Object)
DECL_ACCESSORS(deferred, Object) DECL_ACCESSORS(deferred, Object)
...@@ -6903,7 +6906,8 @@ class PromiseReactionJobInfo : public Struct { ...@@ -6903,7 +6906,8 @@ class PromiseReactionJobInfo : public Struct {
DECL_ACCESSORS(debug_name, Object) DECL_ACCESSORS(debug_name, Object)
DECL_ACCESSORS(context, Context) DECL_ACCESSORS(context, Context)
static const int kValueOffset = Struct::kHeaderSize; static const int kPromiseOffset = Struct::kHeaderSize;
static const int kValueOffset = kPromiseOffset + kPointerSize;
static const int kTasksOffset = kValueOffset + kPointerSize; static const int kTasksOffset = kValueOffset + kPointerSize;
static const int kDeferredOffset = kTasksOffset + kPointerSize; static const int kDeferredOffset = kTasksOffset + kPointerSize;
static const int kDebugIdOffset = kDeferredOffset + kPointerSize; static const int kDebugIdOffset = kDeferredOffset + kPointerSize;
......
...@@ -57,9 +57,9 @@ RUNTIME_FUNCTION(Runtime_PromiseRevokeReject) { ...@@ -57,9 +57,9 @@ RUNTIME_FUNCTION(Runtime_PromiseRevokeReject) {
} }
namespace { namespace {
void EnqueuePromiseReactionJob(Isolate* isolate, Handle<Object> value, void EnqueuePromiseReactionJob(Isolate* isolate, Handle<JSPromise> promise,
Handle<Object> tasks, Handle<Object> deferred, Handle<Object> value, Handle<Object> tasks,
Handle<Object> status) { Handle<Object> deferred, Handle<Object> status) {
Handle<Object> debug_id = isolate->factory()->undefined_value(); Handle<Object> debug_id = isolate->factory()->undefined_value();
Handle<Object> debug_name = isolate->factory()->undefined_value(); Handle<Object> debug_name = isolate->factory()->undefined_value();
if (isolate->debug()->is_active()) { if (isolate->debug()->is_active()) {
...@@ -87,8 +87,8 @@ void EnqueuePromiseReactionJob(Isolate* isolate, Handle<Object> value, ...@@ -87,8 +87,8 @@ void EnqueuePromiseReactionJob(Isolate* isolate, Handle<Object> value,
} }
} }
Handle<PromiseReactionJobInfo> info = Handle<PromiseReactionJobInfo> info =
isolate->factory()->NewPromiseReactionJobInfo(value, tasks, deferred, isolate->factory()->NewPromiseReactionJobInfo(
debug_id, debug_name, promise, value, tasks, deferred, debug_id, debug_name,
isolate->native_context()); isolate->native_context());
isolate->EnqueueMicrotask(info); isolate->EnqueueMicrotask(info);
} }
...@@ -111,7 +111,7 @@ void PromiseFulfill(Isolate* isolate, Handle<JSPromise> promise, ...@@ -111,7 +111,7 @@ void PromiseFulfill(Isolate* isolate, Handle<JSPromise> promise,
: promise->reject_reactions(), : promise->reject_reactions(),
isolate); isolate);
Handle<Object> deferred(promise->deferred(), isolate); Handle<Object> deferred(promise->deferred(), isolate);
EnqueuePromiseReactionJob(isolate, value, tasks, deferred, status); EnqueuePromiseReactionJob(isolate, promise, value, tasks, deferred, status);
} }
PromiseSet(isolate, promise, status->value(), value); PromiseSet(isolate, promise, status->value(), value);
...@@ -145,12 +145,13 @@ RUNTIME_FUNCTION(Runtime_PromiseFulfill) { ...@@ -145,12 +145,13 @@ RUNTIME_FUNCTION(Runtime_PromiseFulfill) {
RUNTIME_FUNCTION(Runtime_EnqueuePromiseReactionJob) { RUNTIME_FUNCTION(Runtime_EnqueuePromiseReactionJob) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK(args.length() == 4); DCHECK(args.length() == 5);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, tasks, 1); CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
CONVERT_ARG_HANDLE_CHECKED(Object, deferred, 2); CONVERT_ARG_HANDLE_CHECKED(Object, tasks, 2);
CONVERT_ARG_HANDLE_CHECKED(Object, status, 3); CONVERT_ARG_HANDLE_CHECKED(Object, deferred, 3);
EnqueuePromiseReactionJob(isolate, value, tasks, deferred, status); CONVERT_ARG_HANDLE_CHECKED(Object, status, 4);
EnqueuePromiseReactionJob(isolate, promise, value, tasks, deferred, status);
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
} }
......
...@@ -1897,13 +1897,14 @@ TEST(AllocatePromiseReactionJobInfo) { ...@@ -1897,13 +1897,14 @@ TEST(AllocatePromiseReactionJobInfo) {
CodeStubAssembler m(data.state()); CodeStubAssembler m(data.state());
Node* const context = m.Parameter(kNumParams + 2); Node* const context = m.Parameter(kNumParams + 2);
Node* const promise = m.AllocateJSPromise(context);
Node* const tasks = m.AllocateFixedArray(FAST_ELEMENTS, m.IntPtrConstant(1)); Node* const tasks = m.AllocateFixedArray(FAST_ELEMENTS, m.IntPtrConstant(1));
m.StoreFixedArrayElement(tasks, 0, m.UndefinedConstant()); m.StoreFixedArrayElement(tasks, 0, m.UndefinedConstant());
Node* const deferred = Node* const deferred =
m.AllocateFixedArray(FAST_ELEMENTS, m.IntPtrConstant(1)); m.AllocateFixedArray(FAST_ELEMENTS, m.IntPtrConstant(1));
m.StoreFixedArrayElement(deferred, 0, m.UndefinedConstant()); m.StoreFixedArrayElement(deferred, 0, m.UndefinedConstant());
Node* const info = m.AllocatePromiseReactionJobInfo(m.SmiConstant(1), tasks, Node* const info = m.AllocatePromiseReactionJobInfo(m.SmiConstant(1), promise,
deferred, context); tasks, deferred, context);
m.Return(info); m.Return(info);
Handle<Code> code = data.GenerateCode(); Handle<Code> code = data.GenerateCode();
...@@ -1916,6 +1917,7 @@ TEST(AllocatePromiseReactionJobInfo) { ...@@ -1916,6 +1917,7 @@ TEST(AllocatePromiseReactionJobInfo) {
Handle<PromiseReactionJobInfo> promise_info = Handle<PromiseReactionJobInfo> promise_info =
Handle<PromiseReactionJobInfo>::cast(result); Handle<PromiseReactionJobInfo>::cast(result);
CHECK_EQ(Smi::FromInt(1), promise_info->value()); CHECK_EQ(Smi::FromInt(1), promise_info->value());
CHECK(promise_info->promise()->IsJSPromise());
CHECK(promise_info->tasks()->IsFixedArray()); CHECK(promise_info->tasks()->IsFixedArray());
CHECK(promise_info->deferred()->IsFixedArray()); CHECK(promise_info->deferred()->IsFixedArray());
CHECK(promise_info->context()->IsContext()); CHECK(promise_info->context()->IsContext());
......
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