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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
9 #include "vm/flow_graph_allocator.h" | 9 #include "vm/flow_graph_allocator.h" |
10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 | 151 |
152 EffectSet LoadFieldInstr::Dependencies() const { | 152 EffectSet LoadFieldInstr::Dependencies() const { |
153 return immutable_ ? EffectSet::None() : EffectSet::All(); | 153 return immutable_ ? EffectSet::None() : EffectSet::All(); |
154 } | 154 } |
155 | 155 |
156 | 156 |
157 bool LoadFieldInstr::AttributesEqual(Instruction* other) const { | 157 bool LoadFieldInstr::AttributesEqual(Instruction* other) const { |
158 LoadFieldInstr* other_load = other->AsLoadField(); | 158 LoadFieldInstr* other_load = other->AsLoadField(); |
159 ASSERT(other_load != NULL); | 159 ASSERT(other_load != NULL); |
160 ASSERT((offset_in_bytes() != other_load->offset_in_bytes()) || | 160 if (field() != NULL) { |
161 ((immutable_ == other_load->immutable_))); | 161 return (other_load->field() != NULL) && |
162 return offset_in_bytes() == other_load->offset_in_bytes(); | 162 (field()->raw() == other_load->field()->raw()); |
| 163 } |
| 164 return (other_load->field() == NULL) && |
| 165 (offset_in_bytes() == other_load->offset_in_bytes()); |
163 } | 166 } |
164 | 167 |
165 | 168 |
166 EffectSet LoadStaticFieldInstr::Dependencies() const { | 169 EffectSet LoadStaticFieldInstr::Dependencies() const { |
167 return field().is_final() ? EffectSet::None() : EffectSet::All(); | 170 return field().is_final() ? EffectSet::None() : EffectSet::All(); |
168 } | 171 } |
169 | 172 |
170 | 173 |
171 bool LoadStaticFieldInstr::AttributesEqual(Instruction* other) const { | 174 bool LoadStaticFieldInstr::AttributesEqual(Instruction* other) const { |
172 LoadStaticFieldInstr* other_load = other->AsLoadStaticField(); | 175 LoadStaticFieldInstr* other_load = other->AsLoadStaticField(); |
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 case kGrowableObjectArrayCid: | 1163 case kGrowableObjectArrayCid: |
1161 return MethodRecognizer::kGrowableArrayLength; | 1164 return MethodRecognizer::kGrowableArrayLength; |
1162 default: | 1165 default: |
1163 UNREACHABLE(); | 1166 UNREACHABLE(); |
1164 return MethodRecognizer::kUnknown; | 1167 return MethodRecognizer::kUnknown; |
1165 } | 1168 } |
1166 } | 1169 } |
1167 | 1170 |
1168 | 1171 |
1169 bool LoadFieldInstr::IsFixedLengthArrayCid(intptr_t cid) { | 1172 bool LoadFieldInstr::IsFixedLengthArrayCid(intptr_t cid) { |
| 1173 if (RawObject::IsTypedDataClassId(cid) || |
| 1174 RawObject::IsExternalTypedDataClassId(cid)) { |
| 1175 return true; |
| 1176 } |
| 1177 |
1170 switch (cid) { | 1178 switch (cid) { |
1171 case kArrayCid: | 1179 case kArrayCid: |
1172 case kImmutableArrayCid: | 1180 case kImmutableArrayCid: |
1173 case kTypedDataInt8ArrayCid: | |
1174 case kTypedDataUint8ArrayCid: | |
1175 case kTypedDataUint8ClampedArrayCid: | |
1176 case kTypedDataInt16ArrayCid: | |
1177 case kTypedDataUint16ArrayCid: | |
1178 case kTypedDataInt32ArrayCid: | |
1179 case kTypedDataUint32ArrayCid: | |
1180 case kTypedDataInt64ArrayCid: | |
1181 case kTypedDataUint64ArrayCid: | |
1182 case kTypedDataFloat32ArrayCid: | |
1183 case kTypedDataFloat64ArrayCid: | |
1184 case kTypedDataFloat32x4ArrayCid: | |
1185 return true; | 1181 return true; |
1186 default: | 1182 default: |
1187 return false; | 1183 return false; |
1188 } | 1184 } |
1189 } | 1185 } |
1190 | 1186 |
1191 | 1187 |
1192 Definition* ConstantInstr::Canonicalize(FlowGraph* flow_graph) { | 1188 Definition* ConstantInstr::Canonicalize(FlowGraph* flow_graph) { |
1193 return HasUses() ? this : NULL; | 1189 return HasUses() ? this : NULL; |
1194 } | 1190 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 comp->InputAt(i)->definition()->representation()) { | 1284 comp->InputAt(i)->definition()->representation()) { |
1289 return this; | 1285 return this; |
1290 } | 1286 } |
1291 } | 1287 } |
1292 | 1288 |
1293 // Replace the comparison if the replacement is used at this branch, | 1289 // Replace the comparison if the replacement is used at this branch, |
1294 // and has exactly one use. | 1290 // and has exactly one use. |
1295 Value* use = comp->input_use_list(); | 1291 Value* use = comp->input_use_list(); |
1296 if ((use->instruction() == this) && comp->HasOnlyUse(use)) { | 1292 if ((use->instruction() == this) && comp->HasOnlyUse(use)) { |
1297 RemoveEnvironment(); | 1293 RemoveEnvironment(); |
1298 InheritDeoptTarget(comp); | 1294 flow_graph->CopyDeoptTarget(this, comp); |
1299 | 1295 |
1300 comp->RemoveFromGraph(); | 1296 comp->RemoveFromGraph(); |
1301 SetComparison(comp); | 1297 SetComparison(comp); |
1302 if (FLAG_trace_optimization) { | 1298 if (FLAG_trace_optimization) { |
1303 OS::Print("Merging comparison v%"Pd"\n", comp->ssa_temp_index()); | 1299 OS::Print("Merging comparison v%"Pd"\n", comp->ssa_temp_index()); |
1304 } | 1300 } |
1305 // Clear the comparison's temp index and ssa temp index since the | 1301 // Clear the comparison's temp index and ssa temp index since the |
1306 // value of the comparison is not used outside the branch anymore. | 1302 // value of the comparison is not used outside the branch anymore. |
1307 ASSERT(comp->input_use_list() == NULL); | 1303 ASSERT(comp->input_use_list() == NULL); |
1308 comp->ClearSSATempIndex(); | 1304 comp->ClearSSATempIndex(); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1530 UNREACHABLE(); | 1526 UNREACHABLE(); |
1531 return NULL; | 1527 return NULL; |
1532 } | 1528 } |
1533 | 1529 |
1534 | 1530 |
1535 void ConstraintInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1531 void ConstraintInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1536 UNREACHABLE(); | 1532 UNREACHABLE(); |
1537 } | 1533 } |
1538 | 1534 |
1539 | 1535 |
| 1536 LocationSummary* MaterializeObjectInstr::MakeLocationSummary() const { |
| 1537 UNREACHABLE(); |
| 1538 return NULL; |
| 1539 } |
| 1540 |
| 1541 |
| 1542 void MaterializeObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1543 UNREACHABLE(); |
| 1544 } |
| 1545 |
| 1546 |
1540 LocationSummary* StoreContextInstr::MakeLocationSummary() const { | 1547 LocationSummary* StoreContextInstr::MakeLocationSummary() const { |
1541 const intptr_t kNumInputs = 1; | 1548 const intptr_t kNumInputs = 1; |
1542 const intptr_t kNumTemps = 0; | 1549 const intptr_t kNumTemps = 0; |
1543 LocationSummary* summary = | 1550 LocationSummary* summary = |
1544 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1551 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
1545 summary->set_in(0, Location::RegisterLocation(CTX)); | 1552 summary->set_in(0, Location::RegisterLocation(CTX)); |
1546 return summary; | 1553 return summary; |
1547 } | 1554 } |
1548 | 1555 |
1549 | 1556 |
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2427 default: | 2434 default: |
2428 UNREACHABLE(); | 2435 UNREACHABLE(); |
2429 } | 2436 } |
2430 return kPowRuntimeEntry; | 2437 return kPowRuntimeEntry; |
2431 } | 2438 } |
2432 | 2439 |
2433 | 2440 |
2434 #undef __ | 2441 #undef __ |
2435 | 2442 |
2436 } // namespace dart | 2443 } // namespace dart |
OLD | NEW |