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); |
113 | 123 |
114 // --------------------------------------------------------------------------- | 124 // --------------------------------------------------------------------------- |
115 // Type. | 125 // Type. |
116 | 126 |
117 static bool IsTyped(Node* node) { return node->type() != nullptr; } | 127 static bool IsTyped(Node* node) { return node->type() != nullptr; } |
118 static Type* GetType(Node* node) { | 128 static Type* GetType(Node* node) { |
119 DCHECK(IsTyped(node)); | 129 DCHECK(IsTyped(node)); |
120 return node->type(); | 130 return node->type(); |
121 } | 131 } |
122 static void SetType(Node* node, Type* type) { | 132 static void SetType(Node* node, Type* type) { |
123 DCHECK_NOT_NULL(type); | 133 DCHECK_NOT_NULL(type); |
124 node->set_type(type); | 134 node->set_type(type); |
125 } | 135 } |
126 static void RemoveType(Node* node) { node->set_type(nullptr); } | 136 static void RemoveType(Node* node) { node->set_type(nullptr); } |
127 static bool AllValueInputsAreTyped(Node* node); | 137 static bool AllValueInputsAreTyped(Node* node); |
128 | 138 |
129 private: | 139 private: |
130 static inline bool IsInputRange(Edge edge, int first, int count); | 140 static inline bool IsInputRange(Edge edge, int first, int count); |
131 }; | 141 }; |
132 | 142 |
133 } // namespace compiler | 143 } // namespace compiler |
134 } // namespace internal | 144 } // namespace internal |
135 } // namespace v8 | 145 } // namespace v8 |
136 | 146 |
137 #endif // V8_COMPILER_NODE_PROPERTIES_H_ | 147 #endif // V8_COMPILER_NODE_PROPERTIES_H_ |
OLD | NEW |