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

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

Issue 21156009: Re-revert "Flush parallel recompilation queues on context dispose notification" (r15883). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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/runtime.cc » ('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 11d60c33d203f0f460e8749724b7b093fb4f5324..21ef237107194d06a897110444c01710eae31bd0 100644
--- a/src/optimizing-compiler-thread.cc
+++ b/src/optimizing-compiler-thread.cc
@@ -60,23 +60,12 @@ void OptimizingCompilerThread::Run() {
OS::Sleep(FLAG_parallel_recompilation_delay);
}
- switch (static_cast<StopFlag>(Acquire_Load(&stop_thread_))) {
- case CONTINUE:
- break;
- case STOP:
- if (FLAG_trace_parallel_recompilation) {
- time_spent_total_ = OS::Ticks() - epoch;
- }
- stop_semaphore_->Signal();
- return;
- case FLUSH:
- // Reset input queue semaphore.
- delete input_queue_semaphore_;
- input_queue_semaphore_ = OS::CreateSemaphore(0);
- // Signal for main thread to start flushing.
- stop_semaphore_->Signal();
- // Return to start of consumer loop.
- continue;
+ if (Acquire_Load(&stop_thread_)) {
+ stop_semaphore_->Signal();
+ if (FLAG_trace_parallel_recompilation) {
+ time_spent_total_ = OS::Ticks() - epoch;
+ }
+ return;
}
int64_t compiling_start = 0;
@@ -113,41 +102,9 @@ void OptimizingCompilerThread::CompileNext() {
}
-void OptimizingCompilerThread::FlushQueue(
- UnboundQueue<OptimizingCompiler*>* queue,
- bool restore_function_code) {
- ASSERT(!IsOptimizerThread());
- OptimizingCompiler* optimizing_compiler;
- // The optimizing compiler is allocated in the CompilationInfo's zone.
- while (queue->Dequeue(&optimizing_compiler)) {
- CompilationInfo* info = optimizing_compiler->info();
- if (restore_function_code) {
- Handle<JSFunction> function = info->closure();
- function->ReplaceCode(function->shared()->code());
- }
- delete info;
- }
-}
-
-
-void OptimizingCompilerThread::Flush() {
- ASSERT(!IsOptimizerThread());
- Release_Store(&stop_thread_, static_cast<AtomicWord>(FLUSH));
- input_queue_semaphore_->Signal();
-
- FlushQueue(&input_queue_, true);
- NoBarrier_Store(&queue_length_, static_cast<AtomicWord>(0));
-
- stop_semaphore_->Wait();
- Release_Store(&stop_thread_, static_cast<AtomicWord>(CONTINUE));
-
- FlushQueue(&output_queue_, true);
-}
-
-
void OptimizingCompilerThread::Stop() {
ASSERT(!IsOptimizerThread());
- Release_Store(&stop_thread_, static_cast<AtomicWord>(STOP));
+ Release_Store(&stop_thread_, static_cast<AtomicWord>(true));
input_queue_semaphore_->Signal();
stop_semaphore_->Wait();
@@ -157,8 +114,14 @@ void OptimizingCompilerThread::Stop() {
while (NoBarrier_Load(&queue_length_) > 0) CompileNext();
InstallOptimizedFunctions();
} else {
- FlushQueue(&input_queue_, false);
- FlushQueue(&output_queue_, false);
+ OptimizingCompiler* optimizing_compiler;
+ // The optimizing compiler is allocated in the CompilationInfo's zone.
+ while (input_queue_.Dequeue(&optimizing_compiler)) {
+ delete optimizing_compiler->info();
+ }
+ while (output_queue_.Dequeue(&optimizing_compiler)) {
+ delete optimizing_compiler->info();
+ }
}
if (FLAG_trace_parallel_recompilation) {
« no previous file with comments | « src/optimizing-compiler-thread.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698