| 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/flow_graph_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 insert_before->token_pos()), | 1121 insert_before->token_pos()), |
| 1122 deopt_environment, | 1122 deopt_environment, |
| 1123 FlowGraph::kEffect); | 1123 FlowGraph::kEffect); |
| 1124 } | 1124 } |
| 1125 } | 1125 } |
| 1126 | 1126 |
| 1127 | 1127 |
| 1128 Instruction* FlowGraphOptimizer::GetCheckClass(Definition* to_check, | 1128 Instruction* FlowGraphOptimizer::GetCheckClass(Definition* to_check, |
| 1129 const ICData& unary_checks, | 1129 const ICData& unary_checks, |
| 1130 intptr_t deopt_id, | 1130 intptr_t deopt_id, |
| 1131 intptr_t token_pos) { | 1131 TokenPosition token_pos) { |
| 1132 if ((unary_checks.NumberOfUsedChecks() == 1) && | 1132 if ((unary_checks.NumberOfUsedChecks() == 1) && |
| 1133 unary_checks.HasReceiverClassId(kSmiCid)) { | 1133 unary_checks.HasReceiverClassId(kSmiCid)) { |
| 1134 return new(Z) CheckSmiInstr(new(Z) Value(to_check), | 1134 return new(Z) CheckSmiInstr(new(Z) Value(to_check), |
| 1135 deopt_id, | 1135 deopt_id, |
| 1136 token_pos); | 1136 token_pos); |
| 1137 } | 1137 } |
| 1138 return new(Z) CheckClassInstr( | 1138 return new(Z) CheckClassInstr( |
| 1139 new(Z) Value(to_check), deopt_id, unary_checks, token_pos); | 1139 new(Z) Value(to_check), deopt_id, unary_checks, token_pos); |
| 1140 } | 1140 } |
| 1141 | 1141 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 } | 1275 } |
| 1276 return TryReplaceInstanceCallWithInline(call); | 1276 return TryReplaceInstanceCallWithInline(call); |
| 1277 } | 1277 } |
| 1278 | 1278 |
| 1279 | 1279 |
| 1280 bool FlowGraphOptimizer::InlineSetIndexed( | 1280 bool FlowGraphOptimizer::InlineSetIndexed( |
| 1281 MethodRecognizer::Kind kind, | 1281 MethodRecognizer::Kind kind, |
| 1282 const Function& target, | 1282 const Function& target, |
| 1283 Instruction* call, | 1283 Instruction* call, |
| 1284 Definition* receiver, | 1284 Definition* receiver, |
| 1285 intptr_t token_pos, | 1285 TokenPosition token_pos, |
| 1286 const ICData& value_check, | 1286 const ICData& value_check, |
| 1287 TargetEntryInstr** entry, | 1287 TargetEntryInstr** entry, |
| 1288 Definition** last) { | 1288 Definition** last) { |
| 1289 intptr_t array_cid = MethodKindToCid(kind); | 1289 intptr_t array_cid = MethodKindToCid(kind); |
| 1290 ASSERT(array_cid != kIllegalCid); | 1290 ASSERT(array_cid != kIllegalCid); |
| 1291 | 1291 |
| 1292 Definition* array = receiver; | 1292 Definition* array = receiver; |
| 1293 Definition* index = call->ArgumentAt(1); | 1293 Definition* index = call->ArgumentAt(1); |
| 1294 Definition* stored_value = call->ArgumentAt(2); | 1294 Definition* stored_value = call->ArgumentAt(2); |
| 1295 | 1295 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1446 call->env(), | 1446 call->env(), |
| 1447 FlowGraph::kEffect); | 1447 FlowGraph::kEffect); |
| 1448 return true; | 1448 return true; |
| 1449 } | 1449 } |
| 1450 | 1450 |
| 1451 | 1451 |
| 1452 bool FlowGraphOptimizer::TryInlineRecognizedMethod(intptr_t receiver_cid, | 1452 bool FlowGraphOptimizer::TryInlineRecognizedMethod(intptr_t receiver_cid, |
| 1453 const Function& target, | 1453 const Function& target, |
| 1454 Instruction* call, | 1454 Instruction* call, |
| 1455 Definition* receiver, | 1455 Definition* receiver, |
| 1456 intptr_t token_pos, | 1456 TokenPosition token_pos, |
| 1457 const ICData& ic_data, | 1457 const ICData& ic_data, |
| 1458 TargetEntryInstr** entry, | 1458 TargetEntryInstr** entry, |
| 1459 Definition** last) { | 1459 Definition** last) { |
| 1460 ICData& value_check = ICData::ZoneHandle(Z); | 1460 ICData& value_check = ICData::ZoneHandle(Z); |
| 1461 MethodRecognizer::Kind kind = MethodRecognizer::RecognizeKind(target); | 1461 MethodRecognizer::Kind kind = MethodRecognizer::RecognizeKind(target); |
| 1462 switch (kind) { | 1462 switch (kind) { |
| 1463 // Recognized [] operators. | 1463 // Recognized [] operators. |
| 1464 case MethodRecognizer::kImmutableArrayGetIndexed: | 1464 case MethodRecognizer::kImmutableArrayGetIndexed: |
| 1465 case MethodRecognizer::kObjectArrayGetIndexed: | 1465 case MethodRecognizer::kObjectArrayGetIndexed: |
| 1466 case MethodRecognizer::kGrowableArrayGetIndexed: | 1466 case MethodRecognizer::kGrowableArrayGetIndexed: |
| (...skipping 7379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8846 | 8846 |
| 8847 // Insert materializations at environment uses. | 8847 // Insert materializations at environment uses. |
| 8848 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { | 8848 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { |
| 8849 CreateMaterializationAt( | 8849 CreateMaterializationAt( |
| 8850 exits_collector_.exits()[i], alloc, *slots); | 8850 exits_collector_.exits()[i], alloc, *slots); |
| 8851 } | 8851 } |
| 8852 } | 8852 } |
| 8853 | 8853 |
| 8854 | 8854 |
| 8855 } // namespace dart | 8855 } // namespace dart |
| OLD | NEW |