Index: src/optimizing-compiler-thread.cc |
diff --git a/src/optimizing-compiler-thread.cc b/src/optimizing-compiler-thread.cc |
index 32a7f971401b65e7521b94edccc114bf0c8ec0d6..c58f773f723fcb795675f04a668165216e1b2ada 100644 |
--- a/src/optimizing-compiler-thread.cc |
+++ b/src/optimizing-compiler-thread.cc |
@@ -140,7 +140,10 @@ static void DisposeRecompileJob(RecompileJob* job, |
CompilationInfo* info = job->info(); |
if (restore_function_code) { |
if (info->is_osr()) { |
- if (!job->IsWaitingForInstall()) BackEdgeTable::RemoveStackCheck(info); |
+ if (!job->IsWaitingForInstall()) { |
+ // Remove stack check that guards OSR entry on original code. |
+ BackEdgeTable::RemoveStackCheck(info); |
+ } |
} else { |
Handle<JSFunction> function = info->closure(); |
function->ReplaceCode(function->shared()->code()); |
@@ -239,6 +242,7 @@ void OptimizingCompilerThread::InstallOptimizedFunctions() { |
RecompileJob* job; |
while (output_queue_.Dequeue(&job)) { |
CompilationInfo* info = job->info(); |
+ Handle<JSFunction> function(*info->closure()); |
if (info->is_osr()) { |
if (FLAG_trace_osr) { |
PrintF("[COSR - "); |
@@ -249,7 +253,8 @@ void OptimizingCompilerThread::InstallOptimizedFunctions() { |
job->WaitForInstall(); |
BackEdgeTable::RemoveStackCheck(info); |
} else { |
- Compiler::InstallOptimizedCode(job); |
+ Handle<Code> code = Compiler::GetConcurrentlyOptimizedCode(job); |
+ function->ReplaceCode(*code); |
} |
} |
} |
@@ -260,13 +265,7 @@ void OptimizingCompilerThread::QueueForOptimization(RecompileJob* job) { |
ASSERT(!IsOptimizerThread()); |
CompilationInfo* info = job->info(); |
if (info->is_osr()) { |
- if (FLAG_trace_concurrent_recompilation) { |
- PrintF(" ** Queueing "); |
- info->closure()->PrintName(); |
- PrintF(" for concurrent on-stack replacement.\n"); |
- } |
osr_attempts_++; |
- BackEdgeTable::AddStackCheck(info); |
AddToOsrBuffer(job); |
// Add job to the front of the input queue. |
LockGuard<Mutex> access_input_queue(&input_queue_mutex_); |
@@ -276,7 +275,6 @@ void OptimizingCompilerThread::QueueForOptimization(RecompileJob* job) { |
input_queue_[InputQueueIndex(0)] = job; |
input_queue_length_++; |
} else { |
- info->closure()->MarkInRecompileQueue(); |
// Add job to the back of the input queue. |
LockGuard<Mutex> access_input_queue(&input_queue_mutex_); |
ASSERT_LT(input_queue_length_, input_queue_capacity_); |
@@ -301,13 +299,13 @@ void OptimizingCompilerThread::Unblock() { |
RecompileJob* OptimizingCompilerThread::FindReadyOSRCandidate( |
- Handle<JSFunction> function, uint32_t osr_pc_offset) { |
+ Handle<JSFunction> function, BailoutId osr_ast_id) { |
ASSERT(!IsOptimizerThread()); |
for (int i = 0; i < osr_buffer_capacity_; i++) { |
RecompileJob* current = osr_buffer_[i]; |
if (current != NULL && |
current->IsWaitingForInstall() && |
- current->info()->HasSameOsrEntry(function, osr_pc_offset)) { |
+ current->info()->HasSameOsrEntry(function, osr_ast_id)) { |
osr_hits_++; |
osr_buffer_[i] = NULL; |
return current; |
@@ -318,12 +316,12 @@ RecompileJob* OptimizingCompilerThread::FindReadyOSRCandidate( |
bool OptimizingCompilerThread::IsQueuedForOSR(Handle<JSFunction> function, |
- uint32_t osr_pc_offset) { |
+ BailoutId osr_ast_id) { |
ASSERT(!IsOptimizerThread()); |
for (int i = 0; i < osr_buffer_capacity_; i++) { |
RecompileJob* current = osr_buffer_[i]; |
if (current != NULL && |
- current->info()->HasSameOsrEntry(function, osr_pc_offset)) { |
+ current->info()->HasSameOsrEntry(function, osr_ast_id)) { |
return !current->IsWaitingForInstall(); |
} |
} |