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 21 matching lines...) Expand all Loading... |
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 | 41 #ifdef DEBUG |
42 thread_id_ = ThreadId::Current().ToInteger(); | 42 { ScopedLock lock(thread_id_mutex_); |
| 43 thread_id_ = ThreadId::Current().ToInteger(); |
| 44 } |
43 #endif | 45 #endif |
44 Isolate::SetIsolateThreadLocals(isolate_, NULL); | 46 Isolate::SetIsolateThreadLocals(isolate_, NULL); |
45 DisallowHeapAllocation no_allocation; | 47 DisallowHeapAllocation no_allocation; |
46 DisallowHandleAllocation no_handles; | 48 DisallowHandleAllocation no_handles; |
47 DisallowHandleDereference no_deref; | 49 DisallowHandleDereference no_deref; |
48 | 50 |
49 int64_t epoch = 0; | 51 int64_t epoch = 0; |
50 if (FLAG_trace_parallel_recompilation) epoch = OS::Ticks(); | 52 if (FLAG_trace_parallel_recompilation) epoch = OS::Ticks(); |
51 | 53 |
52 while (true) { | 54 while (true) { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 Barrier_AtomicIncrement(&queue_length_, static_cast<Atomic32>(1)); | 151 Barrier_AtomicIncrement(&queue_length_, static_cast<Atomic32>(1)); |
150 optimizing_compiler->info()->closure()->MarkInRecompileQueue(); | 152 optimizing_compiler->info()->closure()->MarkInRecompileQueue(); |
151 input_queue_.Enqueue(optimizing_compiler); | 153 input_queue_.Enqueue(optimizing_compiler); |
152 input_queue_semaphore_->Signal(); | 154 input_queue_semaphore_->Signal(); |
153 } | 155 } |
154 | 156 |
155 | 157 |
156 #ifdef DEBUG | 158 #ifdef DEBUG |
157 bool OptimizingCompilerThread::IsOptimizerThread() { | 159 bool OptimizingCompilerThread::IsOptimizerThread() { |
158 if (!FLAG_parallel_recompilation) return false; | 160 if (!FLAG_parallel_recompilation) return false; |
| 161 ScopedLock lock(thread_id_mutex_); |
159 return ThreadId::Current().ToInteger() == thread_id_; | 162 return ThreadId::Current().ToInteger() == thread_id_; |
160 } | 163 } |
161 #endif | 164 #endif |
162 | 165 |
163 | 166 |
164 } } // namespace v8::internal | 167 } } // namespace v8::internal |
OLD | NEW |