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