OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/compiler.h" | 5 #include "vm/compiler.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 | 8 |
9 #include "vm/ast_printer.h" | 9 #include "vm/ast_printer.h" |
10 #include "vm/block_scheduler.h" | 10 #include "vm/block_scheduler.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 "Do conditional constant propagation/unreachable code elimination."); | 52 "Do conditional constant propagation/unreachable code elimination."); |
53 DEFINE_FLAG(int, max_deoptimization_counter_threshold, 16, | 53 DEFINE_FLAG(int, max_deoptimization_counter_threshold, 16, |
54 "How many times we allow deoptimization before we disallow optimization."); | 54 "How many times we allow deoptimization before we disallow optimization."); |
55 DEFINE_FLAG(bool, loop_invariant_code_motion, true, | 55 DEFINE_FLAG(bool, loop_invariant_code_motion, true, |
56 "Do loop invariant code motion."); | 56 "Do loop invariant code motion."); |
57 DEFINE_FLAG(bool, print_flow_graph, false, "Print the IR flow graph."); | 57 DEFINE_FLAG(bool, print_flow_graph, false, "Print the IR flow graph."); |
58 DEFINE_FLAG(bool, print_flow_graph_optimized, false, | 58 DEFINE_FLAG(bool, print_flow_graph_optimized, false, |
59 "Print the IR flow graph when optimizing."); | 59 "Print the IR flow graph when optimizing."); |
60 DEFINE_FLAG(bool, print_ic_data_map, false, | 60 DEFINE_FLAG(bool, print_ic_data_map, false, |
61 "Print the deopt-id to ICData map in optimizing compiler."); | 61 "Print the deopt-id to ICData map in optimizing compiler."); |
| 62 DEFINE_FLAG(bool, print_code_source_map, false, "Print code source map."); |
62 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis"); | 63 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis"); |
63 DEFINE_FLAG(bool, reorder_basic_blocks, true, "Enable basic-block reordering."); | 64 DEFINE_FLAG(bool, reorder_basic_blocks, true, "Enable basic-block reordering."); |
64 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations."); | 65 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations."); |
65 DEFINE_FLAG(bool, trace_optimizing_compiler, false, | 66 DEFINE_FLAG(bool, trace_optimizing_compiler, false, |
66 "Trace only optimizing compiler operations."); | 67 "Trace only optimizing compiler operations."); |
67 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); | 68 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); |
68 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); | 69 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); |
69 DEFINE_FLAG(bool, verify_compiler, false, | 70 DEFINE_FLAG(bool, verify_compiler, false, |
70 "Enable compiler verification assertions"); | 71 "Enable compiler verification assertions"); |
71 | 72 |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 code.SetInlinedIdToTokenPos(inlined_id_to_token_pos); | 465 code.SetInlinedIdToTokenPos(inlined_id_to_token_pos); |
465 | 466 |
466 graph_compiler->FinalizePcDescriptors(code); | 467 graph_compiler->FinalizePcDescriptors(code); |
467 code.set_deopt_info_array(deopt_info_array); | 468 code.set_deopt_info_array(deopt_info_array); |
468 | 469 |
469 graph_compiler->FinalizeStackmaps(code); | 470 graph_compiler->FinalizeStackmaps(code); |
470 graph_compiler->FinalizeVarDescriptors(code); | 471 graph_compiler->FinalizeVarDescriptors(code); |
471 graph_compiler->FinalizeExceptionHandlers(code); | 472 graph_compiler->FinalizeExceptionHandlers(code); |
472 graph_compiler->FinalizeStaticCallTargetsTable(code); | 473 graph_compiler->FinalizeStaticCallTargetsTable(code); |
473 | 474 |
| 475 NOT_IN_PRODUCT( |
| 476 // Set the code source map after setting the inlined information because |
| 477 // we use the inlined information when printing. |
| 478 const CodeSourceMap& code_source_map = |
| 479 CodeSourceMap::Handle( |
| 480 zone, |
| 481 graph_compiler->code_source_map_builder()->Finalize()); |
| 482 code.set_code_source_map(code_source_map); |
| 483 if (FLAG_print_code_source_map) { |
| 484 CodeSourceMap::Dump(code_source_map, code, function); |
| 485 } |
| 486 ); |
474 if (optimized()) { | 487 if (optimized()) { |
475 // Installs code while at safepoint. | 488 // Installs code while at safepoint. |
476 if (thread()->IsMutatorThread()) { | 489 if (thread()->IsMutatorThread()) { |
477 const bool is_osr = osr_id() != Compiler::kNoOSRDeoptId; | 490 const bool is_osr = osr_id() != Compiler::kNoOSRDeoptId; |
478 function.InstallOptimizedCode(code, is_osr); | 491 function.InstallOptimizedCode(code, is_osr); |
479 } else { | 492 } else { |
480 // Background compilation. | 493 // Background compilation. |
481 // Before installing code check generation counts if the code may | 494 // Before installing code check generation counts if the code may |
482 // have become invalid. | 495 // have become invalid. |
483 const bool trace_compiler = | 496 const bool trace_compiler = |
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1845 } | 1858 } |
1846 | 1859 |
1847 | 1860 |
1848 void BackgroundCompiler::EnsureInit(Thread* thread) { | 1861 void BackgroundCompiler::EnsureInit(Thread* thread) { |
1849 UNREACHABLE(); | 1862 UNREACHABLE(); |
1850 } | 1863 } |
1851 | 1864 |
1852 #endif // DART_PRECOMPILED_RUNTIME | 1865 #endif // DART_PRECOMPILED_RUNTIME |
1853 | 1866 |
1854 } // namespace dart | 1867 } // namespace dart |
OLD | NEW |