| Index: src/builtins/builtins-promise.cc
|
| diff --git a/src/builtins/builtins-promise.cc b/src/builtins/builtins-promise.cc
|
| index 88730bf43629a45e94f779980e41d34574dea52e..edc359dcd7d9a0945c27978298f219ba1d74a367 100644
|
| --- a/src/builtins/builtins-promise.cc
|
| +++ b/src/builtins/builtins-promise.cc
|
| @@ -16,10 +16,25 @@ typedef compiler::Node Node;
|
| typedef CodeStubAssembler::ParameterMode ParameterMode;
|
| typedef compiler::CodeAssemblerState CodeAssemblerState;
|
|
|
| -Node* PromiseBuiltinsAssembler::AllocateAndInitPromise(Node* context,
|
| - Node* parent) {
|
| - Node* const instance = AllocateJSPromise(context);
|
| - PromiseInit(instance);
|
| +Node* PromiseBuiltinsAssembler::AllocateAndInitJSPromise(Node* context,
|
| + Node* parent) {
|
| + Node* const instance = CodeStubAssembler::AllocateAndInitJSPromise(context);
|
| +
|
| + Label out(this);
|
| + GotoUnless(IsPromiseHookEnabled(), &out);
|
| + CallRuntime(Runtime::kPromiseHookInit, context, instance, parent);
|
| + Goto(&out);
|
| +
|
| + Bind(&out);
|
| + return instance;
|
| +}
|
| +
|
| +Node* PromiseBuiltinsAssembler::AllocateAndSetJSPromise(Node* context,
|
| + Node* status,
|
| + Node* result,
|
| + Node* parent) {
|
| + Node* const instance =
|
| + CodeStubAssembler::AllocateAndSetJSPromise(context, status, result);
|
|
|
| Label out(this);
|
| GotoUnless(IsPromiseHookEnabled(), &out);
|
| @@ -224,7 +239,7 @@ Node* PromiseBuiltinsAssembler::InternalPromiseThen(Node* context,
|
|
|
| Bind(&fast_promise_capability);
|
| {
|
| - Node* const deferred_promise = AllocateAndInitPromise(context, promise);
|
| + Node* const deferred_promise = AllocateAndInitJSPromise(context, promise);
|
| var_deferred_promise.Bind(deferred_promise);
|
| var_deferred_on_resolve.Bind(UndefinedConstant());
|
| var_deferred_on_reject.Bind(UndefinedConstant());
|
| @@ -724,7 +739,7 @@ TF_BUILTIN(PromiseConstructor, PromiseBuiltinsAssembler) {
|
| Node* const is_debug_active = IsDebugActive();
|
| Label if_targetisnotmodified(this),
|
| if_targetismodified(this, Label::kDeferred), run_executor(this),
|
| - debug_push(this), init(this);
|
| + debug_push(this);
|
|
|
| Branch(WordEqual(promise_fun, new_target), &if_targetisnotmodified,
|
| &if_targetismodified);
|
| @@ -735,9 +750,10 @@ TF_BUILTIN(PromiseConstructor, PromiseBuiltinsAssembler) {
|
|
|
| Bind(&if_targetisnotmodified);
|
| {
|
| - Node* const instance = AllocateJSPromise(context);
|
| + Node* const instance =
|
| + AllocateAndInitJSPromise(context, UndefinedConstant());
|
| var_result.Bind(instance);
|
| - Goto(&init);
|
| + Goto(&debug_push);
|
| }
|
|
|
| Bind(&if_targetismodified);
|
| @@ -745,16 +761,11 @@ TF_BUILTIN(PromiseConstructor, PromiseBuiltinsAssembler) {
|
| Callable fast_new_object_stub = CodeFactory::FastNewObject(isolate);
|
| Node* const instance =
|
| CallStub(fast_new_object_stub, context, promise_fun, new_target);
|
| -
|
| + JSPromiseInit(instance);
|
| var_result.Bind(instance);
|
| - Goto(&init);
|
| - }
|
|
|
| - Bind(&init);
|
| - {
|
| - PromiseInit(var_result.value());
|
| GotoUnless(IsPromiseHookEnabled(), &debug_push);
|
| - CallRuntime(Runtime::kPromiseHookInit, context, var_result.value(),
|
| + CallRuntime(Runtime::kPromiseHookInit, context, instance,
|
| UndefinedConstant());
|
| Goto(&debug_push);
|
| }
|
| @@ -819,7 +830,7 @@ TF_BUILTIN(PromiseConstructor, PromiseBuiltinsAssembler) {
|
| TF_BUILTIN(PromiseInternalConstructor, PromiseBuiltinsAssembler) {
|
| Node* const parent = Parameter(1);
|
| Node* const context = Parameter(4);
|
| - Return(AllocateAndInitPromise(context, parent));
|
| + Return(AllocateAndInitJSPromise(context, parent));
|
| }
|
|
|
| TF_BUILTIN(PromiseCreateAndSet, PromiseBuiltinsAssembler) {
|
| @@ -827,15 +838,8 @@ TF_BUILTIN(PromiseCreateAndSet, PromiseBuiltinsAssembler) {
|
| Node* const result = Parameter(2);
|
| Node* const context = Parameter(5);
|
|
|
| - Node* const instance = AllocateJSPromise(context);
|
| - PromiseSet(instance, status, result);
|
| -
|
| - Label out(this);
|
| - GotoUnless(IsPromiseHookEnabled(), &out);
|
| - CallRuntime(Runtime::kPromiseHookInit, context, instance,
|
| - UndefinedConstant());
|
| - Goto(&out);
|
| - Bind(&out);
|
| + Node* const instance =
|
| + AllocateAndSetJSPromise(context, status, result, UndefinedConstant());
|
| Return(instance);
|
| }
|
|
|
|
|