Reviewers: adamk, rossberg, Yang,

Description:
Fix Promise.resolve/Promise.reject unnecessarily scheduling a microtask.

[email protected],[email protected], [email protected]
LOG=N

Please review this at https://codereview.chromium.org/777703002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+2, -1 lines):
  M src/promise.js


Index: src/promise.js
diff --git a/src/promise.js b/src/promise.js
index 7d5be882f4c1ad161f2816ad70badeef614bcb40..d38cdaa482487e84aaf65f1b021bb457bf48a319 100644
--- a/src/promise.js
+++ b/src/promise.js
@@ -74,7 +74,8 @@ var lastMicrotaskId = 0;

   function PromiseDone(promise, status, value, promiseQueue) {
     if (GET_PRIVATE(promise, promiseStatus) === 0) {
-      PromiseEnqueue(value, GET_PRIVATE(promise, promiseQueue), status);
+      var tasks = GET_PRIVATE(promise, promiseQueue);
+      if (tasks.length) PromiseEnqueue(value, tasks, status);
       PromiseSet(promise, status, value);
     }
   }


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to