OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #if !defined(DART_PRECOMPILED_RUNTIME) | 5 #if !defined(DART_PRECOMPILED_RUNTIME) |
6 | 6 |
7 #include "vm/flow_graph_inliner.h" | 7 #include "vm/flow_graph_inliner.h" |
8 | 8 |
9 #include "vm/aot_optimizer.h" | 9 #include "vm/aot_optimizer.h" |
10 #include "vm/block_scheduler.h" | 10 #include "vm/block_scheduler.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 DEFINE_FLAG(bool, print_inlining_tree, false, "Print inlining tree"); | 91 DEFINE_FLAG(bool, print_inlining_tree, false, "Print inlining tree"); |
92 DEFINE_FLAG(bool, | 92 DEFINE_FLAG(bool, |
93 enable_inlining_annotations, | 93 enable_inlining_annotations, |
94 false, | 94 false, |
95 "Enable inlining annotations"); | 95 "Enable inlining annotations"); |
96 | 96 |
97 DECLARE_FLAG(bool, compiler_stats); | 97 DECLARE_FLAG(bool, compiler_stats); |
98 DECLARE_FLAG(int, max_deoptimization_counter_threshold); | 98 DECLARE_FLAG(int, max_deoptimization_counter_threshold); |
99 DECLARE_FLAG(bool, print_flow_graph); | 99 DECLARE_FLAG(bool, print_flow_graph); |
100 DECLARE_FLAG(bool, print_flow_graph_optimized); | 100 DECLARE_FLAG(bool, print_flow_graph_optimized); |
101 DECLARE_FLAG(bool, support_externalizable_strings); | |
102 DECLARE_FLAG(bool, verify_compiler); | 101 DECLARE_FLAG(bool, verify_compiler); |
103 | 102 |
104 // Quick access to the current zone. | 103 // Quick access to the current zone. |
105 #define Z (zone()) | 104 #define Z (zone()) |
106 #define I (isolate()) | 105 #define I (isolate()) |
107 | 106 |
108 #define TRACE_INLINING(statement) \ | 107 #define TRACE_INLINING(statement) \ |
109 do { \ | 108 do { \ |
110 if (trace_inlining()) statement; \ | 109 if (trace_inlining()) statement; \ |
111 } while (false) | 110 } while (false) |
(...skipping 2611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2723 return true; | 2722 return true; |
2724 } | 2723 } |
2725 | 2724 |
2726 // Returns the LoadIndexedInstr. | 2725 // Returns the LoadIndexedInstr. |
2727 static Definition* PrepareInlineStringIndexOp(FlowGraph* flow_graph, | 2726 static Definition* PrepareInlineStringIndexOp(FlowGraph* flow_graph, |
2728 Instruction* call, | 2727 Instruction* call, |
2729 intptr_t cid, | 2728 intptr_t cid, |
2730 Definition* str, | 2729 Definition* str, |
2731 Definition* index, | 2730 Definition* index, |
2732 Instruction* cursor) { | 2731 Instruction* cursor) { |
2733 // Load the length of the string. | |
2734 // Treat length loads as mutable (i.e. affected by side effects) to avoid | |
2735 // hoisting them since we can't hoist the preceding class-check. This | |
2736 // is because of externalization of strings that affects their class-id. | |
2737 LoadFieldInstr* length = new (Z) | 2732 LoadFieldInstr* length = new (Z) |
2738 LoadFieldInstr(new (Z) Value(str), String::length_offset(), | 2733 LoadFieldInstr(new (Z) Value(str), String::length_offset(), |
2739 Type::ZoneHandle(Z, Type::SmiType()), str->token_pos()); | 2734 Type::ZoneHandle(Z, Type::SmiType()), str->token_pos()); |
2740 length->set_result_cid(kSmiCid); | 2735 length->set_result_cid(kSmiCid); |
2741 length->set_is_immutable(!FLAG_support_externalizable_strings); | 2736 length->set_is_immutable(true); |
2742 length->set_recognized_kind(MethodRecognizer::kStringBaseLength); | 2737 length->set_recognized_kind(MethodRecognizer::kStringBaseLength); |
2743 | 2738 |
2744 cursor = flow_graph->AppendTo(cursor, length, NULL, FlowGraph::kValue); | 2739 cursor = flow_graph->AppendTo(cursor, length, NULL, FlowGraph::kValue); |
2745 // Bounds check. | 2740 // Bounds check. |
2746 cursor = flow_graph->AppendTo( | 2741 cursor = flow_graph->AppendTo( |
2747 cursor, | 2742 cursor, |
2748 new (Z) CheckArrayBoundInstr(new (Z) Value(length), new (Z) Value(index), | 2743 new (Z) CheckArrayBoundInstr(new (Z) Value(length), new (Z) Value(index), |
2749 call->deopt_id()), | 2744 call->deopt_id()), |
2750 call->env(), FlowGraph::kEffect); | 2745 call->env(), FlowGraph::kEffect); |
2751 | 2746 |
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3737 } | 3732 } |
3738 | 3733 |
3739 default: | 3734 default: |
3740 return false; | 3735 return false; |
3741 } | 3736 } |
3742 } | 3737 } |
3743 | 3738 |
3744 } // namespace dart | 3739 } // namespace dart |
3745 | 3740 |
3746 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 3741 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
OLD | NEW |