| Index: src/runtime/runtime-compiler.cc
|
| diff --git a/src/runtime/runtime-compiler.cc b/src/runtime/runtime-compiler.cc
|
| index ebd0c13f0f9b1ef2e2bb44d5bfcb4d017d5e041c..37e17862fa60fa6c62a4d0825be8607ddb2cbf71 100644
|
| --- a/src/runtime/runtime-compiler.cc
|
| +++ b/src/runtime/runtime-compiler.cc
|
| @@ -290,8 +290,15 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
|
| // match. Fix heuristics for reenabling optimizations!
|
| function->shared()->increment_deopt_count();
|
|
|
| - // TODO(titzer): Do not install code into the function.
|
| - function->ReplaceCode(*result);
|
| + 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 {
|
| + // Crankshafted OSR code can be installed into the function.
|
| + function->ReplaceCode(*result);
|
| + }
|
| return *result;
|
| }
|
| }
|
|
|