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 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1790 stress_deopt_count_(0), | 1790 stress_deopt_count_(0), |
1791 virtual_handler_register_(NULL), | 1791 virtual_handler_register_(NULL), |
1792 virtual_slot_register_(NULL), | 1792 virtual_slot_register_(NULL), |
1793 next_optimization_id_(0), | 1793 next_optimization_id_(0), |
1794 js_calls_from_api_counter_(0), | 1794 js_calls_from_api_counter_(0), |
1795 #if TRACE_MAPS | 1795 #if TRACE_MAPS |
1796 next_unique_sfi_id_(0), | 1796 next_unique_sfi_id_(0), |
1797 #endif | 1797 #endif |
1798 use_counter_callback_(NULL), | 1798 use_counter_callback_(NULL), |
1799 basic_block_profiler_(NULL), | 1799 basic_block_profiler_(NULL), |
| 1800 cancelable_task_manager_(new CancelableTaskManager()), |
1800 abort_on_uncaught_exception_callback_(NULL) { | 1801 abort_on_uncaught_exception_callback_(NULL) { |
1801 { | 1802 { |
1802 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer()); | 1803 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer()); |
1803 CHECK(thread_data_table_); | 1804 CHECK(thread_data_table_); |
1804 } | 1805 } |
1805 id_ = base::NoBarrier_AtomicIncrement(&isolate_counter_, 1); | 1806 id_ = base::NoBarrier_AtomicIncrement(&isolate_counter_, 1); |
1806 TRACE_ISOLATE(constructor); | 1807 TRACE_ISOLATE(constructor); |
1807 | 1808 |
1808 memset(isolate_addresses_, 0, | 1809 memset(isolate_addresses_, 0, |
1809 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1)); | 1810 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1)); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1913 bootstrapper_->TearDown(); | 1914 bootstrapper_->TearDown(); |
1914 | 1915 |
1915 if (runtime_profiler_ != NULL) { | 1916 if (runtime_profiler_ != NULL) { |
1916 delete runtime_profiler_; | 1917 delete runtime_profiler_; |
1917 runtime_profiler_ = NULL; | 1918 runtime_profiler_ = NULL; |
1918 } | 1919 } |
1919 | 1920 |
1920 delete basic_block_profiler_; | 1921 delete basic_block_profiler_; |
1921 basic_block_profiler_ = NULL; | 1922 basic_block_profiler_ = NULL; |
1922 | 1923 |
1923 for (Cancelable* task : cancelable_tasks_) { | 1924 cancelable_task_manager()->CancelAndWait(); |
1924 task->Cancel(); | |
1925 } | |
1926 cancelable_tasks_.clear(); | |
1927 | 1925 |
1928 heap_.TearDown(); | 1926 heap_.TearDown(); |
1929 logger_->TearDown(); | 1927 logger_->TearDown(); |
1930 | 1928 |
1931 delete heap_profiler_; | 1929 delete heap_profiler_; |
1932 heap_profiler_ = NULL; | 1930 heap_profiler_ = NULL; |
1933 delete cpu_profiler_; | 1931 delete cpu_profiler_; |
1934 cpu_profiler_ = NULL; | 1932 cpu_profiler_ = NULL; |
1935 | 1933 |
1936 delete root_index_map_; | 1934 delete root_index_map_; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 | 2019 |
2022 delete string_stream_debug_object_cache_; | 2020 delete string_stream_debug_object_cache_; |
2023 string_stream_debug_object_cache_ = NULL; | 2021 string_stream_debug_object_cache_ = NULL; |
2024 | 2022 |
2025 delete random_number_generator_; | 2023 delete random_number_generator_; |
2026 random_number_generator_ = NULL; | 2024 random_number_generator_ = NULL; |
2027 | 2025 |
2028 delete debug_; | 2026 delete debug_; |
2029 debug_ = NULL; | 2027 debug_ = NULL; |
2030 | 2028 |
| 2029 delete cancelable_task_manager_; |
| 2030 cancelable_task_manager_ = nullptr; |
| 2031 |
2031 #if USE_SIMULATOR | 2032 #if USE_SIMULATOR |
2032 Simulator::TearDown(simulator_i_cache_, simulator_redirection_); | 2033 Simulator::TearDown(simulator_i_cache_, simulator_redirection_); |
2033 simulator_i_cache_ = nullptr; | 2034 simulator_i_cache_ = nullptr; |
2034 simulator_redirection_ = nullptr; | 2035 simulator_redirection_ = nullptr; |
2035 #endif | 2036 #endif |
2036 } | 2037 } |
2037 | 2038 |
2038 | 2039 |
2039 void Isolate::InitializeThreadLocal() { | 2040 void Isolate::InitializeThreadLocal() { |
2040 thread_local_top_.isolate_ = this; | 2041 thread_local_top_.isolate_ = this; |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2791 } | 2792 } |
2792 if (new_length == 0) { | 2793 if (new_length == 0) { |
2793 heap()->set_detached_contexts(heap()->empty_fixed_array()); | 2794 heap()->set_detached_contexts(heap()->empty_fixed_array()); |
2794 } else if (new_length < length) { | 2795 } else if (new_length < length) { |
2795 heap()->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>( | 2796 heap()->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>( |
2796 *detached_contexts, length - new_length); | 2797 *detached_contexts, length - new_length); |
2797 } | 2798 } |
2798 } | 2799 } |
2799 | 2800 |
2800 | 2801 |
2801 void Isolate::RegisterCancelableTask(Cancelable* task) { | |
2802 cancelable_tasks_.insert(task); | |
2803 } | |
2804 | |
2805 | |
2806 void Isolate::RemoveCancelableTask(Cancelable* task) { | |
2807 auto removed = cancelable_tasks_.erase(task); | |
2808 USE(removed); | |
2809 DCHECK(removed == 1); | |
2810 } | |
2811 | |
2812 | |
2813 bool StackLimitCheck::JsHasOverflowed(uintptr_t gap) const { | 2802 bool StackLimitCheck::JsHasOverflowed(uintptr_t gap) const { |
2814 StackGuard* stack_guard = isolate_->stack_guard(); | 2803 StackGuard* stack_guard = isolate_->stack_guard(); |
2815 #ifdef USE_SIMULATOR | 2804 #ifdef USE_SIMULATOR |
2816 // The simulator uses a separate JS stack. | 2805 // The simulator uses a separate JS stack. |
2817 Address jssp_address = Simulator::current(isolate_)->get_sp(); | 2806 Address jssp_address = Simulator::current(isolate_)->get_sp(); |
2818 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); | 2807 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); |
2819 if (jssp - gap < stack_guard->real_jslimit()) return true; | 2808 if (jssp - gap < stack_guard->real_jslimit()) return true; |
2820 #endif // USE_SIMULATOR | 2809 #endif // USE_SIMULATOR |
2821 return GetCurrentStackPosition() - gap < stack_guard->real_climit(); | 2810 return GetCurrentStackPosition() - gap < stack_guard->real_climit(); |
2822 } | 2811 } |
(...skipping 28 matching lines...) Expand all Loading... |
2851 // Then check whether this scope intercepts. | 2840 // Then check whether this scope intercepts. |
2852 if ((flag & intercept_mask_)) { | 2841 if ((flag & intercept_mask_)) { |
2853 intercepted_flags_ |= flag; | 2842 intercepted_flags_ |= flag; |
2854 return true; | 2843 return true; |
2855 } | 2844 } |
2856 return false; | 2845 return false; |
2857 } | 2846 } |
2858 | 2847 |
2859 } // namespace internal | 2848 } // namespace internal |
2860 } // namespace v8 | 2849 } // namespace v8 |
OLD | NEW |