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

Unified Diff: src/js/promise.js

Issue 2406343002: [promises] Move PromiseReactionJob to c++ (Closed)
Patch Set: remove ; Created 4 years, 2 months 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 | « src/isolate.cc ('k') | src/objects.h » ('j') | src/objects.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/promise.js
diff --git a/src/js/promise.js b/src/js/promise.js
index 86be06018ce7230dd54a9d7179db9dbd5fa365fa..7abb0e2b8b98a75a2c7546f6c25a51d55ab09fc2 100644
--- a/src/js/promise.js
+++ b/src/js/promise.js
@@ -190,22 +190,8 @@ function PromiseHandle(value, handler, deferred) {
}
function PromiseEnqueue(value, tasks, deferreds, status) {
- var id, name, instrumenting = DEBUG_IS_ACTIVE;
- %EnqueueMicrotask(function() {
- if (instrumenting) {
- %DebugAsyncTaskEvent({ type: "willHandle", id: id, name: name });
- }
- if (IS_ARRAY(tasks)) {
- for (var i = 0; i < tasks.length; i += 2) {
- PromiseHandle(value, tasks[i], tasks[i + 1]);
- }
- } else {
- PromiseHandle(value, tasks, deferreds);
- }
- if (instrumenting) {
- %DebugAsyncTaskEvent({ type: "didHandle", id: id, name: name });
- }
- });
+ var id, name, before_debug, after_debug, instrumenting = DEBUG_IS_ACTIVE;
+
if (instrumenting) {
// In an async function, reuse the existing stack related to the outer
// Promise. Otherwise, e.g. in a direct call to then, save a new stack.
@@ -225,7 +211,13 @@ function PromiseEnqueue(value, tasks, deferreds, status) {
name = status === kFulfilled ? "Promise.resolve" : "Promise.reject";
%DebugAsyncTaskEvent({ type: "enqueue", id: id, name: name });
}
+
+ before_debug = { type: "willHandle", id: id, name: name };
+ after_debug = { type: "didHandle", id: id, name: name };
}
+
+ %EnqueuePromiseReactionJob(value, tasks, deferreds, before_debug, after_debug,
+ function() {});
gsathya 2016/10/11 16:40:51 This is such a hack
}
function PromiseAttachCallbacks(promise, deferred, onResolve, onReject) {
@@ -703,7 +695,8 @@ utils.InstallFunctions(GlobalPromise.prototype, DONT_ENUM, [
"promise_has_user_defined_reject_handler", PromiseHasUserDefinedRejectHandler,
"promise_reject", DoRejectPromise,
"promise_resolve", ResolvePromise,
- "promise_then", PromiseThen
+ "promise_then", PromiseThen,
+ "promise_handle", PromiseHandle
]);
// This allows extras to create promises quickly without building extra
« no previous file with comments | « src/isolate.cc ('k') | src/objects.h » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698