Index: src/optimizing-compiler-thread.cc |
diff --git a/src/optimizing-compiler-thread.cc b/src/optimizing-compiler-thread.cc |
index e6467f1547f641c60c8de772726760eaa3d8bc53..d9c82ce70152abea0200a6e9d78a43a87de1bb61 100644 |
--- a/src/optimizing-compiler-thread.cc |
+++ b/src/optimizing-compiler-thread.cc |
@@ -114,13 +114,17 @@ void OptimizingCompilerThread::CompileNext() { |
} |
-static void DisposeRecompileJob(RecompileJob* compiler, |
+static void DisposeRecompileJob(RecompileJob* job, |
bool restore_function_code) { |
// The recompile job is allocated in the CompilationInfo's zone. |
- CompilationInfo* info = compiler->info(); |
+ CompilationInfo* info = job->info(); |
if (restore_function_code) { |
- Handle<JSFunction> function = info->closure(); |
- function->ReplaceCode(function->shared()->code()); |
+ if (info->is_osr()) { |
+ if (!job->IsWaitingForInstall()) BackEdgeTable::RemoveStackCheck(info); |
+ } else { |
+ Handle<JSFunction> function = info->closure(); |
+ function->ReplaceCode(function->shared()->code()); |
+ } |
} |
delete info; |
} |
@@ -132,8 +136,8 @@ void OptimizingCompilerThread::FlushInputQueue(bool restore_function_code) { |
// This should not block, since we have one signal on the input queue |
// semaphore corresponding to each element in the input queue. |
input_queue_semaphore_.Wait(); |
- if (job->info()->osr_ast_id().IsNone()) { |
- // OSR jobs are dealt with separately. |
+ // OSR jobs are dealt with separately. |
+ if (!job->info()->is_osr()) { |
DisposeRecompileJob(job, restore_function_code); |
} |
} |
@@ -147,8 +151,8 @@ void OptimizingCompilerThread::FlushOutputQueue(bool restore_function_code) { |
{ LockGuard<Mutex> access_queue(&queue_mutex_); |
if (!output_queue_.Dequeue(&job)) break; |
} |
- if (job->info()->osr_ast_id().IsNone()) { |
- // OSR jobs are dealt with separately. |
+ // OSR jobs are dealt with separately. |
+ if (!job->info()->is_osr()) { |
DisposeRecompileJob(job, restore_function_code); |
} |
} |
@@ -221,9 +225,7 @@ void OptimizingCompilerThread::InstallOptimizedFunctions() { |
if (!output_queue_.Dequeue(&job)) break; |
} |
CompilationInfo* info = job->info(); |
- if (info->osr_ast_id().IsNone()) { |
- Compiler::InstallOptimizedCode(job); |
- } else { |
+ if (info->is_osr()) { |
if (FLAG_trace_osr) { |
PrintF("[COSR - "); |
info->closure()->PrintName(); |
@@ -232,6 +234,8 @@ void OptimizingCompilerThread::InstallOptimizedFunctions() { |
} |
job->WaitForInstall(); |
BackEdgeTable::RemoveStackCheck(info); |
+ } else { |
+ Compiler::InstallOptimizedCode(job); |
} |
} |
} |
@@ -242,9 +246,7 @@ void OptimizingCompilerThread::QueueForOptimization(RecompileJob* job) { |
ASSERT(!IsOptimizerThread()); |
Barrier_AtomicIncrement(&queue_length_, static_cast<Atomic32>(1)); |
CompilationInfo* info = job->info(); |
- if (info->osr_ast_id().IsNone()) { |
- info->closure()->MarkInRecompileQueue(); |
- } else { |
+ if (info->is_osr()) { |
if (FLAG_trace_concurrent_recompilation) { |
PrintF(" ** Queueing "); |
info->closure()->PrintName(); |
@@ -253,6 +255,8 @@ void OptimizingCompilerThread::QueueForOptimization(RecompileJob* job) { |
AddToOsrBuffer(job); |
osr_attempts_++; |
BackEdgeTable::AddStackCheck(info); |
+ } else { |
+ info->closure()->MarkInRecompileQueue(); |
} |
input_queue_.Enqueue(job); |
input_queue_semaphore_.Signal(); |
@@ -317,7 +321,6 @@ void OptimizingCompilerThread::AddToOsrBuffer(RecompileJob* job) { |
info->closure()->PrintName(); |
PrintF(", AST id %d]\n", info->osr_ast_id().ToInt()); |
} |
- BackEdgeTable::RemoveStackCheck(info); |
DisposeRecompileJob(stale, false); |
break; |
} |