Commit 4dfbe61a authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[CSA][cleanup] TNodify builtins promise gen (pt. 1)

The promise file is too big so I am splitting it in several CLs.
This is the first one.

TNodified:
 * AllocateAndInitJSPromise (three versions)
 * PerformPromiseThen
 * AllocateJSPromise

Bug: v8:6949
Change-Id: I57ae8de3f929c00a9127ea4be51ffe7703b44959
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1807370
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarDan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63849}
parent 7fcbde16
......@@ -152,7 +152,7 @@ void AsyncGeneratorBuiltinsAssembler::AsyncGeneratorEnqueue(
// presently executing, then this method will loop through, processing each
// request from front to back.
// This loop resides in AsyncGeneratorResumeNext.
Node* promise = AllocateAndInitJSPromise(context);
Node* promise = AllocateAndInitJSPromise(CAST(context));
Label enqueue(this), if_receiverisincompatible(this, Label::kDeferred);
......
......@@ -99,7 +99,7 @@ void AsyncFromSyncBuiltinsAssembler::Generate_AsyncFromSyncIteratorMethod(
const char* operation_name, Label::Type reject_label_type,
Node* const initial_exception_value) {
TNode<NativeContext> const native_context = LoadNativeContext(context);
Node* const promise = AllocateAndInitJSPromise(context);
Node* const promise = AllocateAndInitJSPromise(CAST(context));
VARIABLE(var_exception, MachineRepresentation::kTagged,
initial_exception_value == nullptr ? UndefinedConstant()
......
This diff is collapsed.
......@@ -22,15 +22,17 @@ class V8_EXPORT_PRIVATE PromiseBuiltinsAssembler : public CodeStubAssembler {
//
// This uses undefined as the parent promise for the promise init
// hook.
Node* AllocateAndInitJSPromise(Node* context);
TNode<JSPromise> AllocateAndInitJSPromise(TNode<Context> context);
// This uses the given parent as the parent promise for the promise
// init hook.
Node* AllocateAndInitJSPromise(Node* context, Node* parent);
TNode<JSPromise> AllocateAndInitJSPromise(TNode<Context> context,
TNode<Object> parent);
// This allocates and initializes a promise with the given state and
// fields.
Node* AllocateAndSetJSPromise(Node* context, v8::Promise::PromiseState status,
Node* result);
TNode<JSPromise> AllocateAndSetJSPromise(TNode<Context> context,
v8::Promise::PromiseState status,
TNode<Object> result);
Node* AllocatePromiseReaction(Node* next, Node* promise_or_capability,
Node* fulfill_handler, Node* reject_handler);
......@@ -74,9 +76,10 @@ class V8_EXPORT_PRIVATE PromiseBuiltinsAssembler : public CodeStubAssembler {
void PromiseSetHasHandler(Node* promise);
void PromiseSetHandledHint(Node* promise);
void PerformPromiseThen(Node* context, Node* promise, Node* on_fulfilled,
Node* on_rejected,
Node* result_promise_or_capability);
void PerformPromiseThen(TNode<Context> context, TNode<JSPromise> promise,
TNode<HeapObject> on_fulfilled,
TNode<HeapObject> on_rejected,
TNode<HeapObject> result_promise_or_capability);
Node* CreatePromiseContext(Node* native_context, int slots);
......@@ -161,7 +164,7 @@ class V8_EXPORT_PRIVATE PromiseBuiltinsAssembler : public CodeStubAssembler {
v8::Promise::PromiseState expected);
void PromiseSetStatus(Node* promise, v8::Promise::PromiseState status);
Node* AllocateJSPromise(Node* context);
TNode<JSPromise> AllocateJSPromise(TNode<Context> context);
void ExtractHandlerContext(Node* handler, Variable* var_context);
void Generate_PromiseAll(
......
......@@ -2320,7 +2320,7 @@ TEST(AllocateAndInitJSPromise) {
PromiseBuiltinsAssembler m(asm_tester.state());
Node* const context = m.Parameter(kNumParams + 2);
Node* const promise = m.AllocateAndInitJSPromise(context);
Node* const promise = m.AllocateAndInitJSPromise(m.CAST(context));
m.Return(promise);
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
......@@ -2338,7 +2338,7 @@ TEST(AllocateAndSetJSPromise) {
Node* const context = m.Parameter(kNumParams + 2);
Node* const promise = m.AllocateAndSetJSPromise(
context, v8::Promise::kRejected, m.SmiConstant(1));
m.CAST(context), v8::Promise::kRejected, m.SmiConstant(1));
m.Return(promise);
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
......@@ -2401,7 +2401,7 @@ TEST(PromiseHasHandler) {
Node* const context = m.Parameter(kNumParams + 2);
Node* const promise =
m.AllocateAndInitJSPromise(context, m.UndefinedConstant());
m.AllocateAndInitJSPromise(m.CAST(context), m.UndefinedConstant());
m.Return(m.SelectBooleanConstant(m.PromiseHasHandler(promise)));
FunctionTester ft(asm_tester.GenerateCode(), kNumParams);
......@@ -2420,7 +2420,7 @@ TEST(CreatePromiseResolvingFunctionsContext) {
Node* const context = m.Parameter(kNumParams + 2);
TNode<NativeContext> const native_context = m.LoadNativeContext(context);
Node* const promise =
m.AllocateAndInitJSPromise(context, m.UndefinedConstant());
m.AllocateAndInitJSPromise(m.CAST(context), m.UndefinedConstant());
Node* const promise_context = m.CreatePromiseResolvingFunctionsContext(
promise, m.BooleanConstant(false), native_context);
m.Return(promise_context);
......@@ -2448,7 +2448,7 @@ TEST(CreatePromiseResolvingFunctions) {
Node* const context = m.Parameter(kNumParams + 2);
TNode<NativeContext> const native_context = m.LoadNativeContext(context);
Node* const promise =
m.AllocateAndInitJSPromise(context, m.UndefinedConstant());
m.AllocateAndInitJSPromise(m.CAST(context), m.UndefinedConstant());
Node *resolve, *reject;
std::tie(resolve, reject) = m.CreatePromiseResolvingFunctions(
promise, m.BooleanConstant(false), native_context);
......@@ -2538,7 +2538,7 @@ TEST(AllocateFunctionWithMapAndContext) {
Node* const context = m.Parameter(kNumParams + 2);
TNode<NativeContext> const native_context = m.LoadNativeContext(context);
Node* const promise =
m.AllocateAndInitJSPromise(context, m.UndefinedConstant());
m.AllocateAndInitJSPromise(m.CAST(context), m.UndefinedConstant());
Node* promise_context = m.CreatePromiseResolvingFunctionsContext(
promise, m.BooleanConstant(false), native_context);
TNode<Object> resolve_info = m.LoadContextElement(
......
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