2014-03-13 13:57:21 +00:00
|
|
|
// Copyright 2014 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 big = 1e10;
|
|
|
|
var backup = new Float64Array(1);
|
|
|
|
|
2019-06-12 14:00:50 +00:00
|
|
|
function mult0(val) {
|
2014-03-13 13:57:21 +00:00
|
|
|
var prod = val * big;
|
|
|
|
backup[0] = prod;
|
|
|
|
var rounded = Math.round(prod);
|
|
|
|
assertEquals(prod, backup[0]);
|
|
|
|
return rounded;
|
2019-06-12 14:00:50 +00:00
|
|
|
};
|
|
|
|
%PrepareFunctionForOptimization(mult0);
|
2014-03-13 13:57:21 +00:00
|
|
|
var count = 5;
|
|
|
|
for (var i = 0; i < count; i++) {
|
|
|
|
if (i == count - 1) %OptimizeFunctionOnNextCall(mult0);
|
|
|
|
var result = mult0(-1);
|
|
|
|
assertEquals(result, -big);
|
|
|
|
}
|