2015-05-09 10:30:44 +00:00
|
|
|
// Copyright 2015 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
|
|
|
|
|
|
|
|
var doubles = new Float64Array(1);
|
|
|
|
function ToHeapNumber(i) {
|
|
|
|
doubles[0] = i;
|
|
|
|
return doubles[0];
|
2019-06-12 14:00:50 +00:00
|
|
|
};
|
|
|
|
%PrepareFunctionForOptimization(ToHeapNumber);
|
2015-05-09 10:30:44 +00:00
|
|
|
for (var i = 0; i < 3; i++) ToHeapNumber(i);
|
|
|
|
%OptimizeFunctionOnNextCall(ToHeapNumber);
|
2015-10-27 16:17:43 +00:00
|
|
|
ToHeapNumber(1);
|
2015-05-09 10:30:44 +00:00
|
|
|
|
|
|
|
function Fail(a, i, v) {
|
|
|
|
a[i] = v;
|
2019-06-12 14:00:50 +00:00
|
|
|
};
|
|
|
|
%PrepareFunctionForOptimization(Fail);
|
2015-05-09 10:30:44 +00:00
|
|
|
for (var i = 0; i < 3; i++) Fail(new Array(1), 1, i);
|
|
|
|
%OptimizeFunctionOnNextCall(Fail);
|
|
|
|
// 1050 > JSObject::kMaxGap, causing stub failure and runtime call.
|
|
|
|
Fail(new Array(1), ToHeapNumber(1050), 3);
|