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 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
6 | 6 |
7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
8 | 8 |
9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
10 #include "vm/cha.h" | 10 #include "vm/cha.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 ASSERT(mat != NULL); | 80 ASSERT(mat != NULL); |
81 builder->AddMaterialization(mat); | 81 builder->AddMaterialization(mat); |
82 } | 82 } |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 | 86 |
87 FlowGraphCompiler::FlowGraphCompiler( | 87 FlowGraphCompiler::FlowGraphCompiler( |
88 Assembler* assembler, | 88 Assembler* assembler, |
89 FlowGraph* flow_graph, | 89 FlowGraph* flow_graph, |
| 90 const ParsedFunction& parsed_function, |
90 bool is_optimizing, | 91 bool is_optimizing, |
91 const GrowableArray<const Function*>& inline_id_to_function) | 92 const GrowableArray<const Function*>& inline_id_to_function) |
92 : isolate_(Isolate::Current()), | 93 : isolate_(Isolate::Current()), |
93 assembler_(assembler), | 94 assembler_(assembler), |
94 parsed_function_(*flow_graph->parsed_function()), | 95 parsed_function_(parsed_function), |
95 flow_graph_(*flow_graph), | 96 flow_graph_(*flow_graph), |
96 block_order_(*flow_graph->CodegenBlockOrder(is_optimizing)), | 97 block_order_(*flow_graph->CodegenBlockOrder(is_optimizing)), |
97 current_block_(NULL), | 98 current_block_(NULL), |
98 exception_handlers_list_(NULL), | 99 exception_handlers_list_(NULL), |
99 pc_descriptors_list_(NULL), | 100 pc_descriptors_list_(NULL), |
100 stackmap_table_builder_( | 101 stackmap_table_builder_( |
101 is_optimizing ? new StackmapTableBuilder() : NULL), | 102 is_optimizing ? new StackmapTableBuilder() : NULL), |
102 block_info_(block_order_.length()), | 103 block_info_(block_order_.length()), |
103 deopt_infos_(), | 104 deopt_infos_(), |
104 static_calls_target_table_(GrowableObjectArray::ZoneHandle( | 105 static_calls_target_table_(GrowableObjectArray::ZoneHandle( |
(...skipping 15 matching lines...) Expand all Loading... |
120 Library::Handle(Library::CoreLibrary()). | 121 Library::Handle(Library::CoreLibrary()). |
121 LookupClass(Symbols::List()))), | 122 LookupClass(Symbols::List()))), |
122 parallel_move_resolver_(this), | 123 parallel_move_resolver_(this), |
123 pending_deoptimization_env_(NULL), | 124 pending_deoptimization_env_(NULL), |
124 entry_patch_pc_offset_(Code::kInvalidPc), | 125 entry_patch_pc_offset_(Code::kInvalidPc), |
125 patch_code_pc_offset_(Code::kInvalidPc), | 126 patch_code_pc_offset_(Code::kInvalidPc), |
126 lazy_deopt_pc_offset_(Code::kInvalidPc), | 127 lazy_deopt_pc_offset_(Code::kInvalidPc), |
127 deopt_id_to_ic_data_(NULL), | 128 deopt_id_to_ic_data_(NULL), |
128 inlined_code_intervals_(NULL), | 129 inlined_code_intervals_(NULL), |
129 inline_id_to_function_(inline_id_to_function) { | 130 inline_id_to_function_(inline_id_to_function) { |
| 131 ASSERT(flow_graph->parsed_function().function().raw() == |
| 132 parsed_function.function().raw()); |
130 if (!is_optimizing) { | 133 if (!is_optimizing) { |
131 const intptr_t len = isolate()->deopt_id(); | 134 const intptr_t len = isolate()->deopt_id(); |
132 deopt_id_to_ic_data_ = new(isolate()) ZoneGrowableArray<const ICData*>(len); | 135 deopt_id_to_ic_data_ = new(isolate()) ZoneGrowableArray<const ICData*>(len); |
133 deopt_id_to_ic_data_->SetLength(len); | 136 deopt_id_to_ic_data_->SetLength(len); |
134 for (intptr_t i = 0; i < len; i++) { | 137 for (intptr_t i = 0; i < len; i++) { |
135 (*deopt_id_to_ic_data_)[i] = NULL; | 138 (*deopt_id_to_ic_data_)[i] = NULL; |
136 } | 139 } |
137 const Array& old_saved_icdata = Array::Handle(isolate(), | 140 const Array& old_saved_icdata = Array::Handle(isolate(), |
138 flow_graph->function().ic_data_array()); | 141 flow_graph->function().ic_data_array()); |
139 const intptr_t saved_len = | 142 const intptr_t saved_len = |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 *sequence_node.NodeAt(0)->AsStoreInstanceFieldNode(); | 932 *sequence_node.NodeAt(0)->AsStoreInstanceFieldNode(); |
930 if (store_node.field().guarded_cid() == kDynamicCid) { | 933 if (store_node.field().guarded_cid() == kDynamicCid) { |
931 GenerateInlinedSetter(store_node.field().Offset()); | 934 GenerateInlinedSetter(store_node.field().Offset()); |
932 return; | 935 return; |
933 } | 936 } |
934 } | 937 } |
935 } | 938 } |
936 | 939 |
937 EnterIntrinsicMode(); | 940 EnterIntrinsicMode(); |
938 | 941 |
939 Intrinsifier::Intrinsify(&parsed_function(), this); | 942 Intrinsifier::Intrinsify(parsed_function(), this); |
940 | 943 |
941 ExitIntrinsicMode(); | 944 ExitIntrinsicMode(); |
942 // "Deoptimization" from intrinsic continues here. All deoptimization | 945 // "Deoptimization" from intrinsic continues here. All deoptimization |
943 // branches from intrinsic code redirect to here where the slow-path | 946 // branches from intrinsic code redirect to here where the slow-path |
944 // (normal function body) starts. | 947 // (normal function body) starts. |
945 // This means that there must not be any side-effects in intrinsic code | 948 // This means that there must not be any side-effects in intrinsic code |
946 // before any deoptimization point. | 949 // before any deoptimization point. |
947 ASSERT(!intrinsic_slow_path_label_.IsBound()); | 950 ASSERT(!intrinsic_slow_path_label_.IsBound()); |
948 assembler()->Bind(&intrinsic_slow_path_label_); | 951 assembler()->Bind(&intrinsic_slow_path_label_); |
949 } | 952 } |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1568 case kUnboxedMint: | 1571 case kUnboxedMint: |
1569 return mint_class(); | 1572 return mint_class(); |
1570 default: | 1573 default: |
1571 UNREACHABLE(); | 1574 UNREACHABLE(); |
1572 return Class::ZoneHandle(); | 1575 return Class::ZoneHandle(); |
1573 } | 1576 } |
1574 } | 1577 } |
1575 | 1578 |
1576 | 1579 |
1577 } // namespace dart | 1580 } // namespace dart |
OLD | NEW |