Reviewers: Jakob,

Message:
PTAL.

Description:
Disable concurrent osr when concurrent recompilation is disabled.

Also introduce a flag for a quick check that concurrency is on.

[email protected]
BUG=

Please review this at https://codereview.chromium.org/64543004/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+12, -6 lines):
  M src/flag-definitions.h
  M src/optimizing-compiler-thread.cc
  M src/v8.cc


Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index 9228944d00e342eafa30aecc453bff1508f0632d..e2584dc611d3ce2a17d33d57c27a7aa54b9d7ff4 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -334,6 +334,9 @@ DEFINE_bool(concurrent_osr, false,
             "concurrent on-stack replacement")
 DEFINE_implication(concurrent_osr, concurrent_recompilation)

+DEFINE_bool(verify_concurrency, false,
+            "crash if we are not spawning concurrent threads");
+
 DEFINE_bool(omit_map_checks_for_leaf_maps, true,
"do not emit check maps for constant values that have a leaf map, " "deoptimize the optimized code if the layout of the maps changes.")
Index: src/optimizing-compiler-thread.cc
diff --git a/src/optimizing-compiler-thread.cc b/src/optimizing-compiler-thread.cc index e9c0254522261e881833c6a5d8b31e399475140f..a54873974632ad4bdfab92c8e62636b071862f26 100644
--- a/src/optimizing-compiler-thread.cc
+++ b/src/optimizing-compiler-thread.cc
@@ -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;
   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: src/v8.cc
diff --git a/src/v8.cc b/src/v8.cc
index 62330c32d482aa9a1a74ba70f38d769bfff240da..546d84bcdd3d350bfe8fefdf667a3245b54fe2a5 100644
--- 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");
   }

@@ -231,6 +232,8 @@ void V8::InitializeOncePerProcessImpl() {
       SystemThreadManager::NumberOfParallelSystemThreads(
           SystemThreadManager::PARALLEL_RECOMPILATION) == 0) {
     FLAG_concurrent_recompilation = false;
+    FLAG_concurrent_osr = false;
+    CHECK(!verify_concurrency);
   }

   Sampler::SetUp();


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to