blob: 0845afc5ac6f3e32008b830e8a5283cbc83179c3 [file] [log] [blame]
Ben Murdoch61f157c2016-09-16 13:49:30 +01001// Copyright 2016 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5"use strict";
6
7function f(a, b, c) { return arguments }
8function g(...args) { return args }
9
10// On 64-bit machine this produces a 768K array which is sufficiently small to
11// not cause a stack overflow, but big enough to move the allocated arguments
12// object into large object space (kMaxRegularHeapObjectSize == 600K).
13var length = Math.pow(2, 15) * 3;
14var args = new Array(length);
15assertEquals(length, f.apply(null, args).length);
16assertEquals(length, g.apply(null, args).length);
17
18// On 32-bit machines this produces an equally sized array, however it might in
19// turn trigger a stack overflow on 64-bit machines, which we need to catch.
20var length = Math.pow(2, 16) * 3;
21var args = new Array(length);
22try { f.apply(null, args) } catch(e) {}
23try { g.apply(null, args) } catch(e) {}