| OLD | NEW |
| 1 // Copyright 2006-2009 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 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 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 "simulator.h" | 33 #include "simulator.h" |
| 34 #include "stub-cache.h" | 34 #include "stub-cache.h" |
| 35 #include "heap-profiler.h" |
| 35 #include "oprofile-agent.h" | 36 #include "oprofile-agent.h" |
| 36 #include "log.h" | 37 #include "log.h" |
| 37 | 38 |
| 38 namespace v8 { | 39 namespace v8 { |
| 39 namespace internal { | 40 namespace internal { |
| 40 | 41 |
| 41 bool V8::is_running_ = false; | 42 bool V8::is_running_ = false; |
| 42 bool V8::has_been_setup_ = false; | 43 bool V8::has_been_setup_ = false; |
| 43 bool V8::has_been_disposed_ = false; | 44 bool V8::has_been_disposed_ = false; |
| 44 bool V8::has_fatal_error_ = false; | 45 bool V8::has_fatal_error_ = false; |
| 45 | 46 |
| 46 bool V8::Initialize(Deserializer* des) { | 47 bool V8::Initialize(Deserializer* des) { |
| 47 bool create_heap_objects = des == NULL; | 48 bool create_heap_objects = des == NULL; |
| 48 if (has_been_disposed_ || has_fatal_error_) return false; | 49 if (has_been_disposed_ || has_fatal_error_) return false; |
| 49 if (IsRunning()) return true; | 50 if (IsRunning()) return true; |
| 50 | 51 |
| 51 is_running_ = true; | 52 is_running_ = true; |
| 52 has_been_setup_ = true; | 53 has_been_setup_ = true; |
| 53 has_fatal_error_ = false; | 54 has_fatal_error_ = false; |
| 54 has_been_disposed_ = false; | 55 has_been_disposed_ = false; |
| 55 #ifdef DEBUG | 56 #ifdef DEBUG |
| 56 // The initialization process does not handle memory exhaustion. | 57 // The initialization process does not handle memory exhaustion. |
| 57 DisallowAllocationFailure disallow_allocation_failure; | 58 DisallowAllocationFailure disallow_allocation_failure; |
| 58 #endif | 59 #endif |
| 59 | 60 |
| 60 // Enable logging before setting up the heap | 61 // Enable logging before setting up the heap |
| 61 Logger::Setup(); | 62 Logger::Setup(); |
| 62 | 63 |
| 63 CpuProfiler::Setup(); | 64 CpuProfiler::Setup(); |
| 65 HeapProfiler::Setup(); |
| 64 | 66 |
| 65 // Setup the platform OS support. | 67 // Setup the platform OS support. |
| 66 OS::Setup(); | 68 OS::Setup(); |
| 67 | 69 |
| 68 // Initialize other runtime facilities | 70 // Initialize other runtime facilities |
| 69 #if !V8_HOST_ARCH_ARM && V8_TARGET_ARCH_ARM | 71 #if !V8_HOST_ARCH_ARM && V8_TARGET_ARCH_ARM |
| 70 ::assembler::arm::Simulator::Initialize(); | 72 ::assembler::arm::Simulator::Initialize(); |
| 71 #endif | 73 #endif |
| 72 | 74 |
| 73 { // NOLINT | 75 { // NOLINT |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 if (FLAG_preemption) { | 144 if (FLAG_preemption) { |
| 143 v8::Locker locker; | 145 v8::Locker locker; |
| 144 v8::Locker::StopPreemption(); | 146 v8::Locker::StopPreemption(); |
| 145 } | 147 } |
| 146 | 148 |
| 147 Builtins::TearDown(); | 149 Builtins::TearDown(); |
| 148 Bootstrapper::TearDown(); | 150 Bootstrapper::TearDown(); |
| 149 | 151 |
| 150 Top::TearDown(); | 152 Top::TearDown(); |
| 151 | 153 |
| 154 HeapProfiler::TearDown(); |
| 155 |
| 152 CpuProfiler::TearDown(); | 156 CpuProfiler::TearDown(); |
| 153 | 157 |
| 154 Heap::TearDown(); | 158 Heap::TearDown(); |
| 155 | 159 |
| 156 Logger::TearDown(); | 160 Logger::TearDown(); |
| 157 | 161 |
| 158 is_running_ = false; | 162 is_running_ = false; |
| 159 has_been_disposed_ = true; | 163 has_been_disposed_ = true; |
| 160 } | 164 } |
| 161 | 165 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 219 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
| 216 const double binary_million = 1048576.0; | 220 const double binary_million = 1048576.0; |
| 217 r->double_value = binary_million; | 221 r->double_value = binary_million; |
| 218 r->uint64_t_value |= random_bits; | 222 r->uint64_t_value |= random_bits; |
| 219 r->double_value -= binary_million; | 223 r->double_value -= binary_million; |
| 220 | 224 |
| 221 return heap_number; | 225 return heap_number; |
| 222 } | 226 } |
| 223 | 227 |
| 224 } } // namespace v8::internal | 228 } } // namespace v8::internal |
| OLD | NEW |