| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/cha.h" | 7 #include "vm/cha.h" |
| 8 #include "vm/flow_graph_builder.h" | 8 #include "vm/flow_graph_builder.h" |
| 9 #include "vm/hash_map.h" | 9 #include "vm/hash_map.h" |
| 10 #include "vm/il_printer.h" | 10 #include "vm/il_printer.h" |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 break; | 439 break; |
| 440 case MethodRecognizer::kGrowableArrayLength: | 440 case MethodRecognizer::kGrowableArrayLength: |
| 441 length_offset = GrowableObjectArray::length_offset(); | 441 length_offset = GrowableObjectArray::length_offset(); |
| 442 break; | 442 break; |
| 443 default: | 443 default: |
| 444 UNREACHABLE(); | 444 UNREACHABLE(); |
| 445 } | 445 } |
| 446 LoadVMFieldComp* load = new LoadVMFieldComp( | 446 LoadVMFieldComp* load = new LoadVMFieldComp( |
| 447 comp->ArgumentAt(0)->value(), | 447 comp->ArgumentAt(0)->value(), |
| 448 length_offset, | 448 length_offset, |
| 449 Type::ZoneHandle(Type::IntInterface())); | 449 Type::ZoneHandle(Type::SmiType())); |
| 450 load->set_result_cid(kSmiCid); | 450 load->set_result_cid(kSmiCid); |
| 451 load->set_original(comp); | 451 load->set_original(comp); |
| 452 load->set_ic_data(comp->ic_data()); | 452 load->set_ic_data(comp->ic_data()); |
| 453 instr->set_computation(load); | 453 instr->set_computation(load); |
| 454 RemovePushArguments(comp); | 454 RemovePushArguments(comp); |
| 455 return true; | 455 return true; |
| 456 } | 456 } |
| 457 | 457 |
| 458 if (recognized_kind == MethodRecognizer::kStringBaseLength) { | 458 if (recognized_kind == MethodRecognizer::kStringBaseLength) { |
| 459 if (!HasOneTarget(ic_data)) { | 459 if (!HasOneTarget(ic_data)) { |
| 460 // Target is not only StringBase_get_length. | 460 // Target is not only StringBase_get_length. |
| 461 return false; | 461 return false; |
| 462 } | 462 } |
| 463 ASSERT(HasOneTarget(ic_data)); | 463 ASSERT(HasOneTarget(ic_data)); |
| 464 LoadVMFieldComp* load = new LoadVMFieldComp( | 464 LoadVMFieldComp* load = new LoadVMFieldComp( |
| 465 comp->ArgumentAt(0)->value(), | 465 comp->ArgumentAt(0)->value(), |
| 466 String::length_offset(), | 466 String::length_offset(), |
| 467 Type::ZoneHandle(Type::IntInterface())); | 467 Type::ZoneHandle(Type::SmiType())); |
| 468 load->set_result_cid(kSmiCid); | 468 load->set_result_cid(kSmiCid); |
| 469 load->set_original(comp); | 469 load->set_original(comp); |
| 470 load->set_ic_data(comp->ic_data()); | 470 load->set_ic_data(comp->ic_data()); |
| 471 instr->set_computation(load); | 471 instr->set_computation(load); |
| 472 RemovePushArguments(comp); | 472 RemovePushArguments(comp); |
| 473 return true; | 473 return true; |
| 474 } | 474 } |
| 475 return false; | 475 return false; |
| 476 } | 476 } |
| 477 | 477 |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 OS::Print("Replacing v%d with v%d\n", | 971 OS::Print("Replacing v%d with v%d\n", |
| 972 instr->ssa_temp_index(), | 972 instr->ssa_temp_index(), |
| 973 result->ssa_temp_index()); | 973 result->ssa_temp_index()); |
| 974 } | 974 } |
| 975 } | 975 } |
| 976 } | 976 } |
| 977 } | 977 } |
| 978 | 978 |
| 979 | 979 |
| 980 } // namespace dart | 980 } // namespace dart |
| OLD | NEW |