| 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/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 3823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3834 void ConstantPropagator::VisitAllocateObjectWithBoundsCheck( | 3834 void ConstantPropagator::VisitAllocateObjectWithBoundsCheck( |
| 3835 AllocateObjectWithBoundsCheckInstr* instr) { | 3835 AllocateObjectWithBoundsCheckInstr* instr) { |
| 3836 SetValue(instr, non_constant_); | 3836 SetValue(instr, non_constant_); |
| 3837 } | 3837 } |
| 3838 | 3838 |
| 3839 | 3839 |
| 3840 void ConstantPropagator::VisitLoadField(LoadFieldInstr* instr) { | 3840 void ConstantPropagator::VisitLoadField(LoadFieldInstr* instr) { |
| 3841 if ((instr->recognized_kind() == MethodRecognizer::kObjectArrayLength) && | 3841 if ((instr->recognized_kind() == MethodRecognizer::kObjectArrayLength) && |
| 3842 (instr->value()->definition()->IsCreateArray())) { | 3842 (instr->value()->definition()->IsCreateArray())) { |
| 3843 const intptr_t length = | 3843 const intptr_t length = |
| 3844 instr->value()->definition()->AsCreateArray()->ArgumentCount(); | 3844 instr->value()->definition()->AsCreateArray()->num_elements(); |
| 3845 const Object& result = Smi::ZoneHandle(Smi::New(length)); | 3845 const Object& result = Smi::ZoneHandle(Smi::New(length)); |
| 3846 SetValue(instr, result); | 3846 SetValue(instr, result); |
| 3847 return; | 3847 return; |
| 3848 } | 3848 } |
| 3849 | 3849 |
| 3850 if (instr->IsImmutableLengthLoad()) { | 3850 if (instr->IsImmutableLengthLoad()) { |
| 3851 ConstantInstr* constant = instr->value()->definition()->AsConstant(); | 3851 ConstantInstr* constant = instr->value()->definition()->AsConstant(); |
| 3852 if (constant != NULL) { | 3852 if (constant != NULL) { |
| 3853 if (constant->value().IsString()) { | 3853 if (constant->value().IsString()) { |
| 3854 SetValue(instr, Smi::ZoneHandle( | 3854 SetValue(instr, Smi::ZoneHandle( |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4253 | 4253 |
| 4254 if (FLAG_trace_constant_propagation) { | 4254 if (FLAG_trace_constant_propagation) { |
| 4255 OS::Print("\n==== After constant propagation ====\n"); | 4255 OS::Print("\n==== After constant propagation ====\n"); |
| 4256 FlowGraphPrinter printer(*graph_); | 4256 FlowGraphPrinter printer(*graph_); |
| 4257 printer.PrintBlocks(); | 4257 printer.PrintBlocks(); |
| 4258 } | 4258 } |
| 4259 } | 4259 } |
| 4260 | 4260 |
| 4261 | 4261 |
| 4262 } // namespace dart | 4262 } // namespace dart |
| OLD | NEW |