OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_NODE_PROPERTIES_H_ | 5 #ifndef V8_COMPILER_NODE_PROPERTIES_H_ |
6 #define V8_COMPILER_NODE_PROPERTIES_H_ | 6 #define V8_COMPILER_NODE_PROPERTIES_H_ |
7 | 7 |
8 #include "src/compiler/node.h" | 8 #include "src/compiler/node.h" |
9 #include "src/types.h" | 9 #include "src/types.h" |
10 | 10 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 static Node* FindProjection(Node* node, size_t projection_index); | 104 static Node* FindProjection(Node* node, size_t projection_index); |
105 | 105 |
106 // Collect the branch-related projections from a node, such as IfTrue, | 106 // Collect the branch-related projections from a node, such as IfTrue, |
107 // IfFalse, IfSuccess, IfException, IfValue and IfDefault. | 107 // IfFalse, IfSuccess, IfException, IfValue and IfDefault. |
108 // - Branch: [ IfTrue, IfFalse ] | 108 // - Branch: [ IfTrue, IfFalse ] |
109 // - Call : [ IfSuccess, IfException ] | 109 // - Call : [ IfSuccess, IfException ] |
110 // - Switch: [ IfValue, ..., IfDefault ] | 110 // - Switch: [ IfValue, ..., IfDefault ] |
111 static void CollectControlProjections(Node* node, Node** proj, size_t count); | 111 static void CollectControlProjections(Node* node, Node** proj, size_t count); |
112 | 112 |
113 // Verifies consistency of node inputs and uses: | |
114 // - node inputs should agree with the input count computed from | |
115 // the node's operator. | |
116 // - effect inputs should have effect outputs. | |
117 // - control inputs should have control outputs. | |
118 // - frame state inputs should be frame states. | |
119 // - if the node has control uses, it should produce control. | |
120 // - if the node has effect uses, it should produce effect. | |
121 // - if the node has frame state uses, it must be a frame state. | |
122 static void Verify(Node* node); | |
123 | |
124 // --------------------------------------------------------------------------- | 113 // --------------------------------------------------------------------------- |
125 // Type. | 114 // Type. |
126 | 115 |
127 static bool IsTyped(Node* node) { return node->type() != nullptr; } | 116 static bool IsTyped(Node* node) { return node->type() != nullptr; } |
128 static Type* GetType(Node* node) { | 117 static Type* GetType(Node* node) { |
129 DCHECK(IsTyped(node)); | 118 DCHECK(IsTyped(node)); |
130 return node->type(); | 119 return node->type(); |
131 } | 120 } |
132 static void SetType(Node* node, Type* type) { | 121 static void SetType(Node* node, Type* type) { |
133 DCHECK_NOT_NULL(type); | 122 DCHECK_NOT_NULL(type); |
134 node->set_type(type); | 123 node->set_type(type); |
135 } | 124 } |
136 static void RemoveType(Node* node) { node->set_type(nullptr); } | 125 static void RemoveType(Node* node) { node->set_type(nullptr); } |
137 static bool AllValueInputsAreTyped(Node* node); | 126 static bool AllValueInputsAreTyped(Node* node); |
138 | 127 |
139 private: | 128 private: |
140 static inline bool IsInputRange(Edge edge, int first, int count); | 129 static inline bool IsInputRange(Edge edge, int first, int count); |
141 }; | 130 }; |
142 | 131 |
143 } // namespace compiler | 132 } // namespace compiler |
144 } // namespace internal | 133 } // namespace internal |
145 } // namespace v8 | 134 } // namespace v8 |
146 | 135 |
147 #endif // V8_COMPILER_NODE_PROPERTIES_H_ | 136 #endif // V8_COMPILER_NODE_PROPERTIES_H_ |
OLD | NEW |