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 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1965 Recompile<KeyedLoadICTFStub>(isolate); | 1965 Recompile<KeyedLoadICTFStub>(isolate); |
1966 Recompile<KeyedLoadICTrampolineTFStub>(isolate); | 1966 Recompile<KeyedLoadICTrampolineTFStub>(isolate); |
1967 Recompile<StoreICStub>(isolate, StoreICState(STRICT)); | 1967 Recompile<StoreICStub>(isolate, StoreICState(STRICT)); |
1968 Recompile<StoreICTrampolineStub>(isolate, StoreICState(STRICT)); | 1968 Recompile<StoreICTrampolineStub>(isolate, StoreICState(STRICT)); |
1969 Recompile<KeyedStoreICTFStub>(isolate, StoreICState(STRICT)); | 1969 Recompile<KeyedStoreICTFStub>(isolate, StoreICState(STRICT)); |
1970 Recompile<KeyedStoreICTrampolineTFStub>(isolate, StoreICState(STRICT)); | 1970 Recompile<KeyedStoreICTrampolineTFStub>(isolate, StoreICState(STRICT)); |
1971 } | 1971 } |
1972 v8_isolate->Dispose(); | 1972 v8_isolate->Dispose(); |
1973 } | 1973 } |
1974 | 1974 |
| 1975 TEST(IsPromiseHookEnabled) { |
| 1976 Isolate* isolate(CcTest::InitIsolateOnce()); |
| 1977 |
| 1978 const int kNumParams = 1; |
| 1979 CodeAssemblerTester data(isolate, kNumParams); |
| 1980 CodeStubAssembler m(data.state()); |
| 1981 |
| 1982 m.Return(m.SelectBooleanConstant(m.IsPromiseHookEnabled())); |
| 1983 |
| 1984 Handle<Code> code = data.GenerateCode(); |
| 1985 CHECK(!code.is_null()); |
| 1986 |
| 1987 FunctionTester ft(code, kNumParams); |
| 1988 CHECK_EQ(false, isolate->IsPromiseHookEnabled()); |
| 1989 Handle<Object> result = |
| 1990 ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); |
| 1991 CHECK_EQ(isolate->heap()->false_value(), *result); |
| 1992 |
| 1993 isolate->EnablePromiseHook(); |
| 1994 result = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); |
| 1995 CHECK_EQ(isolate->heap()->true_value(), *result); |
| 1996 |
| 1997 isolate->DisablePromiseHook(); |
| 1998 result = ft.Call(isolate->factory()->undefined_value()).ToHandleChecked(); |
| 1999 CHECK_EQ(isolate->heap()->false_value(), *result); |
| 2000 } |
| 2001 |
1975 } // namespace internal | 2002 } // namespace internal |
1976 } // namespace v8 | 2003 } // namespace v8 |
OLD | NEW |