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

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: Correct CL 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
« no previous file with comments | « 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 a0db42760352bacccc431ee5507d32c272d77e05..66224e43381ac75c944bbf18691509341513edce 100644
--- a/src/hydrogen-gvn.h
+++ b/src/hydrogen-gvn.h
@@ -76,14 +76,24 @@ 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);
-
- // Returns true if values with side effects are removed.
- bool Analyze();
+ explicit HGlobalValueNumberingPhase(HGraph* graph);
+
+ void Run() {
+ 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_) {
+ Analyze();
+ ASSERT(!removed_side_effects_);
+ }
+ }
private:
+ void Analyze();
GVNFlagSet CollectSideEffectsOnPathsToDominatedBlock(
HBasicBlock* dominator,
HBasicBlock* dominated);
@@ -98,16 +108,8 @@ class HGlobalValueNumberer BASE_EMBEDDED {
bool AllowCodeMotion();
bool ShouldMove(HInstruction* instr, HBasicBlock* loop_header);
- HGraph* graph() { return graph_; }
- CompilationInfo* info() { return info_; }
- Zone* zone() { return &zone_; }
-
- HGraph* graph_;
- CompilationInfo* info_;
bool removed_side_effects_;
- Zone zone_;
-
// A map of block IDs to their side effects.
ZoneList<GVNFlagSet> block_side_effects_;
@@ -117,6 +119,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);
};
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-gvn.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698