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 6635d6b919825b8781361d901a505d1f98c16672..b4b9e7b55b2ea5b41c177ec11838869b10bfb89a 100644 |
--- a/test/cctest/test-code-stub-assembler.cc |
+++ b/test/cctest/test-code-stub-assembler.cc |
@@ -1972,5 +1972,32 @@ TEST(CodeStubAssemblerGraphsCorrectness) { |
v8_isolate->Dispose(); |
} |
+TEST(IsPromiseHookEnabled) { |
+ Isolate* isolate(CcTest::InitIsolateOnce()); |
+ |
+ const int kNumParams = 1; |
+ CodeAssemblerTester data(isolate, kNumParams); |
+ CodeStubAssembler m(data.state()); |
+ |
+ m.Return(m.SelectBooleanConstant(m.IsPromiseHookEnabled())); |
+ |
+ Handle<Code> code = data.GenerateCode(); |
+ CHECK(!code.is_null()); |
+ |
+ FunctionTester ft(code, kNumParams); |
+ CHECK_EQ(false, isolate->IsPromiseHookEnabled()); |
+ Handle<Object> result = |
+ ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); |
+ CHECK_EQ(isolate->heap()->false_value(), *result); |
+ |
+ isolate->EnablePromiseHook(); |
+ result = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); |
+ CHECK_EQ(isolate->heap()->true_value(), *result); |
+ |
+ isolate->DisablePromiseHook(); |
+ result = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); |
+ CHECK_EQ(isolate->heap()->false_value(), *result); |
+} |
+ |
} // namespace internal |
} // namespace v8 |