| OLD | NEW |
| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 for (int i = 0; i < osr_buffer_capacity_; i++) { | 66 for (int i = 0; i < osr_buffer_capacity_; i++) { |
| 67 CHECK_EQ(NULL, osr_buffer_[i]); | 67 CHECK_EQ(NULL, osr_buffer_[i]); |
| 68 } | 68 } |
| 69 #endif | 69 #endif |
| 70 DeleteArray(osr_buffer_); | 70 DeleteArray(osr_buffer_); |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 | 74 |
| 75 void OptimizingCompilerThread::Run() { | 75 void OptimizingCompilerThread::Run() { |
| 76 #ifdef DEBUG | 76 #if DCHECK_IS_ON |
| 77 { base::LockGuard<base::Mutex> lock_guard(&thread_id_mutex_); | 77 { base::LockGuard<base::Mutex> lock_guard(&thread_id_mutex_); |
| 78 thread_id_ = ThreadId::Current().ToInteger(); | 78 thread_id_ = ThreadId::Current().ToInteger(); |
| 79 } | 79 } |
| 80 #endif | 80 #endif |
| 81 DisallowHeapAllocation no_allocation; | 81 DisallowHeapAllocation no_allocation; |
| 82 DisallowHandleAllocation no_handles; | 82 DisallowHandleAllocation no_handles; |
| 83 DisallowHandleDereference no_deref; | 83 DisallowHandleDereference no_deref; |
| 84 | 84 |
| 85 if (job_based_recompilation_) { | 85 if (job_based_recompilation_) { |
| 86 return; | 86 return; |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 info->closure()->PrintName(); | 418 info->closure()->PrintName(); |
| 419 PrintF(", AST id %d]\n", info->osr_ast_id().ToInt()); | 419 PrintF(", AST id %d]\n", info->osr_ast_id().ToInt()); |
| 420 } | 420 } |
| 421 DisposeOptimizedCompileJob(stale, false); | 421 DisposeOptimizedCompileJob(stale, false); |
| 422 } | 422 } |
| 423 osr_buffer_[osr_buffer_cursor_] = job; | 423 osr_buffer_[osr_buffer_cursor_] = job; |
| 424 osr_buffer_cursor_ = (osr_buffer_cursor_ + 1) % osr_buffer_capacity_; | 424 osr_buffer_cursor_ = (osr_buffer_cursor_ + 1) % osr_buffer_capacity_; |
| 425 } | 425 } |
| 426 | 426 |
| 427 | 427 |
| 428 #ifdef DEBUG | 428 #if DCHECK_IS_ON |
| 429 bool OptimizingCompilerThread::IsOptimizerThread(Isolate* isolate) { | 429 bool OptimizingCompilerThread::IsOptimizerThread(Isolate* isolate) { |
| 430 return isolate->concurrent_recompilation_enabled() && | 430 return isolate->concurrent_recompilation_enabled() && |
| 431 isolate->optimizing_compiler_thread()->IsOptimizerThread(); | 431 isolate->optimizing_compiler_thread()->IsOptimizerThread(); |
| 432 } | 432 } |
| 433 | 433 |
| 434 | 434 |
| 435 bool OptimizingCompilerThread::IsOptimizerThread() { | 435 bool OptimizingCompilerThread::IsOptimizerThread() { |
| 436 base::LockGuard<base::Mutex> lock_guard(&thread_id_mutex_); | 436 base::LockGuard<base::Mutex> lock_guard(&thread_id_mutex_); |
| 437 return ThreadId::Current().ToInteger() == thread_id_; | 437 return ThreadId::Current().ToInteger() == thread_id_; |
| 438 } | 438 } |
| 439 #endif | 439 #endif |
| 440 | 440 |
| 441 | 441 |
| 442 } } // namespace v8::internal | 442 } } // namespace v8::internal |
| OLD | NEW |