Make sure that the TimerEventScope is destroyed before we signal completion
authorjochen <jochen@chromium.org>
Thu, 8 Jan 2015 13:14:16 +0000 (05:14 -0800)
committerCommit bot <commit-bot@chromium.org>
Thu, 8 Jan 2015 13:14:30 +0000 (13:14 +0000)
Otherwise, the isolate that is referenced by the scope might already be
gone

BUG=v8:3608
R=yangguo@chromium.org
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#25993}

src/optimizing-compiler-thread.cc

index 6926f47..ed1e56a 100644 (file)
@@ -53,25 +53,28 @@ class OptimizingCompilerThread::CompileTask : public v8::Task {
     DisallowHandleAllocation no_handles;
     DisallowHandleDereference no_deref;
 
-    TimerEventScope<TimerEventRecompileConcurrent> timer(isolate_);
-
     OptimizingCompilerThread* thread = isolate_->optimizing_compiler_thread();
 
-    if (thread->recompilation_delay_ != 0) {
-      base::OS::Sleep(thread->recompilation_delay_);
-    }
+    {
+      TimerEventScope<TimerEventRecompileConcurrent> timer(isolate_);
+
+      if (thread->recompilation_delay_ != 0) {
+        base::OS::Sleep(thread->recompilation_delay_);
+      }
 
-    StopFlag flag;
-    OptimizedCompileJob* job = thread->NextInput(&flag);
+      StopFlag flag;
+      OptimizedCompileJob* job = thread->NextInput(&flag);
 
-    if (flag == CONTINUE) {
-      thread->CompileNext(job);
-    } else {
-      AllowHandleDereference allow_handle_dereference;
-      if (!job->info()->is_osr()) {
-        DisposeOptimizedCompileJob(job, true);
+      if (flag == CONTINUE) {
+        thread->CompileNext(job);
+      } else {
+        AllowHandleDereference allow_handle_dereference;
+        if (!job->info()->is_osr()) {
+          DisposeOptimizedCompileJob(job, true);
+        }
       }
     }
+
     bool signal = false;
     {
       base::LockGuard<base::RecursiveMutex> lock(&thread->task_count_mutex_);