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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 i::Isolate::Current()); | 72 i::Isolate::Current()); |
73 | 73 |
74 Isolate* isolate = Isolate::Current(); | 74 Isolate* isolate = Isolate::Current(); |
75 if (isolate->IsDead()) return false; | 75 if (isolate->IsDead()) return false; |
76 if (isolate->IsInitialized()) return true; | 76 if (isolate->IsInitialized()) return true; |
77 | 77 |
78 return isolate->Init(des); | 78 return isolate->Init(des); |
79 } | 79 } |
80 | 80 |
81 | 81 |
82 bool V8::TearDown() { | 82 void V8::TearDown() { |
83 Isolate* isolate = Isolate::UncheckedCurrent(); | 83 Isolate* isolate = Isolate::Current(); |
84 if (isolate != NULL) { | 84 ASSERT(isolate->IsDefaultIsolate()); |
85 ASSERT(isolate->IsDefaultIsolate()); | 85 if (!isolate->IsInitialized()) return; |
86 if (isolate->IsInitialized()) isolate->TearDown(); | |
87 delete isolate; | |
88 } | |
89 | 86 |
90 // V8 was never initialized, nothing to do. | 87 // The isolate has to be torn down before clearing the LOperand |
91 if (Acquire_Load(&init_once) == ONCE_STATE_UNINITIALIZED) return true; | |
92 | |
93 // TODO(dcarney): Everything below this should be in some sort of mutex... | |
94 Atomic32 living_isolates = Isolate::GetLivingIsolates(); | |
95 | |
96 // All isolates have to be torn down before clearing the LOperand | |
97 // caches so that the optimizing compiler thread (if running) | 88 // caches so that the optimizing compiler thread (if running) |
98 // doesn't see an inconsistent view of the lithium instructions. | 89 // doesn't see an inconsistent view of the lithium instructions. |
99 if (living_isolates != 0) return false; | 90 isolate->TearDown(); |
| 91 delete isolate; |
100 | 92 |
101 ElementsAccessor::TearDown(); | 93 ElementsAccessor::TearDown(); |
102 LOperand::TearDownCaches(); | 94 LOperand::TearDownCaches(); |
103 ExternalReference::TearDownMathExpData(); | 95 ExternalReference::TearDownMathExpData(); |
104 RegisteredExtension::UnregisterAll(); | 96 RegisteredExtension::UnregisterAll(); |
105 Isolate::GlobalTearDown(); | 97 Isolate::GlobalTearDown(); |
106 | 98 |
107 delete call_completed_callbacks_; | 99 delete call_completed_callbacks_; |
108 call_completed_callbacks_ = NULL; | 100 call_completed_callbacks_ = NULL; |
109 | 101 |
110 Sampler::TearDown(); | 102 Sampler::TearDown(); |
111 return true; | |
112 } | 103 } |
113 | 104 |
114 | 105 |
115 void V8::SetReturnAddressLocationResolver( | 106 void V8::SetReturnAddressLocationResolver( |
116 ReturnAddressLocationResolver resolver) { | 107 ReturnAddressLocationResolver resolver) { |
117 StackFrame::SetReturnAddressLocationResolver(resolver); | 108 StackFrame::SetReturnAddressLocationResolver(resolver); |
118 } | 109 } |
119 | 110 |
120 | 111 |
121 // Used by JavaScript APIs | 112 // Used by JavaScript APIs |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 ExternalReference::SetUp(); | 242 ExternalReference::SetUp(); |
252 Bootstrapper::InitializeOncePerProcess(); | 243 Bootstrapper::InitializeOncePerProcess(); |
253 } | 244 } |
254 | 245 |
255 | 246 |
256 void V8::InitializeOncePerProcess() { | 247 void V8::InitializeOncePerProcess() { |
257 CallOnce(&init_once, &InitializeOncePerProcessImpl); | 248 CallOnce(&init_once, &InitializeOncePerProcessImpl); |
258 } | 249 } |
259 | 250 |
260 } } // namespace v8::internal | 251 } } // namespace v8::internal |
OLD | NEW |