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/base/utils/random-number-generator.h" | 5 #include "src/base/utils/random-number-generator.h" |
6 #include "src/builtins/builtins-promise.h" | 6 #include "src/builtins/builtins-promise.h" |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stub-assembler.h" | 8 #include "src/code-stub-assembler.h" |
9 #include "src/compiler/node.h" | 9 #include "src/compiler/node.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
(...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1862 CHECK(result->IsPromiseReactionJobInfo()); | 1862 CHECK(result->IsPromiseReactionJobInfo()); |
1863 Handle<PromiseReactionJobInfo> promise_info = | 1863 Handle<PromiseReactionJobInfo> promise_info = |
1864 Handle<PromiseReactionJobInfo>::cast(result); | 1864 Handle<PromiseReactionJobInfo>::cast(result); |
1865 CHECK_EQ(Smi::FromInt(1), promise_info->value()); | 1865 CHECK_EQ(Smi::FromInt(1), promise_info->value()); |
1866 CHECK(promise_info->tasks()->IsFixedArray()); | 1866 CHECK(promise_info->tasks()->IsFixedArray()); |
1867 CHECK(promise_info->deferred_promise()->IsFixedArray()); | 1867 CHECK(promise_info->deferred_promise()->IsFixedArray()); |
1868 CHECK(promise_info->deferred_on_resolve()->IsUndefined(isolate)); | 1868 CHECK(promise_info->deferred_on_resolve()->IsUndefined(isolate)); |
1869 CHECK(promise_info->deferred_on_reject()->IsUndefined(isolate)); | 1869 CHECK(promise_info->deferred_on_reject()->IsUndefined(isolate)); |
1870 CHECK(promise_info->context()->IsContext()); | 1870 CHECK(promise_info->context()->IsContext()); |
1871 CHECK_EQ(kDebugPromiseNoID, promise_info->debug_id()); | 1871 CHECK_EQ(kDebugPromiseNoID, promise_info->debug_id()); |
1872 CHECK_EQ(kDebugNotActive, promise_info->debug_name()); | |
1873 } | 1872 } |
1874 | 1873 |
1875 TEST(AllocatePromiseResolveThenableJobInfo) { | 1874 TEST(AllocatePromiseResolveThenableJobInfo) { |
1876 Isolate* isolate(CcTest::InitIsolateOnce()); | 1875 Isolate* isolate(CcTest::InitIsolateOnce()); |
1877 | 1876 |
1878 const int kNumParams = 1; | 1877 const int kNumParams = 1; |
1879 CodeAssemblerTester data(isolate, kNumParams); | 1878 CodeAssemblerTester data(isolate, kNumParams); |
1880 PromiseBuiltinsAssembler p(data.state()); | 1879 PromiseBuiltinsAssembler p(data.state()); |
1881 | 1880 |
1882 Node* const context = p.Parameter(kNumParams + 2); | 1881 Node* const context = p.Parameter(kNumParams + 2); |
(...skipping 19 matching lines...) Expand all Loading... |
1902 Handle<Object> result = | 1901 Handle<Object> result = |
1903 ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); | 1902 ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); |
1904 CHECK(result->IsPromiseResolveThenableJobInfo()); | 1903 CHECK(result->IsPromiseResolveThenableJobInfo()); |
1905 Handle<PromiseResolveThenableJobInfo> promise_info = | 1904 Handle<PromiseResolveThenableJobInfo> promise_info = |
1906 Handle<PromiseResolveThenableJobInfo>::cast(result); | 1905 Handle<PromiseResolveThenableJobInfo>::cast(result); |
1907 CHECK(promise_info->thenable()->IsJSPromise()); | 1906 CHECK(promise_info->thenable()->IsJSPromise()); |
1908 CHECK(promise_info->then()->IsJSFunction()); | 1907 CHECK(promise_info->then()->IsJSFunction()); |
1909 CHECK(promise_info->resolve()->IsJSFunction()); | 1908 CHECK(promise_info->resolve()->IsJSFunction()); |
1910 CHECK(promise_info->reject()->IsJSFunction()); | 1909 CHECK(promise_info->reject()->IsJSFunction()); |
1911 CHECK_EQ(kDebugPromiseNoID, promise_info->debug_id()); | 1910 CHECK_EQ(kDebugPromiseNoID, promise_info->debug_id()); |
1912 CHECK_EQ(kDebugNotActive, promise_info->debug_name()); | |
1913 CHECK(promise_info->context()->IsContext()); | 1911 CHECK(promise_info->context()->IsContext()); |
1914 } | 1912 } |
1915 | 1913 |
1916 TEST(IsSymbol) { | 1914 TEST(IsSymbol) { |
1917 Isolate* isolate(CcTest::InitIsolateOnce()); | 1915 Isolate* isolate(CcTest::InitIsolateOnce()); |
1918 | 1916 |
1919 const int kNumParams = 1; | 1917 const int kNumParams = 1; |
1920 CodeAssemblerTester data(isolate, kNumParams); | 1918 CodeAssemblerTester data(isolate, kNumParams); |
1921 CodeStubAssembler m(data.state()); | 1919 CodeStubAssembler m(data.state()); |
1922 | 1920 |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2292 .ToHandleChecked(); | 2290 .ToHandleChecked(); |
2293 Handle<Object> prop2 = | 2291 Handle<Object> prop2 = |
2294 JSReceiver::GetProperty(isolate, promise, "rejectedReason") | 2292 JSReceiver::GetProperty(isolate, promise, "rejectedReason") |
2295 .ToHandleChecked(); | 2293 .ToHandleChecked(); |
2296 CHECK_EQ(*rejected_str, *prop2); | 2294 CHECK_EQ(*rejected_str, *prop2); |
2297 } | 2295 } |
2298 } | 2296 } |
2299 | 2297 |
2300 } // namespace internal | 2298 } // namespace internal |
2301 } // namespace v8 | 2299 } // namespace v8 |
OLD | NEW |