| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 #include "hydrogen.h" | 32 #include "hydrogen.h" |
| 33 #include "isolate.h" | 33 #include "isolate.h" |
| 34 #include "v8threads.h" | 34 #include "v8threads.h" |
| 35 | 35 |
| 36 namespace v8 { | 36 namespace v8 { |
| 37 namespace internal { | 37 namespace internal { |
| 38 | 38 |
| 39 | 39 |
| 40 void OptimizingCompilerThread::Run() { | 40 void OptimizingCompilerThread::Run() { |
| 41 #ifdef DEBUG | |
| 42 thread_id_ = ThreadId::Current().ToInteger(); | 41 thread_id_ = ThreadId::Current().ToInteger(); |
| 43 #endif | |
| 44 Isolate::SetIsolateThreadLocals(isolate_, NULL); | 42 Isolate::SetIsolateThreadLocals(isolate_, NULL); |
| 45 | 43 |
| 46 int64_t epoch = 0; | 44 int64_t epoch = 0; |
| 47 if (FLAG_trace_parallel_recompilation) epoch = OS::Ticks(); | 45 if (FLAG_trace_parallel_recompilation) epoch = OS::Ticks(); |
| 48 | 46 |
| 49 while (true) { | 47 while (true) { |
| 50 input_queue_semaphore_->Wait(); | 48 input_queue_semaphore_->Wait(); |
| 51 Logger::TimerEventScope timer( | 49 Logger::TimerEventScope timer( |
| 52 isolate_, Logger::TimerEventScope::v8_recompile_parallel); | 50 isolate_, Logger::TimerEventScope::v8_recompile_parallel); |
| 53 | 51 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 OptimizingCompiler* optimizing_compiler) { | 135 OptimizingCompiler* optimizing_compiler) { |
| 138 ASSERT(IsQueueAvailable()); | 136 ASSERT(IsQueueAvailable()); |
| 139 ASSERT(!IsOptimizerThread()); | 137 ASSERT(!IsOptimizerThread()); |
| 140 Barrier_AtomicIncrement(&queue_length_, static_cast<Atomic32>(1)); | 138 Barrier_AtomicIncrement(&queue_length_, static_cast<Atomic32>(1)); |
| 141 optimizing_compiler->info()->closure()->MarkInRecompileQueue(); | 139 optimizing_compiler->info()->closure()->MarkInRecompileQueue(); |
| 142 input_queue_.Enqueue(optimizing_compiler); | 140 input_queue_.Enqueue(optimizing_compiler); |
| 143 input_queue_semaphore_->Signal(); | 141 input_queue_semaphore_->Signal(); |
| 144 } | 142 } |
| 145 | 143 |
| 146 | 144 |
| 147 #ifdef DEBUG | |
| 148 bool OptimizingCompilerThread::IsOptimizerThread() { | 145 bool OptimizingCompilerThread::IsOptimizerThread() { |
| 149 if (!FLAG_parallel_recompilation) return false; | 146 if (!FLAG_parallel_recompilation) return false; |
| 150 return ThreadId::Current().ToInteger() == thread_id_; | 147 return ThreadId::Current().ToInteger() == thread_id_; |
| 151 } | 148 } |
| 152 #endif | |
| 153 | 149 |
| 154 | 150 |
| 155 } } // namespace v8::internal | 151 } } // namespace v8::internal |
| OLD | NEW |