| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #include "assembler.h" | 7 #include "assembler.h" |
| 8 #include "isolate.h" | 8 #include "isolate.h" |
| 9 #include "elements.h" | 9 #include "elements.h" |
| 10 #include "bootstrapper.h" | 10 #include "bootstrapper.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 platform->SetThreadPoolSize(isolate->max_available_threads()); | 46 platform->SetThreadPoolSize(isolate->max_available_threads()); |
| 47 // We currently only start the threads early, if we know that we'll use them. | 47 // We currently only start the threads early, if we know that we'll use them. |
| 48 if (FLAG_job_based_sweeping) platform->EnsureInitialized(); | 48 if (FLAG_job_based_sweeping) platform->EnsureInitialized(); |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 return isolate->Init(des); | 51 return isolate->Init(des); |
| 52 } | 52 } |
| 53 | 53 |
| 54 | 54 |
| 55 void V8::TearDown() { | 55 void V8::TearDown() { |
| 56 Isolate* isolate = Isolate::Current(); | |
| 57 ASSERT(isolate->IsDefaultIsolate()); | |
| 58 if (!isolate->IsInitialized()) return; | |
| 59 | |
| 60 // The isolate has to be torn down before clearing the LOperand | |
| 61 // caches so that the optimizing compiler thread (if running) | |
| 62 // doesn't see an inconsistent view of the lithium instructions. | |
| 63 isolate->TearDown(); | |
| 64 delete isolate; | |
| 65 | |
| 66 Bootstrapper::TearDownExtensions(); | 56 Bootstrapper::TearDownExtensions(); |
| 67 ElementsAccessor::TearDown(); | 57 ElementsAccessor::TearDown(); |
| 68 LOperand::TearDownCaches(); | 58 LOperand::TearDownCaches(); |
| 69 ExternalReference::TearDownMathExpData(); | 59 ExternalReference::TearDownMathExpData(); |
| 70 RegisteredExtension::UnregisterAll(); | 60 RegisteredExtension::UnregisterAll(); |
| 71 Isolate::GlobalTearDown(); | 61 Isolate::GlobalTearDown(); |
| 72 | 62 |
| 73 Sampler::TearDown(); | 63 Sampler::TearDown(); |
| 74 Serializer::TearDown(); | 64 Serializer::TearDown(); |
| 75 | 65 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 platform_ = NULL; | 131 platform_ = NULL; |
| 142 } | 132 } |
| 143 | 133 |
| 144 | 134 |
| 145 v8::Platform* V8::GetCurrentPlatform() { | 135 v8::Platform* V8::GetCurrentPlatform() { |
| 146 ASSERT(platform_); | 136 ASSERT(platform_); |
| 147 return platform_; | 137 return platform_; |
| 148 } | 138 } |
| 149 | 139 |
| 150 } } // namespace v8::internal | 140 } } // namespace v8::internal |
| OLD | NEW |