Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Unified Diff: src/promise.js

Issue 777703002: Fix Promise.resolve/Promise.reject unnecessarily scheduling a microtask. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698