Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: runtime/vm/constant_propagator.cc

Issue 2904733003: Revert "Shuffle around deopt id allocation to give the flow graph builder a chance to record other … (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/branch_optimizer.cc ('k') | runtime/vm/flow_graph.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/constant_propagator.h" 5 #include "vm/constant_propagator.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/flow_graph_builder.h" 8 #include "vm/flow_graph_builder.h"
9 #include "vm/flow_graph_compiler.h" 9 #include "vm/flow_graph_compiler.h"
10 #include "vm/flow_graph_range_analysis.h" 10 #include "vm/flow_graph_range_analysis.h"
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 ASSERT(branch->previous() != NULL); // Not already eliminated. 1544 ASSERT(branch->previous() != NULL); // Not already eliminated.
1545 BlockEntryInstr* if_true = 1545 BlockEntryInstr* if_true =
1546 FindFirstNonEmptySuccessor(branch->true_successor(), empty_blocks); 1546 FindFirstNonEmptySuccessor(branch->true_successor(), empty_blocks);
1547 BlockEntryInstr* if_false = 1547 BlockEntryInstr* if_false =
1548 FindFirstNonEmptySuccessor(branch->false_successor(), empty_blocks); 1548 FindFirstNonEmptySuccessor(branch->false_successor(), empty_blocks);
1549 if (if_true == if_false) { 1549 if (if_true == if_false) {
1550 // Replace the branch with a jump to the common successor. 1550 // Replace the branch with a jump to the common successor.
1551 // Drop the comparison, which does not have side effects 1551 // Drop the comparison, which does not have side effects
1552 JoinEntryInstr* join = if_true->AsJoinEntry(); 1552 JoinEntryInstr* join = if_true->AsJoinEntry();
1553 if (join->phis() == NULL) { 1553 if (join->phis() == NULL) {
1554 GotoInstr* jump = 1554 GotoInstr* jump = new (Z) GotoInstr(if_true->AsJoinEntry());
1555 new (Z) GotoInstr(if_true->AsJoinEntry(), Thread::kNoDeoptId);
1556 jump->InheritDeoptTarget(Z, branch); 1555 jump->InheritDeoptTarget(Z, branch);
1557 1556
1558 Instruction* previous = branch->previous(); 1557 Instruction* previous = branch->previous();
1559 branch->set_previous(NULL); 1558 branch->set_previous(NULL);
1560 previous->LinkTo(jump); 1559 previous->LinkTo(jump);
1561 1560
1562 // Remove uses from branch and all the empty blocks that 1561 // Remove uses from branch and all the empty blocks that
1563 // are now unreachable. 1562 // are now unreachable.
1564 branch->UnuseAllInputs(); 1563 branch->UnuseAllInputs();
1565 for (BitVector::Iterator it(empty_blocks); !it.Done(); it.Advance()) { 1564 for (BitVector::Iterator it(empty_blocks); !it.Done(); it.Advance()) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 if (branch != NULL) { 1687 if (branch != NULL) {
1689 TargetEntryInstr* if_true = branch->true_successor(); 1688 TargetEntryInstr* if_true = branch->true_successor();
1690 TargetEntryInstr* if_false = branch->false_successor(); 1689 TargetEntryInstr* if_false = branch->false_successor();
1691 JoinEntryInstr* join = NULL; 1690 JoinEntryInstr* join = NULL;
1692 Instruction* next = NULL; 1691 Instruction* next = NULL;
1693 1692
1694 if (!reachable_->Contains(if_true->preorder_number())) { 1693 if (!reachable_->Contains(if_true->preorder_number())) {
1695 ASSERT(reachable_->Contains(if_false->preorder_number())); 1694 ASSERT(reachable_->Contains(if_false->preorder_number()));
1696 ASSERT(if_false->parallel_move() == NULL); 1695 ASSERT(if_false->parallel_move() == NULL);
1697 ASSERT(if_false->loop_info() == NULL); 1696 ASSERT(if_false->loop_info() == NULL);
1698 join = new (Z) JoinEntryInstr( 1697 join =
1699 if_false->block_id(), if_false->try_index(), Thread::kNoDeoptId); 1698 new (Z) JoinEntryInstr(if_false->block_id(), if_false->try_index());
1700 join->InheritDeoptTarget(Z, if_false); 1699 join->InheritDeoptTarget(Z, if_false);
1701 if_false->UnuseAllInputs(); 1700 if_false->UnuseAllInputs();
1702 next = if_false->next(); 1701 next = if_false->next();
1703 } else if (!reachable_->Contains(if_false->preorder_number())) { 1702 } else if (!reachable_->Contains(if_false->preorder_number())) {
1704 ASSERT(if_true->parallel_move() == NULL); 1703 ASSERT(if_true->parallel_move() == NULL);
1705 ASSERT(if_true->loop_info() == NULL); 1704 ASSERT(if_true->loop_info() == NULL);
1706 join = new (Z) JoinEntryInstr(if_true->block_id(), if_true->try_index(), 1705 join =
1707 Thread::kNoDeoptId); 1706 new (Z) JoinEntryInstr(if_true->block_id(), if_true->try_index());
1708 join->InheritDeoptTarget(Z, if_true); 1707 join->InheritDeoptTarget(Z, if_true);
1709 if_true->UnuseAllInputs(); 1708 if_true->UnuseAllInputs();
1710 next = if_true->next(); 1709 next = if_true->next();
1711 } 1710 }
1712 1711
1713 if (join != NULL) { 1712 if (join != NULL) {
1714 // Replace the branch with a jump to the reachable successor. 1713 // Replace the branch with a jump to the reachable successor.
1715 // Drop the comparison, which does not have side effects as long 1714 // Drop the comparison, which does not have side effects as long
1716 // as it is a strict compare (the only one we can determine is 1715 // as it is a strict compare (the only one we can determine is
1717 // constant with the current analysis). 1716 // constant with the current analysis).
1718 GotoInstr* jump = new (Z) GotoInstr(join, Thread::kNoDeoptId); 1717 GotoInstr* jump = new (Z) GotoInstr(join);
1719 jump->InheritDeoptTarget(Z, branch); 1718 jump->InheritDeoptTarget(Z, branch);
1720 1719
1721 Instruction* previous = branch->previous(); 1720 Instruction* previous = branch->previous();
1722 branch->set_previous(NULL); 1721 branch->set_previous(NULL);
1723 previous->LinkTo(jump); 1722 previous->LinkTo(jump);
1724 1723
1725 // Replace the false target entry with the new join entry. We will 1724 // Replace the false target entry with the new join entry. We will
1726 // recompute the dominators after this pass. 1725 // recompute the dominators after this pass.
1727 join->LinkTo(next); 1726 join->LinkTo(next);
1728 branch->UnuseAllInputs(); 1727 branch->UnuseAllInputs();
1729 } 1728 }
1730 } 1729 }
1731 } 1730 }
1732 1731
1733 graph_->DiscoverBlocks(); 1732 graph_->DiscoverBlocks();
1734 graph_->MergeBlocks(); 1733 graph_->MergeBlocks();
1735 GrowableArray<BitVector*> dominance_frontier; 1734 GrowableArray<BitVector*> dominance_frontier;
1736 graph_->ComputeDominators(&dominance_frontier); 1735 graph_->ComputeDominators(&dominance_frontier);
1737 1736
1738 if (FLAG_trace_constant_propagation && 1737 if (FLAG_trace_constant_propagation &&
1739 FlowGraphPrinter::ShouldPrint(graph_->function())) { 1738 FlowGraphPrinter::ShouldPrint(graph_->function())) {
1740 FlowGraphPrinter::PrintGraph("After CP", graph_); 1739 FlowGraphPrinter::PrintGraph("After CP", graph_);
1741 } 1740 }
1742 } 1741 }
1743 1742
1744 } // namespace dart 1743 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/branch_optimizer.cc ('k') | runtime/vm/flow_graph.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698