Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "bootstrapper.h" | 30 #include "bootstrapper.h" |
| 31 #include "debug.h" | 31 #include "debug.h" |
| 32 #include "serialize.h" | 32 #include "serialize.h" |
| 33 #include "stub-cache.h" | 33 #include "stub-cache.h" |
| 34 #include "oprofile-agent.h" | 34 #include "oprofile-agent.h" |
| 35 | 35 |
| 36 #if V8_TARGET_ARCH_ARM | |
| 37 #include "arm/simulator-arm.h" | |
| 38 #endif | |
| 39 | |
| 36 namespace v8 { | 40 namespace v8 { |
| 37 namespace internal { | 41 namespace internal { |
| 38 | 42 |
| 39 bool V8::is_running_ = false; | 43 bool V8::is_running_ = false; |
| 40 bool V8::has_been_setup_ = false; | 44 bool V8::has_been_setup_ = false; |
| 41 bool V8::has_been_disposed_ = false; | 45 bool V8::has_been_disposed_ = false; |
| 42 bool V8::has_fatal_error_ = false; | 46 bool V8::has_fatal_error_ = false; |
| 43 | 47 |
| 44 bool V8::Initialize(Deserializer *des) { | 48 bool V8::Initialize(Deserializer *des) { |
| 45 bool create_heap_objects = des == NULL; | 49 bool create_heap_objects = des == NULL; |
| 46 if (has_been_disposed_ || has_fatal_error_) return false; | 50 if (has_been_disposed_ || has_fatal_error_) return false; |
| 47 if (IsRunning()) return true; | 51 if (IsRunning()) return true; |
| 48 | 52 |
| 49 is_running_ = true; | 53 is_running_ = true; |
| 50 has_been_setup_ = true; | 54 has_been_setup_ = true; |
| 51 has_fatal_error_ = false; | 55 has_fatal_error_ = false; |
| 52 has_been_disposed_ = false; | 56 has_been_disposed_ = false; |
| 53 #ifdef DEBUG | 57 #ifdef DEBUG |
| 54 // The initialization process does not handle memory exhaustion. | 58 // The initialization process does not handle memory exhaustion. |
| 55 DisallowAllocationFailure disallow_allocation_failure; | 59 DisallowAllocationFailure disallow_allocation_failure; |
| 56 #endif | 60 #endif |
| 57 | 61 |
| 58 // Enable logging before setting up the heap | 62 // Enable logging before setting up the heap |
| 59 Logger::Setup(); | 63 Logger::Setup(); |
| 60 if (des) des->GetLog(); | 64 if (des) des->GetLog(); |
| 61 | 65 |
| 62 // Setup the platform OS support. | 66 // Setup the platform OS support. |
| 63 OS::Setup(); | 67 OS::Setup(); |
| 64 | 68 |
| 69 // Initialize other runtime facilities | |
| 70 #if !defined(__arm__) && V8_TARGET_ARCH_ARM | |
|
iposva
2009/06/08 21:48:41
For consistency we should start using V8_HOST_ARCH
Erik Corry
2009/06/09 09:27:00
done.
| |
| 71 ::assembler::arm::Simulator::Initialize(); | |
| 72 #endif | |
| 73 | |
| 65 // Setup the object heap | 74 // Setup the object heap |
| 66 ASSERT(!Heap::HasBeenSetup()); | 75 ASSERT(!Heap::HasBeenSetup()); |
| 67 if (!Heap::Setup(create_heap_objects)) { | 76 if (!Heap::Setup(create_heap_objects)) { |
| 68 SetFatalError(); | 77 SetFatalError(); |
| 69 return false; | 78 return false; |
| 70 } | 79 } |
| 71 | 80 |
| 72 // Initialize other runtime facilities | |
| 73 Bootstrapper::Initialize(create_heap_objects); | 81 Bootstrapper::Initialize(create_heap_objects); |
| 74 Builtins::Setup(create_heap_objects); | 82 Builtins::Setup(create_heap_objects); |
| 75 Top::Initialize(); | 83 Top::Initialize(); |
| 76 | 84 |
| 77 if (FLAG_preemption) { | 85 if (FLAG_preemption) { |
| 78 v8::Locker locker; | 86 v8::Locker locker; |
| 79 v8::Locker::StartPreemption(100); | 87 v8::Locker::StartPreemption(100); |
| 80 } | 88 } |
| 81 | 89 |
| 82 #ifdef ENABLE_DEBUGGER_SUPPORT | 90 #ifdef ENABLE_DEBUGGER_SUPPORT |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 | 132 |
| 125 Heap::TearDown(); | 133 Heap::TearDown(); |
| 126 Logger::TearDown(); | 134 Logger::TearDown(); |
| 127 | 135 |
| 128 is_running_ = false; | 136 is_running_ = false; |
| 129 has_been_disposed_ = true; | 137 has_been_disposed_ = true; |
| 130 } | 138 } |
| 131 | 139 |
| 132 | 140 |
| 133 } } // namespace v8::internal | 141 } } // namespace v8::internal |
| OLD | NEW |