| 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);
|
| };
|
|
|
|
|
|
|