Chromium Code Reviews| Index: src/compiler.cc |
| diff --git a/src/compiler.cc b/src/compiler.cc |
| index 2e1a400981f931c3e2d0e1638f6405a258cb5d5d..c76d5078bf3918cb8e023736094a5bed7876f27c 100644 |
| --- a/src/compiler.cc |
| +++ b/src/compiler.cc |
| @@ -1118,21 +1118,6 @@ bool Compiler::InstallOptimizedCode(OptimizingCompiler* optimizing_compiler) { |
| } |
| -static uint32_t CurrentPcOffset(Isolate* isolate, |
| - Handle<JSFunction> function, |
| - Handle<Code> unoptimized) { |
| - JavaScriptFrameIterator it(isolate); |
| - JavaScriptFrame* frame = it.frame(); |
| - ASSERT(frame->function() == *function); |
| - ASSERT(frame->LookupCode() == *unoptimized); |
| - ASSERT(unoptimized->contains(frame->pc())); |
| - |
| - // Use linear search of the unoptimized code's back edge table to find |
| - // the AST id matching the PC. |
| - return static_cast<uint32_t>(frame->pc() - unoptimized->instruction_start()); |
| -} |
| - |
| - |
| static bool IsSuitableForOnStackReplacement(Isolate* isolate, |
| Handle<JSFunction> function, |
| Handle<Code> unoptimized) { |
| @@ -1153,7 +1138,7 @@ static bool IsSuitableForOnStackReplacement(Isolate* isolate, |
| Handle<Code> Compiler::CompileForOnStackReplacement( |
| - Handle<JSFunction> function) { |
| + Handle<JSFunction> function, uint32_t pc_offset) { |
| Isolate* isolate = function->GetIsolate(); |
| Handle<Code> unoptimized(function->shared()->code(), isolate); |
| @@ -1166,7 +1151,6 @@ Handle<Code> Compiler::CompileForOnStackReplacement( |
| if (IsSuitableForOnStackReplacement(isolate, function, unoptimized)) { |
|
titzer
2013/09/10 11:00:46
And this as well. The compiler should just compile
|
| // Find the PC offset in unoptimized code and translate to an AST id. |
| - uint32_t pc_offset = CurrentPcOffset(isolate, function, unoptimized); |
| BailoutId ast_id = unoptimized->TranslatePcOffsetToAstId(pc_offset); |
| ASSERT(!ast_id.IsNone()); |
| if (FLAG_trace_osr) { |
| @@ -1201,11 +1185,9 @@ Handle<Code> Compiler::CompileForOnStackReplacement( |
| } |
| -Handle<Code> Compiler::CompileForConcurrentOSR(Handle<JSFunction> function) { |
| +Handle<Code> Compiler::CompileForConcurrentOSR(Handle<JSFunction> function, |
| + uint32_t pc_offset) { |
| Isolate* isolate = function->GetIsolate(); |
| - Handle<Code> unoptimized(function->shared()->code(), isolate); |
| - |
| - uint32_t pc_offset = CurrentPcOffset(isolate, function, unoptimized); |
| if (isolate->optimizing_compiler_thread()-> |
| IsQueuedForOSR(function, pc_offset)) { |
| @@ -1218,6 +1200,7 @@ Handle<Code> Compiler::CompileForConcurrentOSR(Handle<JSFunction> function) { |
| return Handle<Code>::null(); |
| } |
| + Handle<Code> unoptimized(function->shared()->code(), isolate); |
| OptimizingCompiler* compiler = isolate->optimizing_compiler_thread()-> |
| FindReadyOSRCandidate(function, pc_offset); |
| @@ -1262,19 +1245,17 @@ Handle<Code> Compiler::CompileForConcurrentOSR(Handle<JSFunction> function) { |
| return Handle<Code>::null(); |
| } |
| - if (!IsSuitableForOnStackReplacement(isolate, function, unoptimized)) { |
| + if (IsSuitableForOnStackReplacement(isolate, function, unoptimized)) { |
| + if (RecompileConcurrent(function, pc_offset)) return Handle<Code>::null(); |
| + } else { |
| if (FLAG_trace_osr) { |
| PrintF("[COSR - "); |
| function->PrintName(); |
| PrintF(" is unsuitable, restoring interrupt calls]\n"); |
| } |
| - Deoptimizer::RevertInterruptCode(isolate, *unoptimized); |
| - return Handle<Code>::null(); |
| } |
| - if (!RecompileConcurrent(function, pc_offset)) { |
| - Deoptimizer::RevertInterruptCode(isolate, *unoptimized); |
| - } |
| + Deoptimizer::RevertInterruptCode(isolate, *unoptimized); |
| return Handle<Code>::null(); |
| } |