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

Unified Diff: src/js/promise.js

Issue 1985293002: Promises: Make debug calls only when debugging (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Use local var Created 4 years, 7 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 | « no previous file | no next file » | no next file with comments »
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 42b772bab1580883b53e8ff6d6ddac255af37da2..f2fcc477996afc47d1954b71504ecd7b48f73943 100644
--- a/src/js/promise.js
+++ b/src/js/promise.js
@@ -83,14 +83,14 @@ var GlobalPromise = function Promise(resolver) {
var promise = PromiseInit(%_NewObject(GlobalPromise, new.target));
var callbacks = CreateResolvingFunctions(promise);
-
+ var debug_is_active = DEBUG_IS_ACTIVE;
try {
- %DebugPushPromise(promise, Promise);
+ if (debug_is_active) %DebugPushPromise(promise, Promise);
resolver(callbacks.resolve, callbacks.reject);
} catch (e) {
%_Call(callbacks.reject, UNDEFINED, e);
} finally {
- %DebugPopPromise();
+ if (debug_is_active) %DebugPopPromise();
}
return promise;
@@ -127,14 +127,15 @@ function PromiseDone(promise, status, value, promiseQueue) {
}
function PromiseHandle(value, handler, deferred) {
+ var debug_is_active = DEBUG_IS_ACTIVE;
try {
- %DebugPushPromise(deferred.promise, PromiseHandle);
+ if (debug_is_active) %DebugPushPromise(deferred.promise, PromiseHandle);
var result = handler(value);
deferred.resolve(result);
} catch (exception) {
try { deferred.reject(exception); } catch (e) { }
} finally {
- %DebugPopPromise();
+ if (debug_is_active) %DebugPopPromise();
}
}
« 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