v8/test/mjsunit/regress/regress-381313.js
Mathias Bynens c6a16c10dd [test] Add %PrepareForOptimization to even more tests
With bytecode flushing and lazy feedback allocation, we need to call
%PrepareForOptimization before we call %OptimizeFunctionOnNextCall,
ideally after declaring the function.

Bug: v8:8801, v8:8394, v8:9183
Change-Id: I3fb257282a30f6526a376a3afdedb44786320d34
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1648255
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62119}
2019-06-12 14:40:14 +00:00

43 lines
875 B
JavaScript

// 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 g = 0;
function f(x, deopt) {
var a0 = x;
var a1 = 2 * x;
var a2 = 3 * x;
var a3 = 4 * x;
var a4 = 5 * x;
var a5 = 6 * x;
var a6 = 7 * x;
var a7 = 8 * x;
var a8 = 9 * x;
var a9 = 10 * x;
var a10 = 11 * x;
var a11 = 12 * x;
var a12 = 13 * x;
var a13 = 14 * x;
var a14 = 15 * x;
var a15 = 16 * x;
var a16 = 17 * x;
var a17 = 18 * x;
var a18 = 19 * x;
var a19 = 20 * x;
g = 1;
deopt + 0;
return a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9 + a10 + a11 + a12 +
a13 + a14 + a15 + a16 + a17 + a18 + a19;
};
%PrepareFunctionForOptimization(f);
f(0.5, 0);
f(0.5, 0);
%OptimizeFunctionOnNextCall(f);
print(f(0.5, ""));