OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/api.h" | 5 #include "src/api.h" |
6 #include "src/base/utils/random-number-generator.h" | 6 #include "src/base/utils/random-number-generator.h" |
7 #include "src/builtins/builtins-promise.h" | 7 #include "src/builtins/builtins-promise.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stub-assembler.h" | 9 #include "src/code-stub-assembler.h" |
10 #include "src/compiler/node.h" | 10 #include "src/compiler/node.h" |
(...skipping 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1855 TEST(AllocatePromiseResolveThenableJobInfo) { | 1855 TEST(AllocatePromiseResolveThenableJobInfo) { |
1856 Isolate* isolate(CcTest::InitIsolateOnce()); | 1856 Isolate* isolate(CcTest::InitIsolateOnce()); |
1857 | 1857 |
1858 const int kNumParams = 1; | 1858 const int kNumParams = 1; |
1859 CodeAssemblerTester data(isolate, kNumParams); | 1859 CodeAssemblerTester data(isolate, kNumParams); |
1860 PromiseBuiltinsAssembler p(data.state()); | 1860 PromiseBuiltinsAssembler p(data.state()); |
1861 | 1861 |
1862 Node* const context = p.Parameter(kNumParams + 2); | 1862 Node* const context = p.Parameter(kNumParams + 2); |
1863 Node* const native_context = p.LoadNativeContext(context); | 1863 Node* const native_context = p.LoadNativeContext(context); |
1864 Node* const thenable = p.AllocateAndInitJSPromise(context); | 1864 Node* const thenable = p.AllocateAndInitJSPromise(context); |
1865 Node* const then_str = p.HeapConstant(isolate->factory()->then_string()); | |
1866 Callable getproperty_callable = CodeFactory::GetProperty(isolate); | |
1867 Node* const then = | 1865 Node* const then = |
1868 p.CallStub(getproperty_callable, context, thenable, then_str); | 1866 p.GetProperty(context, thenable, isolate->factory()->then_string()); |
1869 Node* resolve = nullptr; | 1867 Node* resolve = nullptr; |
1870 Node* reject = nullptr; | 1868 Node* reject = nullptr; |
1871 std::tie(resolve, reject) = p.CreatePromiseResolvingFunctions( | 1869 std::tie(resolve, reject) = p.CreatePromiseResolvingFunctions( |
1872 thenable, p.FalseConstant(), native_context); | 1870 thenable, p.FalseConstant(), native_context); |
1873 | 1871 |
1874 Node* const info = p.AllocatePromiseResolveThenableJobInfo( | 1872 Node* const info = p.AllocatePromiseResolveThenableJobInfo( |
1875 thenable, then, resolve, reject, context); | 1873 thenable, then, resolve, reject, context); |
1876 p.Return(info); | 1874 p.Return(info); |
1877 | 1875 |
1878 Handle<Code> code = data.GenerateCode(); | 1876 Handle<Code> code = data.GenerateCode(); |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2458 m.Return(m.SmiConstant(0)); | 2456 m.Return(m.SmiConstant(0)); |
2459 | 2457 |
2460 Handle<Code> code = data.GenerateCode(); | 2458 Handle<Code> code = data.GenerateCode(); |
2461 CHECK(!code.is_null()); | 2459 CHECK(!code.is_null()); |
2462 FunctionTester ft(code, kNumParams); | 2460 FunctionTester ft(code, kNumParams); |
2463 CHECK_EQ(1, Handle<Smi>::cast(ft.Call().ToHandleChecked())->value()); | 2461 CHECK_EQ(1, Handle<Smi>::cast(ft.Call().ToHandleChecked())->value()); |
2464 } | 2462 } |
2465 | 2463 |
2466 } // namespace internal | 2464 } // namespace internal |
2467 } // namespace v8 | 2465 } // namespace v8 |
OLD | NEW |