| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 platform->SetThreadPoolSize(isolate->max_available_threads()); | 70 platform->SetThreadPoolSize(isolate->max_available_threads()); |
| 71 // We currently only start the threads early, if we know that we'll use them. | 71 // We currently only start the threads early, if we know that we'll use them. |
| 72 if (FLAG_job_based_sweeping) platform->EnsureInitialized(); | 72 if (FLAG_job_based_sweeping) platform->EnsureInitialized(); |
| 73 #endif | 73 #endif |
| 74 | 74 |
| 75 return isolate->Init(des); | 75 return isolate->Init(des); |
| 76 } | 76 } |
| 77 | 77 |
| 78 | 78 |
| 79 void V8::TearDown() { | 79 void V8::TearDown() { |
| 80 Isolate* isolate = Isolate::Current(); | |
| 81 ASSERT(isolate->IsDefaultIsolate()); | |
| 82 if (!isolate->IsInitialized()) return; | |
| 83 | |
| 84 // The isolate has to be torn down before clearing the LOperand | |
| 85 // caches so that the optimizing compiler thread (if running) | |
| 86 // doesn't see an inconsistent view of the lithium instructions. | |
| 87 isolate->TearDown(); | |
| 88 delete isolate; | |
| 89 | |
| 90 Bootstrapper::TearDownExtensions(); | 80 Bootstrapper::TearDownExtensions(); |
| 91 ElementsAccessor::TearDown(); | 81 ElementsAccessor::TearDown(); |
| 92 LOperand::TearDownCaches(); | 82 LOperand::TearDownCaches(); |
| 93 ExternalReference::TearDownMathExpData(); | 83 ExternalReference::TearDownMathExpData(); |
| 94 RegisteredExtension::UnregisterAll(); | 84 RegisteredExtension::UnregisterAll(); |
| 95 Isolate::GlobalTearDown(); | 85 Isolate::GlobalTearDown(); |
| 96 | 86 |
| 97 delete call_completed_callbacks_; | 87 delete call_completed_callbacks_; |
| 98 call_completed_callbacks_ = NULL; | 88 call_completed_callbacks_ = NULL; |
| 99 | 89 |
| 100 Sampler::TearDown(); | 90 Sampler::TearDown(); |
| 101 Serializer::TearDown(); | |
| 102 | 91 |
| 103 #ifdef V8_USE_DEFAULT_PLATFORM | 92 #ifdef V8_USE_DEFAULT_PLATFORM |
| 104 DefaultPlatform* platform = static_cast<DefaultPlatform*>(platform_); | 93 DefaultPlatform* platform = static_cast<DefaultPlatform*>(platform_); |
| 105 platform_ = NULL; | 94 platform_ = NULL; |
| 106 delete platform; | 95 delete platform; |
| 107 #endif | 96 #endif |
| 108 } | 97 } |
| 109 | 98 |
| 110 | 99 |
| 111 void V8::SetReturnAddressLocationResolver( | 100 void V8::SetReturnAddressLocationResolver( |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 platform_ = NULL; | 206 platform_ = NULL; |
| 218 } | 207 } |
| 219 | 208 |
| 220 | 209 |
| 221 v8::Platform* V8::GetCurrentPlatform() { | 210 v8::Platform* V8::GetCurrentPlatform() { |
| 222 ASSERT(platform_); | 211 ASSERT(platform_); |
| 223 return platform_; | 212 return platform_; |
| 224 } | 213 } |
| 225 | 214 |
| 226 } } // namespace v8::internal | 215 } } // namespace v8::internal |
| OLD | NEW |