| Index: runtime/vm/flow_graph.cc
|
| diff --git a/runtime/vm/flow_graph.cc b/runtime/vm/flow_graph.cc
|
| index 16ed1ebacf2ba492cc0366c771511fe4e3790cf0..92c75ac3f2f97f5e7a6754d2b35dc5ee02d4fb3d 100644
|
| --- a/runtime/vm/flow_graph.cc
|
| +++ b/runtime/vm/flow_graph.cc
|
| @@ -483,10 +483,40 @@ bool FlowGraph::VerifyUseLists() {
|
| VerifyUseListsInInstruction(it.Current());
|
| }
|
| }
|
| +
|
| return true; // Return true so we can ASSERT validation.
|
| }
|
|
|
|
|
| +// Verify that a redefinition dominates all uses of the redefined value.
|
| +bool FlowGraph::VerifyRedefinitions() {
|
| + for (BlockIterator block_it = reverse_postorder_iterator(); !block_it.Done();
|
| + block_it.Advance()) {
|
| + for (ForwardInstructionIterator instr_it(block_it.Current());
|
| + !instr_it.Done(); instr_it.Advance()) {
|
| + RedefinitionInstr* redefinition = instr_it.Current()->AsRedefinition();
|
| + if (redefinition != NULL) {
|
| + Definition* original = redefinition->value()->definition();
|
| + for (Value::Iterator it(original->input_use_list()); !it.Done();
|
| + it.Advance()) {
|
| + Value* original_use = it.Current();
|
| + if (original_use->instruction() == redefinition) {
|
| + continue;
|
| + }
|
| + if (original_use->instruction()->IsDominatedBy(redefinition)) {
|
| + FlowGraphPrinter::PrintGraph("VerifyRedefinitions", this);
|
| + THR_Print("%s\n", redefinition->ToCString());
|
| + THR_Print("use=%s\n", original_use->instruction()->ToCString());
|
| + return false;
|
| + }
|
| + }
|
| + }
|
| + }
|
| + }
|
| + return true;
|
| +}
|
| +
|
| +
|
| LivenessAnalysis::LivenessAnalysis(
|
| intptr_t variable_count,
|
| const GrowableArray<BlockEntryInstr*>& postorder)
|
| @@ -2096,6 +2126,21 @@ void FlowGraph::RenameDominatedUses(Definition* def,
|
| }
|
|
|
|
|
| +void FlowGraph::RenameUsesDominatedByRedefinitions() {
|
| + for (BlockIterator block_it = reverse_postorder_iterator(); !block_it.Done();
|
| + block_it.Advance()) {
|
| + for (ForwardInstructionIterator instr_it(block_it.Current());
|
| + !instr_it.Done(); instr_it.Advance()) {
|
| + RedefinitionInstr* redefinition = instr_it.Current()->AsRedefinition();
|
| + if (redefinition != NULL) {
|
| + Definition* original = redefinition->value()->definition();
|
| + RenameDominatedUses(original, redefinition, redefinition);
|
| + }
|
| + }
|
| + }
|
| +}
|
| +
|
| +
|
| static bool IsPositiveOrZeroSmiConst(Definition* d) {
|
| ConstantInstr* const_instr = d->AsConstant();
|
| if ((const_instr != NULL) && (const_instr->value().IsSmi())) {
|
|
|