| 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_inliner.h" | 5 #include "vm/flow_graph_inliner.h" |
| 6 | 6 |
| 7 #include "vm/compiler.h" | 7 #include "vm/compiler.h" |
| 8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
| 9 #include "vm/flow_graph.h" | 9 #include "vm/flow_graph.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1092 if (inlined_variants_[i].cid == kSmiCid) { | 1092 if (inlined_variants_[i].cid == kSmiCid) { |
| 1093 CheckSmiInstr* check_smi = | 1093 CheckSmiInstr* check_smi = |
| 1094 new CheckSmiInstr(new Value(redefinition), call_->deopt_id()); | 1094 new CheckSmiInstr(new Value(redefinition), call_->deopt_id()); |
| 1095 check_smi->InheritDeoptTarget(call_); | 1095 check_smi->InheritDeoptTarget(call_); |
| 1096 cursor = AppendInstruction(cursor, check_smi); | 1096 cursor = AppendInstruction(cursor, check_smi); |
| 1097 } else { | 1097 } else { |
| 1098 const ICData& old_checks = call_->ic_data(); | 1098 const ICData& old_checks = call_->ic_data(); |
| 1099 const ICData& new_checks = ICData::ZoneHandle( | 1099 const ICData& new_checks = ICData::ZoneHandle( |
| 1100 ICData::New(Function::Handle(old_checks.function()), | 1100 ICData::New(Function::Handle(old_checks.function()), |
| 1101 String::Handle(old_checks.target_name()), | 1101 String::Handle(old_checks.target_name()), |
| 1102 Array::Handle(old_checks.arguments_descriptor()), |
| 1102 old_checks.deopt_id(), | 1103 old_checks.deopt_id(), |
| 1103 1)); // Number of args tested. | 1104 1)); // Number of args tested. |
| 1104 new_checks.AddReceiverCheck(inlined_variants_[i].cid, | 1105 new_checks.AddReceiverCheck(inlined_variants_[i].cid, |
| 1105 *inlined_variants_[i].target); | 1106 *inlined_variants_[i].target); |
| 1106 CheckClassInstr* check_class = | 1107 CheckClassInstr* check_class = |
| 1107 new CheckClassInstr(new Value(redefinition), | 1108 new CheckClassInstr(new Value(redefinition), |
| 1108 call_->deopt_id(), | 1109 call_->deopt_id(), |
| 1109 new_checks); | 1110 new_checks); |
| 1110 check_class->InheritDeoptTarget(call_); | 1111 check_class->InheritDeoptTarget(call_); |
| 1111 cursor = AppendInstruction(cursor, check_class); | 1112 cursor = AppendInstruction(cursor, check_class); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 PushArgumentInstr* push = call_->PushArgumentAt(i); | 1217 PushArgumentInstr* push = call_->PushArgumentAt(i); |
| 1217 push->ReplaceUsesWith(push->value()->definition()); | 1218 push->ReplaceUsesWith(push->value()->definition()); |
| 1218 push->previous()->LinkTo(push->next()); | 1219 push->previous()->LinkTo(push->next()); |
| 1219 cursor->LinkTo(push); | 1220 cursor->LinkTo(push); |
| 1220 cursor = push; | 1221 cursor = push; |
| 1221 } | 1222 } |
| 1222 const ICData& old_checks = call_->ic_data(); | 1223 const ICData& old_checks = call_->ic_data(); |
| 1223 const ICData& new_checks = ICData::ZoneHandle( | 1224 const ICData& new_checks = ICData::ZoneHandle( |
| 1224 ICData::New(Function::Handle(old_checks.function()), | 1225 ICData::New(Function::Handle(old_checks.function()), |
| 1225 String::Handle(old_checks.target_name()), | 1226 String::Handle(old_checks.target_name()), |
| 1227 Array::Handle(old_checks.arguments_descriptor()), |
| 1226 old_checks.deopt_id(), | 1228 old_checks.deopt_id(), |
| 1227 1)); // Number of args tested. | 1229 1)); // Number of args tested. |
| 1228 for (intptr_t i = 0; i < non_inlined_variants_.length(); ++i) { | 1230 for (intptr_t i = 0; i < non_inlined_variants_.length(); ++i) { |
| 1229 new_checks.AddReceiverCheck(non_inlined_variants_[i].cid, | 1231 new_checks.AddReceiverCheck(non_inlined_variants_[i].cid, |
| 1230 *non_inlined_variants_[i].target, | 1232 *non_inlined_variants_[i].target, |
| 1231 non_inlined_variants_[i].count); | 1233 non_inlined_variants_[i].count); |
| 1232 } | 1234 } |
| 1233 PolymorphicInstanceCallInstr* fallback_call = | 1235 PolymorphicInstanceCallInstr* fallback_call = |
| 1234 new PolymorphicInstanceCallInstr(call_->instance_call(), | 1236 new PolymorphicInstanceCallInstr(call_->instance_call(), |
| 1235 new_checks, | 1237 new_checks, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1341 OS::Print("After Inlining of %s\n", flow_graph_-> | 1343 OS::Print("After Inlining of %s\n", flow_graph_-> |
| 1342 parsed_function().function().ToFullyQualifiedCString()); | 1344 parsed_function().function().ToFullyQualifiedCString()); |
| 1343 FlowGraphPrinter printer(*flow_graph_); | 1345 FlowGraphPrinter printer(*flow_graph_); |
| 1344 printer.PrintBlocks(); | 1346 printer.PrintBlocks(); |
| 1345 } | 1347 } |
| 1346 } | 1348 } |
| 1347 } | 1349 } |
| 1348 } | 1350 } |
| 1349 | 1351 |
| 1350 } // namespace dart | 1352 } // namespace dart |
| OLD | NEW |