| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 case kGrowableObjectArrayCid: { | 222 case kGrowableObjectArrayCid: { |
| 223 Value* array = comp->ArgumentAt(0)->value(); | 223 Value* array = comp->ArgumentAt(0)->value(); |
| 224 Value* index = comp->ArgumentAt(1)->value(); | 224 Value* index = comp->ArgumentAt(1)->value(); |
| 225 // Insert class check and index smi checks and attach a copy of the | 225 // Insert class check and index smi checks and attach a copy of the |
| 226 // original environment because the operation can still deoptimize. | 226 // original environment because the operation can still deoptimize. |
| 227 AddCheckClass(instr, comp, array->CopyValue()); | 227 AddCheckClass(instr, comp, array->CopyValue()); |
| 228 InsertBefore(instr, | 228 InsertBefore(instr, |
| 229 new CheckSmiComp(index->CopyValue(), comp), | 229 new CheckSmiComp(index->CopyValue(), comp), |
| 230 instr->env(), | 230 instr->env(), |
| 231 BindInstr::kUnused); | 231 BindInstr::kUnused); |
| 232 // Insert array bounds check. |
| 233 InsertBefore(instr, |
| 234 new CheckArrayBoundComp(array->CopyValue(), |
| 235 index->CopyValue(), |
| 236 class_id, |
| 237 comp), |
| 238 instr->env(), |
| 239 BindInstr::kUnused); |
| 232 Computation* array_op = NULL; | 240 Computation* array_op = NULL; |
| 233 if (op_kind == Token::kINDEX) { | 241 if (op_kind == Token::kINDEX) { |
| 234 array_op = new LoadIndexedComp(array, index, class_id, comp); | 242 array_op = new LoadIndexedComp(array, index, class_id); |
| 235 } else { | 243 } else { |
| 236 Value* value = comp->ArgumentAt(2)->value(); | 244 Value* value = comp->ArgumentAt(2)->value(); |
| 237 array_op = new StoreIndexedComp(array, index, value, class_id, comp); | 245 array_op = new StoreIndexedComp(array, index, value, class_id); |
| 238 } | 246 } |
| 239 array_op->set_ic_data(comp->ic_data()); | 247 array_op->set_ic_data(comp->ic_data()); |
| 240 instr->set_computation(array_op); | 248 instr->set_computation(array_op); |
| 241 RemovePushArguments(comp); | 249 RemovePushArguments(comp); |
| 242 return true; | 250 return true; |
| 243 } | 251 } |
| 244 default: | 252 default: |
| 245 return false; | 253 return false; |
| 246 } | 254 } |
| 247 } | 255 } |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 DirectChainedHashMap<BindInstr*> child_map(*map); // Copy map. | 1067 DirectChainedHashMap<BindInstr*> child_map(*map); // Copy map. |
| 1060 OptimizeRecursive(child, &child_map); | 1068 OptimizeRecursive(child, &child_map); |
| 1061 } else { | 1069 } else { |
| 1062 OptimizeRecursive(child, map); // Reuse map for the last child. | 1070 OptimizeRecursive(child, map); // Reuse map for the last child. |
| 1063 } | 1071 } |
| 1064 } | 1072 } |
| 1065 } | 1073 } |
| 1066 | 1074 |
| 1067 | 1075 |
| 1068 } // namespace dart | 1076 } // namespace dart |
| OLD | NEW |