| 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 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1753 | 1753 |
| 1754 template <typename Stub, typename... Args> | 1754 template <typename Stub, typename... Args> |
| 1755 void Recompile(Args... args) { | 1755 void Recompile(Args... args) { |
| 1756 Stub stub(args...); | 1756 Stub stub(args...); |
| 1757 stub.DeleteStubFromCacheForTesting(); | 1757 stub.DeleteStubFromCacheForTesting(); |
| 1758 stub.GetCode(); | 1758 stub.GetCode(); |
| 1759 } | 1759 } |
| 1760 | 1760 |
| 1761 } // namespace | 1761 } // namespace |
| 1762 | 1762 |
| 1763 TEST(CodeStubAssemblerGraphsCorrectness) { | |
| 1764 // The test does not work with interpreter because bytecode handlers taken | |
| 1765 // from the snapshot already refer to precompiled stubs from the snapshot | |
| 1766 // and there is no way to trigger bytecode handlers recompilation. | |
| 1767 if (FLAG_ignition || FLAG_turbo) return; | |
| 1768 | |
| 1769 v8::Isolate::CreateParams create_params; | |
| 1770 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); | |
| 1771 v8::Isolate* v8_isolate = v8::Isolate::New(create_params); | |
| 1772 Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate); | |
| 1773 | |
| 1774 { | |
| 1775 v8::Isolate::Scope isolate_scope(v8_isolate); | |
| 1776 LocalContext env(v8_isolate); | |
| 1777 v8::HandleScope scope(v8_isolate); | |
| 1778 | |
| 1779 FLAG_csa_verify = true; | |
| 1780 | |
| 1781 // Recompile some stubs here. | |
| 1782 Recompile<LoadGlobalICStub>(isolate, LoadGlobalICState(NOT_INSIDE_TYPEOF)); | |
| 1783 Recompile<LoadGlobalICTrampolineStub>(isolate, | |
| 1784 LoadGlobalICState(NOT_INSIDE_TYPEOF)); | |
| 1785 } | |
| 1786 v8_isolate->Dispose(); | |
| 1787 } | |
| 1788 | |
| 1789 void CustomPromiseHook(v8::PromiseHookType type, v8::Local<v8::Promise> promise, | 1763 void CustomPromiseHook(v8::PromiseHookType type, v8::Local<v8::Promise> promise, |
| 1790 v8::Local<v8::Value> parentPromise) {} | 1764 v8::Local<v8::Value> parentPromise) {} |
| 1791 | 1765 |
| 1792 TEST(IsPromiseHookEnabled) { | 1766 TEST(IsPromiseHookEnabled) { |
| 1793 Isolate* isolate(CcTest::InitIsolateOnce()); | 1767 Isolate* isolate(CcTest::InitIsolateOnce()); |
| 1794 | 1768 |
| 1795 const int kNumParams = 1; | 1769 const int kNumParams = 1; |
| 1796 CodeAssemblerTester data(isolate, kNumParams); | 1770 CodeAssemblerTester data(isolate, kNumParams); |
| 1797 CodeStubAssembler m(data.state()); | 1771 CodeStubAssembler m(data.state()); |
| 1798 | 1772 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2091 CHECK_EQ(isolate->heap()->empty_fixed_array(), fun->elements()); | 2065 CHECK_EQ(isolate->heap()->empty_fixed_array(), fun->elements()); |
| 2092 CHECK_EQ(isolate->heap()->empty_literals_array(), fun->literals()); | 2066 CHECK_EQ(isolate->heap()->empty_literals_array(), fun->literals()); |
| 2093 CHECK_EQ(isolate->heap()->the_hole_value(), fun->prototype_or_initial_map()); | 2067 CHECK_EQ(isolate->heap()->the_hole_value(), fun->prototype_or_initial_map()); |
| 2094 CHECK_EQ(*isolate->promise_resolve_shared_fun(), fun->shared()); | 2068 CHECK_EQ(*isolate->promise_resolve_shared_fun(), fun->shared()); |
| 2095 CHECK_EQ(isolate->promise_resolve_shared_fun()->code(), fun->code()); | 2069 CHECK_EQ(isolate->promise_resolve_shared_fun()->code(), fun->code()); |
| 2096 CHECK_EQ(isolate->heap()->undefined_value(), fun->next_function_link()); | 2070 CHECK_EQ(isolate->heap()->undefined_value(), fun->next_function_link()); |
| 2097 } | 2071 } |
| 2098 | 2072 |
| 2099 } // namespace internal | 2073 } // namespace internal |
| 2100 } // namespace v8 | 2074 } // namespace v8 |
| OLD | NEW |