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" |
| 11 #include "src/compiler/instruction.h" |
11 #include "src/debug.h" | 12 #include "src/debug.h" |
12 #include "src/deoptimizer.h" | 13 #include "src/deoptimizer.h" |
13 #include "src/elements.h" | 14 #include "src/elements.h" |
14 #include "src/frames.h" | 15 #include "src/frames.h" |
15 #include "src/heap-profiler.h" | 16 #include "src/heap-profiler.h" |
16 #include "src/hydrogen.h" | 17 #include "src/hydrogen.h" |
17 #include "src/isolate.h" | 18 #include "src/isolate.h" |
18 #include "src/lithium-allocator.h" | 19 #include "src/lithium-allocator.h" |
19 #include "src/objects.h" | 20 #include "src/objects.h" |
20 #include "src/runtime-profiler.h" | 21 #include "src/runtime-profiler.h" |
21 #include "src/sampler.h" | 22 #include "src/sampler.h" |
22 #include "src/serialize.h" | 23 #include "src/serialize.h" |
23 #include "src/store-buffer.h" | 24 #include "src/store-buffer.h" |
24 | 25 |
| 26 |
25 namespace v8 { | 27 namespace v8 { |
26 namespace internal { | 28 namespace internal { |
27 | 29 |
28 V8_DECLARE_ONCE(init_once); | 30 V8_DECLARE_ONCE(init_once); |
29 | 31 |
30 v8::ArrayBuffer::Allocator* V8::array_buffer_allocator_ = NULL; | 32 v8::ArrayBuffer::Allocator* V8::array_buffer_allocator_ = NULL; |
31 v8::Platform* V8::platform_ = NULL; | 33 v8::Platform* V8::platform_ = NULL; |
32 | 34 |
33 | 35 |
34 bool V8::Initialize(Deserializer* des) { | 36 bool V8::Initialize(Deserializer* des) { |
35 InitializeOncePerProcess(); | 37 InitializeOncePerProcess(); |
36 Isolate* isolate = Isolate::UncheckedCurrent(); | 38 Isolate* isolate = Isolate::UncheckedCurrent(); |
37 if (isolate == NULL) return true; | 39 if (isolate == NULL) return true; |
38 if (isolate->IsDead()) return false; | 40 if (isolate->IsDead()) return false; |
39 if (isolate->IsInitialized()) return true; | 41 if (isolate->IsInitialized()) return true; |
40 | 42 |
41 return isolate->Init(des); | 43 return isolate->Init(des); |
42 } | 44 } |
43 | 45 |
44 | 46 |
45 void V8::TearDown() { | 47 void V8::TearDown() { |
46 Bootstrapper::TearDownExtensions(); | 48 Bootstrapper::TearDownExtensions(); |
47 ElementsAccessor::TearDown(); | 49 ElementsAccessor::TearDown(); |
48 LOperand::TearDownCaches(); | 50 LOperand::TearDownCaches(); |
| 51 compiler::InstructionOperand::TearDownCaches(); |
49 ExternalReference::TearDownMathExpData(); | 52 ExternalReference::TearDownMathExpData(); |
50 RegisteredExtension::UnregisterAll(); | 53 RegisteredExtension::UnregisterAll(); |
51 Isolate::GlobalTearDown(); | 54 Isolate::GlobalTearDown(); |
52 | 55 |
53 Sampler::TearDown(); | 56 Sampler::TearDown(); |
54 } | 57 } |
55 | 58 |
56 | 59 |
57 void V8::SetReturnAddressLocationResolver( | 60 void V8::SetReturnAddressLocationResolver( |
58 ReturnAddressLocationResolver resolver) { | 61 ReturnAddressLocationResolver resolver) { |
(...skipping 21 matching lines...) Expand all Loading... |
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(); |
89 LOperand::SetUpCaches(); | 92 LOperand::SetUpCaches(); |
| 93 compiler::InstructionOperand::SetUpCaches(); |
90 SetUpJSCallerSavedCodeData(); | 94 SetUpJSCallerSavedCodeData(); |
91 ExternalReference::SetUp(); | 95 ExternalReference::SetUp(); |
92 Bootstrapper::InitializeOncePerProcess(); | 96 Bootstrapper::InitializeOncePerProcess(); |
93 } | 97 } |
94 | 98 |
95 | 99 |
96 void V8::InitializeOncePerProcess() { | 100 void V8::InitializeOncePerProcess() { |
97 base::CallOnce(&init_once, &InitializeOncePerProcessImpl); | 101 base::CallOnce(&init_once, &InitializeOncePerProcessImpl); |
98 } | 102 } |
99 | 103 |
(...skipping 10 matching lines...) Expand all Loading... |
110 platform_ = NULL; | 114 platform_ = NULL; |
111 } | 115 } |
112 | 116 |
113 | 117 |
114 v8::Platform* V8::GetCurrentPlatform() { | 118 v8::Platform* V8::GetCurrentPlatform() { |
115 ASSERT(platform_); | 119 ASSERT(platform_); |
116 return platform_; | 120 return platform_; |
117 } | 121 } |
118 | 122 |
119 } } // namespace v8::internal | 123 } } // namespace v8::internal |
OLD | NEW |