Revision: 16978
Author:   [email protected]
Date:     Fri Sep 27 09:37:18 2013 UTC
Log:      Disposing an OSR job should only restore the back edge state.

[email protected]
BUG=

Review URL: https://codereview.chromium.org/24725002
http://code.google.com/p/v8/source/detail?r=16978

Modified:
 /branches/bleeding_edge/src/compiler.h
 /branches/bleeding_edge/src/optimizing-compiler-thread.cc

=======================================
--- /branches/bleeding_edge/src/compiler.h      Wed Sep 25 10:01:18 2013 UTC
+++ /branches/bleeding_edge/src/compiler.h      Fri Sep 27 09:37:18 2013 UTC
@@ -534,7 +534,7 @@
   }

   void WaitForInstall() {
-    ASSERT(!info_->osr_ast_id().IsNone());
+    ASSERT(info_->is_osr());
     awaiting_install_ = true;
   }

=======================================
--- /branches/bleeding_edge/src/optimizing-compiler-thread.cc Wed Sep 25 15:13:10 2013 UTC +++ /branches/bleeding_edge/src/optimizing-compiler-thread.cc Fri Sep 27 09:37:18 2013 UTC
@@ -114,13 +114,17 @@
 }


-static void DisposeRecompileJob(RecompileJob* compiler,
+static void DisposeRecompileJob(RecompileJob* job,
                                 bool restore_function_code) {
   // The recompile job is allocated in the CompilationInfo's zone.
-  CompilationInfo* info = compiler->info();
+  CompilationInfo* info = job->info();
   if (restore_function_code) {
-    Handle<JSFunction> function = info->closure();
-    function->ReplaceCode(function->shared()->code());
+    if (info->is_osr()) {
+ if (!job->IsWaitingForInstall()) BackEdgeTable::RemoveStackCheck(info);
+    } else {
+      Handle<JSFunction> function = info->closure();
+      function->ReplaceCode(function->shared()->code());
+    }
   }
   delete info;
 }
@@ -132,8 +136,8 @@
     // This should not block, since we have one signal on the input queue
     // semaphore corresponding to each element in the input queue.
     input_queue_semaphore_.Wait();
-    if (job->info()->osr_ast_id().IsNone()) {
-      // OSR jobs are dealt with separately.
+    // OSR jobs are dealt with separately.
+    if (!job->info()->is_osr()) {
       DisposeRecompileJob(job, restore_function_code);
     }
   }
@@ -147,8 +151,8 @@
     { LockGuard<Mutex> access_queue(&queue_mutex_);
       if (!output_queue_.Dequeue(&job)) break;
     }
-    if (job->info()->osr_ast_id().IsNone()) {
-      // OSR jobs are dealt with separately.
+    // OSR jobs are dealt with separately.
+    if (!job->info()->is_osr()) {
       DisposeRecompileJob(job, restore_function_code);
     }
   }
@@ -221,9 +225,7 @@
       if (!output_queue_.Dequeue(&job)) break;
     }
     CompilationInfo* info = job->info();
-    if (info->osr_ast_id().IsNone()) {
-      Compiler::InstallOptimizedCode(job);
-    } else {
+    if (info->is_osr()) {
       if (FLAG_trace_osr) {
         PrintF("[COSR - ");
         info->closure()->PrintName();
@@ -232,6 +234,8 @@
       }
       job->WaitForInstall();
       BackEdgeTable::RemoveStackCheck(info);
+    } else {
+      Compiler::InstallOptimizedCode(job);
     }
   }
 }
@@ -242,9 +246,7 @@
   ASSERT(!IsOptimizerThread());
   Barrier_AtomicIncrement(&queue_length_, static_cast<Atomic32>(1));
   CompilationInfo* info = job->info();
-  if (info->osr_ast_id().IsNone()) {
-    info->closure()->MarkInRecompileQueue();
-  } else {
+  if (info->is_osr()) {
     if (FLAG_trace_concurrent_recompilation) {
       PrintF("  ** Queueing ");
       info->closure()->PrintName();
@@ -253,6 +255,8 @@
     AddToOsrBuffer(job);
     osr_attempts_++;
     BackEdgeTable::AddStackCheck(info);
+  } else {
+    info->closure()->MarkInRecompileQueue();
   }
   input_queue_.Enqueue(job);
   input_queue_semaphore_.Signal();
@@ -317,7 +321,6 @@
         info->closure()->PrintName();
         PrintF(", AST id %d]\n", info->osr_ast_id().ToInt());
       }
-      BackEdgeTable::RemoveStackCheck(info);
       DisposeRecompileJob(stale, false);
       break;
     }

--
--
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