| 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 <stdlib.h> | 5 #include <stdlib.h> |
| 6 | 6 |
| 7 #include <fstream> // NOLINT(readability/streams) | 7 #include <fstream> // NOLINT(readability/streams) |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/v8.h" | 10 #include "src/v8.h" |
| (...skipping 2635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2646 queue = FixedArray::CopySize(queue, num_tasks * 2); | 2646 queue = FixedArray::CopySize(queue, num_tasks * 2); |
| 2647 heap()->set_microtask_queue(*queue); | 2647 heap()->set_microtask_queue(*queue); |
| 2648 } | 2648 } |
| 2649 DCHECK(queue->get(num_tasks)->IsUndefined()); | 2649 DCHECK(queue->get(num_tasks)->IsUndefined()); |
| 2650 queue->set(num_tasks, *microtask); | 2650 queue->set(num_tasks, *microtask); |
| 2651 set_pending_microtask_count(num_tasks + 1); | 2651 set_pending_microtask_count(num_tasks + 1); |
| 2652 } | 2652 } |
| 2653 | 2653 |
| 2654 | 2654 |
| 2655 void Isolate::RunMicrotasks() { | 2655 void Isolate::RunMicrotasks() { |
| 2656 // %RunMicrotasks may be called in mjsunit tests, which violates | |
| 2657 // this assertion, hence the check for --allow-natives-syntax. | |
| 2658 // TODO(adamk): However, this also fails some layout tests. | |
| 2659 // | |
| 2660 // DCHECK(FLAG_allow_natives_syntax || | |
| 2661 // handle_scope_implementer()->CallDepthIsZero()); | |
| 2662 | |
| 2663 // Increase call depth to prevent recursive callbacks. | 2656 // Increase call depth to prevent recursive callbacks. |
| 2664 v8::Isolate::SuppressMicrotaskExecutionScope suppress( | 2657 v8::Isolate::SuppressMicrotaskExecutionScope suppress( |
| 2665 reinterpret_cast<v8::Isolate*>(this)); | 2658 reinterpret_cast<v8::Isolate*>(this)); |
| 2666 | 2659 |
| 2667 while (pending_microtask_count() > 0) { | 2660 while (pending_microtask_count() > 0) { |
| 2668 HandleScope scope(this); | 2661 HandleScope scope(this); |
| 2669 int num_tasks = pending_microtask_count(); | 2662 int num_tasks = pending_microtask_count(); |
| 2670 Handle<FixedArray> queue(heap()->microtask_queue(), this); | 2663 Handle<FixedArray> queue(heap()->microtask_queue(), this); |
| 2671 DCHECK(num_tasks <= queue->length()); | 2664 DCHECK(num_tasks <= queue->length()); |
| 2672 set_pending_microtask_count(0); | 2665 set_pending_microtask_count(0); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2838 // Then check whether this scope intercepts. | 2831 // Then check whether this scope intercepts. |
| 2839 if ((flag & intercept_mask_)) { | 2832 if ((flag & intercept_mask_)) { |
| 2840 intercepted_flags_ |= flag; | 2833 intercepted_flags_ |= flag; |
| 2841 return true; | 2834 return true; |
| 2842 } | 2835 } |
| 2843 return false; | 2836 return false; |
| 2844 } | 2837 } |
| 2845 | 2838 |
| 2846 } // namespace internal | 2839 } // namespace internal |
| 2847 } // namespace v8 | 2840 } // namespace v8 |
| OLD | NEW |