Chromium Code Reviews| Index: src/optimizing-compiler-thread.cc |
| diff --git a/src/optimizing-compiler-thread.cc b/src/optimizing-compiler-thread.cc |
| index e092248b6f56613ee3b196bf08a0fd701bfade32..387575bf86ef323b9d88c9589e56a50b4e46e18a 100644 |
| --- a/src/optimizing-compiler-thread.cc |
| +++ b/src/optimizing-compiler-thread.cc |
| @@ -89,8 +89,8 @@ void OptimizingCompilerThread::CompileNext() { |
| ASSERT(status != OptimizingCompiler::FAILED); |
| // The function may have already been optimized by OSR. Simply continue. |
| - // Mark it for installing before queuing so that we can be sure of the write |
| - // order: marking first and (after being queued) installing code second. |
| + // Use a mutex to make sure that functions marked for install |
|
Jakob Kummerow
2013/06/21 08:35:10
Looks like you forgot to actually use that mutex h
|
| + // are always also queued. |
| { Heap::RelocationLock relocation_lock(isolate_->heap()); |
| AllowHandleDereference ahd; |
| optimizing_compiler->info()->closure()->MarkForInstallingRecompiledCode(); |
| @@ -127,11 +127,13 @@ void OptimizingCompilerThread::Stop() { |
| void OptimizingCompilerThread::InstallOptimizedFunctions() { |
| ASSERT(!IsOptimizerThread()); |
| HandleScope handle_scope(isolate_); |
| - int functions_installed = 0; |
| OptimizingCompiler* compiler; |
| - while (output_queue_.Dequeue(&compiler)) { |
| + while (true) { |
| + { // Memory barrier to ensure marked functions are queued. |
| + ScopedLock marked_and_queued(install_mutex_); |
| + if (!output_queue_.Dequeue(&compiler)) return; |
| + } |
| Compiler::InstallOptimizedCode(compiler); |
| - functions_installed++; |
| } |
| } |