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

Side by Side Diff: test/cctest/test-code-stub-assembler.cc

Issue 2650803003: [inspector] change target promise for kDebugWillHandle & kDebugDidHandle (Closed)
Patch Set: added missing guard in asyncTaskCreated 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 unified diff | Download patch
OLDNEW
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 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 void CustomPromiseHook(v8::PromiseHookType type, v8::Local<v8::Promise> promise, 1742 void CustomPromiseHook(v8::PromiseHookType type, v8::Local<v8::Promise> promise,
1743 v8::Local<v8::Value> parentPromise) {} 1743 v8::Local<v8::Value> parentPromise) {}
1744 1744
1745 TEST(IsPromiseHookEnabled) { 1745 TEST(IsPromiseHookEnabled) {
1746 Isolate* isolate(CcTest::InitIsolateOnce()); 1746 Isolate* isolate(CcTest::InitIsolateOnce());
1747 1747
1748 const int kNumParams = 1; 1748 const int kNumParams = 1;
1749 CodeAssemblerTester data(isolate, kNumParams); 1749 CodeAssemblerTester data(isolate, kNumParams);
1750 CodeStubAssembler m(data.state()); 1750 CodeStubAssembler m(data.state());
1751 1751
1752 m.Return(m.SelectBooleanConstant(m.IsPromiseHookEnabled())); 1752 m.Return(m.SelectBooleanConstant(m.IsPromiseHookEnabledOrDebugIsActive()));
1753 1753
1754 Handle<Code> code = data.GenerateCode(); 1754 Handle<Code> code = data.GenerateCode();
1755 CHECK(!code.is_null()); 1755 CHECK(!code.is_null());
1756 1756
1757 FunctionTester ft(code, kNumParams); 1757 FunctionTester ft(code, kNumParams);
1758 Handle<Object> result = 1758 Handle<Object> result =
1759 ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); 1759 ft.Call(isolate->factory()->undefined_value()).ToHandleChecked();
1760 CHECK_EQ(isolate->heap()->false_value(), *result); 1760 CHECK_EQ(isolate->heap()->false_value(), *result);
1761 1761
1762 isolate->SetPromiseHook(CustomPromiseHook); 1762 isolate->SetPromiseHook(CustomPromiseHook);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); 1840 ft.Call(isolate->factory()->undefined_value()).ToHandleChecked();
1841 CHECK(result->IsPromiseReactionJobInfo()); 1841 CHECK(result->IsPromiseReactionJobInfo());
1842 Handle<PromiseReactionJobInfo> promise_info = 1842 Handle<PromiseReactionJobInfo> promise_info =
1843 Handle<PromiseReactionJobInfo>::cast(result); 1843 Handle<PromiseReactionJobInfo>::cast(result);
1844 CHECK_EQ(Smi::FromInt(1), promise_info->value()); 1844 CHECK_EQ(Smi::FromInt(1), promise_info->value());
1845 CHECK(promise_info->tasks()->IsFixedArray()); 1845 CHECK(promise_info->tasks()->IsFixedArray());
1846 CHECK(promise_info->deferred_promise()->IsFixedArray()); 1846 CHECK(promise_info->deferred_promise()->IsFixedArray());
1847 CHECK(promise_info->deferred_on_resolve()->IsUndefined(isolate)); 1847 CHECK(promise_info->deferred_on_resolve()->IsUndefined(isolate));
1848 CHECK(promise_info->deferred_on_reject()->IsUndefined(isolate)); 1848 CHECK(promise_info->deferred_on_reject()->IsUndefined(isolate));
1849 CHECK(promise_info->context()->IsContext()); 1849 CHECK(promise_info->context()->IsContext());
1850 CHECK_EQ(kDebugPromiseNoID, promise_info->debug_id());
1851 } 1850 }
1852 1851
1853 TEST(AllocatePromiseResolveThenableJobInfo) { 1852 TEST(AllocatePromiseResolveThenableJobInfo) {
1854 Isolate* isolate(CcTest::InitIsolateOnce()); 1853 Isolate* isolate(CcTest::InitIsolateOnce());
1855 1854
1856 const int kNumParams = 1; 1855 const int kNumParams = 1;
1857 CodeAssemblerTester data(isolate, kNumParams); 1856 CodeAssemblerTester data(isolate, kNumParams);
1858 PromiseBuiltinsAssembler p(data.state()); 1857 PromiseBuiltinsAssembler p(data.state());
1859 1858
1860 Node* const context = p.Parameter(kNumParams + 2); 1859 Node* const context = p.Parameter(kNumParams + 2);
(...skipping 18 matching lines...) Expand all
1879 FunctionTester ft(code, kNumParams); 1878 FunctionTester ft(code, kNumParams);
1880 Handle<Object> result = 1879 Handle<Object> result =
1881 ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); 1880 ft.Call(isolate->factory()->undefined_value()).ToHandleChecked();
1882 CHECK(result->IsPromiseResolveThenableJobInfo()); 1881 CHECK(result->IsPromiseResolveThenableJobInfo());
1883 Handle<PromiseResolveThenableJobInfo> promise_info = 1882 Handle<PromiseResolveThenableJobInfo> promise_info =
1884 Handle<PromiseResolveThenableJobInfo>::cast(result); 1883 Handle<PromiseResolveThenableJobInfo>::cast(result);
1885 CHECK(promise_info->thenable()->IsJSPromise()); 1884 CHECK(promise_info->thenable()->IsJSPromise());
1886 CHECK(promise_info->then()->IsJSFunction()); 1885 CHECK(promise_info->then()->IsJSFunction());
1887 CHECK(promise_info->resolve()->IsJSFunction()); 1886 CHECK(promise_info->resolve()->IsJSFunction());
1888 CHECK(promise_info->reject()->IsJSFunction()); 1887 CHECK(promise_info->reject()->IsJSFunction());
1889 CHECK_EQ(kDebugPromiseNoID, promise_info->debug_id());
1890 CHECK(promise_info->context()->IsContext()); 1888 CHECK(promise_info->context()->IsContext());
1891 } 1889 }
1892 1890
1893 TEST(IsSymbol) { 1891 TEST(IsSymbol) {
1894 Isolate* isolate(CcTest::InitIsolateOnce()); 1892 Isolate* isolate(CcTest::InitIsolateOnce());
1895 1893
1896 const int kNumParams = 1; 1894 const int kNumParams = 1;
1897 CodeAssemblerTester data(isolate, kNumParams); 1895 CodeAssemblerTester data(isolate, kNumParams);
1898 CodeStubAssembler m(data.state()); 1896 CodeStubAssembler m(data.state());
1899 1897
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
2457 m.Return(m.SmiConstant(0)); 2455 m.Return(m.SmiConstant(0));
2458 2456
2459 Handle<Code> code = data.GenerateCode(); 2457 Handle<Code> code = data.GenerateCode();
2460 CHECK(!code.is_null()); 2458 CHECK(!code.is_null());
2461 FunctionTester ft(code, kNumParams); 2459 FunctionTester ft(code, kNumParams);
2462 CHECK_EQ(1, Handle<Smi>::cast(ft.Call().ToHandleChecked())->value()); 2460 CHECK_EQ(1, Handle<Smi>::cast(ft.Call().ToHandleChecked())->value());
2463 } 2461 }
2464 2462
2465 } // namespace internal 2463 } // namespace internal
2466 } // namespace v8 2464 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698