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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 | 8 |
9 #include "src/ast-numbering.h" | 9 #include "src/ast-numbering.h" |
10 #include "src/ast-this-access-visitor.h" | 10 #include "src/ast-this-access-visitor.h" |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 if (FLAG_hydrogen_stats) { | 408 if (FLAG_hydrogen_stats) { |
409 isolate()->GetHStatistics()->IncrementFullCodeGen(timer.Elapsed()); | 409 isolate()->GetHStatistics()->IncrementFullCodeGen(timer.Elapsed()); |
410 } | 410 } |
411 } | 411 } |
412 | 412 |
413 DCHECK(info()->shared_info()->has_deoptimization_support()); | 413 DCHECK(info()->shared_info()->has_deoptimization_support()); |
414 | 414 |
415 // Check the whitelist for TurboFan. | 415 // Check the whitelist for TurboFan. |
416 if ((FLAG_turbo_asm && info()->shared_info()->asm_function()) || | 416 if ((FLAG_turbo_asm && info()->shared_info()->asm_function()) || |
417 info()->closure()->PassesFilter(FLAG_turbo_filter)) { | 417 info()->closure()->PassesFilter(FLAG_turbo_filter)) { |
| 418 if (FLAG_trace_opt) { |
| 419 OFStream os(stdout); |
| 420 os << "[compiling method " << Brief(*info()->closure()) |
| 421 << " using TurboFan]" << std::endl; |
| 422 } |
| 423 Timer t(this, &time_taken_to_create_graph_); |
418 compiler::Pipeline pipeline(info()); | 424 compiler::Pipeline pipeline(info()); |
419 pipeline.GenerateCode(); | 425 pipeline.GenerateCode(); |
420 if (!info()->code().is_null()) { | 426 if (!info()->code().is_null()) { |
421 return SetLastStatus(SUCCEEDED); | 427 return SetLastStatus(SUCCEEDED); |
422 } | 428 } |
423 } | 429 } |
424 | 430 |
| 431 if (FLAG_trace_opt) { |
| 432 OFStream os(stdout); |
| 433 os << "[compiling method " << Brief(*info()->closure()) |
| 434 << " using Crankshaft]" << std::endl; |
| 435 } |
| 436 |
425 if (FLAG_trace_hydrogen) { | 437 if (FLAG_trace_hydrogen) { |
426 Handle<String> name = info()->function()->debug_name(); | |
427 PrintF("-----------------------------------------------------------\n"); | |
428 PrintF("Compiling method %s using hydrogen\n", name->ToCString().get()); | |
429 isolate()->GetHTracer()->TraceCompilation(info()); | 438 isolate()->GetHTracer()->TraceCompilation(info()); |
430 } | 439 } |
431 | 440 |
432 // Type-check the function. | 441 // Type-check the function. |
433 AstTyper::Run(info()); | 442 AstTyper::Run(info()); |
434 | 443 |
435 graph_builder_ = (FLAG_hydrogen_track_positions || FLAG_trace_ic) | 444 graph_builder_ = (FLAG_hydrogen_track_positions || FLAG_trace_ic) |
436 ? new(info()->zone()) HOptimizedGraphBuilderWithPositions(info()) | 445 ? new(info()->zone()) HOptimizedGraphBuilderWithPositions(info()) |
437 : new(info()->zone()) HOptimizedGraphBuilder(info()); | 446 : new(info()->zone()) HOptimizedGraphBuilder(info()); |
438 | 447 |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 PrintF(" because: %s]\n", GetBailoutReason(info->bailout_reason())); | 873 PrintF(" because: %s]\n", GetBailoutReason(info->bailout_reason())); |
865 } | 874 } |
866 return false; | 875 return false; |
867 } | 876 } |
868 | 877 |
869 // Success! | 878 // Success! |
870 DCHECK(!info->isolate()->has_pending_exception()); | 879 DCHECK(!info->isolate()->has_pending_exception()); |
871 InsertCodeIntoOptimizedCodeMap(info); | 880 InsertCodeIntoOptimizedCodeMap(info); |
872 RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info, | 881 RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info, |
873 info->shared_info()); | 882 info->shared_info()); |
874 if (FLAG_trace_opt) { | |
875 PrintF("[completed optimizing "); | |
876 info->closure()->ShortPrint(); | |
877 PrintF("]\n"); | |
878 } | |
879 return true; | 883 return true; |
880 } | 884 } |
881 | 885 |
882 | 886 |
883 static bool GetOptimizedCodeLater(CompilationInfo* info) { | 887 static bool GetOptimizedCodeLater(CompilationInfo* info) { |
884 Isolate* isolate = info->isolate(); | 888 Isolate* isolate = info->isolate(); |
885 if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) { | 889 if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) { |
886 if (FLAG_trace_concurrent_recompilation) { | 890 if (FLAG_trace_concurrent_recompilation) { |
887 PrintF(" ** Compilation queue full, will retry optimizing "); | 891 PrintF(" ** Compilation queue full, will retry optimizing "); |
888 info->closure()->ShortPrint(); | 892 info->closure()->ShortPrint(); |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1572 AllowHandleDereference allow_deref; | 1576 AllowHandleDereference allow_deref; |
1573 bool tracing_on = info()->IsStub() | 1577 bool tracing_on = info()->IsStub() |
1574 ? FLAG_trace_hydrogen_stubs | 1578 ? FLAG_trace_hydrogen_stubs |
1575 : (FLAG_trace_hydrogen && | 1579 : (FLAG_trace_hydrogen && |
1576 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1580 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
1577 return (tracing_on && | 1581 return (tracing_on && |
1578 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1582 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1579 } | 1583 } |
1580 | 1584 |
1581 } } // namespace v8::internal | 1585 } } // namespace v8::internal |
OLD | NEW |