OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILER_LOOP_PEELING_H_ | 5 #ifndef V8_COMPILER_LOOP_PEELING_H_ |
6 #define V8_COMPILER_LOOP_PEELING_H_ | 6 #define V8_COMPILER_LOOP_PEELING_H_ |
7 | 7 |
| 8 #include "src/base/compiler-specific.h" |
8 #include "src/compiler/loop-analysis.h" | 9 #include "src/compiler/loop-analysis.h" |
| 10 #include "src/globals.h" |
9 | 11 |
10 namespace v8 { | 12 namespace v8 { |
11 namespace internal { | 13 namespace internal { |
12 namespace compiler { | 14 namespace compiler { |
13 | 15 |
14 // Represents the output of peeling a loop, which is basically the mapping | 16 // Represents the output of peeling a loop, which is basically the mapping |
15 // from the body of the loop to the corresponding nodes in the peeled | 17 // from the body of the loop to the corresponding nodes in the peeled |
16 // iteration. | 18 // iteration. |
17 class PeeledIteration : public ZoneObject { | 19 class V8_EXPORT_PRIVATE PeeledIteration : public NON_EXPORTED_BASE(ZoneObject) { |
18 public: | 20 public: |
19 // Maps {node} to its corresponding copy in the peeled iteration, if | 21 // Maps {node} to its corresponding copy in the peeled iteration, if |
20 // the node was part of the body of the loop. Returns {node} otherwise. | 22 // the node was part of the body of the loop. Returns {node} otherwise. |
21 Node* map(Node* node); | 23 Node* map(Node* node); |
22 | 24 |
23 protected: | 25 protected: |
24 PeeledIteration() {} | 26 PeeledIteration() {} |
25 }; | 27 }; |
26 | 28 |
27 class CommonOperatorBuilder; | 29 class CommonOperatorBuilder; |
28 | 30 |
29 // Implements loop peeling. | 31 // Implements loop peeling. |
30 class LoopPeeler { | 32 class V8_EXPORT_PRIVATE LoopPeeler { |
31 public: | 33 public: |
32 static bool CanPeel(LoopTree* loop_tree, LoopTree::Loop* loop); | 34 static bool CanPeel(LoopTree* loop_tree, LoopTree::Loop* loop); |
33 static PeeledIteration* Peel(Graph* graph, CommonOperatorBuilder* common, | 35 static PeeledIteration* Peel(Graph* graph, CommonOperatorBuilder* common, |
34 LoopTree* loop_tree, LoopTree::Loop* loop, | 36 LoopTree* loop_tree, LoopTree::Loop* loop, |
35 Zone* tmp_zone); | 37 Zone* tmp_zone); |
36 static void PeelInnerLoopsOfTree(Graph* graph, CommonOperatorBuilder* common, | 38 static void PeelInnerLoopsOfTree(Graph* graph, CommonOperatorBuilder* common, |
37 LoopTree* loop_tree, Zone* tmp_zone); | 39 LoopTree* loop_tree, Zone* tmp_zone); |
38 | 40 |
39 static void EliminateLoopExits(Graph* graph, Zone* temp_zone); | 41 static void EliminateLoopExits(Graph* graph, Zone* temp_zone); |
40 static const size_t kMaxPeeledNodes = 1000; | 42 static const size_t kMaxPeeledNodes = 1000; |
41 }; | 43 }; |
42 | 44 |
43 | 45 |
44 } // namespace compiler | 46 } // namespace compiler |
45 } // namespace internal | 47 } // namespace internal |
46 } // namespace v8 | 48 } // namespace v8 |
47 | 49 |
48 #endif // V8_COMPILER_LOOP_PEELING_H_ | 50 #endif // V8_COMPILER_LOOP_PEELING_H_ |
OLD | NEW |