| 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/code-factory.h" | 6 #include "src/code-factory.h" |
| 7 #include "src/code-stub-assembler.h" | 7 #include "src/code-stub-assembler.h" |
| 8 #include "src/compiler/node.h" | 8 #include "src/compiler/node.h" |
| 9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
| 10 #include "test/cctest/compiler/code-assembler-tester.h" | 10 #include "test/cctest/compiler/code-assembler-tester.h" |
| (...skipping 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1890 } | 1890 } |
| 1891 | 1891 |
| 1892 TEST(AllocatePromiseReactionJobInfo) { | 1892 TEST(AllocatePromiseReactionJobInfo) { |
| 1893 Isolate* isolate(CcTest::InitIsolateOnce()); | 1893 Isolate* isolate(CcTest::InitIsolateOnce()); |
| 1894 | 1894 |
| 1895 const int kNumParams = 1; | 1895 const int kNumParams = 1; |
| 1896 CodeAssemblerTester data(isolate, kNumParams); | 1896 CodeAssemblerTester data(isolate, kNumParams); |
| 1897 CodeStubAssembler m(data.state()); | 1897 CodeStubAssembler m(data.state()); |
| 1898 | 1898 |
| 1899 Node* const context = m.Parameter(kNumParams + 2); | 1899 Node* const context = m.Parameter(kNumParams + 2); |
| 1900 Node* const tasks = m.AllocateFixedArray(FAST_ELEMENTS, m.Int32Constant(1)); | 1900 Node* const tasks = m.AllocateFixedArray(FAST_ELEMENTS, m.IntPtrConstant(1)); |
| 1901 m.StoreFixedArrayElement(tasks, 0, m.UndefinedConstant()); | 1901 m.StoreFixedArrayElement(tasks, 0, m.UndefinedConstant()); |
| 1902 Node* const deferred = | 1902 Node* const deferred = |
| 1903 m.AllocateFixedArray(FAST_ELEMENTS, m.Int32Constant(1)); | 1903 m.AllocateFixedArray(FAST_ELEMENTS, m.IntPtrConstant(1)); |
| 1904 m.StoreFixedArrayElement(deferred, 0, m.UndefinedConstant()); | 1904 m.StoreFixedArrayElement(deferred, 0, m.UndefinedConstant()); |
| 1905 Node* const info = m.AllocatePromiseReactionJobInfo(m.SmiConstant(1), tasks, | 1905 Node* const info = m.AllocatePromiseReactionJobInfo(m.SmiConstant(1), tasks, |
| 1906 deferred, context); | 1906 deferred, context); |
| 1907 m.Return(info); | 1907 m.Return(info); |
| 1908 | 1908 |
| 1909 Handle<Code> code = data.GenerateCode(); | 1909 Handle<Code> code = data.GenerateCode(); |
| 1910 CHECK(!code.is_null()); | 1910 CHECK(!code.is_null()); |
| 1911 | 1911 |
| 1912 FunctionTester ft(code, kNumParams); | 1912 FunctionTester ft(code, kNumParams); |
| 1913 Handle<Object> result = | 1913 Handle<Object> result = |
| 1914 ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); | 1914 ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); |
| 1915 CHECK(result->IsPromiseReactionJobInfo()); | 1915 CHECK(result->IsPromiseReactionJobInfo()); |
| 1916 Handle<PromiseReactionJobInfo> promise_info = | 1916 Handle<PromiseReactionJobInfo> promise_info = |
| 1917 Handle<PromiseReactionJobInfo>::cast(result); | 1917 Handle<PromiseReactionJobInfo>::cast(result); |
| 1918 CHECK_EQ(Smi::FromInt(1), promise_info->value()); | 1918 CHECK_EQ(Smi::FromInt(1), promise_info->value()); |
| 1919 CHECK(promise_info->tasks()->IsFixedArray()); | 1919 CHECK(promise_info->tasks()->IsFixedArray()); |
| 1920 CHECK(promise_info->deferred()->IsFixedArray()); | 1920 CHECK(promise_info->deferred()->IsFixedArray()); |
| 1921 CHECK(promise_info->context()->IsContext()); | 1921 CHECK(promise_info->context()->IsContext()); |
| 1922 CHECK(promise_info->debug_id()->IsUndefined(isolate)); | 1922 CHECK(promise_info->debug_id()->IsUndefined(isolate)); |
| 1923 CHECK(promise_info->debug_name()->IsUndefined(isolate)); | 1923 CHECK(promise_info->debug_name()->IsUndefined(isolate)); |
| 1924 } | 1924 } |
| 1925 | 1925 |
| 1926 } // namespace internal | 1926 } // namespace internal |
| 1927 } // namespace v8 | 1927 } // namespace v8 |
| OLD | NEW |