Disable concurrent osr when concurrent recompilation is disabled.
authoryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 7 Nov 2013 16:25:20 +0000 (16:25 +0000)
committeryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 7 Nov 2013 16:25:20 +0000 (16:25 +0000)
Also introduce a flag for a quick check that concurrency is on.

R=jkummerow@chromium.org
BUG=

Review URL: https://codereview.chromium.org/64543004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17570 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/isolate.h
src/optimizing-compiler-thread.cc
src/v8.cc

index 9aa14ee..cef7159 100644 (file)
@@ -305,7 +305,7 @@ class SystemThreadManager {
   enum ParallelSystemComponent {
     PARALLEL_SWEEPING,
     CONCURRENT_SWEEPING,
-    PARALLEL_RECOMPILATION
+    CONCURRENT_RECOMPILATION
   };
 
   static int NumberOfParallelSystemThreads(ParallelSystemComponent type);
index e9c0254..fbc4f05 100644 (file)
@@ -346,23 +346,23 @@ bool OptimizingCompilerThread::IsQueuedForOSR(JSFunction* function) {
 void OptimizingCompilerThread::AddToOsrBuffer(RecompileJob* job) {
   ASSERT(!IsOptimizerThread());
   // Find the next slot that is empty or has a stale job.
+  RecompileJob* stale = NULL;
   while (true) {
-    RecompileJob* stale = osr_buffer_[osr_buffer_cursor_];
+    stale = osr_buffer_[osr_buffer_cursor_];
     if (stale == NULL || stale->IsWaitingForInstall()) break;
     osr_buffer_cursor_ = (osr_buffer_cursor_ + 1) % osr_buffer_capacity_;
   }
 
   // Add to found slot and dispose the evicted job.
-  RecompileJob* evicted = osr_buffer_[osr_buffer_cursor_];
-  if (evicted != NULL) {
-    ASSERT(evicted->IsWaitingForInstall());
-    CompilationInfo* info = evicted->info();
+  if (stale != NULL) {
+    ASSERT(stale->IsWaitingForInstall());
+    CompilationInfo* info = stale->info();
     if (FLAG_trace_osr) {
       PrintF("[COSR - Discarded ");
       info->closure()->PrintName();
       PrintF(", AST id %d]\n", info->osr_ast_id().ToInt());
     }
-    DisposeRecompileJob(evicted, false);
+    DisposeRecompileJob(stale, false);
   }
   osr_buffer_[osr_buffer_cursor_] = job;
   osr_buffer_cursor_ = (osr_buffer_cursor_ + 1) % osr_buffer_capacity_;
index 62330c3..fc6c56d 100644 (file)
--- a/src/v8.cc
+++ b/src/v8.cc
@@ -206,6 +206,7 @@ void V8::InitializeOncePerProcessImpl() {
   if (FLAG_concurrent_recompilation &&
       (FLAG_trace_hydrogen || FLAG_trace_hydrogen_stubs)) {
     FLAG_concurrent_recompilation = false;
+    FLAG_concurrent_osr = false;
     PrintF("Concurrent recompilation has been disabled for tracing.\n");
   }
 
@@ -229,8 +230,9 @@ void V8::InitializeOncePerProcessImpl() {
 
   if (FLAG_concurrent_recompilation &&
       SystemThreadManager::NumberOfParallelSystemThreads(
-          SystemThreadManager::PARALLEL_RECOMPILATION) == 0) {
+          SystemThreadManager::CONCURRENT_RECOMPILATION) == 0) {
     FLAG_concurrent_recompilation = false;
+    FLAG_concurrent_osr = false;
   }
 
   Sampler::SetUp();