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

Unified Diff: src/js/promise.js

Issue 2521723003: [promises] Remove IsPromise (Closed)
Patch Set: rebase again Created 4 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 | « src/js/async-await.js ('k') | 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 dd1f695a623c788c74ad0e7472249d8c36d35123..fec0076a3598de2f80b81c988aba146469a21497 100644
--- a/src/js/promise.js
+++ b/src/js/promise.js
@@ -180,12 +180,6 @@ SET_PRIVATE(PromiseIdRejectHandler, promiseForwardingHandlerSymbol, true);
// For bootstrapper.
-// Only used by utils
-// ES#sec-ispromise IsPromise ( x )
-function IsPromise(x) {
- return IS_RECEIVER(x) && HAS_DEFINED_PRIVATE(x, promiseStateSymbol);
-}
-
function PromiseCreate() {
return PromiseInit(%promise_internal_constructor());
}
@@ -212,7 +206,7 @@ function ResolvePromise(promise, resolution) {
// Resolution is a native promise and if it's already resolved or
// rejected, shortcircuit the resolution procedure by directly
// reusing the value from the promise.
- if (IsPromise(resolution) && then === PromiseThen) {
+ if (%is_promise(resolution) && then === PromiseThen) {
var thenableState = GET_PRIVATE(resolution, promiseStateSymbol);
if (thenableState === kFulfilled) {
// This goes inside the if-else to save one symbol lookup in
@@ -239,7 +233,7 @@ function ResolvePromise(promise, resolution) {
}
if (IS_CALLABLE(then)) {
- if (DEBUG_IS_ACTIVE && IsPromise(resolution)) {
+ if (DEBUG_IS_ACTIVE && %is_promise(resolution)) {
// Mark the dependency of the new promise on the resolution
SET_PRIVATE(resolution, promiseHandledBySymbol, promise);
}
@@ -358,7 +352,7 @@ function PerformPromiseThen(promise, onResolve, onReject, resultCapability) {
// Promise.prototype.then ( onFulfilled, onRejected )
// Multi-unwrapped chaining with thenable coercion.
function PromiseThen(onResolve, onReject) {
- if (!IsPromise(this)) {
+ if (!%is_promise(this)) {
throw %make_type_error(kNotAPromise, this);
}
@@ -388,7 +382,7 @@ function PromiseResolve(x) {
if (!IS_RECEIVER(this)) {
throw %make_type_error(kCalledOnNonObject, PromiseResolve);
}
- if (IsPromise(x) && x.constructor === this) return x;
+ if (%is_promise(x) && x.constructor === this) return x;
// Avoid creating resolving functions.
if (this === GlobalPromise) {
@@ -448,7 +442,7 @@ function PromiseAll(iterable) {
deferred.reject);
// For catch prediction, mark that rejections here are semantically
// handled by the combined Promise.
- if (instrumenting && IsPromise(throwawayPromise)) {
+ if (instrumenting && %is_promise(throwawayPromise)) {
SET_PRIVATE(throwawayPromise, promiseHandledBySymbol, deferred.promise);
}
++i;
@@ -491,7 +485,7 @@ function PromiseRace(iterable) {
deferred.reject);
// For catch prediction, mark that rejections here are semantically
// handled by the combined Promise.
- if (instrumenting && IsPromise(throwawayPromise)) {
+ if (instrumenting && %is_promise(throwawayPromise)) {
SET_PRIVATE(throwawayPromise, promiseHandledBySymbol, deferred.promise);
}
}
@@ -611,7 +605,6 @@ utils.InstallFunctions(extrasUtils, 0, [
]);
utils.Export(function(to) {
- to.IsPromise = IsPromise;
to.PromiseCreate = PromiseCreate;
to.PromiseThen = PromiseThen;
« no previous file with comments | « src/js/async-await.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698