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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 99 } |
100 | 100 |
101 | 101 |
102 void OptimizingCompilerThread::Stop() { | 102 void OptimizingCompilerThread::Stop() { |
103 ASSERT(!IsOptimizerThread()); | 103 ASSERT(!IsOptimizerThread()); |
104 Release_Store(&stop_thread_, static_cast<AtomicWord>(true)); | 104 Release_Store(&stop_thread_, static_cast<AtomicWord>(true)); |
105 input_queue_semaphore_->Signal(); | 105 input_queue_semaphore_->Signal(); |
106 stop_semaphore_->Wait(); | 106 stop_semaphore_->Wait(); |
107 | 107 |
108 if (FLAG_parallel_recompilation_delay != 0) { | 108 if (FLAG_parallel_recompilation_delay != 0) { |
109 InstallOptimizedFunctions(); | |
110 // Barrier when loading queue length is not necessary since the write | 109 // Barrier when loading queue length is not necessary since the write |
111 // happens in CompileNext on the same thread. | 110 // happens in CompileNext on the same thread. |
112 while (NoBarrier_Load(&queue_length_) > 0) { | 111 while (NoBarrier_Load(&queue_length_) > 0) CompileNext(); |
113 CompileNext(); | 112 InstallOptimizedFunctions(); |
114 InstallOptimizedFunctions(); | 113 } else { |
| 114 OptimizingCompiler* optimizing_compiler; |
| 115 while (input_queue_.Dequeue(&optimizing_compiler)) { |
| 116 // The optimizing compiler is allocated in the CompilationInfo's zone. |
| 117 delete optimizing_compiler->info(); |
115 } | 118 } |
116 } | 119 } |
117 | 120 |
118 if (FLAG_trace_parallel_recompilation) { | 121 if (FLAG_trace_parallel_recompilation) { |
119 double compile_time = static_cast<double>(time_spent_compiling_); | 122 double compile_time = static_cast<double>(time_spent_compiling_); |
120 double total_time = static_cast<double>(time_spent_total_); | 123 double total_time = static_cast<double>(time_spent_total_); |
121 double percentage = (compile_time * 100) / total_time; | 124 double percentage = (compile_time * 100) / total_time; |
122 PrintF(" ** Compiler thread did %.2f%% useful work\n", percentage); | 125 PrintF(" ** Compiler thread did %.2f%% useful work\n", percentage); |
123 } | 126 } |
124 } | 127 } |
(...skipping 24 matching lines...) Expand all Loading... |
149 | 152 |
150 #ifdef DEBUG | 153 #ifdef DEBUG |
151 bool OptimizingCompilerThread::IsOptimizerThread() { | 154 bool OptimizingCompilerThread::IsOptimizerThread() { |
152 if (!FLAG_parallel_recompilation) return false; | 155 if (!FLAG_parallel_recompilation) return false; |
153 return ThreadId::Current().ToInteger() == thread_id_; | 156 return ThreadId::Current().ToInteger() == thread_id_; |
154 } | 157 } |
155 #endif | 158 #endif |
156 | 159 |
157 | 160 |
158 } } // namespace v8::internal | 161 } } // namespace v8::internal |
OLD | NEW |