Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(868)

Unified Diff: src/optimizing-compiler-thread.cc

Issue 142813003: A64: Synchronize with r15358. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/optimizing-compiler-thread.h ('k') | src/parser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/optimizing-compiler-thread.cc
diff --git a/src/optimizing-compiler-thread.cc b/src/optimizing-compiler-thread.cc
index b2abc813abb63e52a191ae789352b79962264e19..b9ff7d83eca369c0b194ab2cd40ccdec5c9379be 100644
--- a/src/optimizing-compiler-thread.cc
+++ b/src/optimizing-compiler-thread.cc
@@ -89,8 +89,9 @@ 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
+ // are always also queued.
+ ScopedLock mark_and_queue(install_mutex_);
{ Heap::RelocationLock relocation_lock(isolate_->heap());
AllowHandleDereference ahd;
optimizing_compiler->info()->closure()->MarkForInstallingRecompiledCode();
@@ -106,12 +107,15 @@ void OptimizingCompilerThread::Stop() {
stop_semaphore_->Wait();
if (FLAG_parallel_recompilation_delay != 0) {
- InstallOptimizedFunctions();
// Barrier when loading queue length is not necessary since the write
// happens in CompileNext on the same thread.
- while (NoBarrier_Load(&queue_length_) > 0) {
- CompileNext();
- InstallOptimizedFunctions();
+ while (NoBarrier_Load(&queue_length_) > 0) CompileNext();
+ InstallOptimizedFunctions();
+ } else {
+ OptimizingCompiler* optimizing_compiler;
+ while (input_queue_.Dequeue(&optimizing_compiler)) {
+ // The optimizing compiler is allocated in the CompilationInfo's zone.
+ delete optimizing_compiler->info();
}
}
@@ -127,12 +131,13 @@ void OptimizingCompilerThread::Stop() {
void OptimizingCompilerThread::InstallOptimizedFunctions() {
ASSERT(!IsOptimizerThread());
HandleScope handle_scope(isolate_);
- int functions_installed = 0;
- while (!output_queue_.IsEmpty()) {
- OptimizingCompiler* compiler;
- output_queue_.Dequeue(&compiler);
+ OptimizingCompiler* 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++;
}
}
« no previous file with comments | « src/optimizing-compiler-thread.h ('k') | src/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698