Index: src/hydrogen-gvn.h |
diff --git a/src/hydrogen-gvn.h b/src/hydrogen-gvn.h |
index 2d6075e7157a8d558a8d9f496e1e7c6b9e648c8d..819ead341c54333f85cfc1bea6f18e21168880de 100644 |
--- a/src/hydrogen-gvn.h |
+++ b/src/hydrogen-gvn.h |
@@ -76,14 +76,25 @@ class SparseSet { |
}; |
-class HGlobalValueNumberer BASE_EMBEDDED { |
+// Perform common subexpression elimination and loop-invariant code motion. |
+class HGlobalValueNumberingPhase : public HPhase { |
public: |
- HGlobalValueNumberer(HGraph* graph, CompilationInfo* info); |
+ HGlobalValueNumberingPhase(HGraph* graph, Zone* zone); |
danno
2013/06/25 15:20:54
Why do you need to pass the zone in? Shouldn't you
Benedikt Meurer
2013/06/27 08:20:04
Done. Using the HPhase zone.
|
+ |
+ void Run() { |
+ bool removed_side_effects = Analyze(); |
+ // Trigger a second analysis pass to further eliminate duplicate values that |
+ // could only be discovered by removing side-effect-generating instructions |
+ // during the first pass. |
+ if (FLAG_smi_only_arrays && removed_side_effects) { |
+ removed_side_effects = Analyze(); |
+ ASSERT(!removed_side_effects); |
+ } |
+ } |
+ private: |
// Returns true if values with side effects are removed. |
bool Analyze(); |
- |
- private: |
GVNFlagSet CollectSideEffectsOnPathsToDominatedBlock( |
HBasicBlock* dominator, |
HBasicBlock* dominated); |
@@ -98,17 +109,10 @@ class HGlobalValueNumberer BASE_EMBEDDED { |
bool AllowCodeMotion(); |
bool ShouldMove(HInstruction* instr, HBasicBlock* loop_header); |
- HGraph* graph() { return graph_; } |
- CompilationInfo* info() { return info_; } |
- Zone* phase_zone() const { return info_->phase_zone(); } |
+ CompilationInfo* info() { return graph()->info(); } |
- HGraph* graph_; |
- CompilationInfo* info_; |
bool removed_side_effects_; |
- Zone* phase_zone_; |
- ZoneScope phase_zone_scope_; |
- |
// A map of block IDs to their side effects. |
ZoneList<GVNFlagSet> block_side_effects_; |
@@ -118,6 +122,8 @@ class HGlobalValueNumberer BASE_EMBEDDED { |
// Used when collecting side effects on paths from dominator to |
// dominated. |
SparseSet visited_on_paths_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(HGlobalValueNumberingPhase); |
}; |