| 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 4256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4267 void ConstantPropagator::VisitAllocateObjectWithBoundsCheck( | 4267 void ConstantPropagator::VisitAllocateObjectWithBoundsCheck( |
| 4268 AllocateObjectWithBoundsCheckInstr* instr) { | 4268 AllocateObjectWithBoundsCheckInstr* instr) { |
| 4269 SetValue(instr, non_constant_); | 4269 SetValue(instr, non_constant_); |
| 4270 } | 4270 } |
| 4271 | 4271 |
| 4272 | 4272 |
| 4273 void ConstantPropagator::VisitLoadField(LoadFieldInstr* instr) { | 4273 void ConstantPropagator::VisitLoadField(LoadFieldInstr* instr) { |
| 4274 if ((instr->recognized_kind() == MethodRecognizer::kObjectArrayLength) && | 4274 if ((instr->recognized_kind() == MethodRecognizer::kObjectArrayLength) && |
| 4275 (instr->value()->definition()->IsCreateArray())) { | 4275 (instr->value()->definition()->IsCreateArray())) { |
| 4276 const intptr_t length = | 4276 const intptr_t length = |
| 4277 instr->value()->definition()->AsCreateArray()->ArgumentCount(); | 4277 instr->value()->definition()->AsCreateArray()->num_elements(); |
| 4278 const Object& result = Smi::ZoneHandle(Smi::New(length)); | 4278 const Object& result = Smi::ZoneHandle(Smi::New(length)); |
| 4279 SetValue(instr, result); | 4279 SetValue(instr, result); |
| 4280 return; | 4280 return; |
| 4281 } | 4281 } |
| 4282 | 4282 |
| 4283 if (instr->IsImmutableLengthLoad()) { | 4283 if (instr->IsImmutableLengthLoad()) { |
| 4284 ConstantInstr* constant = instr->value()->definition()->AsConstant(); | 4284 ConstantInstr* constant = instr->value()->definition()->AsConstant(); |
| 4285 if (constant != NULL) { | 4285 if (constant != NULL) { |
| 4286 if (constant->value().IsString()) { | 4286 if (constant->value().IsString()) { |
| 4287 SetValue(instr, Smi::ZoneHandle( | 4287 SetValue(instr, Smi::ZoneHandle( |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4686 | 4686 |
| 4687 if (FLAG_trace_constant_propagation) { | 4687 if (FLAG_trace_constant_propagation) { |
| 4688 OS::Print("\n==== After constant propagation ====\n"); | 4688 OS::Print("\n==== After constant propagation ====\n"); |
| 4689 FlowGraphPrinter printer(*graph_); | 4689 FlowGraphPrinter printer(*graph_); |
| 4690 printer.PrintBlocks(); | 4690 printer.PrintBlocks(); |
| 4691 } | 4691 } |
| 4692 } | 4692 } |
| 4693 | 4693 |
| 4694 | 4694 |
| 4695 } // namespace dart | 4695 } // namespace dart |
| OLD | NEW |