[cleanup] Replace runtime call with stub call in Torque code

This CL replaces Delete/SetProperty runtime calls with calls to their
stub version. The stubs will bail to the runtime themselves if they
can't perform the action.

R=jgruber@chromium.org

Bug: v8:8015
Change-Id: I1f141296ee074e028c27a3682e2eb46d9f74c0d9
Reviewed-on: https://chromium-review.googlesource.com/1169810
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Simon Zünd <szuend@google.com>
Cr-Commit-Position: refs/heads/master@{#55031}
This commit is contained in:
Simon Zünd 2018-08-10 08:51:12 +02:00 committed by Commit Bot
parent 7495925011
commit 27040f9729
4 changed files with 9 additions and 10 deletions

View File

@ -71,7 +71,7 @@ module array {
const from_val: Object = GetProperty(context, object, from);
// ii. Perform ? Set(O, toKey, fromVal, true).
SetProperty(context, object, to, from_val, kStrict);
SetProperty(context, object, to, from_val);
} else {
// i. Perform ? DeletePropertyOrThrow(O, toKey).
DeleteProperty(context, object, to, kStrict);

View File

@ -194,7 +194,7 @@ module array {
}
// 12. Perform ? Set(A, "length", actualDeleteCount, true).
SetProperty(context, a, 'length', actualDeleteCount, kStrict);
SetProperty(context, a, 'length', actualDeleteCount);
// 13. Let items be a List whose elements are, in left-to-right order,
// the portion of the actual argument list starting with the third
@ -224,7 +224,7 @@ module array {
let fromValue: Object = GetProperty(context, o, from);
// 2. Perform ? Set(O, to, fromValue, true).
SetProperty(context, o, to, fromValue, kStrict);
SetProperty(context, o, to, fromValue);
// v. Else fromPresent is false,
} else {
@ -267,7 +267,7 @@ module array {
let fromValue: Object = GetProperty(context, o, from);
// 2. Perform ? Set(O, to, fromValue, true).
SetProperty(context, o, to, fromValue, kStrict);
SetProperty(context, o, to, fromValue);
// v. Else fromPresent is false,
} else {
@ -289,7 +289,7 @@ module array {
if (arguments.length > 2) {
for (let e: Object of arguments [2: ]) {
// b. Perform ? Set(O, ! ToString(k), E, true).
SetProperty(context, o, ToString_Inline(context, k), e, kStrict);
SetProperty(context, o, ToString_Inline(context, k), e);
// c. Increase k by 1.
k = k + 1;
@ -298,8 +298,7 @@ module array {
// 19. Perform ? Set(O, "length", len - actualDeleteCount + itemCount,
// true).
SetProperty(
context, o, 'length', len - actualDeleteCount + itemCount, kStrict);
SetProperty(context, o, 'length', len - actualDeleteCount + itemCount);
return a;
}

View File

@ -181,6 +181,8 @@ extern macro ToLength_Inline(Context, Object): Number;
extern macro ToNumber_Inline(Context, Object): Number;
extern macro ToString_Inline(Context, Object): String;
extern macro GetProperty(Context, Object, Object): Object;
extern builtin SetProperty(Context, Object, Object, Object);
extern builtin DeleteProperty(Context, Object, Object, LanguageMode);
extern builtin HasProperty(Context, JSReceiver, Object): Boolean;
extern macro ThrowRangeError(Context, constexpr MessageTemplate): never;
@ -198,8 +200,6 @@ extern macro IsString(HeapObject): bool;
extern builtin ToString(Context, Object): String;
extern runtime CreateDataProperty(Context, Object, Object, Object);
extern runtime SetProperty(Context, Object, Object, Object, LanguageMode);
extern runtime DeleteProperty(Context, Object, Object, LanguageMode);
extern macro LoadRoot(constexpr RootListIndex): Object;
extern macro StoreRoot(constexpr RootListIndex, Object): Object;

View File

@ -205,7 +205,7 @@ module array {
builtin Store<ElementsAccessor : type>(
context: Context, sortState: FixedArray, elements: HeapObject, index: Smi,
value: Object): Smi {
SetProperty(context, elements, index, value, kStrict);
SetProperty(context, elements, index, value);
return kSuccess;
}