| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "zone.h" | 34 #include "zone.h" |
| 35 | 35 |
| 36 namespace v8 { | 36 namespace v8 { |
| 37 namespace internal { | 37 namespace internal { |
| 38 | 38 |
| 39 // Perform common subexpression elimination and loop-invariant code motion. | 39 // Perform common subexpression elimination and loop-invariant code motion. |
| 40 class HGlobalValueNumberingPhase : public HPhase { | 40 class HGlobalValueNumberingPhase : public HPhase { |
| 41 public: | 41 public: |
| 42 explicit HGlobalValueNumberingPhase(HGraph* graph); | 42 explicit HGlobalValueNumberingPhase(HGraph* graph); |
| 43 | 43 |
| 44 void Run() { | 44 void Run(); |
| 45 int max_fixpoint_iteration_count = FLAG_gvn_iterations; | |
| 46 for (int i = 0; i < max_fixpoint_iteration_count; i++) { | |
| 47 Analyze(); | |
| 48 if (!removed_side_effects_) break; | |
| 49 Reset(); | |
| 50 } | |
| 51 } | |
| 52 | 45 |
| 53 private: | 46 private: |
| 54 void Reset(); | |
| 55 void Analyze(); | |
| 56 GVNFlagSet CollectSideEffectsOnPathsToDominatedBlock( | 47 GVNFlagSet CollectSideEffectsOnPathsToDominatedBlock( |
| 57 HBasicBlock* dominator, | 48 HBasicBlock* dominator, |
| 58 HBasicBlock* dominated); | 49 HBasicBlock* dominated); |
| 59 void AnalyzeGraph(); | 50 void AnalyzeGraph(); |
| 60 void ComputeBlockSideEffects(); | 51 void ComputeBlockSideEffects(); |
| 61 void LoopInvariantCodeMotion(); | 52 void LoopInvariantCodeMotion(); |
| 62 void ProcessLoopBlock(HBasicBlock* block, | 53 void ProcessLoopBlock(HBasicBlock* block, |
| 63 HBasicBlock* before_loop, | 54 HBasicBlock* before_loop, |
| 64 GVNFlagSet loop_kills, | 55 GVNFlagSet loop_kills, |
| 65 GVNFlagSet* accumulated_first_time_depends, | 56 GVNFlagSet* accumulated_first_time_depends, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 79 // dominated. | 70 // dominated. |
| 80 BitVector visited_on_paths_; | 71 BitVector visited_on_paths_; |
| 81 | 72 |
| 82 DISALLOW_COPY_AND_ASSIGN(HGlobalValueNumberingPhase); | 73 DISALLOW_COPY_AND_ASSIGN(HGlobalValueNumberingPhase); |
| 83 }; | 74 }; |
| 84 | 75 |
| 85 | 76 |
| 86 } } // namespace v8::internal | 77 } } // namespace v8::internal |
| 87 | 78 |
| 88 #endif // V8_HYDROGEN_GVN_H_ | 79 #endif // V8_HYDROGEN_GVN_H_ |
| OLD | NEW |