Chromium Code Reviews| 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 "src/isolate.h" | 5 #include "src/isolate.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include <fstream> // NOLINT(readability/streams) | 9 #include <fstream> // NOLINT(readability/streams) |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2018 } | 2018 } |
| 2019 | 2019 |
| 2020 | 2020 |
| 2021 Isolate::ThreadDataTable::~ThreadDataTable() { | 2021 Isolate::ThreadDataTable::~ThreadDataTable() { |
| 2022 // TODO(svenpanne) The assertion below would fire if an embedder does not | 2022 // TODO(svenpanne) The assertion below would fire if an embedder does not |
| 2023 // cleanly dispose all Isolates before disposing v8, so we are conservative | 2023 // cleanly dispose all Isolates before disposing v8, so we are conservative |
| 2024 // and leave it out for now. | 2024 // and leave it out for now. |
| 2025 // DCHECK_NULL(list_); | 2025 // DCHECK_NULL(list_); |
| 2026 } | 2026 } |
| 2027 | 2027 |
| 2028 void Isolate::ReleaseManagedLifelines() { | |
| 2029 for (Isolate::ManagedLifeline* current = managed_lifelines_root_.next_; | |
| 2030 current != nullptr;) { | |
| 2031 Isolate::ManagedLifeline* next = current->next_; | |
| 2032 current->Dispose(); | |
| 2033 delete current; | |
|
Eric Holk
2017/02/11 02:19:29
Out of curiosity, would it make sense to just rely
Mircea Trofin
2017/02/11 02:29:32
You mean, instead of a separate Dispose?
Mircea Trofin
2017/02/11 02:29:32
You mean, instead of a separate Dispose?
Eric Holk
2017/02/13 21:55:35
Sure, although I was referring to the Deleter in i
| |
| 2034 current = next; | |
| 2035 } | |
| 2036 } | |
| 2037 | |
| 2038 Isolate::ManagedLifeline* Isolate::RegisterForReleaseAtTeardown( | |
| 2039 void* value, Isolate::ManagedLifeline::Deleter deleter) { | |
| 2040 DCHECK_NOT_NULL(value); | |
| 2041 DCHECK_NOT_NULL(deleter); | |
| 2042 | |
| 2043 Isolate::ManagedLifeline* ret = new Isolate::ManagedLifeline(); | |
| 2044 ret->value_ = value; | |
| 2045 ret->deleter_ = deleter; | |
| 2046 // Insert at head. We keep the head alive for the lifetime of the Isolate | |
| 2047 // because otherwise we can't reset the head, should we delete it before | |
| 2048 // the isolate expires | |
| 2049 Isolate::ManagedLifeline* next = managed_lifelines_root_.next_; | |
| 2050 managed_lifelines_root_.next_ = ret; | |
| 2051 ret->prev_ = &managed_lifelines_root_; | |
| 2052 ret->next_ = next; | |
| 2053 if (next != nullptr) next->prev_ = ret; | |
| 2054 return ret; | |
| 2055 } | |
| 2056 | |
| 2057 void Isolate::UnregisterFromReleaseAtTeardown( | |
| 2058 Isolate::ManagedLifeline*& lifeline) { | |
| 2059 DCHECK_NOT_NULL(lifeline->prev_); | |
| 2060 | |
| 2061 lifeline->prev_->next_ = lifeline->next_; | |
| 2062 if (lifeline->next_ != nullptr) lifeline->next_->prev_ = lifeline->prev_; | |
| 2063 delete lifeline; | |
| 2064 lifeline = nullptr; | |
| 2065 } | |
| 2028 | 2066 |
| 2029 Isolate::PerIsolateThreadData::~PerIsolateThreadData() { | 2067 Isolate::PerIsolateThreadData::~PerIsolateThreadData() { |
| 2030 #if defined(USE_SIMULATOR) | 2068 #if defined(USE_SIMULATOR) |
| 2031 delete simulator_; | 2069 delete simulator_; |
| 2032 #endif | 2070 #endif |
| 2033 } | 2071 } |
| 2034 | 2072 |
| 2035 | 2073 |
| 2036 Isolate::PerIsolateThreadData* | 2074 Isolate::PerIsolateThreadData* |
| 2037 Isolate::ThreadDataTable::Lookup(Isolate* isolate, | 2075 Isolate::ThreadDataTable::Lookup(Isolate* isolate, |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2387 | 2425 |
| 2388 delete cpu_profiler_; | 2426 delete cpu_profiler_; |
| 2389 cpu_profiler_ = NULL; | 2427 cpu_profiler_ = NULL; |
| 2390 | 2428 |
| 2391 code_event_dispatcher_.reset(); | 2429 code_event_dispatcher_.reset(); |
| 2392 | 2430 |
| 2393 delete root_index_map_; | 2431 delete root_index_map_; |
| 2394 root_index_map_ = NULL; | 2432 root_index_map_ = NULL; |
| 2395 | 2433 |
| 2396 ClearSerializerData(); | 2434 ClearSerializerData(); |
| 2435 ReleaseManagedLifelines(); | |
| 2397 } | 2436 } |
| 2398 | 2437 |
| 2399 | 2438 |
| 2400 void Isolate::SetIsolateThreadLocals(Isolate* isolate, | 2439 void Isolate::SetIsolateThreadLocals(Isolate* isolate, |
| 2401 PerIsolateThreadData* data) { | 2440 PerIsolateThreadData* data) { |
| 2402 base::Thread::SetThreadLocal(isolate_key_, isolate); | 2441 base::Thread::SetThreadLocal(isolate_key_, isolate); |
| 2403 base::Thread::SetThreadLocal(per_isolate_thread_data_key_, data); | 2442 base::Thread::SetThreadLocal(per_isolate_thread_data_key_, data); |
| 2404 } | 2443 } |
| 2405 | 2444 |
| 2406 | 2445 |
| (...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3657 // Then check whether this scope intercepts. | 3696 // Then check whether this scope intercepts. |
| 3658 if ((flag & intercept_mask_)) { | 3697 if ((flag & intercept_mask_)) { |
| 3659 intercepted_flags_ |= flag; | 3698 intercepted_flags_ |= flag; |
| 3660 return true; | 3699 return true; |
| 3661 } | 3700 } |
| 3662 return false; | 3701 return false; |
| 3663 } | 3702 } |
| 3664 | 3703 |
| 3665 } // namespace internal | 3704 } // namespace internal |
| 3666 } // namespace v8 | 3705 } // namespace v8 |
| OLD | NEW |