| 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 |
| 56 Bootstrapper::TearDownExtensions(); | 66 Bootstrapper::TearDownExtensions(); |
| 57 ElementsAccessor::TearDown(); | 67 ElementsAccessor::TearDown(); |
| 58 LOperand::TearDownCaches(); | 68 LOperand::TearDownCaches(); |
| 59 ExternalReference::TearDownMathExpData(); | 69 ExternalReference::TearDownMathExpData(); |
| 60 RegisteredExtension::UnregisterAll(); | 70 RegisteredExtension::UnregisterAll(); |
| 61 Isolate::GlobalTearDown(); | 71 Isolate::GlobalTearDown(); |
| 62 | 72 |
| 63 Sampler::TearDown(); | 73 Sampler::TearDown(); |
| 64 Serializer::TearDown(); | 74 Serializer::TearDown(); |
| 65 | 75 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 platform_ = NULL; | 141 platform_ = NULL; |
| 132 } | 142 } |
| 133 | 143 |
| 134 | 144 |
| 135 v8::Platform* V8::GetCurrentPlatform() { | 145 v8::Platform* V8::GetCurrentPlatform() { |
| 136 ASSERT(platform_); | 146 ASSERT(platform_); |
| 137 return platform_; | 147 return platform_; |
| 138 } | 148 } |
| 139 | 149 |
| 140 } } // namespace v8::internal | 150 } } // namespace v8::internal |
| OLD | NEW |