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 24 matching lines...) Expand all Loading... |
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 Analyze(); | 45 int max_fixpoint_iteration_count = FLAG_gvn_iterations; |
46 // Trigger a second analysis pass to further eliminate duplicate values | 46 for (int i = 0; i < max_fixpoint_iteration_count; i++) { |
47 // that could only be discovered by removing side-effect-generating | |
48 // instructions during the first pass. | |
49 if (FLAG_smi_only_arrays && removed_side_effects_) { | |
50 Analyze(); | 47 Analyze(); |
51 // TODO(danno): Turn this into a fixpoint iteration. | 48 if (!removed_side_effects_) break; |
| 49 Reset(); |
52 } | 50 } |
53 } | 51 } |
54 | 52 |
55 private: | 53 private: |
| 54 void Reset(); |
56 void Analyze(); | 55 void Analyze(); |
57 GVNFlagSet CollectSideEffectsOnPathsToDominatedBlock( | 56 GVNFlagSet CollectSideEffectsOnPathsToDominatedBlock( |
58 HBasicBlock* dominator, | 57 HBasicBlock* dominator, |
59 HBasicBlock* dominated); | 58 HBasicBlock* dominated); |
60 void AnalyzeGraph(); | 59 void AnalyzeGraph(); |
61 void ComputeBlockSideEffects(); | 60 void ComputeBlockSideEffects(); |
62 void LoopInvariantCodeMotion(); | 61 void LoopInvariantCodeMotion(); |
63 void ProcessLoopBlock(HBasicBlock* block, | 62 void ProcessLoopBlock(HBasicBlock* block, |
64 HBasicBlock* before_loop, | 63 HBasicBlock* before_loop, |
65 GVNFlagSet loop_kills, | 64 GVNFlagSet loop_kills, |
(...skipping 14 matching lines...) Expand all Loading... |
80 // dominated. | 79 // dominated. |
81 BitVector visited_on_paths_; | 80 BitVector visited_on_paths_; |
82 | 81 |
83 DISALLOW_COPY_AND_ASSIGN(HGlobalValueNumberingPhase); | 82 DISALLOW_COPY_AND_ASSIGN(HGlobalValueNumberingPhase); |
84 }; | 83 }; |
85 | 84 |
86 | 85 |
87 } } // namespace v8::internal | 86 } } // namespace v8::internal |
88 | 87 |
89 #endif // V8_HYDROGEN_GVN_H_ | 88 #endif // V8_HYDROGEN_GVN_H_ |
OLD | NEW |