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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 input_queue_semaphore_->Signal(); | 108 input_queue_semaphore_->Signal(); |
109 stop_semaphore_->Wait(); | 109 stop_semaphore_->Wait(); |
110 | 110 |
111 if (FLAG_parallel_recompilation_delay != 0) { | 111 if (FLAG_parallel_recompilation_delay != 0) { |
112 // Barrier when loading queue length is not necessary since the write | 112 // Barrier when loading queue length is not necessary since the write |
113 // happens in CompileNext on the same thread. | 113 // happens in CompileNext on the same thread. |
114 while (NoBarrier_Load(&queue_length_) > 0) CompileNext(); | 114 while (NoBarrier_Load(&queue_length_) > 0) CompileNext(); |
115 InstallOptimizedFunctions(); | 115 InstallOptimizedFunctions(); |
116 } else { | 116 } else { |
117 OptimizingCompiler* optimizing_compiler; | 117 OptimizingCompiler* optimizing_compiler; |
| 118 // The optimizing compiler is allocated in the CompilationInfo's zone. |
118 while (input_queue_.Dequeue(&optimizing_compiler)) { | 119 while (input_queue_.Dequeue(&optimizing_compiler)) { |
119 // The optimizing compiler is allocated in the CompilationInfo's zone. | 120 delete optimizing_compiler->info(); |
| 121 } |
| 122 while (output_queue_.Dequeue(&optimizing_compiler)) { |
120 delete optimizing_compiler->info(); | 123 delete optimizing_compiler->info(); |
121 } | 124 } |
122 } | 125 } |
123 | 126 |
124 if (FLAG_trace_parallel_recompilation) { | 127 if (FLAG_trace_parallel_recompilation) { |
125 double compile_time = static_cast<double>(time_spent_compiling_); | 128 double compile_time = static_cast<double>(time_spent_compiling_); |
126 double total_time = static_cast<double>(time_spent_total_); | 129 double total_time = static_cast<double>(time_spent_total_); |
127 double percentage = (compile_time * 100) / total_time; | 130 double percentage = (compile_time * 100) / total_time; |
128 PrintF(" ** Compiler thread did %.2f%% useful work\n", percentage); | 131 PrintF(" ** Compiler thread did %.2f%% useful work\n", percentage); |
129 } | 132 } |
(...skipping 28 matching lines...) Expand all Loading... |
158 #ifdef DEBUG | 161 #ifdef DEBUG |
159 bool OptimizingCompilerThread::IsOptimizerThread() { | 162 bool OptimizingCompilerThread::IsOptimizerThread() { |
160 if (!FLAG_parallel_recompilation) return false; | 163 if (!FLAG_parallel_recompilation) return false; |
161 ScopedLock lock(thread_id_mutex_); | 164 ScopedLock lock(thread_id_mutex_); |
162 return ThreadId::Current().ToInteger() == thread_id_; | 165 return ThreadId::Current().ToInteger() == thread_id_; |
163 } | 166 } |
164 #endif | 167 #endif |
165 | 168 |
166 | 169 |
167 } } // namespace v8::internal | 170 } } // namespace v8::internal |
OLD | NEW |