summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/array-reduce.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/mjsunit/array-reduce.js')
-rw-r--r--deps/v8/test/mjsunit/array-reduce.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/array-reduce.js b/deps/v8/test/mjsunit/array-reduce.js
index f34d3ef6ff..4a4494a72c 100644
--- a/deps/v8/test/mjsunit/array-reduce.js
+++ b/deps/v8/test/mjsunit/array-reduce.js
@@ -537,3 +537,23 @@ var arr = [];
Object.defineProperty(arr, "0", { get: function() { delete this[0] },
configurable: true});
assertEquals(undefined, arr.reduceRight(function(val) { return val }));
+
+
+(function ReduceRightMaxIndex() {
+ const kMaxIndex = 0xffffffff-1;
+ let array = [];
+ array[kMaxIndex-2] = 'value-2';
+ array[kMaxIndex-1] = 'value-1';
+ // Use the maximum array index possible.
+ array[kMaxIndex] = 'value';
+ // Add the next index which is a normal property and thus will not show up.
+ array[kMaxIndex+1] = 'normal property';
+ assertThrowsEquals( () => {
+ array.reduceRight((sum, value) => {
+ assertEquals('initial', sum);
+ assertEquals('value', value);
+ // Throw at this point as we would very slowly loop down from kMaxIndex.
+ throw 'do not continue';
+ }, 'initial')
+ }, 'do not continue');
+})();