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