Commit 54c4cc5f authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[builtins] Make Promise.prototype builtin naming consistent.

This changes the names of the builtins on the Promise.prototype to match
the general naming convention and make it easier to tell what the
builtin is about just by looking at its name.

Bug: v8:7253
Change-Id: I906cc6fc14a6b9d8ffe9c0dcfd94b50439c4cfcf
Reviewed-on: https://chromium-review.googlesource.com/850698Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50367}
parent e999f671
......@@ -2374,11 +2374,11 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Handle<JSFunction> promise_then =
SimpleInstallFunction(prototype, isolate->factory()->then_string(),
Builtins::kPromiseThen, 2, true);
Builtins::kPromisePrototypeThen, 2, true);
native_context()->set_promise_then(*promise_then);
Handle<JSFunction> promise_catch = SimpleInstallFunction(
prototype, "catch", Builtins::kPromiseCatch, 1, true);
prototype, "catch", Builtins::kPromisePrototypeCatch, 1, true);
native_context()->set_promise_catch(*promise_catch);
// Force the Promise constructor to fast properties, so that we can use the
......@@ -4388,8 +4388,8 @@ void Genesis::InitializeGlobal_harmony_promise_finally() {
Handle<JSFunction> constructor(native_context()->promise_function());
Handle<JSObject> prototype(JSObject::cast(constructor->instance_prototype()));
SimpleInstallFunction(prototype, "finally", Builtins::kPromiseFinally, 1,
true, DONT_ENUM);
SimpleInstallFunction(prototype, "finally",
Builtins::kPromisePrototypeFinally, 1, true, DONT_ENUM);
// The promise prototype map has changed because we added a property
// to prototype, so we update the saved map.
......
......@@ -808,9 +808,9 @@ namespace internal {
TFJ(PromiseRejectClosure, 1, kValue) \
TFJ(PromiseAllResolveElementClosure, 1, kValue) \
/* ES #sec-promise.prototype.then */ \
TFJ(PromiseThen, 2, kOnFullfilled, kOnRejected) \
TFJ(PromisePrototypeThen, 2, kOnFullfilled, kOnRejected) \
/* ES #sec-promise.prototype.catch */ \
TFJ(PromiseCatch, 1, kOnRejected) \
TFJ(PromisePrototypeCatch, 1, kOnRejected) \
/* ES #sec-fulfillpromise */ \
TFJ(ResolvePromise, 2, kPromise, kValue) \
TFS(PromiseHandleReject, kPromise, kOnReject, kException) \
......@@ -824,7 +824,7 @@ namespace internal {
/* ES #sec-promise.reject */ \
TFJ(PromiseReject, 1, kReason) \
TFJ(InternalPromiseReject, 3, kPromise, kReason, kDebugEvent) \
TFJ(PromiseFinally, 1, kOnFinally) \
TFJ(PromisePrototypeFinally, 1, kOnFinally) \
TFJ(PromiseThenFinally, 1, kValue) \
TFJ(PromiseCatchFinally, 1, kReason) \
TFJ(PromiseValueThunkFinally, 0) \
......
......@@ -1118,8 +1118,8 @@ TF_BUILTIN(PromiseInternalConstructor, PromiseBuiltinsAssembler) {
}
// ES#sec-promise.prototype.then
// Promise.prototype.catch ( onFulfilled, onRejected )
TF_BUILTIN(PromiseThen, PromiseBuiltinsAssembler) {
// Promise.prototype.then ( onFulfilled, onRejected )
TF_BUILTIN(PromisePrototypeThen, PromiseBuiltinsAssembler) {
// 1. Let promise be the this value.
Node* const promise = Parameter(Descriptor::kReceiver);
Node* const on_resolve = Parameter(Descriptor::kOnFullfilled);
......@@ -1306,7 +1306,7 @@ TF_BUILTIN(PromiseHandleJS, PromiseBuiltinsAssembler) {
// ES#sec-promise.prototype.catch
// Promise.prototype.catch ( onRejected )
TF_BUILTIN(PromiseCatch, PromiseBuiltinsAssembler) {
TF_BUILTIN(PromisePrototypeCatch, PromiseBuiltinsAssembler) {
// 1. Let promise be the this value.
Node* const promise = Parameter(Descriptor::kReceiver);
Node* const on_resolve = UndefinedConstant();
......@@ -1661,7 +1661,7 @@ TF_BUILTIN(PromiseCatchFinally, PromiseBuiltinsAssembler) {
Return(result_promise);
}
TF_BUILTIN(PromiseFinally, PromiseBuiltinsAssembler) {
TF_BUILTIN(PromisePrototypeFinally, PromiseBuiltinsAssembler) {
CSA_ASSERT_JS_ARGC_EQ(this, 1);
// 1. Let promise be the this value.
......
......@@ -1782,13 +1782,13 @@ void Debug::RunPromiseHook(PromiseHookType hook_type, Handle<JSPromise> promise,
if (*code == *BUILTIN_CODE(isolate_, AsyncFunctionPromiseCreate)) {
type = debug::kDebugAsyncFunctionPromiseCreated;
last_frame_was_promise_builtin = true;
} else if (*code == *BUILTIN_CODE(isolate_, PromiseThen)) {
} else if (*code == *BUILTIN_CODE(isolate_, PromisePrototypeThen)) {
type = debug::kDebugPromiseThen;
last_frame_was_promise_builtin = true;
} else if (*code == *BUILTIN_CODE(isolate_, PromiseCatch)) {
} else if (*code == *BUILTIN_CODE(isolate_, PromisePrototypeCatch)) {
type = debug::kDebugPromiseCatch;
last_frame_was_promise_builtin = true;
} else if (*code == *BUILTIN_CODE(isolate_, PromiseFinally)) {
} else if (*code == *BUILTIN_CODE(isolate_, PromisePrototypeFinally)) {
type = debug::kDebugPromiseFinally;
last_frame_was_promise_builtin = true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment