blob: bb11c82908d6ada5a0aea74aaa9c1895ea851691 [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
7var doubles = new Float64Array(1);
8function ToHeapNumber(i) {
9 doubles[0] = i;
10 return doubles[0];
11}
12for (var i = 0; i < 3; i++) ToHeapNumber(i);
13%OptimizeFunctionOnNextCall(ToHeapNumber);
14ToHeapNumber(1);
15
16function Fail(a, i, v) {
17 a[i] = v;
18}
19
20for (var i = 0; i < 3; i++) Fail(new Array(1), 1, i);
21%OptimizeFunctionOnNextCall(Fail);
22// 1050 > JSObject::kMaxGap, causing stub failure and runtime call.
23Fail(new Array(1), ToHeapNumber(1050), 3);