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 1862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1873 delete external_reference_table_; | 1873 delete external_reference_table_; |
| 1874 external_reference_table_ = NULL; | 1874 external_reference_table_ = NULL; |
| 1875 delete external_reference_map_; | 1875 delete external_reference_map_; |
| 1876 external_reference_map_ = NULL; | 1876 external_reference_map_ = NULL; |
| 1877 } | 1877 } |
| 1878 | 1878 |
| 1879 | 1879 |
| 1880 void Isolate::Deinit() { | 1880 void Isolate::Deinit() { |
| 1881 TRACE_ISOLATE(deinit); | 1881 TRACE_ISOLATE(deinit); |
| 1882 | 1882 |
| 1883 while (true) { | |
|
Hannes Payer (out of office)
2015/11/04 23:19:00
Why the while loop?
| |
| 1884 base::LockGuard<base::Mutex> guard(&isolate_mutex_); | |
| 1885 for (Cancelable* task : cancelable_tasks_) { | |
| 1886 if (task->CancelForShutdown()) { | |
| 1887 cancelable_tasks_.erase(task); | |
| 1888 } | |
| 1889 } | |
| 1890 if (cancelable_tasks_.empty()) break; | |
| 1891 } | |
| 1892 | |
| 1883 debug()->Unload(); | 1893 debug()->Unload(); |
| 1884 | 1894 |
| 1885 FreeThreadResources(); | 1895 FreeThreadResources(); |
| 1886 | 1896 |
| 1887 if (concurrent_recompilation_enabled()) { | 1897 if (concurrent_recompilation_enabled()) { |
| 1888 optimizing_compile_dispatcher_->Stop(); | 1898 optimizing_compile_dispatcher_->Stop(); |
| 1889 delete optimizing_compile_dispatcher_; | 1899 delete optimizing_compile_dispatcher_; |
| 1890 optimizing_compile_dispatcher_ = NULL; | 1900 optimizing_compile_dispatcher_ = NULL; |
| 1891 } | 1901 } |
| 1892 | 1902 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 1913 bootstrapper_->TearDown(); | 1923 bootstrapper_->TearDown(); |
| 1914 | 1924 |
| 1915 if (runtime_profiler_ != NULL) { | 1925 if (runtime_profiler_ != NULL) { |
| 1916 delete runtime_profiler_; | 1926 delete runtime_profiler_; |
| 1917 runtime_profiler_ = NULL; | 1927 runtime_profiler_ = NULL; |
| 1918 } | 1928 } |
| 1919 | 1929 |
| 1920 delete basic_block_profiler_; | 1930 delete basic_block_profiler_; |
| 1921 basic_block_profiler_ = NULL; | 1931 basic_block_profiler_ = NULL; |
| 1922 | 1932 |
| 1923 for (Cancelable* task : cancelable_tasks_) { | |
| 1924 task->Cancel(); | |
| 1925 } | |
| 1926 cancelable_tasks_.clear(); | |
| 1927 | |
| 1928 heap_.TearDown(); | 1933 heap_.TearDown(); |
| 1929 logger_->TearDown(); | 1934 logger_->TearDown(); |
| 1930 | 1935 |
| 1931 delete heap_profiler_; | 1936 delete heap_profiler_; |
| 1932 heap_profiler_ = NULL; | 1937 heap_profiler_ = NULL; |
| 1933 delete cpu_profiler_; | 1938 delete cpu_profiler_; |
| 1934 cpu_profiler_ = NULL; | 1939 cpu_profiler_ = NULL; |
| 1935 | 1940 |
| 1936 delete root_index_map_; | 1941 delete root_index_map_; |
| 1937 root_index_map_ = NULL; | 1942 root_index_map_ = NULL; |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2792 if (new_length == 0) { | 2797 if (new_length == 0) { |
| 2793 heap()->set_detached_contexts(heap()->empty_fixed_array()); | 2798 heap()->set_detached_contexts(heap()->empty_fixed_array()); |
| 2794 } else if (new_length < length) { | 2799 } else if (new_length < length) { |
| 2795 heap()->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>( | 2800 heap()->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>( |
| 2796 *detached_contexts, length - new_length); | 2801 *detached_contexts, length - new_length); |
| 2797 } | 2802 } |
| 2798 } | 2803 } |
| 2799 | 2804 |
| 2800 | 2805 |
| 2801 void Isolate::RegisterCancelableTask(Cancelable* task) { | 2806 void Isolate::RegisterCancelableTask(Cancelable* task) { |
| 2807 base::LockGuard<base::Mutex> guard(&isolate_mutex_); | |
|
Hannes Payer (out of office)
2015/11/04 23:19:00
Are these methods not always called from the main
| |
| 2802 cancelable_tasks_.insert(task); | 2808 cancelable_tasks_.insert(task); |
| 2803 } | 2809 } |
| 2804 | 2810 |
| 2805 | 2811 |
| 2806 void Isolate::RemoveCancelableTask(Cancelable* task) { | 2812 void Isolate::RemoveCancelableTask(Cancelable* task) { |
| 2813 base::LockGuard<base::Mutex> guard(&isolate_mutex_); | |
| 2807 auto removed = cancelable_tasks_.erase(task); | 2814 auto removed = cancelable_tasks_.erase(task); |
| 2808 USE(removed); | 2815 USE(removed); |
| 2809 DCHECK(removed == 1); | 2816 DCHECK(removed == 1); |
| 2810 } | 2817 } |
| 2811 | 2818 |
| 2812 | 2819 |
| 2813 bool StackLimitCheck::JsHasOverflowed(uintptr_t gap) const { | 2820 bool StackLimitCheck::JsHasOverflowed(uintptr_t gap) const { |
| 2814 StackGuard* stack_guard = isolate_->stack_guard(); | 2821 StackGuard* stack_guard = isolate_->stack_guard(); |
| 2815 #ifdef USE_SIMULATOR | 2822 #ifdef USE_SIMULATOR |
| 2816 // The simulator uses a separate JS stack. | 2823 // The simulator uses a separate JS stack. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2851 // Then check whether this scope intercepts. | 2858 // Then check whether this scope intercepts. |
| 2852 if ((flag & intercept_mask_)) { | 2859 if ((flag & intercept_mask_)) { |
| 2853 intercepted_flags_ |= flag; | 2860 intercepted_flags_ |= flag; |
| 2854 return true; | 2861 return true; |
| 2855 } | 2862 } |
| 2856 return false; | 2863 return false; |
| 2857 } | 2864 } |
| 2858 | 2865 |
| 2859 } // namespace internal | 2866 } // namespace internal |
| 2860 } // namespace v8 | 2867 } // namespace v8 |
| OLD | NEW |