blob: daa776005e7b5bcb165cd04f2c6abf226fc720b3 [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// Copyright 2015 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// Flags: --allow-natives-syntax
6
7function f(a, i, bool) {
8 var result;
9 if (bool) {
10 // Make sure i - -0x80000000 doesn't overflow in BCE, missing a check for
11 // x-0 later on.
12 result = f2(a, 0x7fffffff, i, i, -0x80000000);
13 } else {
14 result = f2(a, -3, 4, i, 0);
15 }
16 return result;
17}
18
19function f2(a, c, x, i, d) {
20 return a[x + c] + a[x - 0] + a[i - d];
21}
22
23
24var a = [];
25var i = 0;
26a.push(i++);
27a.push(i++);
28a.push(i++);
29a.push(i++);
30a.push(i++);
31f(a, 0, false);
32f(a, 0, false);
33f(a, 0, false);
34%OptimizeFunctionOnNextCall(f);
35%DebugPrint(f(a, -0x7fffffff, true));