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

Unified Diff: src/js/promise.js

Issue 2222893002: Move family of MakeError functions to C++ (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix in prologue.js Created 4 years, 4 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
Index: src/js/promise.js
diff --git a/src/js/promise.js b/src/js/promise.js
index 466912d5eb6eaba98a8e4d9fe41c90ead55c4667..fe2f659742b4771f4c1c11ada84ed18ebd53e1bc 100644
--- a/src/js/promise.js
+++ b/src/js/promise.js
@@ -12,7 +12,6 @@
// Imports
var InternalArray = utils.InternalArray;
-var MakeTypeError;
var promiseCombinedDeferredSymbol =
utils.ImportNow("promise_combined_deferred_symbol");
var promiseHasHandlerSymbol =
@@ -31,7 +30,6 @@ var speciesSymbol = utils.ImportNow("species_symbol");
var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
utils.Import(function(from) {
- MakeTypeError = from.MakeTypeError;
SpeciesConstructor = from.SpeciesConstructor;
});
@@ -79,9 +77,9 @@ var GlobalPromise = function Promise(executor) {
if (executor === promiseRawSymbol) {
return %_NewObject(GlobalPromise, new.target);
}
- if (IS_UNDEFINED(new.target)) throw MakeTypeError(kNotAPromise, this);
+ if (IS_UNDEFINED(new.target)) throw %make_type_error(kNotAPromise, this);
if (!IS_CALLABLE(executor)) {
- throw MakeTypeError(kResolverNotAFunction, executor);
+ throw %make_type_error(kResolverNotAFunction, executor);
}
var promise = PromiseInit(%_NewObject(GlobalPromise, new.target));
@@ -240,7 +238,7 @@ function PromiseCreate() {
// Promise Resolve Functions, steps 6-13
function ResolvePromise(promise, resolution) {
if (resolution === promise) {
- return RejectPromise(promise, MakeTypeError(kPromiseCyclic, resolution));
+ return RejectPromise(promise, %make_type_error(kPromiseCyclic, resolution));
}
if (IS_RECEIVER(resolution)) {
// 25.4.1.3.2 steps 8-12
@@ -337,13 +335,13 @@ function NewPromiseCapability(C) {
var result = {promise: UNDEFINED, resolve: UNDEFINED, reject: UNDEFINED };
result.promise = new C((resolve, reject) => {
if (!IS_UNDEFINED(result.resolve) || !IS_UNDEFINED(result.reject))
- throw MakeTypeError(kPromiseExecutorAlreadyInvoked);
+ throw %make_type_error(kPromiseExecutorAlreadyInvoked);
result.resolve = resolve;
result.reject = reject;
});
if (!IS_CALLABLE(result.resolve) || !IS_CALLABLE(result.reject))
- throw MakeTypeError(kPromiseNonCallable);
+ throw %make_type_error(kPromiseNonCallable);
return result;
}
@@ -364,7 +362,7 @@ function PromiseAccept(x) {
// Promise.reject ( x )
function PromiseReject(r) {
if (!IS_RECEIVER(this)) {
- throw MakeTypeError(kCalledOnNonObject, PromiseResolve);
+ throw %make_type_error(kCalledOnNonObject, PromiseResolve);
}
if (this === GlobalPromise) {
// Optimized case, avoid extra closure.
@@ -396,7 +394,7 @@ function PromiseCreateResolved(x) {
function PromiseThen(onResolve, onReject) {
var status = GET_PRIVATE(this, promiseStateSymbol);
if (IS_UNDEFINED(status)) {
- throw MakeTypeError(kNotAPromise, this);
+ throw %make_type_error(kNotAPromise, this);
}
var constructor = SpeciesConstructor(this, GlobalPromise);
@@ -445,7 +443,7 @@ function PromiseCatch(onReject) {
// Promise.resolve ( x )
function PromiseResolve(x) {
if (!IS_RECEIVER(this)) {
- throw MakeTypeError(kCalledOnNonObject, PromiseResolve);
+ throw %make_type_error(kCalledOnNonObject, PromiseResolve);
}
if (IsPromise(x) && x.constructor === this) return x;
@@ -465,7 +463,7 @@ function PromiseResolve(x) {
// Promise.all ( iterable )
function PromiseAll(iterable) {
if (!IS_RECEIVER(this)) {
- throw MakeTypeError(kCalledOnNonObject, "Promise.all");
+ throw %make_type_error(kCalledOnNonObject, "Promise.all");
}
var deferred = NewPromiseCapability(this);
@@ -516,7 +514,7 @@ function PromiseAll(iterable) {
// Promise.race ( iterable )
function PromiseRace(iterable) {
if (!IS_RECEIVER(this)) {
- throw MakeTypeError(kCalledOnNonObject, PromiseRace);
+ throw %make_type_error(kCalledOnNonObject, PromiseRace);
}
var deferred = NewPromiseCapability(this);
« src/bootstrapper.cc ('K') | « src/js/prologue.js ('k') | src/js/regexp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698