| 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 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1851 deferred_handles_head_(NULL), | 1851 deferred_handles_head_(NULL), |
| 1852 optimizing_compile_dispatcher_(NULL), | 1852 optimizing_compile_dispatcher_(NULL), |
| 1853 stress_deopt_count_(0), | 1853 stress_deopt_count_(0), |
| 1854 virtual_handler_register_(NULL), | 1854 virtual_handler_register_(NULL), |
| 1855 virtual_slot_register_(NULL), | 1855 virtual_slot_register_(NULL), |
| 1856 next_optimization_id_(0), | 1856 next_optimization_id_(0), |
| 1857 js_calls_from_api_counter_(0), | 1857 js_calls_from_api_counter_(0), |
| 1858 #if TRACE_MAPS | 1858 #if TRACE_MAPS |
| 1859 next_unique_sfi_id_(0), | 1859 next_unique_sfi_id_(0), |
| 1860 #endif | 1860 #endif |
| 1861 is_running_microtasks_(false), |
| 1861 use_counter_callback_(NULL), | 1862 use_counter_callback_(NULL), |
| 1862 basic_block_profiler_(NULL), | 1863 basic_block_profiler_(NULL), |
| 1863 cancelable_task_manager_(new CancelableTaskManager()), | 1864 cancelable_task_manager_(new CancelableTaskManager()), |
| 1864 abort_on_uncaught_exception_callback_(NULL) { | 1865 abort_on_uncaught_exception_callback_(NULL) { |
| 1865 { | 1866 { |
| 1866 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer()); | 1867 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer()); |
| 1867 CHECK(thread_data_table_); | 1868 CHECK(thread_data_table_); |
| 1868 } | 1869 } |
| 1869 id_ = base::NoBarrier_AtomicIncrement(&isolate_counter_, 1); | 1870 id_ = base::NoBarrier_AtomicIncrement(&isolate_counter_, 1); |
| 1870 TRACE_ISOLATE(constructor); | 1871 TRACE_ISOLATE(constructor); |
| (...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2773 DCHECK(queue->get(num_tasks)->IsUndefined()); | 2774 DCHECK(queue->get(num_tasks)->IsUndefined()); |
| 2774 queue->set(num_tasks, *microtask); | 2775 queue->set(num_tasks, *microtask); |
| 2775 set_pending_microtask_count(num_tasks + 1); | 2776 set_pending_microtask_count(num_tasks + 1); |
| 2776 } | 2777 } |
| 2777 | 2778 |
| 2778 | 2779 |
| 2779 void Isolate::RunMicrotasks() { | 2780 void Isolate::RunMicrotasks() { |
| 2780 // Increase call depth to prevent recursive callbacks. | 2781 // Increase call depth to prevent recursive callbacks. |
| 2781 v8::Isolate::SuppressMicrotaskExecutionScope suppress( | 2782 v8::Isolate::SuppressMicrotaskExecutionScope suppress( |
| 2782 reinterpret_cast<v8::Isolate*>(this)); | 2783 reinterpret_cast<v8::Isolate*>(this)); |
| 2784 is_running_microtasks_ = true; |
| 2783 RunMicrotasksInternal(); | 2785 RunMicrotasksInternal(); |
| 2786 is_running_microtasks_ = false; |
| 2784 FireMicrotasksCompletedCallback(); | 2787 FireMicrotasksCompletedCallback(); |
| 2785 } | 2788 } |
| 2786 | 2789 |
| 2787 | 2790 |
| 2788 void Isolate::RunMicrotasksInternal() { | 2791 void Isolate::RunMicrotasksInternal() { |
| 2789 while (pending_microtask_count() > 0) { | 2792 while (pending_microtask_count() > 0) { |
| 2790 HandleScope scope(this); | 2793 HandleScope scope(this); |
| 2791 int num_tasks = pending_microtask_count(); | 2794 int num_tasks = pending_microtask_count(); |
| 2792 Handle<FixedArray> queue(heap()->microtask_queue(), this); | 2795 Handle<FixedArray> queue(heap()->microtask_queue(), this); |
| 2793 DCHECK(num_tasks <= queue->length()); | 2796 DCHECK(num_tasks <= queue->length()); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2994 // Then check whether this scope intercepts. | 2997 // Then check whether this scope intercepts. |
| 2995 if ((flag & intercept_mask_)) { | 2998 if ((flag & intercept_mask_)) { |
| 2996 intercepted_flags_ |= flag; | 2999 intercepted_flags_ |= flag; |
| 2997 return true; | 3000 return true; |
| 2998 } | 3001 } |
| 2999 return false; | 3002 return false; |
| 3000 } | 3003 } |
| 3001 | 3004 |
| 3002 } // namespace internal | 3005 } // namespace internal |
| 3003 } // namespace v8 | 3006 } // namespace v8 |
| OLD | NEW |