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

Unified Diff: src/hydrogen-gvn.h

Issue 17657004: Refactor Hydrogen GVN into an HPhase and use the phase zone. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« src/hydrogen.h ('K') | « src/hydrogen.cc ('k') | src/hydrogen-gvn.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« src/hydrogen.h ('K') | « src/hydrogen.cc ('k') | src/hydrogen-gvn.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698