summaryrefslogtreecommitdiff
path: root/deps/v8/src/builtins/array-reduce.tq
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/builtins/array-reduce.tq')
-rw-r--r--deps/v8/src/builtins/array-reduce.tq50
1 files changed, 25 insertions, 25 deletions
diff --git a/deps/v8/src/builtins/array-reduce.tq b/deps/v8/src/builtins/array-reduce.tq
index 67a112fd41..a5f6feb9cc 100644
--- a/deps/v8/src/builtins/array-reduce.tq
+++ b/deps/v8/src/builtins/array-reduce.tq
@@ -4,8 +4,9 @@
namespace array {
transitioning javascript builtin
- ArrayReducePreLoopEagerDeoptContinuation(implicit context: Context)(
- receiver: Object, callback: Object, length: Object): Object {
+ ArrayReducePreLoopEagerDeoptContinuation(
+ js-implicit context: Context,
+ receiver: Object)(callback: Object, length: Object): Object {
// All continuation points in the optimized every implementation are
// after the ToObject(O) call that ensures we are dealing with a
// JSReceiver.
@@ -21,12 +22,13 @@ namespace array {
// the hole. The continuation stub will search for the initial non-hole
// element, rightly throwing an exception if not found.
return ArrayReduceLoopContinuation(
- jsreceiver, callbackfn, Hole, jsreceiver, 0, numberLength);
+ jsreceiver, callbackfn, TheHole, jsreceiver, 0, numberLength);
}
transitioning javascript builtin
- ArrayReduceLoopEagerDeoptContinuation(implicit context: Context)(
- receiver: Object, callback: Object, initialK: Object, length: Object,
+ ArrayReduceLoopEagerDeoptContinuation(
+ js-implicit context: Context, receiver: Object)(
+ callback: Object, initialK: Object, length: Object,
accumulator: Object): Object {
// All continuation points in the optimized every implementation are
// after the ToObject(O) call that ensures we are dealing with a
@@ -45,25 +47,26 @@ namespace array {
}
transitioning javascript builtin
- ArrayReduceLoopLazyDeoptContinuation(implicit context: Context)(
- receiver: Object, callback: Object, initialK: Object, length: Object,
+ ArrayReduceLoopLazyDeoptContinuation(
+ js-implicit context: Context, receiver: Object)(
+ callback: Object, initialK: Object, length: Object,
result: Object): Object {
// All continuation points in the optimized every implementation are
// after the ToObject(O) call that ensures we are dealing with a
// JSReceiver.
const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable;
const callbackfn = Cast<Callable>(callback) otherwise unreachable;
- let numberK = Cast<Number>(initialK) otherwise unreachable;
+ const numberK = Cast<Number>(initialK) otherwise unreachable;
const numberLength = Cast<Number>(length) otherwise unreachable;
// The accumulator is the result from the callback call which just occured.
- let r = ArrayReduceLoopContinuation(
+ const r = ArrayReduceLoopContinuation(
jsreceiver, callbackfn, result, jsreceiver, numberK, numberLength);
return r;
}
transitioning builtin ArrayReduceLoopContinuation(implicit context: Context)(
- receiver: JSReceiver, callbackfn: Callable, initialAccumulator: Object,
+ _receiver: JSReceiver, callbackfn: Callable, initialAccumulator: Object,
o: JSReceiver, initialK: Number, length: Number): Object {
let accumulator = initialAccumulator;
@@ -81,7 +84,7 @@ namespace array {
// 6c. i. Let kValue be ? Get(O, Pk).
const value: Object = GetProperty(o, k);
- if (accumulator == Hole) {
+ if (accumulator == TheHole) {
// 8b.
accumulator = value;
} else {
@@ -98,7 +101,7 @@ namespace array {
// 8c. if kPresent is false, throw a TypeError exception.
// If the accumulator is discovered with the sentinel hole value,
// this means kPresent is false.
- if (accumulator == Hole) {
+ if (accumulator == TheHole) {
ThrowTypeError(kReduceNoInitial, 'Array.prototype.reduce');
}
return accumulator;
@@ -110,9 +113,10 @@ namespace array {
labels Bailout(Number, Object) {
const k = 0;
let accumulator = initialAccumulator;
- const smiLen = Cast<Smi>(len) otherwise goto Bailout(k, accumulator);
- let fastO = Cast<FastJSArray>(o) otherwise goto Bailout(k, accumulator);
- let fastOW = NewFastJSArrayWitness(fastO);
+ Cast<Smi>(len) otherwise goto Bailout(k, accumulator);
+ const fastO =
+ Cast<FastJSArrayForRead>(o) otherwise goto Bailout(k, accumulator);
+ let fastOW = NewFastJSArrayForReadWitness(fastO);
// Build a fast loop over the array.
for (let k: Smi = 0; k < len; k++) {
@@ -122,7 +126,7 @@ namespace array {
if (k >= fastOW.Get().length) goto Bailout(k, accumulator);
const value: Object = fastOW.LoadElementNoHole(k) otherwise continue;
- if (accumulator == Hole) {
+ if (accumulator == TheHole) {
accumulator = value;
} else {
accumulator = Call(
@@ -130,7 +134,7 @@ namespace array {
fastOW.Get());
}
}
- if (accumulator == Hole) {
+ if (accumulator == TheHole) {
ThrowTypeError(kReduceNoInitial, 'Array.prototype.reduce');
}
return accumulator;
@@ -138,12 +142,10 @@ namespace array {
// https://tc39.github.io/ecma262/#sec-array.prototype.reduce
transitioning javascript builtin
- ArrayReduce(implicit context: Context)(receiver: Object, ...arguments):
+ ArrayReduce(js-implicit context: Context, receiver: Object)(...arguments):
Object {
try {
- if (IsNullOrUndefined(receiver)) {
- goto NullOrUndefinedError;
- }
+ RequireObjectCoercible(receiver, 'Array.prototype.reduce');
// 1. Let O be ? ToObject(this value).
const o: JSReceiver = ToObject_Inline(context, receiver);
@@ -161,7 +163,8 @@ namespace array {
// exception. (This case is handled at the end of
// ArrayReduceLoopContinuation).
- const initialValue: Object = arguments.length > 1 ? arguments[1] : Hole;
+ const initialValue: Object =
+ arguments.length > 1 ? arguments[1] : TheHole;
try {
return FastArrayReduce(o, len, callbackfn, initialValue)
@@ -175,8 +178,5 @@ namespace array {
label NoCallableError deferred {
ThrowTypeError(kCalledNonCallable, arguments[0]);
}
- label NullOrUndefinedError deferred {
- ThrowTypeError(kCalledOnNullOrUndefined, 'Array.prototype.reduce');
- }
}
}