Commit 0d1e15d6 authored by klaasb's avatar klaasb Committed by Commit bot

Remove decision by Turbofan OSR to optimize on next call

When we OSR using Turbofan, we would set the function to be optimized
on the next call, irrespective of the runtime profiler's previous
decisions - such as compiling for baseline. It seems more prudent to
always make these decisions in the runtime profiler where the data is
available.

Review-Url: https://codereview.chromium.org/2369043002
Cr-Commit-Position: refs/heads/master@{#39782}
parent 55dd687a
......@@ -361,12 +361,7 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
// match. Fix heuristics for reenabling optimizations!
function->shared()->increment_deopt_count();
if (result->is_turbofanned()) {
// TurboFanned OSR code cannot be installed into the function.
// But the function is obviously hot, so optimize it next time.
function->ReplaceCode(
isolate->builtins()->builtin(Builtins::kCompileOptimized));
} else {
if (!result->is_turbofanned()) {
// Crankshafted OSR code can be installed into the function.
function->ReplaceCode(*result);
}
......
......@@ -1023,6 +1023,7 @@ TEST(BoundFunctionCall) {
// This tests checks distribution of the samples through the source lines.
static void TickLines(bool optimize) {
if (!optimize) i::FLAG_crankshaft = false;
CcTest::InitializeVM();
LocalContext env;
i::FLAG_allow_natives_syntax = true;
......@@ -1032,10 +1033,15 @@ static void TickLines(bool optimize) {
i::HandleScope scope(isolate);
i::EmbeddedVector<char, 512> script;
i::EmbeddedVector<char, 64> optimize_call;
const char* func_name = "func";
const char* opt_func =
optimize ? "%OptimizeFunctionOnNextCall" : "%NeverOptimizeFunction";
if (optimize) {
i::SNPrintF(optimize_call, "%%OptimizeFunctionOnNextCall(%s);\n",
func_name);
} else {
i::SNPrintF(optimize_call, "");
}
i::SNPrintF(script,
"function %s() {\n"
" var n = 0;\n"
......@@ -1045,10 +1051,10 @@ static void TickLines(bool optimize) {
" n += m * m * m;\n"
" }\n"
"}\n"
"%s();"
"%s(%s);\n"
"%s();\n"
"%s"
"%s();\n",
func_name, func_name, opt_func, func_name, func_name);
func_name, func_name, optimize_call.start(), func_name);
CompileRun(script.start());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment