regress-5404.js 524 Bytes
Newer Older
1 2 3 4
// 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.

5
// Flags: --allow-natives-syntax --opt
6 7 8 9 10 11 12 13 14 15

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

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

16 17
var a = "a".repeat(%StringMaxLength());
assertThrows(function() { foo(a); }, RangeError);
18 19

%OptimizeFunctionOnNextCall(foo);
20
assertThrows(function() { foo(a); }, RangeError);
21
assertOptimized(foo);