Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index 3c51baa30e9881d3a8ac739166ba01c2673d1c1f..0d19dd7a21ded7359924910ce40185fa0d993671 100644 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -361,7 +361,7 @@ OptimizingCompiler::Status OptimizingCompiler::CreateGraph() { |
} |
const int locals_limit = LUnallocated::kMaxFixedSlotIndex; |
- if (!info()->osr_ast_id().IsNone() && |
+ if (info()->is_osr() && |
scope->num_parameters() + 1 + scope->num_stack_slots() > locals_limit) { |
info()->set_bailout_reason("too many parameters/locals"); |
return AbortOptimization(); |
@@ -872,7 +872,7 @@ static void InstallCodeCommon(CompilationInfo* info) { |
static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) { |
Handle<Code> code = info->code(); |
if (FLAG_cache_optimized_code && |
- info->osr_ast_id().IsNone() && |
+ !info->is_osr() && |
code->kind() == Code::OPTIMIZED_FUNCTION) { |
Handle<JSFunction> function = info->closure(); |
Handle<SharedFunctionInfo> shared(function->shared()); |
@@ -886,7 +886,7 @@ static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) { |
static bool InstallCodeFromOptimizedCodeMap(CompilationInfo* info) { |
if (FLAG_cache_optimized_code && |
- info->osr_ast_id().IsNone() && |
+ !info->is_osr() && |
info->IsOptimizing()) { |
Handle<SharedFunctionInfo> shared = info->shared_info(); |
Handle<JSFunction> function = info->closure(); |
@@ -943,12 +943,17 @@ bool Compiler::CompileLazy(CompilationInfo* info) { |
InstallCodeCommon(info); |
if (info->IsOptimizing()) { |
+ // Optimized code successfully created. |
Handle<Code> code = info->code(); |
ASSERT(shared->scope_info() != ScopeInfo::Empty(isolate)); |
- info->closure()->ReplaceCode(*code); |
- InsertCodeIntoOptimizedCodeMap(info); |
+ if (!info->is_osr()) { |
+ // Only replace the code if it was not an OSR compile. |
+ info->closure()->ReplaceCode(*code); |
+ InsertCodeIntoOptimizedCodeMap(info); |
+ } |
return true; |
- } else { |
+ } else if (!info->is_osr()) { |
+ // Compilation failed. Replace with full code if not OSR compile. |
return InstallFullCode(info); |
} |
} |