OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_REDUNDANCY_ELIMINATION_H_ | 5 #ifndef V8_COMPILER_REDUNDANCY_ELIMINATION_H_ |
6 #define V8_COMPILER_REDUNDANCY_ELIMINATION_H_ | 6 #define V8_COMPILER_REDUNDANCY_ELIMINATION_H_ |
7 | 7 |
8 #include "src/compiler/graph-reducer.h" | 8 #include "src/compiler/graph-reducer.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 class EffectPathChecks final { | 28 class EffectPathChecks final { |
29 public: | 29 public: |
30 static EffectPathChecks* Copy(Zone* zone, EffectPathChecks const* checks); | 30 static EffectPathChecks* Copy(Zone* zone, EffectPathChecks const* checks); |
31 static EffectPathChecks const* Empty(Zone* zone); | 31 static EffectPathChecks const* Empty(Zone* zone); |
32 bool Equals(EffectPathChecks const* that) const; | 32 bool Equals(EffectPathChecks const* that) const; |
33 void Merge(EffectPathChecks const* that); | 33 void Merge(EffectPathChecks const* that); |
34 | 34 |
35 EffectPathChecks const* AddCheck(Zone* zone, Node* node) const; | 35 EffectPathChecks const* AddCheck(Zone* zone, Node* node) const; |
36 Node* LookupCheck(Node* node) const; | 36 Node* LookupCheck(Node* node) const; |
| 37 Node* LookupBoundsCheckFor(Node* node) const; |
37 | 38 |
38 private: | 39 private: |
39 EffectPathChecks(Check* head, size_t size) : head_(head), size_(size) {} | 40 EffectPathChecks(Check* head, size_t size) : head_(head), size_(size) {} |
40 | 41 |
41 // We keep track of the list length so that we can find the longest | 42 // We keep track of the list length so that we can find the longest |
42 // common tail easily. | 43 // common tail easily. |
43 Check* head_; | 44 Check* head_; |
44 size_t size_; | 45 size_t size_; |
45 }; | 46 }; |
46 | 47 |
47 class PathChecksForEffectNodes final { | 48 class PathChecksForEffectNodes final { |
48 public: | 49 public: |
49 explicit PathChecksForEffectNodes(Zone* zone) : info_for_node_(zone) {} | 50 explicit PathChecksForEffectNodes(Zone* zone) : info_for_node_(zone) {} |
50 EffectPathChecks const* Get(Node* node) const; | 51 EffectPathChecks const* Get(Node* node) const; |
51 void Set(Node* node, EffectPathChecks const* checks); | 52 void Set(Node* node, EffectPathChecks const* checks); |
52 | 53 |
53 private: | 54 private: |
54 ZoneVector<EffectPathChecks const*> info_for_node_; | 55 ZoneVector<EffectPathChecks const*> info_for_node_; |
55 }; | 56 }; |
56 | 57 |
57 Reduction ReduceCheckNode(Node* node); | 58 Reduction ReduceCheckNode(Node* node); |
58 Reduction ReduceEffectPhi(Node* node); | 59 Reduction ReduceEffectPhi(Node* node); |
59 Reduction ReduceStart(Node* node); | 60 Reduction ReduceStart(Node* node); |
60 Reduction ReduceOtherNode(Node* node); | 61 Reduction ReduceOtherNode(Node* node); |
61 | 62 |
62 Reduction TakeChecksFromFirstEffect(Node* node); | 63 Reduction TakeChecksFromFirstEffect(Node* node); |
63 Reduction UpdateChecks(Node* node, EffectPathChecks const* checks); | 64 Reduction UpdateChecks(Node* node, EffectPathChecks const* checks); |
64 | 65 |
| 66 Reduction TryReuseBoundsCheckForFirstInput(Node* node); |
| 67 |
65 Zone* zone() const { return zone_; } | 68 Zone* zone() const { return zone_; } |
66 | 69 |
67 PathChecksForEffectNodes node_checks_; | 70 PathChecksForEffectNodes node_checks_; |
68 Zone* const zone_; | 71 Zone* const zone_; |
69 | 72 |
70 DISALLOW_COPY_AND_ASSIGN(RedundancyElimination); | 73 DISALLOW_COPY_AND_ASSIGN(RedundancyElimination); |
71 }; | 74 }; |
72 | 75 |
73 } // namespace compiler | 76 } // namespace compiler |
74 } // namespace internal | 77 } // namespace internal |
75 } // namespace v8 | 78 } // namespace v8 |
76 | 79 |
77 #endif // V8_COMPILER_REDUNDANCY_ELIMINATION_H_ | 80 #endif // V8_COMPILER_REDUNDANCY_ELIMINATION_H_ |
OLD | NEW |