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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 #ifdef DEBUG | 55 #ifdef DEBUG |
56 // The initialization process does not handle memory exhaustion. | 56 // The initialization process does not handle memory exhaustion. |
57 DisallowAllocationFailure disallow_allocation_failure; | 57 DisallowAllocationFailure disallow_allocation_failure; |
58 #endif | 58 #endif |
59 | 59 |
60 // Enable logging before setting up the heap | 60 // Enable logging before setting up the heap |
61 Logger::Setup(); | 61 Logger::Setup(); |
62 | 62 |
63 CpuProfiler::Setup(); | 63 CpuProfiler::Setup(); |
64 | 64 |
65 #ifdef ENABLE_CPP_PROFILES_PROCESSOR | |
66 if (FLAG_prof && FLAG_prof_auto) { | |
67 CpuProfiler::StartProfiling("internal.auto"); | |
68 } | |
69 #endif | |
70 | |
71 // Setup the platform OS support. | 65 // Setup the platform OS support. |
72 OS::Setup(); | 66 OS::Setup(); |
73 | 67 |
74 // Initialize other runtime facilities | 68 // Initialize other runtime facilities |
75 #if !V8_HOST_ARCH_ARM && V8_TARGET_ARCH_ARM | 69 #if !V8_HOST_ARCH_ARM && V8_TARGET_ARCH_ARM |
76 ::assembler::arm::Simulator::Initialize(); | 70 ::assembler::arm::Simulator::Initialize(); |
77 #endif | 71 #endif |
78 | 72 |
79 { // NOLINT | 73 { // NOLINT |
80 // Ensure that the thread has a valid stack guard. The v8::Locker object | 74 // Ensure that the thread has a valid stack guard. The v8::Locker object |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 130 |
137 void V8::SetFatalError() { | 131 void V8::SetFatalError() { |
138 is_running_ = false; | 132 is_running_ = false; |
139 has_fatal_error_ = true; | 133 has_fatal_error_ = true; |
140 } | 134 } |
141 | 135 |
142 | 136 |
143 void V8::TearDown() { | 137 void V8::TearDown() { |
144 if (!has_been_setup_ || has_been_disposed_) return; | 138 if (!has_been_setup_ || has_been_disposed_) return; |
145 | 139 |
146 #ifdef ENABLE_CPP_PROFILES_PROCESSOR | |
147 if (FLAG_prof && FLAG_prof_auto) { | |
148 CpuProfiler::StopProfiling("internal.auto"); | |
149 } | |
150 #endif | |
151 | |
152 OProfileAgent::TearDown(); | 140 OProfileAgent::TearDown(); |
153 | 141 |
154 if (FLAG_preemption) { | 142 if (FLAG_preemption) { |
155 v8::Locker locker; | 143 v8::Locker locker; |
156 v8::Locker::StopPreemption(); | 144 v8::Locker::StopPreemption(); |
157 } | 145 } |
158 | 146 |
159 Builtins::TearDown(); | 147 Builtins::TearDown(); |
160 Bootstrapper::TearDown(); | 148 Bootstrapper::TearDown(); |
161 | 149 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 // Create a random number between 0.0 and 1.0 by putting random bits into | 213 // Create a random number between 0.0 and 1.0 by putting random bits into |
226 // the mantissa of 1.0 and subtracting 1.0. | 214 // the mantissa of 1.0 and subtracting 1.0. |
227 r->double_value = 1.0; | 215 r->double_value = 1.0; |
228 r->uint64_t_value |= (random_bits << 20); | 216 r->uint64_t_value |= (random_bits << 20); |
229 r->double_value -= 1.0; // Force into the range [0.0, 1.0). | 217 r->double_value -= 1.0; // Force into the range [0.0, 1.0). |
230 | 218 |
231 return heap_number; | 219 return heap_number; |
232 } | 220 } |
233 | 221 |
234 } } // namespace v8::internal | 222 } } // namespace v8::internal |
OLD | NEW |