Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Unified Diff: test/cctest/test-code-stub-assembler.cc

Issue 2611083002: [promises] Add AllocatePromiseResolveThenableJobInfo to TF (Closed)
Patch Set: rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime-promise.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-code-stub-assembler.cc
diff --git a/test/cctest/test-code-stub-assembler.cc b/test/cctest/test-code-stub-assembler.cc
index 8bd5d099cc2e3f384c2b3e417ba5eb322c12fa74..007121ca7ae67fad1cbd0bf68a902ca823641eb4 100644
--- a/test/cctest/test-code-stub-assembler.cc
+++ b/test/cctest/test-code-stub-assembler.cc
@@ -1874,6 +1874,47 @@ TEST(AllocatePromiseReactionJobInfo) {
CHECK_EQ(kDebugNotActive, promise_info->debug_name());
}
+TEST(AllocatePromiseResolveThenableJobInfo) {
+ Isolate* isolate(CcTest::InitIsolateOnce());
+
+ const int kNumParams = 1;
+ CodeAssemblerTester data(isolate, kNumParams);
+ PromiseBuiltinsAssembler p(data.state());
+
+ Node* const context = p.Parameter(kNumParams + 2);
+ Node* const native_context = p.LoadNativeContext(context);
+ Node* const thenable = p.AllocateAndInitJSPromise(context);
+ Node* const then_str = p.HeapConstant(isolate->factory()->then_string());
+ Callable getproperty_callable = CodeFactory::GetProperty(isolate);
+ Node* const then =
+ p.CallStub(getproperty_callable, context, thenable, then_str);
+ Node* resolve = nullptr;
+ Node* reject = nullptr;
+ std::tie(resolve, reject) = p.CreatePromiseResolvingFunctions(
+ thenable, p.FalseConstant(), native_context);
+
+ Node* const info = p.AllocatePromiseResolveThenableJobInfo(
+ thenable, then, resolve, reject, context);
+ p.Return(info);
+
+ Handle<Code> code = data.GenerateCode();
+ CHECK(!code.is_null());
+
+ FunctionTester ft(code, kNumParams);
+ Handle<Object> result =
+ ft.Call(isolate->factory()->undefined_value()).ToHandleChecked();
+ CHECK(result->IsPromiseResolveThenableJobInfo());
+ Handle<PromiseResolveThenableJobInfo> promise_info =
+ Handle<PromiseResolveThenableJobInfo>::cast(result);
+ CHECK(promise_info->thenable()->IsJSPromise());
+ CHECK(promise_info->then()->IsJSFunction());
+ CHECK(promise_info->resolve()->IsJSFunction());
+ CHECK(promise_info->reject()->IsJSFunction());
+ CHECK_EQ(kDebugPromiseNoID, promise_info->debug_id());
+ CHECK_EQ(kDebugNotActive, promise_info->debug_name());
+ CHECK(promise_info->context()->IsContext());
+}
+
TEST(IsSymbol) {
Isolate* isolate(CcTest::InitIsolateOnce());
« no previous file with comments | « src/runtime/runtime-promise.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698