OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/optimizing-compiler-thread.h" | 5 #include "src/optimizing-compiler-thread.h" |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/base/atomicops.h" | 9 #include "src/base/atomicops.h" |
10 #include "src/full-codegen.h" | 10 #include "src/full-codegen.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 DCHECK(!IsOptimizerThread()); | 219 DCHECK(!IsOptimizerThread()); |
220 HandleScope handle_scope(isolate_); | 220 HandleScope handle_scope(isolate_); |
221 | 221 |
222 OptimizedCompileJob* job; | 222 OptimizedCompileJob* job; |
223 while (output_queue_.Dequeue(&job)) { | 223 while (output_queue_.Dequeue(&job)) { |
224 CompilationInfo* info = job->info(); | 224 CompilationInfo* info = job->info(); |
225 Handle<JSFunction> function(*info->closure()); | 225 Handle<JSFunction> function(*info->closure()); |
226 if (info->is_osr()) { | 226 if (info->is_osr()) { |
227 if (FLAG_trace_osr) { | 227 if (FLAG_trace_osr) { |
228 PrintF("[COSR - "); | 228 PrintF("[COSR - "); |
229 info->closure()->PrintName(); | 229 function->ShortPrint(); |
230 PrintF(" is ready for install and entry at AST id %d]\n", | 230 PrintF(" is ready for install and entry at AST id %d]\n", |
231 info->osr_ast_id().ToInt()); | 231 info->osr_ast_id().ToInt()); |
232 } | 232 } |
233 job->WaitForInstall(); | 233 job->WaitForInstall(); |
234 // Remove stack check that guards OSR entry on original code. | 234 // Remove stack check that guards OSR entry on original code. |
235 Handle<Code> code = info->unoptimized_code(); | 235 Handle<Code> code = info->unoptimized_code(); |
236 uint32_t offset = code->TranslateAstIdToPcOffset(info->osr_ast_id()); | 236 uint32_t offset = code->TranslateAstIdToPcOffset(info->osr_ast_id()); |
237 BackEdgeTable::RemoveStackCheck(code, offset); | 237 BackEdgeTable::RemoveStackCheck(code, offset); |
238 } else { | 238 } else { |
239 if (function->IsOptimized()) { | 239 if (function->IsOptimized()) { |
| 240 if (FLAG_trace_concurrent_recompilation) { |
| 241 PrintF(" ** Aborting compilation for "); |
| 242 function->ShortPrint(); |
| 243 PrintF(" as it has already been optimized.\n"); |
| 244 } |
240 DisposeOptimizedCompileJob(job, false); | 245 DisposeOptimizedCompileJob(job, false); |
241 } else { | 246 } else { |
242 Handle<Code> code = Compiler::GetConcurrentlyOptimizedCode(job); | 247 Handle<Code> code = Compiler::GetConcurrentlyOptimizedCode(job); |
243 function->ReplaceCode( | 248 function->ReplaceCode( |
244 code.is_null() ? function->shared()->code() : *code); | 249 code.is_null() ? function->shared()->code() : *code); |
245 } | 250 } |
246 } | 251 } |
247 } | 252 } |
248 } | 253 } |
249 | 254 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 368 |
364 | 369 |
365 bool OptimizingCompilerThread::IsOptimizerThread() { | 370 bool OptimizingCompilerThread::IsOptimizerThread() { |
366 base::LockGuard<base::Mutex> lock_guard(&thread_id_mutex_); | 371 base::LockGuard<base::Mutex> lock_guard(&thread_id_mutex_); |
367 return ThreadId::Current().ToInteger() == thread_id_; | 372 return ThreadId::Current().ToInteger() == thread_id_; |
368 } | 373 } |
369 #endif | 374 #endif |
370 | 375 |
371 | 376 |
372 } } // namespace v8::internal | 377 } } // namespace v8::internal |
OLD | NEW |