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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 has_fatal_error_ = false; | 53 has_fatal_error_ = false; |
54 has_been_disposed_ = false; | 54 has_been_disposed_ = false; |
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(); |
| 64 |
| 65 #ifdef ENABLE_CPP_PROFILES_PROCESSOR |
| 66 if (FLAG_prof && FLAG_prof_auto) { |
| 67 CpuProfiler::StartProfiling("internal.auto"); |
| 68 } |
| 69 #endif |
| 70 |
63 // Setup the platform OS support. | 71 // Setup the platform OS support. |
64 OS::Setup(); | 72 OS::Setup(); |
65 | 73 |
66 // Initialize other runtime facilities | 74 // Initialize other runtime facilities |
67 #if !V8_HOST_ARCH_ARM && V8_TARGET_ARCH_ARM | 75 #if !V8_HOST_ARCH_ARM && V8_TARGET_ARCH_ARM |
68 ::assembler::arm::Simulator::Initialize(); | 76 ::assembler::arm::Simulator::Initialize(); |
69 #endif | 77 #endif |
70 | 78 |
71 { // NOLINT | 79 { // NOLINT |
72 // Ensure that the thread has a valid stack guard. The v8::Locker object | 80 // 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... |
128 | 136 |
129 void V8::SetFatalError() { | 137 void V8::SetFatalError() { |
130 is_running_ = false; | 138 is_running_ = false; |
131 has_fatal_error_ = true; | 139 has_fatal_error_ = true; |
132 } | 140 } |
133 | 141 |
134 | 142 |
135 void V8::TearDown() { | 143 void V8::TearDown() { |
136 if (!has_been_setup_ || has_been_disposed_) return; | 144 if (!has_been_setup_ || has_been_disposed_) return; |
137 | 145 |
| 146 #ifdef ENABLE_CPP_PROFILES_PROCESSOR |
| 147 if (FLAG_prof && FLAG_prof_auto) { |
| 148 CpuProfiler::StopProfiling("internal.auto"); |
| 149 } |
| 150 #endif |
| 151 |
138 OProfileAgent::TearDown(); | 152 OProfileAgent::TearDown(); |
139 | 153 |
140 if (FLAG_preemption) { | 154 if (FLAG_preemption) { |
141 v8::Locker locker; | 155 v8::Locker locker; |
142 v8::Locker::StopPreemption(); | 156 v8::Locker::StopPreemption(); |
143 } | 157 } |
144 | 158 |
145 Builtins::TearDown(); | 159 Builtins::TearDown(); |
146 Bootstrapper::TearDown(); | 160 Bootstrapper::TearDown(); |
147 | 161 |
148 Top::TearDown(); | 162 Top::TearDown(); |
149 | 163 |
150 Heap::TearDown(); | 164 Heap::TearDown(); |
| 165 |
| 166 CpuProfiler::TearDown(); |
| 167 |
151 Logger::TearDown(); | 168 Logger::TearDown(); |
152 | 169 |
153 is_running_ = false; | 170 is_running_ = false; |
154 has_been_disposed_ = true; | 171 has_been_disposed_ = true; |
155 } | 172 } |
156 | 173 |
157 | 174 |
158 static uint32_t random_seed() { | 175 static uint32_t random_seed() { |
159 if (FLAG_random_seed == 0) { | 176 if (FLAG_random_seed == 0) { |
160 return random(); | 177 return random(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 212 |
196 Smi* V8::RandomPositiveSmi() { | 213 Smi* V8::RandomPositiveSmi() { |
197 uint32_t random = Random(); | 214 uint32_t random = Random(); |
198 ASSERT(static_cast<uint32_t>(Smi::kMaxValue) >= kRandomPositiveSmiMax); | 215 ASSERT(static_cast<uint32_t>(Smi::kMaxValue) >= kRandomPositiveSmiMax); |
199 // kRandomPositiveSmiMax must match the value being divided | 216 // kRandomPositiveSmiMax must match the value being divided |
200 // by in math.js. | 217 // by in math.js. |
201 return Smi::FromInt(random & kRandomPositiveSmiMax); | 218 return Smi::FromInt(random & kRandomPositiveSmiMax); |
202 } | 219 } |
203 | 220 |
204 } } // namespace v8::internal | 221 } } // namespace v8::internal |
OLD | NEW |