summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/regress/regress-5404.js
blob: b776a73bd0447027bcaa46feb8646c1b6ef3f4fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Flags: --allow-natives-syntax --crankshaft

function foo(a, b) {
  return a + "0123456789012";
}

foo("a");
foo("a");
%OptimizeFunctionOnNextCall(foo);
foo("a");

var a = "a".repeat(268435440);
assertThrows(function() { foo(a); });

%OptimizeFunctionOnNextCall(foo);
assertThrows(function() { foo(a); });
assertOptimized(foo);