svenpanne@chromium.org | b1df11d | 2012-02-08 10:26:21 +0000 | [diff] [blame] | 1 | // Copyright 2012 the V8 project authors. All rights reserved. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | #include "v8.h" |
| 29 | |
fschneider@chromium.org | 7d10be5 | 2012-04-10 12:30:14 +0000 | [diff] [blame] | 30 | #include "assembler.h" |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 31 | #include "isolate.h" |
kmillikin@chromium.org | 7c2628c | 2011-08-10 11:27:35 +0000 | [diff] [blame] | 32 | #include "elements.h" |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 33 | #include "bootstrapper.h" |
| 34 | #include "debug.h" |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 35 | #include "deoptimizer.h" |
fschneider@chromium.org | 7d10be5 | 2012-04-10 12:30:14 +0000 | [diff] [blame] | 36 | #include "frames.h" |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 37 | #include "heap-profiler.h" |
| 38 | #include "hydrogen.h" |
| 39 | #include "lithium-allocator.h" |
| 40 | #include "log.h" |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 41 | #include "objects.h" |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 42 | #include "once.h" |
| 43 | #include "platform.h" |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 44 | #include "runtime-profiler.h" |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 45 | #include "serialize.h" |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 46 | #include "store-buffer.h" |
ager@chromium.org | eadaf22 | 2009-06-16 09:43:10 +0000 | [diff] [blame] | 47 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 48 | namespace v8 { |
| 49 | namespace internal { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 50 | |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 51 | V8_DECLARE_ONCE(init_once); |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 52 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 53 | bool V8::is_running_ = false; |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 54 | bool V8::has_been_set_up_ = false; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 55 | bool V8::has_been_disposed_ = false; |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 56 | bool V8::has_fatal_error_ = false; |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 57 | bool V8::use_crankshaft_ = true; |
rossberg@chromium.org | fab1498 | 2012-01-05 15:02:15 +0000 | [diff] [blame] | 58 | List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 59 | |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 60 | static LazyMutex entropy_mutex = LAZY_MUTEX_INITIALIZER; |
| 61 | |
svenpanne@chromium.org | 84bcc55 | 2011-07-18 09:50:57 +0000 | [diff] [blame] | 62 | static EntropySource entropy_source; |
| 63 | |
erik.corry@gmail.com | 4a6c327 | 2010-11-18 12:04:40 +0000 | [diff] [blame] | 64 | |
whesse@chromium.org | cec079d | 2010-03-22 14:44:04 +0000 | [diff] [blame] | 65 | bool V8::Initialize(Deserializer* des) { |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 66 | InitializeOncePerProcess(); |
| 67 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 68 | // The current thread may not yet had entered an isolate to run. |
| 69 | // Note the Isolate::Current() may be non-null because for various |
| 70 | // initialization purposes an initializing thread may be assigned an isolate |
| 71 | // but not actually enter it. |
| 72 | if (i::Isolate::CurrentPerIsolateThreadData() == NULL) { |
| 73 | i::Isolate::EnterDefaultIsolate(); |
| 74 | } |
| 75 | |
| 76 | ASSERT(i::Isolate::CurrentPerIsolateThreadData() != NULL); |
ager@chromium.org | a9aa5fa | 2011-04-13 08:46:07 +0000 | [diff] [blame] | 77 | ASSERT(i::Isolate::CurrentPerIsolateThreadData()->thread_id().Equals( |
| 78 | i::ThreadId::Current())); |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 79 | ASSERT(i::Isolate::CurrentPerIsolateThreadData()->isolate() == |
| 80 | i::Isolate::Current()); |
| 81 | |
| 82 | if (IsDead()) return false; |
| 83 | |
| 84 | Isolate* isolate = Isolate::Current(); |
| 85 | if (isolate->IsInitialized()) return true; |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 86 | |
| 87 | is_running_ = true; |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 88 | has_been_set_up_ = true; |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 89 | has_fatal_error_ = false; |
| 90 | has_been_disposed_ = false; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 91 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 92 | return isolate->Init(des); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 93 | } |
| 94 | |
| 95 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 96 | void V8::SetFatalError() { |
| 97 | is_running_ = false; |
| 98 | has_fatal_error_ = true; |
| 99 | } |
| 100 | |
| 101 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 102 | void V8::TearDown() { |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 103 | Isolate* isolate = Isolate::Current(); |
| 104 | ASSERT(isolate->IsDefaultIsolate()); |
| 105 | |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 106 | if (!has_been_set_up_ || has_been_disposed_) return; |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 107 | |
yangguo@chromium.org | 304cc33 | 2012-07-24 07:59:48 +0000 | [diff] [blame] | 108 | // The isolate has to be torn down before clearing the LOperand |
| 109 | // caches so that the optimizing compiler thread (if running) |
| 110 | // doesn't see an inconsistent view of the lithium instructions. |
| 111 | isolate->TearDown(); |
| 112 | delete isolate; |
| 113 | |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 114 | ElementsAccessor::TearDown(); |
| 115 | LOperand::TearDownCaches(); |
danno@chromium.org | 1f34ad3 | 2012-11-26 14:53:56 +0000 | [diff] [blame] | 116 | ExternalReference::TearDownMathExpData(); |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 117 | RegisteredExtension::UnregisterAll(); |
hpayer@chromium.org | 7c3372b | 2013-02-13 17:26:04 +0000 | [diff] [blame] | 118 | Isolate::GlobalTearDown(); |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 119 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 120 | is_running_ = false; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 121 | has_been_disposed_ = true; |
rossberg@chromium.org | fab1498 | 2012-01-05 15:02:15 +0000 | [diff] [blame] | 122 | |
| 123 | delete call_completed_callbacks_; |
| 124 | call_completed_callbacks_ = NULL; |
erik.corry@gmail.com | ed49e96 | 2012-04-17 11:57:53 +0000 | [diff] [blame] | 125 | |
| 126 | OS::TearDown(); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 127 | } |
| 128 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 129 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 130 | static void seed_random(uint32_t* state) { |
| 131 | for (int i = 0; i < 2; ++i) { |
svenpanne@chromium.org | 84bcc55 | 2011-07-18 09:50:57 +0000 | [diff] [blame] | 132 | if (FLAG_random_seed != 0) { |
| 133 | state[i] = FLAG_random_seed; |
| 134 | } else if (entropy_source != NULL) { |
| 135 | uint32_t val; |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 136 | ScopedLock lock(entropy_mutex.Pointer()); |
svenpanne@chromium.org | 84bcc55 | 2011-07-18 09:50:57 +0000 | [diff] [blame] | 137 | entropy_source(reinterpret_cast<unsigned char*>(&val), sizeof(uint32_t)); |
| 138 | state[i] = val; |
| 139 | } else { |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 140 | state[i] = random(); |
| 141 | } |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 142 | } |
sgjesse@chromium.org | df7a284 | 2010-03-25 14:34:15 +0000 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | |
erik.corry@gmail.com | 4a6c327 | 2010-11-18 12:04:40 +0000 | [diff] [blame] | 146 | // Random number generator using George Marsaglia's MWC algorithm. |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 147 | static uint32_t random_base(uint32_t* state) { |
| 148 | // Initialize seed using the system random(). |
| 149 | // No non-zero seed will ever become zero again. |
| 150 | if (state[0] == 0) seed_random(state); |
ager@chromium.org | eadaf22 | 2009-06-16 09:43:10 +0000 | [diff] [blame] | 151 | |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 152 | // Mix the bits. Never replaces state[i] with 0 if it is nonzero. |
| 153 | state[0] = 18273 * (state[0] & 0xFFFF) + (state[0] >> 16); |
| 154 | state[1] = 36969 * (state[1] & 0xFFFF) + (state[1] >> 16); |
| 155 | |
| 156 | return (state[0] << 14) + (state[1] & 0x3FFFF); |
erik.corry@gmail.com | 4a6c327 | 2010-11-18 12:04:40 +0000 | [diff] [blame] | 157 | } |
| 158 | |
| 159 | |
svenpanne@chromium.org | 84bcc55 | 2011-07-18 09:50:57 +0000 | [diff] [blame] | 160 | void V8::SetEntropySource(EntropySource source) { |
| 161 | entropy_source = source; |
| 162 | } |
| 163 | |
| 164 | |
ulan@chromium.org | 967e270 | 2012-02-28 09:49:15 +0000 | [diff] [blame] | 165 | void V8::SetReturnAddressLocationResolver( |
| 166 | ReturnAddressLocationResolver resolver) { |
| 167 | StackFrame::SetReturnAddressLocationResolver(resolver); |
| 168 | } |
| 169 | |
| 170 | |
erik.corry@gmail.com | 4a6c327 | 2010-11-18 12:04:40 +0000 | [diff] [blame] | 171 | // Used by JavaScript APIs |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 172 | uint32_t V8::Random(Context* context) { |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 173 | ASSERT(context->IsNativeContext()); |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 174 | ByteArray* seed = context->random_seed(); |
| 175 | return random_base(reinterpret_cast<uint32_t*>(seed->GetDataStartAddress())); |
erik.corry@gmail.com | 4a6c327 | 2010-11-18 12:04:40 +0000 | [diff] [blame] | 176 | } |
| 177 | |
| 178 | |
| 179 | // Used internally by the JIT and memory allocator for security |
| 180 | // purposes. So, we keep a different state to prevent informations |
| 181 | // leaks that could be used in an exploit. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 182 | uint32_t V8::RandomPrivate(Isolate* isolate) { |
| 183 | ASSERT(isolate == Isolate::Current()); |
ricow@chromium.org | 4f693d6 | 2011-07-04 14:01:31 +0000 | [diff] [blame] | 184 | return random_base(isolate->private_random_seed()); |
ager@chromium.org | eadaf22 | 2009-06-16 09:43:10 +0000 | [diff] [blame] | 185 | } |
| 186 | |
sgjesse@chromium.org | c81c894 | 2009-08-21 10:54:26 +0000 | [diff] [blame] | 187 | |
svenpanne@chromium.org | ecb9dd6 | 2011-12-01 08:22:35 +0000 | [diff] [blame] | 188 | bool V8::IdleNotification(int hint) { |
sgjesse@chromium.org | c514574 | 2009-10-07 09:00:33 +0000 | [diff] [blame] | 189 | // Returning true tells the caller that there is no need to call |
| 190 | // IdleNotification again. |
| 191 | if (!FLAG_use_idle_notification) return true; |
ager@chromium.org | add848f | 2009-08-13 12:44:13 +0000 | [diff] [blame] | 192 | |
ager@chromium.org | ab99eea | 2009-08-25 07:05:41 +0000 | [diff] [blame] | 193 | // Tell the heap that it may want to adjust. |
svenpanne@chromium.org | ecb9dd6 | 2011-12-01 08:22:35 +0000 | [diff] [blame] | 194 | return HEAP->IdleNotification(hint); |
ager@chromium.org | add848f | 2009-08-13 12:44:13 +0000 | [diff] [blame] | 195 | } |
| 196 | |
ager@chromium.org | eadaf22 | 2009-06-16 09:43:10 +0000 | [diff] [blame] | 197 | |
rossberg@chromium.org | fab1498 | 2012-01-05 15:02:15 +0000 | [diff] [blame] | 198 | void V8::AddCallCompletedCallback(CallCompletedCallback callback) { |
| 199 | if (call_completed_callbacks_ == NULL) { // Lazy init. |
| 200 | call_completed_callbacks_ = new List<CallCompletedCallback>(); |
| 201 | } |
| 202 | for (int i = 0; i < call_completed_callbacks_->length(); i++) { |
| 203 | if (callback == call_completed_callbacks_->at(i)) return; |
| 204 | } |
| 205 | call_completed_callbacks_->Add(callback); |
| 206 | } |
| 207 | |
| 208 | |
| 209 | void V8::RemoveCallCompletedCallback(CallCompletedCallback callback) { |
| 210 | if (call_completed_callbacks_ == NULL) return; |
| 211 | for (int i = 0; i < call_completed_callbacks_->length(); i++) { |
| 212 | if (callback == call_completed_callbacks_->at(i)) { |
| 213 | call_completed_callbacks_->Remove(i); |
| 214 | } |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | |
| 219 | void V8::FireCallCompletedCallback(Isolate* isolate) { |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 220 | bool has_call_completed_callbacks = call_completed_callbacks_ != NULL; |
| 221 | bool observer_delivery_pending = |
| 222 | FLAG_harmony_observation && isolate->observer_delivery_pending(); |
| 223 | if (!has_call_completed_callbacks && !observer_delivery_pending) return; |
rossberg@chromium.org | fab1498 | 2012-01-05 15:02:15 +0000 | [diff] [blame] | 224 | HandleScopeImplementer* handle_scope_implementer = |
| 225 | isolate->handle_scope_implementer(); |
| 226 | if (!handle_scope_implementer->CallDepthIsZero()) return; |
| 227 | // Fire callbacks. Increase call depth to prevent recursive callbacks. |
| 228 | handle_scope_implementer->IncrementCallDepth(); |
mvstanton@chromium.org | e4ac3ef | 2012-11-12 14:53:34 +0000 | [diff] [blame] | 229 | if (observer_delivery_pending) { |
| 230 | JSObject::DeliverChangeRecords(isolate); |
| 231 | } |
| 232 | if (has_call_completed_callbacks) { |
| 233 | for (int i = 0; i < call_completed_callbacks_->length(); i++) { |
| 234 | call_completed_callbacks_->at(i)(); |
| 235 | } |
rossberg@chromium.org | fab1498 | 2012-01-05 15:02:15 +0000 | [diff] [blame] | 236 | } |
| 237 | handle_scope_implementer->DecrementCallDepth(); |
| 238 | } |
| 239 | |
| 240 | |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 241 | // Use a union type to avoid type-aliasing optimizations in GCC. |
| 242 | typedef union { |
| 243 | double double_value; |
| 244 | uint64_t uint64_t_value; |
| 245 | } double_int_union; |
| 246 | |
| 247 | |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 248 | Object* V8::FillHeapNumberWithRandom(Object* heap_number, |
| 249 | Context* context) { |
erik.corry@gmail.com | bbceb57 | 2012-03-09 10:52:05 +0000 | [diff] [blame] | 250 | double_int_union r; |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 251 | uint64_t random_bits = Random(context); |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 252 | // Convert 32 random bits to 0.(32 random bits) in a double |
| 253 | // by computing: |
| 254 | // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
erik.corry@gmail.com | bbceb57 | 2012-03-09 10:52:05 +0000 | [diff] [blame] | 255 | static const double binary_million = 1048576.0; |
| 256 | r.double_value = binary_million; |
| 257 | r.uint64_t_value |= random_bits; |
| 258 | r.double_value -= binary_million; |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 259 | |
erik.corry@gmail.com | bbceb57 | 2012-03-09 10:52:05 +0000 | [diff] [blame] | 260 | HeapNumber::cast(heap_number)->set_value(r.double_value); |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 261 | return heap_number; |
ager@chromium.org | eadaf22 | 2009-06-16 09:43:10 +0000 | [diff] [blame] | 262 | } |
| 263 | |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 264 | void V8::InitializeOncePerProcessImpl() { |
yangguo@chromium.org | 28381b4 | 2013-01-21 14:39:38 +0000 | [diff] [blame] | 265 | FlagList::EnforceFlagImplications(); |
rossberg@chromium.org | b4b2aa6 | 2011-10-13 09:49:59 +0000 | [diff] [blame] | 266 | if (FLAG_stress_compaction) { |
| 267 | FLAG_force_marking_deque_overflows = true; |
| 268 | FLAG_gc_global = true; |
| 269 | FLAG_max_new_space_size = (1 << (kPageSizeBits - 10)) * 2; |
| 270 | } |
yangguo@chromium.org | 28381b4 | 2013-01-21 14:39:38 +0000 | [diff] [blame] | 271 | OS::SetUp(); |
| 272 | CPU::SetUp(); |
| 273 | use_crankshaft_ = FLAG_crankshaft |
| 274 | && !Serializer::enabled() |
| 275 | && CPU::SupportsCrankshaft(); |
| 276 | OS::PostSetUp(); |
| 277 | RuntimeProfiler::GlobalSetUp(); |
| 278 | ElementsAccessor::InitializeOncePerProcess(); |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 279 | LOperand::SetUpCaches(); |
fschneider@chromium.org | 7d10be5 | 2012-04-10 12:30:14 +0000 | [diff] [blame] | 280 | SetUpJSCallerSavedCodeData(); |
| 281 | SamplerRegistry::SetUp(); |
| 282 | ExternalReference::SetUp(); |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 283 | } |
| 284 | |
| 285 | void V8::InitializeOncePerProcess() { |
| 286 | CallOnce(&init_once, &InitializeOncePerProcessImpl); |
kmillikin@chromium.org | c36ce6e | 2011-04-04 08:25:31 +0000 | [diff] [blame] | 287 | } |
| 288 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 289 | } } // namespace v8::internal |