Skip to content

Commit 6eff6cc

Browse files
tebbiCommit Bot
authored andcommitted
[torque] introduce separate implicit parameters for JavaScript calling convention
Implicit parameters for builtins with JavaScript linkage are now separate, using the keyword "js-implicit". They have to be one of: - context: Context - receiver: Object (this in JS) - target: JSFunction (arguments.callee in JS) - newTarget: Object (new.target in JS) Bug: v8:9120 v8:7793 Change-Id: I916f60971bb53d5046b6006725d0ce39291ca55e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1658159 Reviewed-by: Tamer Tas <tmrts@chromium.org> Reviewed-by: Simon Zünd <szuend@chromium.org> Reviewed-by: Sigurd Schneider <sigurds@chromium.org> Commit-Queue: Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#62174}
1 parent a66e3e5 commit 6eff6cc

60 files changed

Lines changed: 473 additions & 351 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/builtins/array-copywithin.tq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace array_copywithin {
99

1010
// https://tc39.github.io/ecma262/#sec-array.prototype.copyWithin
1111
transitioning javascript builtin ArrayPrototypeCopyWithin(
12-
context: Context, receiver: Object, ...arguments): Object {
12+
js-implicit context: Context, receiver: Object)(...arguments): Object {
1313
// 1. Let O be ? ToObject(this value).
1414
const object: JSReceiver = ToObject_Inline(context, receiver);
1515

src/builtins/array-every.tq

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
namespace array {
66
transitioning javascript builtin
7-
ArrayEveryLoopEagerDeoptContinuation(implicit context: Context)(
8-
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
7+
ArrayEveryLoopEagerDeoptContinuation(
8+
js-implicit context: Context, receiver: Object)(
9+
callback: Object, thisArg: Object, initialK: Object,
910
length: Object): Object {
1011
// All continuation points in the optimized every implementation are
1112
// after the ToObject(O) call that ensures we are dealing with a
@@ -25,9 +26,10 @@ namespace array {
2526
}
2627

2728
transitioning javascript builtin
28-
ArrayEveryLoopLazyDeoptContinuation(implicit context: Context)(
29-
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
30-
length: Object, result: Object): Object {
29+
ArrayEveryLoopLazyDeoptContinuation(
30+
js-implicit context: Context, receiver: Object)(
31+
callback: Object, thisArg: Object, initialK: Object, length: Object,
32+
result: Object): Object {
3133
// All continuation points in the optimized every implementation are
3234
// after the ToObject(O) call that ensures we are dealing with a
3335
// JSReceiver.
@@ -109,7 +111,7 @@ namespace array {
109111

110112
// https://tc39.github.io/ecma262/#sec-array.prototype.every
111113
transitioning javascript builtin
112-
ArrayEvery(implicit context: Context)(receiver: Object, ...arguments):
114+
ArrayEvery(js-implicit context: Context, receiver: Object)(...arguments):
113115
Object {
114116
try {
115117
if (IsNullOrUndefined(receiver)) {

src/builtins/array-filter.tq

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
namespace array_filter {
66
transitioning javascript builtin
7-
ArrayFilterLoopEagerDeoptContinuation(implicit context: Context)(
8-
receiver: Object, callback: Object, thisArg: Object, array: Object,
9-
initialK: Object, length: Object, initialTo: Object): Object {
7+
ArrayFilterLoopEagerDeoptContinuation(
8+
js-implicit context: Context, receiver: Object)(
9+
callback: Object, thisArg: Object, array: Object, initialK: Object,
10+
length: Object, initialTo: Object): Object {
1011
// All continuation points in the optimized filter implementation are
1112
// after the ToObject(O) call that ensures we are dealing with a
1213
// JSReceiver.
@@ -27,9 +28,10 @@ namespace array_filter {
2728
}
2829

2930
transitioning javascript builtin
30-
ArrayFilterLoopLazyDeoptContinuation(implicit context: Context)(
31-
receiver: Object, callback: Object, thisArg: Object, array: Object,
32-
initialK: Object, length: Object, valueK: Object, initialTo: Object,
31+
ArrayFilterLoopLazyDeoptContinuation(
32+
js-implicit context: Context, receiver: Object)(
33+
callback: Object, thisArg: Object, array: Object, initialK: Object,
34+
length: Object, valueK: Object, initialTo: Object,
3335
result: Object): Object {
3436
// All continuation points in the optimized filter implementation are
3537
// after the ToObject(O) call that ensures we are dealing with a
@@ -42,9 +44,9 @@ namespace array_filter {
4244
const numberLength = Cast<Number>(length) otherwise unreachable;
4345

4446
// This custom lazy deopt point is right after the callback. filter() needs
45-
// to pick up at the next step, which is setting the callback result in
46-
// the output array. After incrementing k and to, we can glide into the loop
47-
// continuation builtin.
47+
// to pick up at the next step, which is setting the callback
48+
// result in the output array. After incrementing k and to, we can glide
49+
// into the loop continuation builtin.
4850
if (ToBoolean(result)) {
4951
FastCreateDataProperty(outputArray, numberTo, valueK);
5052
numberTo = numberTo + 1;
@@ -145,7 +147,7 @@ namespace array_filter {
145147

146148
// https://tc39.github.io/ecma262/#sec-array.prototype.filter
147149
transitioning javascript builtin
148-
ArrayFilter(implicit context: Context)(receiver: Object, ...arguments):
150+
ArrayFilter(js-implicit context: Context, receiver: Object)(...arguments):
149151
Object {
150152
try {
151153
if (IsNullOrUndefined(receiver)) {

src/builtins/array-find.tq

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
namespace array_find {
66
transitioning javascript builtin
7-
ArrayFindLoopEagerDeoptContinuation(implicit context: Context)(
8-
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
7+
ArrayFindLoopEagerDeoptContinuation(
8+
js-implicit context: Context, receiver: Object)(
9+
callback: Object, thisArg: Object, initialK: Object,
910
length: Object): Object {
1011
// All continuation points in the optimized find implementation are
1112
// after the ToObject(O) call that ensures we are dealing with a
@@ -24,9 +25,10 @@ namespace array_find {
2425
}
2526

2627
transitioning javascript builtin
27-
ArrayFindLoopLazyDeoptContinuation(implicit context: Context)(
28-
_receiver: Object, _callback: Object, _thisArg: Object, _initialK: Object,
29-
_length: Object, _result: Object): Object {
28+
ArrayFindLoopLazyDeoptContinuation(
29+
js-implicit context: Context, receiver: Object)(
30+
_callback: Object, _thisArg: Object, _initialK: Object, _length: Object,
31+
_result: Object): Object {
3032
// This deopt continuation point is never actually called, it just
3133
// exists to make stack traces correct from a ThrowTypeError if the
3234
// callback was found to be non-callable.
@@ -37,9 +39,10 @@ namespace array_find {
3739
// happens right after the callback and it's returned value must be handled
3840
// before iteration continues.
3941
transitioning javascript builtin
40-
ArrayFindLoopAfterCallbackLazyDeoptContinuation(implicit context: Context)(
41-
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
42-
length: Object, foundValue: Object, isFound: Object): Object {
42+
ArrayFindLoopAfterCallbackLazyDeoptContinuation(
43+
js-implicit context: Context, receiver: Object)(
44+
callback: Object, thisArg: Object, initialK: Object, length: Object,
45+
foundValue: Object, isFound: Object): Object {
4346
// All continuation points in the optimized find implementation are
4447
// after the ToObject(O) call that ensures we are dealing with a
4548
// JSReceiver.
@@ -116,8 +119,8 @@ namespace array_find {
116119

117120
// https://tc39.github.io/ecma262/#sec-array.prototype.find
118121
transitioning javascript builtin
119-
ArrayPrototypeFind(implicit context: Context)(receiver: Object, ...arguments):
120-
Object {
122+
ArrayPrototypeFind(js-implicit context: Context, receiver: Object)(
123+
...arguments): Object {
121124
try {
122125
if (IsNullOrUndefined(receiver)) {
123126
goto NullOrUndefinedError;

src/builtins/array-findindex.tq

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
namespace array_findindex {
66
transitioning javascript builtin
7-
ArrayFindIndexLoopEagerDeoptContinuation(implicit context: Context)(
8-
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
7+
ArrayFindIndexLoopEagerDeoptContinuation(
8+
js-implicit context: Context, receiver: Object)(
9+
callback: Object, thisArg: Object, initialK: Object,
910
length: Object): Object {
1011
// All continuation points in the optimized findIndex implementation are
1112
// after the ToObject(O) call that ensures we are dealing with a
@@ -24,9 +25,10 @@ namespace array_findindex {
2425
}
2526

2627
transitioning javascript builtin
27-
ArrayFindIndexLoopLazyDeoptContinuation(implicit context: Context)(
28-
_receiver: Object, _callback: Object, _thisArg: Object, _initialK: Object,
29-
_length: Object, _result: Object): Object {
28+
ArrayFindIndexLoopLazyDeoptContinuation(
29+
js-implicit context: Context, receiver: Object)(
30+
_callback: Object, _thisArg: Object, _initialK: Object, _length: Object,
31+
_result: Object): Object {
3032
// This deopt continuation point is never actually called, it just
3133
// exists to make stack traces correct from a ThrowTypeError if the
3234
// callback was found to be non-callable.
@@ -37,10 +39,10 @@ namespace array_findindex {
3739
// happens right after the callback and it's returned value must be handled
3840
// before iteration continues.
3941
transitioning javascript builtin
40-
ArrayFindIndexLoopAfterCallbackLazyDeoptContinuation(implicit context:
41-
Context)(
42-
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
43-
length: Object, foundValue: Object, isFound: Object): Object {
42+
ArrayFindIndexLoopAfterCallbackLazyDeoptContinuation(
43+
js-implicit context: Context, receiver: Object)(
44+
callback: Object, thisArg: Object, initialK: Object, length: Object,
45+
foundValue: Object, isFound: Object): Object {
4446
// All continuation points in the optimized findIndex implementation are
4547
// after the ToObject(O) call that ensures we are dealing with a
4648
// JSReceiver.
@@ -118,8 +120,8 @@ namespace array_findindex {
118120

119121
// https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
120122
transitioning javascript builtin
121-
ArrayPrototypeFindIndex(implicit context:
122-
Context)(receiver: Object, ...arguments): Object {
123+
ArrayPrototypeFindIndex(js-implicit context: Context, receiver: Object)(
124+
...arguments): Object {
123125
try {
124126
if (IsNullOrUndefined(receiver)) {
125127
goto NullOrUndefinedError;

src/builtins/array-foreach.tq

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
namespace array_foreach {
66
transitioning javascript builtin
7-
ArrayForEachLoopEagerDeoptContinuation(implicit context: Context)(
8-
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
7+
ArrayForEachLoopEagerDeoptContinuation(
8+
js-implicit context: Context, receiver: Object)(
9+
callback: Object, thisArg: Object, initialK: Object,
910
length: Object): Object {
1011
// All continuation points in the optimized forEach implemntation are
1112
// after the ToObject(O) call that ensures we are dealing with a
@@ -21,9 +22,10 @@ namespace array_foreach {
2122
}
2223

2324
transitioning javascript builtin
24-
ArrayForEachLoopLazyDeoptContinuation(implicit context: Context)(
25-
receiver: Object, callback: Object, thisArg: Object, initialK: Object,
26-
length: Object, _result: Object): Object {
25+
ArrayForEachLoopLazyDeoptContinuation(
26+
js-implicit context: Context, receiver: Object)(
27+
callback: Object, thisArg: Object, initialK: Object, length: Object,
28+
_result: Object): Object {
2729
// All continuation points in the optimized forEach implemntation are
2830
// after the ToObject(O) call that ensures we are dealing with a
2931
// JSReceiver.
@@ -90,7 +92,8 @@ namespace array_foreach {
9092

9193
// https://tc39.github.io/ecma262/#sec-array.prototype.foreach
9294
transitioning javascript builtin
93-
ArrayForEach(context: Context, receiver: Object, ...arguments): Object {
95+
ArrayForEach(js-implicit context: Context, receiver: Object)(...arguments):
96+
Object {
9497
try {
9598
if (IsNullOrUndefined(receiver)) {
9699
goto NullOrUndefinedError;

src/builtins/array-join.tq

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,8 @@ namespace array_join {
557557

558558
// https://tc39.github.io/ecma262/#sec-array.prototype.join
559559
transitioning javascript builtin
560-
ArrayPrototypeJoin(context: Context, receiver: Object, ...arguments): Object {
560+
ArrayPrototypeJoin(js-implicit context: Context, receiver: Object)(
561+
...arguments): Object {
561562
const separator: Object = arguments[0];
562563

563564
// 1. Let O be ? ToObject(this value).
@@ -566,8 +567,8 @@ namespace array_join {
566567
// 2. Let len be ? ToLength(? Get(O, "length")).
567568
const len: Number = GetLengthProperty(o);
568569

569-
// Only handle valid array lengths. Although the spec allows larger values,
570-
// this matches historical V8 behavior.
570+
// Only handle valid array lengths. Although the spec allows larger
571+
// values, this matches historical V8 behavior.
571572
if (len > kMaxArrayIndex + 1) ThrowTypeError(kInvalidArrayLength);
572573

573574
return CycleProtectedArrayJoin<JSArray>(
@@ -576,7 +577,7 @@ namespace array_join {
576577

577578
// https://tc39.github.io/ecma262/#sec-array.prototype.tolocalestring
578579
transitioning javascript builtin ArrayPrototypeToLocaleString(
579-
context: Context, receiver: Object, ...arguments): Object {
580+
js-implicit context: Context, receiver: Object)(...arguments): Object {
580581
const locales: Object = arguments[0];
581582
const options: Object = arguments[1];
582583

@@ -586,8 +587,8 @@ namespace array_join {
586587
// 2. Let len be ? ToLength(? Get(O, "length")).
587588
const len: Number = GetLengthProperty(o);
588589

589-
// Only handle valid array lengths. Although the spec allows larger values,
590-
// this matches historical V8 behavior.
590+
// Only handle valid array lengths. Although the spec allows larger
591+
// values, this matches historical V8 behavior.
591592
if (len > kMaxArrayIndex + 1) ThrowTypeError(kInvalidArrayLength);
592593

593594
return CycleProtectedArrayJoin<JSArray>(
@@ -596,7 +597,7 @@ namespace array_join {
596597

597598
// https://tc39.github.io/ecma262/#sec-array.prototype.tostring
598599
transitioning javascript builtin ArrayPrototypeToString(
599-
context: Context, receiver: Object, ...arguments): Object {
600+
js-implicit context: Context, receiver: Object)(...arguments): Object {
600601
// 1. Let array be ? ToObject(this value).
601602
const array: JSReceiver = ToObject_Inline(context, receiver);
602603

@@ -617,7 +618,7 @@ namespace array_join {
617618

618619
// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.join
619620
transitioning javascript builtin TypedArrayPrototypeJoin(
620-
context: Context, receiver: Object, ...arguments): Object {
621+
js-implicit context: Context, receiver: Object)(...arguments): Object {
621622
const separator: Object = arguments[0];
622623

623624
// Spec: ValidateTypedArray is applied to the this value prior to evaluating
@@ -632,7 +633,7 @@ namespace array_join {
632633

633634
// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.tolocalestring
634635
transitioning javascript builtin TypedArrayPrototypeToLocaleString(
635-
context: Context, receiver: Object, ...arguments): Object {
636+
js-implicit context: Context, receiver: Object)(...arguments): Object {
636637
const locales: Object = arguments[0];
637638
const options: Object = arguments[1];
638639

src/builtins/array-lastindexof.tq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ namespace array_lastindexof {
131131

132132
// https://tc39.github.io/ecma262/#sec-array.prototype.lastIndexOf
133133
transitioning javascript builtin ArrayPrototypeLastIndexOf(
134-
context: Context, receiver: Object, ...arguments): Object {
134+
js-implicit context: Context, receiver: Object)(...arguments): Object {
135135
// 1. Let O be ? ToObject(this value).
136136
const object: JSReceiver = ToObject_Inline(context, receiver);
137137

src/builtins/array-map.tq

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
namespace array_map {
66
transitioning javascript builtin
7-
ArrayMapLoopEagerDeoptContinuation(implicit context: Context)(
8-
receiver: Object, callback: Object, thisArg: Object, array: Object,
9-
initialK: Object, length: Object): Object {
7+
ArrayMapLoopEagerDeoptContinuation(
8+
js-implicit context: Context, receiver: Object)(
9+
callback: Object, thisArg: Object, array: Object, initialK: Object,
10+
length: Object): Object {
1011
// All continuation points in the optimized filter implementation are
1112
// after the ToObject(O) call that ensures we are dealing with a
1213
// JSReceiver.
@@ -26,9 +27,10 @@ namespace array_map {
2627
}
2728

2829
transitioning javascript builtin
29-
ArrayMapLoopLazyDeoptContinuation(implicit context: Context)(
30-
receiver: Object, callback: Object, thisArg: Object, array: Object,
31-
initialK: Object, length: Object, result: Object): Object {
30+
ArrayMapLoopLazyDeoptContinuation(
31+
js-implicit context: Context, receiver: Object)(
32+
callback: Object, thisArg: Object, array: Object, initialK: Object,
33+
length: Object, result: Object): Object {
3234
// All continuation points in the optimized filter implementation are
3335
// after the ToObject(O) call that ensures we are dealing with a
3436
// JSReceiver.
@@ -222,7 +224,8 @@ namespace array_map {
222224

223225
// https://tc39.github.io/ecma262/#sec-array.prototype.map
224226
transitioning javascript builtin
225-
ArrayMap(implicit context: Context)(receiver: Object, ...arguments): Object {
227+
ArrayMap(js-implicit context: Context, receiver: Object)(...arguments):
228+
Object {
226229
try {
227230
if (IsNullOrUndefined(receiver)) goto NullOrUndefinedError;
228231

src/builtins/array-of.tq

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
namespace array_of {
66
// https://tc39.github.io/ecma262/#sec-array.of
77
transitioning javascript builtin
8-
ArrayOf(implicit context: Context)(receiver: Object, ...arguments): Object {
8+
ArrayOf(js-implicit context: Context, receiver: Object)(...arguments):
9+
Object {
910
// 1. Let len be the actual number of arguments passed to this function.
1011
const len: Smi = Convert<Smi>(arguments.length);
1112

0 commit comments

Comments
 (0)