| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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/precompiler.h" | 5 #include "vm/precompiler.h" |
| 6 | 6 |
| 7 #include "vm/aot_optimizer.h" | 7 #include "vm/aot_optimizer.h" |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/ast_printer.h" | 9 #include "vm/ast_printer.h" |
| 10 #include "vm/branch_optimizer.h" | 10 #include "vm/branch_optimizer.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 #define T (thread()) | 48 #define T (thread()) |
| 49 #define I (isolate()) | 49 #define I (isolate()) |
| 50 #define Z (zone()) | 50 #define Z (zone()) |
| 51 | 51 |
| 52 | 52 |
| 53 DEFINE_FLAG(bool, print_unique_targets, false, "Print unique dynaic targets"); | 53 DEFINE_FLAG(bool, print_unique_targets, false, "Print unique dynaic targets"); |
| 54 DEFINE_FLAG(bool, trace_precompiler, false, "Trace precompiler."); | 54 DEFINE_FLAG(bool, trace_precompiler, false, "Trace precompiler."); |
| 55 DEFINE_FLAG(int, max_speculative_inlining_attempts, 1, | 55 DEFINE_FLAG(int, max_speculative_inlining_attempts, 1, |
| 56 "Max number of attempts with speculative inlining (precompilation only)"); | 56 "Max number of attempts with speculative inlining (precompilation only)"); |
| 57 DEFINE_FLAG(int, precompiler_rounds, 1, "Number of precompiler iterations"); |
| 57 | 58 |
| 58 DECLARE_FLAG(bool, allocation_sinking); | 59 DECLARE_FLAG(bool, allocation_sinking); |
| 59 DECLARE_FLAG(bool, common_subexpression_elimination); | 60 DECLARE_FLAG(bool, common_subexpression_elimination); |
| 60 DECLARE_FLAG(bool, constant_propagation); | 61 DECLARE_FLAG(bool, constant_propagation); |
| 61 DECLARE_FLAG(bool, loop_invariant_code_motion); | 62 DECLARE_FLAG(bool, loop_invariant_code_motion); |
| 62 DECLARE_FLAG(bool, print_flow_graph); | 63 DECLARE_FLAG(bool, print_flow_graph); |
| 63 DECLARE_FLAG(bool, print_flow_graph_optimized); | 64 DECLARE_FLAG(bool, print_flow_graph_optimized); |
| 64 DECLARE_FLAG(bool, range_analysis); | 65 DECLARE_FLAG(bool, range_analysis); |
| 65 DECLARE_FLAG(bool, trace_compiler); | 66 DECLARE_FLAG(bool, trace_compiler); |
| 66 DECLARE_FLAG(bool, trace_optimizing_compiler); | 67 DECLARE_FLAG(bool, trace_optimizing_compiler); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 162 |
| 162 { | 163 { |
| 163 StackZone stack_zone(T); | 164 StackZone stack_zone(T); |
| 164 zone_ = stack_zone.GetZone(); | 165 zone_ = stack_zone.GetZone(); |
| 165 | 166 |
| 166 // Make sure class hierarchy is stable before compilation so that CHA | 167 // Make sure class hierarchy is stable before compilation so that CHA |
| 167 // can be used. Also ensures lookup of entry points won't miss functions | 168 // can be used. Also ensures lookup of entry points won't miss functions |
| 168 // because their class hasn't been finalized yet. | 169 // because their class hasn't been finalized yet. |
| 169 FinalizeAllClasses(); | 170 FinalizeAllClasses(); |
| 170 | 171 |
| 171 const intptr_t kPrecompilerRounds = 1; | 172 for (intptr_t round = 0; round < FLAG_precompiler_rounds; round++) { |
| 172 for (intptr_t round = 0; round < kPrecompilerRounds; round++) { | |
| 173 if (FLAG_trace_precompiler) { | 173 if (FLAG_trace_precompiler) { |
| 174 THR_Print("Precompiler round %" Pd "\n", round); | 174 THR_Print("Precompiler round %" Pd "\n", round); |
| 175 } | 175 } |
| 176 | 176 |
| 177 if (round > 0) { | 177 if (round > 0) { |
| 178 ResetPrecompilerState(); | 178 ResetPrecompilerState(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 // TODO(rmacnak): We should be able to do a more thorough job and drop | 181 // TODO(rmacnak): We should be able to do a more thorough job and drop |
| 182 // some | 182 // some |
| (...skipping 2575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2758 CompilationPipeline::New(thread->zone(), function); | 2758 CompilationPipeline::New(thread->zone(), function); |
| 2759 | 2759 |
| 2760 ASSERT(FLAG_precompiled_mode); | 2760 ASSERT(FLAG_precompiled_mode); |
| 2761 const bool optimized = function.IsOptimizable(); // False for natives. | 2761 const bool optimized = function.IsOptimizable(); // False for natives. |
| 2762 return PrecompileFunctionHelper(pipeline, function, optimized); | 2762 return PrecompileFunctionHelper(pipeline, function, optimized); |
| 2763 } | 2763 } |
| 2764 | 2764 |
| 2765 #endif // DART_PRECOMPILER | 2765 #endif // DART_PRECOMPILER |
| 2766 | 2766 |
| 2767 } // namespace dart | 2767 } // namespace dart |
| OLD | NEW |