OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/isolate.h" | 5 #include "src/isolate.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <fstream> // NOLINT(readability/streams) | 9 #include <fstream> // NOLINT(readability/streams) |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "src/interpreter/interpreter.h" | 37 #include "src/interpreter/interpreter.h" |
38 #include "src/isolate-inl.h" | 38 #include "src/isolate-inl.h" |
39 #include "src/libsampler/sampler.h" | 39 #include "src/libsampler/sampler.h" |
40 #include "src/log.h" | 40 #include "src/log.h" |
41 #include "src/messages.h" | 41 #include "src/messages.h" |
42 #include "src/objects/frame-array-inl.h" | 42 #include "src/objects/frame-array-inl.h" |
43 #include "src/profiler/cpu-profiler.h" | 43 #include "src/profiler/cpu-profiler.h" |
44 #include "src/prototype.h" | 44 #include "src/prototype.h" |
45 #include "src/regexp/regexp-stack.h" | 45 #include "src/regexp/regexp-stack.h" |
46 #include "src/runtime-profiler.h" | 46 #include "src/runtime-profiler.h" |
| 47 #include "src/setup-isolate.h" |
47 #include "src/simulator.h" | 48 #include "src/simulator.h" |
48 #include "src/snapshot/deserializer.h" | 49 #include "src/snapshot/deserializer.h" |
49 #include "src/tracing/tracing-category-observer.h" | 50 #include "src/tracing/tracing-category-observer.h" |
50 #include "src/v8.h" | 51 #include "src/v8.h" |
51 #include "src/version.h" | 52 #include "src/version.h" |
52 #include "src/vm-state-inl.h" | 53 #include "src/vm-state-inl.h" |
53 #include "src/wasm/wasm-module.h" | 54 #include "src/wasm/wasm-module.h" |
54 #include "src/wasm/wasm-objects.h" | 55 #include "src/wasm/wasm-objects.h" |
55 #include "src/zone/accounting-allocator.h" | 56 #include "src/zone/accounting-allocator.h" |
56 | 57 |
(...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2240 descriptor_lookup_cache_(NULL), | 2241 descriptor_lookup_cache_(NULL), |
2241 handle_scope_implementer_(NULL), | 2242 handle_scope_implementer_(NULL), |
2242 unicode_cache_(NULL), | 2243 unicode_cache_(NULL), |
2243 allocator_(FLAG_trace_gc_object_stats ? new VerboseAccountingAllocator( | 2244 allocator_(FLAG_trace_gc_object_stats ? new VerboseAccountingAllocator( |
2244 &heap_, 256 * KB, 128 * KB) | 2245 &heap_, 256 * KB, 128 * KB) |
2245 : new AccountingAllocator()), | 2246 : new AccountingAllocator()), |
2246 inner_pointer_to_code_cache_(NULL), | 2247 inner_pointer_to_code_cache_(NULL), |
2247 global_handles_(NULL), | 2248 global_handles_(NULL), |
2248 eternal_handles_(NULL), | 2249 eternal_handles_(NULL), |
2249 thread_manager_(NULL), | 2250 thread_manager_(NULL), |
| 2251 setup_delegate_(NULL), |
2250 regexp_stack_(NULL), | 2252 regexp_stack_(NULL), |
2251 date_cache_(NULL), | 2253 date_cache_(NULL), |
2252 call_descriptor_data_(NULL), | 2254 call_descriptor_data_(NULL), |
2253 // TODO(bmeurer) Initialized lazily because it depends on flags; can | 2255 // TODO(bmeurer) Initialized lazily because it depends on flags; can |
2254 // be fixed once the default isolate cleanup is done. | 2256 // be fixed once the default isolate cleanup is done. |
2255 random_number_generator_(NULL), | 2257 random_number_generator_(NULL), |
2256 rail_mode_(PERFORMANCE_ANIMATION), | 2258 rail_mode_(PERFORMANCE_ANIMATION), |
2257 promise_hook_or_debug_is_active_(false), | 2259 promise_hook_or_debug_is_active_(false), |
2258 promise_hook_(NULL), | 2260 promise_hook_(NULL), |
2259 load_start_time_ms_(0), | 2261 load_start_time_ms_(0), |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2679 } | 2681 } |
2680 | 2682 |
2681 if (create_heap_objects) { | 2683 if (create_heap_objects) { |
2682 // Terminate the partial snapshot cache so we can iterate. | 2684 // Terminate the partial snapshot cache so we can iterate. |
2683 partial_snapshot_cache_.Add(heap_.undefined_value()); | 2685 partial_snapshot_cache_.Add(heap_.undefined_value()); |
2684 } | 2686 } |
2685 | 2687 |
2686 InitializeThreadLocal(); | 2688 InitializeThreadLocal(); |
2687 | 2689 |
2688 bootstrapper_->Initialize(create_heap_objects); | 2690 bootstrapper_->Initialize(create_heap_objects); |
2689 builtins_.SetUp(this, create_heap_objects); | 2691 if (setup_delegate_ == nullptr) { |
| 2692 setup_delegate_ = new SetupIsolateDelegate(); |
| 2693 } |
| 2694 setup_delegate_->SetupBuiltins(this, create_heap_objects); |
2690 if (create_heap_objects) heap_.CreateFixedStubs(); | 2695 if (create_heap_objects) heap_.CreateFixedStubs(); |
2691 | 2696 |
2692 if (FLAG_log_internal_timer_events) { | 2697 if (FLAG_log_internal_timer_events) { |
2693 set_event_logger(Logger::DefaultEventLoggerSentinel); | 2698 set_event_logger(Logger::DefaultEventLoggerSentinel); |
2694 } | 2699 } |
2695 | 2700 |
2696 if (FLAG_trace_hydrogen || FLAG_trace_hydrogen_stubs || FLAG_trace_turbo || | 2701 if (FLAG_trace_hydrogen || FLAG_trace_hydrogen_stubs || FLAG_trace_turbo || |
2697 FLAG_trace_turbo_graph) { | 2702 FLAG_trace_turbo_graph) { |
2698 PrintF("Concurrent recompilation has been disabled for tracing.\n"); | 2703 PrintF("Concurrent recompilation has been disabled for tracing.\n"); |
2699 } else if (OptimizingCompileDispatcher::Enabled()) { | 2704 } else if (OptimizingCompileDispatcher::Enabled()) { |
2700 optimizing_compile_dispatcher_ = new OptimizingCompileDispatcher(this); | 2705 optimizing_compile_dispatcher_ = new OptimizingCompileDispatcher(this); |
2701 } | 2706 } |
2702 | 2707 |
2703 // Initialize runtime profiler before deserialization, because collections may | 2708 // Initialize runtime profiler before deserialization, because collections may |
2704 // occur, clearing/updating ICs. | 2709 // occur, clearing/updating ICs. |
2705 runtime_profiler_ = new RuntimeProfiler(this); | 2710 runtime_profiler_ = new RuntimeProfiler(this); |
2706 | 2711 |
2707 // If we are deserializing, read the state into the now-empty heap. | 2712 // If we are deserializing, read the state into the now-empty heap. |
2708 { | 2713 { |
2709 AlwaysAllocateScope always_allocate(this); | 2714 AlwaysAllocateScope always_allocate(this); |
2710 | 2715 |
2711 if (!create_heap_objects) { | 2716 if (!create_heap_objects) { |
2712 des->Deserialize(this); | 2717 des->Deserialize(this); |
2713 } | 2718 } |
2714 load_stub_cache_->Initialize(); | 2719 load_stub_cache_->Initialize(); |
2715 store_stub_cache_->Initialize(); | 2720 store_stub_cache_->Initialize(); |
2716 interpreter_->Initialize(); | 2721 setup_delegate_->SetupInterpreter(interpreter_, create_heap_objects); |
2717 | 2722 |
2718 heap_.NotifyDeserializationComplete(); | 2723 heap_.NotifyDeserializationComplete(); |
2719 } | 2724 } |
| 2725 delete setup_delegate_; |
| 2726 setup_delegate_ = nullptr; |
2720 | 2727 |
2721 // Finish initialization of ThreadLocal after deserialization is done. | 2728 // Finish initialization of ThreadLocal after deserialization is done. |
2722 clear_pending_exception(); | 2729 clear_pending_exception(); |
2723 clear_pending_message(); | 2730 clear_pending_message(); |
2724 clear_scheduled_exception(); | 2731 clear_scheduled_exception(); |
2725 | 2732 |
2726 // Deserializing may put strange things in the root array's copy of the | 2733 // Deserializing may put strange things in the root array's copy of the |
2727 // stack guard. | 2734 // stack guard. |
2728 heap_.SetStackLimits(); | 2735 heap_.SetStackLimits(); |
2729 | 2736 |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3671 // Then check whether this scope intercepts. | 3678 // Then check whether this scope intercepts. |
3672 if ((flag & intercept_mask_)) { | 3679 if ((flag & intercept_mask_)) { |
3673 intercepted_flags_ |= flag; | 3680 intercepted_flags_ |= flag; |
3674 return true; | 3681 return true; |
3675 } | 3682 } |
3676 return false; | 3683 return false; |
3677 } | 3684 } |
3678 | 3685 |
3679 } // namespace internal | 3686 } // namespace internal |
3680 } // namespace v8 | 3687 } // namespace v8 |
OLD | NEW |