Index: src/isolate.cc |
diff --git a/src/isolate.cc b/src/isolate.cc |
index 10835256ccc9d2e021de96cd5a9c8917c7f911ed..7d21090ed2e9fecb8b30aa2a37b5b354e95a3d9f 100644 |
--- a/src/isolate.cc |
+++ b/src/isolate.cc |
@@ -2957,17 +2957,21 @@ void Isolate::EnqueueMicrotask(Handle<Object> microtask) { |
void Isolate::RunMicrotasks() { |
- // Increase call depth to prevent recursive callbacks. |
- v8::Isolate::SuppressMicrotaskExecutionScope suppress( |
- reinterpret_cast<v8::Isolate*>(this)); |
- is_running_microtasks_ = true; |
- RunMicrotasksInternal(); |
- is_running_microtasks_ = false; |
+ if (pending_microtask_count()) { |
+ TRACE_EVENT0("v8.execute", "RunMicrotasks"); |
caseq
2016/08/30 16:16:14
let's move down to RunMicrotasksInternal?
alph
2016/08/30 17:06:04
Done.
Also I noticed that originally FireMicrotask
|
+ // Increase call depth to prevent recursive callbacks. |
+ v8::Isolate::SuppressMicrotaskExecutionScope suppress( |
+ reinterpret_cast<v8::Isolate*>(this)); |
+ is_running_microtasks_ = true; |
+ RunMicrotasksInternal(); |
+ is_running_microtasks_ = false; |
+ } |
FireMicrotasksCompletedCallback(); |
} |
void Isolate::RunMicrotasksInternal() { |
+ DCHECK(pending_microtask_count() > 0); |
while (pending_microtask_count() > 0) { |
HandleScope scope(this); |
int num_tasks = pending_microtask_count(); |