Commit e875dcbe authored by Z Nguyen-Huu's avatar Z Nguyen-Huu Committed by Commit Bot

[csa] Omit LoadNativeContext in some Torque javascript builtins

Instead, use Is<NativeContext> then UnsafeCast.

Bug: v8:9679
Change-Id: Id87a10fa66ff1c1e0ca0099b1938c72da2437832
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2631554
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72175}
parent a2596d41
...@@ -101,7 +101,10 @@ PromisePrototypeCatch( ...@@ -101,7 +101,10 @@ PromisePrototypeCatch(
js-implicit context: Context, receiver: JSAny)(onRejected: JSAny): JSAny { js-implicit context: Context, receiver: JSAny)(onRejected: JSAny): JSAny {
// 1. Let promise be the this value. // 1. Let promise be the this value.
// 2. Return ? Invoke(promise, "then", « undefined, onRejected »). // 2. Return ? Invoke(promise, "then", « undefined, onRejected »).
const nativeContext = LoadNativeContext(context); // This builtin is attached to JSFunction created by the bootstrapper so
// `context` is the native context.
check(Is<NativeContext>(context));
const nativeContext = UnsafeCast<NativeContext>(context);
return UnsafeCast<JSAny>( return UnsafeCast<JSAny>(
InvokeThen(nativeContext, receiver, Undefined, onRejected)); InvokeThen(nativeContext, receiver, Undefined, onRejected));
} }
......
...@@ -169,7 +169,10 @@ PromisePrototypeFinally( ...@@ -169,7 +169,10 @@ PromisePrototypeFinally(
MessageTemplate::kCalledOnNonObject, 'Promise.prototype.finally'); MessageTemplate::kCalledOnNonObject, 'Promise.prototype.finally');
// 3. Let C be ? SpeciesConstructor(promise, %Promise%). // 3. Let C be ? SpeciesConstructor(promise, %Promise%).
const nativeContext = LoadNativeContext(context); // This builtin is attached to JSFunction created by the bootstrapper so
// `context` is the native context.
check(Is<NativeContext>(context));
const nativeContext = UnsafeCast<NativeContext>(context);
const promiseFun = *NativeContextSlot(ContextSlot::PROMISE_FUNCTION_INDEX); const promiseFun = *NativeContextSlot(ContextSlot::PROMISE_FUNCTION_INDEX);
let constructor: Constructor = UnsafeCast<Constructor>(promiseFun); let constructor: Constructor = UnsafeCast<Constructor>(promiseFun);
......
...@@ -13,7 +13,10 @@ PromiseRace( ...@@ -13,7 +13,10 @@ PromiseRace(
const receiver = Cast<JSReceiver>(receiver) const receiver = Cast<JSReceiver>(receiver)
otherwise ThrowTypeError(MessageTemplate::kCalledOnNonObject, 'Promise.race'); otherwise ThrowTypeError(MessageTemplate::kCalledOnNonObject, 'Promise.race');
const nativeContext = LoadNativeContext(context); // This builtin is attached to JSFunction created by the bootstrapper so
// `context` is the native context.
check(Is<NativeContext>(context));
const nativeContext = UnsafeCast<NativeContext>(context);
// Let promiseCapability be ? NewPromiseCapability(C). // Let promiseCapability be ? NewPromiseCapability(C).
// Don't fire debugEvent so that forwarding the rejection through all does // Don't fire debugEvent so that forwarding the rejection through all does
......
...@@ -472,27 +472,27 @@ KNOWN_OBJECTS = { ...@@ -472,27 +472,27 @@ KNOWN_OBJECTS = {
("old_space", 0x02ac5): "StringSplitCache", ("old_space", 0x02ac5): "StringSplitCache",
("old_space", 0x02ecd): "RegExpMultipleCache", ("old_space", 0x02ecd): "RegExpMultipleCache",
("old_space", 0x032d5): "BuiltinsConstantsTable", ("old_space", 0x032d5): "BuiltinsConstantsTable",
("old_space", 0x036bd): "AsyncFunctionAwaitRejectSharedFun", ("old_space", 0x036c9): "AsyncFunctionAwaitRejectSharedFun",
("old_space", 0x036e1): "AsyncFunctionAwaitResolveSharedFun", ("old_space", 0x036ed): "AsyncFunctionAwaitResolveSharedFun",
("old_space", 0x03705): "AsyncGeneratorAwaitRejectSharedFun", ("old_space", 0x03711): "AsyncGeneratorAwaitRejectSharedFun",
("old_space", 0x03729): "AsyncGeneratorAwaitResolveSharedFun", ("old_space", 0x03735): "AsyncGeneratorAwaitResolveSharedFun",
("old_space", 0x0374d): "AsyncGeneratorYieldResolveSharedFun", ("old_space", 0x03759): "AsyncGeneratorYieldResolveSharedFun",
("old_space", 0x03771): "AsyncGeneratorReturnResolveSharedFun", ("old_space", 0x0377d): "AsyncGeneratorReturnResolveSharedFun",
("old_space", 0x03795): "AsyncGeneratorReturnClosedRejectSharedFun", ("old_space", 0x037a1): "AsyncGeneratorReturnClosedRejectSharedFun",
("old_space", 0x037b9): "AsyncGeneratorReturnClosedResolveSharedFun", ("old_space", 0x037c5): "AsyncGeneratorReturnClosedResolveSharedFun",
("old_space", 0x037dd): "AsyncIteratorValueUnwrapSharedFun", ("old_space", 0x037e9): "AsyncIteratorValueUnwrapSharedFun",
("old_space", 0x03801): "PromiseAllResolveElementSharedFun", ("old_space", 0x0380d): "PromiseAllResolveElementSharedFun",
("old_space", 0x03825): "PromiseAllSettledResolveElementSharedFun", ("old_space", 0x03831): "PromiseAllSettledResolveElementSharedFun",
("old_space", 0x03849): "PromiseAllSettledRejectElementSharedFun", ("old_space", 0x03855): "PromiseAllSettledRejectElementSharedFun",
("old_space", 0x0386d): "PromiseAnyRejectElementSharedFun", ("old_space", 0x03879): "PromiseAnyRejectElementSharedFun",
("old_space", 0x03891): "PromiseCapabilityDefaultRejectSharedFun", ("old_space", 0x0389d): "PromiseCapabilityDefaultRejectSharedFun",
("old_space", 0x038b5): "PromiseCapabilityDefaultResolveSharedFun", ("old_space", 0x038c1): "PromiseCapabilityDefaultResolveSharedFun",
("old_space", 0x038d9): "PromiseCatchFinallySharedFun", ("old_space", 0x038e5): "PromiseCatchFinallySharedFun",
("old_space", 0x038fd): "PromiseGetCapabilitiesExecutorSharedFun", ("old_space", 0x03909): "PromiseGetCapabilitiesExecutorSharedFun",
("old_space", 0x03921): "PromiseThenFinallySharedFun", ("old_space", 0x0392d): "PromiseThenFinallySharedFun",
("old_space", 0x03945): "PromiseThrowerFinallySharedFun", ("old_space", 0x03951): "PromiseThrowerFinallySharedFun",
("old_space", 0x03969): "PromiseValueThunkFinallySharedFun", ("old_space", 0x03975): "PromiseValueThunkFinallySharedFun",
("old_space", 0x0398d): "ProxyRevokeSharedFun", ("old_space", 0x03999): "ProxyRevokeSharedFun",
} }
# Lower 32 bits of first page addresses for various heap spaces. # Lower 32 bits of first page addresses for various heap spaces.
......
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