| 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/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 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1327 for (intptr_t i = 0; i < worklist_.length(); i++) { | 1327 for (intptr_t i = 0; i < worklist_.length(); i++) { |
| 1328 PhiInstr* phi = worklist_[i]; | 1328 PhiInstr* phi = worklist_[i]; |
| 1329 ASSERT(phi->GetPropagatedCid() == kDynamicCid); | 1329 ASSERT(phi->GetPropagatedCid() == kDynamicCid); |
| 1330 phi->SetPropagatedCid(kSmiCid); | 1330 phi->SetPropagatedCid(kSmiCid); |
| 1331 | 1331 |
| 1332 // Append all phis that use this phi and can potentially be smi to the | 1332 // Append all phis that use this phi and can potentially be smi to the |
| 1333 // end of worklist. | 1333 // end of worklist. |
| 1334 for (Value* use = phi->input_use_list(); | 1334 for (Value* use = phi->input_use_list(); |
| 1335 use != NULL; | 1335 use != NULL; |
| 1336 use = use->next_use()) { | 1336 use = use->next_use()) { |
| 1337 PhiInstr* phi_use = use->definition()->AsPhi(); | 1337 PhiInstr* phi_use = use->instruction()->AsPhi(); |
| 1338 if ((phi_use != NULL) && | 1338 if ((phi_use != NULL) && |
| 1339 (phi_use->GetPropagatedCid() == kDynamicCid) && | 1339 (phi_use->GetPropagatedCid() == kDynamicCid) && |
| 1340 IsPossiblySmiPhi(phi_use)) { | 1340 IsPossiblySmiPhi(phi_use)) { |
| 1341 AddToWorklist(phi_use); | 1341 AddToWorklist(phi_use); |
| 1342 } | 1342 } |
| 1343 } | 1343 } |
| 1344 } | 1344 } |
| 1345 | 1345 |
| 1346 // Now unmark phis that are not definitely smi: that is have only | 1346 // Now unmark phis that are not definitely smi: that is have only |
| 1347 // smi operands. | 1347 // smi operands. |
| 1348 while (!worklist_.is_empty()) { | 1348 while (!worklist_.is_empty()) { |
| 1349 PhiInstr* phi = RemoveLastFromWorklist(); | 1349 PhiInstr* phi = RemoveLastFromWorklist(); |
| 1350 if (!IsDefinitelySmiPhi(phi)) { | 1350 if (!IsDefinitelySmiPhi(phi)) { |
| 1351 // Phi result is not a smi. Propagate this fact to phis that depend on it. | 1351 // Phi result is not a smi. Propagate this fact to phis that depend on it. |
| 1352 phi->SetPropagatedCid(kDynamicCid); | 1352 phi->SetPropagatedCid(kDynamicCid); |
| 1353 for (Value* use = phi->input_use_list(); | 1353 for (Value* use = phi->input_use_list(); |
| 1354 use != NULL; | 1354 use != NULL; |
| 1355 use = use->next_use()) { | 1355 use = use->next_use()) { |
| 1356 PhiInstr* phi_use = use->definition()->AsPhi(); | 1356 PhiInstr* phi_use = use->instruction()->AsPhi(); |
| 1357 if ((phi_use != NULL) && (phi_use->GetPropagatedCid() == kSmiCid)) { | 1357 if ((phi_use != NULL) && (phi_use->GetPropagatedCid() == kSmiCid)) { |
| 1358 AddToWorklist(phi_use); | 1358 AddToWorklist(phi_use); |
| 1359 } | 1359 } |
| 1360 } | 1360 } |
| 1361 } | 1361 } |
| 1362 } | 1362 } |
| 1363 } | 1363 } |
| 1364 | 1364 |
| 1365 | 1365 |
| 1366 void SminessPropagator::PropagateSminessRecursive(BlockEntryInstr* block) { | 1366 void SminessPropagator::PropagateSminessRecursive(BlockEntryInstr* block) { |
| (...skipping 1926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3293 | 3293 |
| 3294 if (FLAG_trace_constant_propagation) { | 3294 if (FLAG_trace_constant_propagation) { |
| 3295 OS::Print("\n==== After constant propagation ====\n"); | 3295 OS::Print("\n==== After constant propagation ====\n"); |
| 3296 FlowGraphPrinter printer(*graph_); | 3296 FlowGraphPrinter printer(*graph_); |
| 3297 printer.PrintBlocks(); | 3297 printer.PrintBlocks(); |
| 3298 } | 3298 } |
| 3299 } | 3299 } |
| 3300 | 3300 |
| 3301 | 3301 |
| 3302 } // namespace dart | 3302 } // namespace dart |
| OLD | NEW |