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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 double percentage = (compile_time * 100) / total_time; | 121 double percentage = (compile_time * 100) / total_time; |
122 PrintF(" ** Compiler thread did %.2f%% useful work\n", percentage); | 122 PrintF(" ** Compiler thread did %.2f%% useful work\n", percentage); |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 | 126 |
127 void OptimizingCompilerThread::InstallOptimizedFunctions() { | 127 void OptimizingCompilerThread::InstallOptimizedFunctions() { |
128 ASSERT(!IsOptimizerThread()); | 128 ASSERT(!IsOptimizerThread()); |
129 HandleScope handle_scope(isolate_); | 129 HandleScope handle_scope(isolate_); |
130 int functions_installed = 0; | 130 int functions_installed = 0; |
131 while (!output_queue_.IsEmpty()) { | 131 OptimizingCompiler* compiler; |
132 OptimizingCompiler* compiler; | 132 while (output_queue_.Dequeue(&compiler)) { |
133 output_queue_.Dequeue(&compiler); | |
134 Compiler::InstallOptimizedCode(compiler); | 133 Compiler::InstallOptimizedCode(compiler); |
135 functions_installed++; | 134 functions_installed++; |
136 } | 135 } |
137 } | 136 } |
138 | 137 |
139 | 138 |
140 void OptimizingCompilerThread::QueueForOptimization( | 139 void OptimizingCompilerThread::QueueForOptimization( |
141 OptimizingCompiler* optimizing_compiler) { | 140 OptimizingCompiler* optimizing_compiler) { |
142 ASSERT(IsQueueAvailable()); | 141 ASSERT(IsQueueAvailable()); |
143 ASSERT(!IsOptimizerThread()); | 142 ASSERT(!IsOptimizerThread()); |
144 Barrier_AtomicIncrement(&queue_length_, static_cast<Atomic32>(1)); | 143 Barrier_AtomicIncrement(&queue_length_, static_cast<Atomic32>(1)); |
145 optimizing_compiler->info()->closure()->MarkInRecompileQueue(); | 144 optimizing_compiler->info()->closure()->MarkInRecompileQueue(); |
146 input_queue_.Enqueue(optimizing_compiler); | 145 input_queue_.Enqueue(optimizing_compiler); |
147 input_queue_semaphore_->Signal(); | 146 input_queue_semaphore_->Signal(); |
148 } | 147 } |
149 | 148 |
150 | 149 |
151 #ifdef DEBUG | 150 #ifdef DEBUG |
152 bool OptimizingCompilerThread::IsOptimizerThread() { | 151 bool OptimizingCompilerThread::IsOptimizerThread() { |
153 if (!FLAG_parallel_recompilation) return false; | 152 if (!FLAG_parallel_recompilation) return false; |
154 return ThreadId::Current().ToInteger() == thread_id_; | 153 return ThreadId::Current().ToInteger() == thread_id_; |
155 } | 154 } |
156 #endif | 155 #endif |
157 | 156 |
158 | 157 |
159 } } // namespace v8::internal | 158 } } // namespace v8::internal |
OLD | NEW |