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

Side by Side Diff: src/optimizing-compiler-thread.cc

Issue 836413005: Make sure that the TimerEventScope is destroyed before we signal completion (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/optimizing-compiler-thread.h" 5 #include "src/optimizing-compiler-thread.h"
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/base/atomicops.h" 9 #include "src/base/atomicops.h"
10 #include "src/full-codegen.h" 10 #include "src/full-codegen.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 virtual ~CompileTask() {} 47 virtual ~CompileTask() {}
48 48
49 private: 49 private:
50 // v8::Task overrides. 50 // v8::Task overrides.
51 void Run() OVERRIDE { 51 void Run() OVERRIDE {
52 DisallowHeapAllocation no_allocation; 52 DisallowHeapAllocation no_allocation;
53 DisallowHandleAllocation no_handles; 53 DisallowHandleAllocation no_handles;
54 DisallowHandleDereference no_deref; 54 DisallowHandleDereference no_deref;
55 55
56 TimerEventScope<TimerEventRecompileConcurrent> timer(isolate_);
57
58 OptimizingCompilerThread* thread = isolate_->optimizing_compiler_thread(); 56 OptimizingCompilerThread* thread = isolate_->optimizing_compiler_thread();
59 57
60 if (thread->recompilation_delay_ != 0) { 58 {
61 base::OS::Sleep(thread->recompilation_delay_); 59 TimerEventScope<TimerEventRecompileConcurrent> timer(isolate_);
60
61 if (thread->recompilation_delay_ != 0) {
62 base::OS::Sleep(thread->recompilation_delay_);
63 }
64
65 StopFlag flag;
66 OptimizedCompileJob* job = thread->NextInput(&flag);
67
68 if (flag == CONTINUE) {
69 thread->CompileNext(job);
70 } else {
71 AllowHandleDereference allow_handle_dereference;
72 if (!job->info()->is_osr()) {
73 DisposeOptimizedCompileJob(job, true);
74 }
75 }
62 } 76 }
63 77
64 StopFlag flag;
65 OptimizedCompileJob* job = thread->NextInput(&flag);
66
67 if (flag == CONTINUE) {
68 thread->CompileNext(job);
69 } else {
70 AllowHandleDereference allow_handle_dereference;
71 if (!job->info()->is_osr()) {
72 DisposeOptimizedCompileJob(job, true);
73 }
74 }
75 bool signal = false; 78 bool signal = false;
76 { 79 {
77 base::LockGuard<base::RecursiveMutex> lock(&thread->task_count_mutex_); 80 base::LockGuard<base::RecursiveMutex> lock(&thread->task_count_mutex_);
78 if (--thread->task_count_ == 0) { 81 if (--thread->task_count_ == 0) {
79 if (static_cast<StopFlag>(base::Acquire_Load(&thread->stop_thread_)) == 82 if (static_cast<StopFlag>(base::Acquire_Load(&thread->stop_thread_)) ==
80 FLUSH) { 83 FLUSH) {
81 base::Release_Store(&thread->stop_thread_, 84 base::Release_Store(&thread->stop_thread_,
82 static_cast<base::AtomicWord>(CONTINUE)); 85 static_cast<base::AtomicWord>(CONTINUE));
83 signal = true; 86 signal = true;
84 } 87 }
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 477
475 478
476 bool OptimizingCompilerThread::IsOptimizerThread() { 479 bool OptimizingCompilerThread::IsOptimizerThread() {
477 base::LockGuard<base::Mutex> lock_guard(&thread_id_mutex_); 480 base::LockGuard<base::Mutex> lock_guard(&thread_id_mutex_);
478 return ThreadId::Current().ToInteger() == thread_id_; 481 return ThreadId::Current().ToInteger() == thread_id_;
479 } 482 }
480 #endif 483 #endif
481 484
482 485
483 } } // namespace v8::internal 486 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698