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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/assembler.h" | 7 #include "src/assembler.h" |
8 #include "src/base/once.h" | 8 #include "src/base/once.h" |
9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 namespace v8 { | 27 namespace v8 { |
28 namespace internal { | 28 namespace internal { |
29 | 29 |
30 V8_DECLARE_ONCE(init_once); | 30 V8_DECLARE_ONCE(init_once); |
31 | 31 |
32 v8::ArrayBuffer::Allocator* V8::array_buffer_allocator_ = NULL; | 32 v8::ArrayBuffer::Allocator* V8::array_buffer_allocator_ = NULL; |
33 v8::Platform* V8::platform_ = NULL; | 33 v8::Platform* V8::platform_ = NULL; |
34 | 34 |
35 | 35 |
36 bool V8::Initialize() { | 36 bool V8::Initialize(Deserializer* des) { |
37 InitializeOncePerProcess(); | 37 InitializeOncePerProcess(); |
38 return true; | 38 Isolate* isolate = Isolate::UncheckedCurrent(); |
| 39 if (isolate == NULL) return true; |
| 40 if (isolate->IsDead()) return false; |
| 41 if (isolate->IsInitialized()) return true; |
| 42 |
| 43 return isolate->Init(des); |
39 } | 44 } |
40 | 45 |
41 | 46 |
42 void V8::TearDown() { | 47 void V8::TearDown() { |
43 Bootstrapper::TearDownExtensions(); | 48 Bootstrapper::TearDownExtensions(); |
44 ElementsAccessor::TearDown(); | 49 ElementsAccessor::TearDown(); |
45 LOperand::TearDownCaches(); | 50 LOperand::TearDownCaches(); |
46 compiler::Pipeline::TearDown(); | 51 compiler::Pipeline::TearDown(); |
47 ExternalReference::TearDownMathExpData(); | 52 ExternalReference::TearDownMathExpData(); |
48 RegisteredExtension::UnregisterAll(); | 53 RegisteredExtension::UnregisterAll(); |
(...skipping 18 matching lines...) Expand all Loading... |
67 } | 72 } |
68 | 73 |
69 if (FLAG_stress_compaction) { | 74 if (FLAG_stress_compaction) { |
70 FLAG_force_marking_deque_overflows = true; | 75 FLAG_force_marking_deque_overflows = true; |
71 FLAG_gc_global = true; | 76 FLAG_gc_global = true; |
72 FLAG_max_semi_space_size = 1; | 77 FLAG_max_semi_space_size = 1; |
73 } | 78 } |
74 | 79 |
75 base::OS::Initialize(FLAG_random_seed, FLAG_hard_abort, FLAG_gc_fake_mmap); | 80 base::OS::Initialize(FLAG_random_seed, FLAG_hard_abort, FLAG_gc_fake_mmap); |
76 | 81 |
77 Isolate::InitializeOncePerProcess(); | |
78 | |
79 Sampler::SetUp(); | 82 Sampler::SetUp(); |
80 CpuFeatures::Probe(false); | 83 CpuFeatures::Probe(false); |
81 init_memcopy_functions(); | 84 init_memcopy_functions(); |
82 // The custom exp implementation needs 16KB of lookup data; initialize it | 85 // The custom exp implementation needs 16KB of lookup data; initialize it |
83 // on demand. | 86 // on demand. |
84 init_fast_sqrt_function(); | 87 init_fast_sqrt_function(); |
85 #ifdef _WIN64 | 88 #ifdef _WIN64 |
86 init_modulo_function(); | 89 init_modulo_function(); |
87 #endif | 90 #endif |
88 ElementsAccessor::InitializeOncePerProcess(); | 91 ElementsAccessor::InitializeOncePerProcess(); |
(...skipping 22 matching lines...) Expand all Loading... |
111 platform_ = NULL; | 114 platform_ = NULL; |
112 } | 115 } |
113 | 116 |
114 | 117 |
115 v8::Platform* V8::GetCurrentPlatform() { | 118 v8::Platform* V8::GetCurrentPlatform() { |
116 DCHECK(platform_); | 119 DCHECK(platform_); |
117 return platform_; | 120 return platform_; |
118 } | 121 } |
119 | 122 |
120 } } // namespace v8::internal | 123 } } // namespace v8::internal |
OLD | NEW |