| 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_INL_H_ | 5 #ifndef V8_COMPILER_NODE_PROPERTIES_INL_H_ |
| 6 #define V8_COMPILER_NODE_PROPERTIES_INL_H_ | 6 #define V8_COMPILER_NODE_PROPERTIES_INL_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // Input layout. | 22 // Input layout. |
| 23 // Inputs are always arranged in order as follows: | 23 // Inputs are always arranged in order as follows: |
| 24 // 0 [ values, context, effects, control ] node->InputCount() | 24 // 0 [ values, context, effects, control ] node->InputCount() |
| 25 | 25 |
| 26 inline int NodeProperties::FirstValueIndex(Node* node) { return 0; } | 26 inline int NodeProperties::FirstValueIndex(Node* node) { return 0; } |
| 27 | 27 |
| 28 inline int NodeProperties::FirstContextIndex(Node* node) { | 28 inline int NodeProperties::FirstContextIndex(Node* node) { |
| 29 return PastValueIndex(node); | 29 return PastValueIndex(node); |
| 30 } | 30 } |
| 31 | 31 |
| 32 inline int NodeProperties::FirstFrameStateIndex(Node* node) { |
| 33 return PastContextIndex(node); |
| 34 } |
| 35 |
| 32 inline int NodeProperties::FirstEffectIndex(Node* node) { | 36 inline int NodeProperties::FirstEffectIndex(Node* node) { |
| 33 return PastContextIndex(node); | 37 return PastFrameStateIndex(node); |
| 34 } | 38 } |
| 35 | 39 |
| 36 inline int NodeProperties::FirstControlIndex(Node* node) { | 40 inline int NodeProperties::FirstControlIndex(Node* node) { |
| 37 return PastEffectIndex(node); | 41 return PastEffectIndex(node); |
| 38 } | 42 } |
| 39 | 43 |
| 40 | 44 |
| 41 inline int NodeProperties::PastValueIndex(Node* node) { | 45 inline int NodeProperties::PastValueIndex(Node* node) { |
| 42 return FirstValueIndex(node) + | 46 return FirstValueIndex(node) + |
| 43 OperatorProperties::GetValueInputCount(node->op()); | 47 OperatorProperties::GetValueInputCount(node->op()); |
| 44 } | 48 } |
| 45 | 49 |
| 46 inline int NodeProperties::PastContextIndex(Node* node) { | 50 inline int NodeProperties::PastContextIndex(Node* node) { |
| 47 return FirstContextIndex(node) + | 51 return FirstContextIndex(node) + |
| 48 OperatorProperties::GetContextInputCount(node->op()); | 52 OperatorProperties::GetContextInputCount(node->op()); |
| 49 } | 53 } |
| 50 | 54 |
| 55 inline int NodeProperties::PastFrameStateIndex(Node* node) { |
| 56 return FirstFrameStateIndex(node) + |
| 57 OperatorProperties::GetFrameStateInputCount(node->op()); |
| 58 } |
| 59 |
| 51 inline int NodeProperties::PastEffectIndex(Node* node) { | 60 inline int NodeProperties::PastEffectIndex(Node* node) { |
| 52 return FirstEffectIndex(node) + | 61 return FirstEffectIndex(node) + |
| 53 OperatorProperties::GetEffectInputCount(node->op()); | 62 OperatorProperties::GetEffectInputCount(node->op()); |
| 54 } | 63 } |
| 55 | 64 |
| 56 inline int NodeProperties::PastControlIndex(Node* node) { | 65 inline int NodeProperties::PastControlIndex(Node* node) { |
| 57 return FirstControlIndex(node) + | 66 return FirstControlIndex(node) + |
| 58 OperatorProperties::GetControlInputCount(node->op()); | 67 OperatorProperties::GetControlInputCount(node->op()); |
| 59 } | 68 } |
| 60 | 69 |
| 61 | 70 |
| 62 // ----------------------------------------------------------------------------- | 71 // ----------------------------------------------------------------------------- |
| 63 // Input accessors. | 72 // Input accessors. |
| 64 | 73 |
| 65 inline Node* NodeProperties::GetValueInput(Node* node, int index) { | 74 inline Node* NodeProperties::GetValueInput(Node* node, int index) { |
| 66 DCHECK(0 <= index && | 75 DCHECK(0 <= index && |
| 67 index < OperatorProperties::GetValueInputCount(node->op())); | 76 index < OperatorProperties::GetValueInputCount(node->op())); |
| 68 return node->InputAt(FirstValueIndex(node) + index); | 77 return node->InputAt(FirstValueIndex(node) + index); |
| 69 } | 78 } |
| 70 | 79 |
| 71 inline Node* NodeProperties::GetContextInput(Node* node) { | 80 inline Node* NodeProperties::GetContextInput(Node* node) { |
| 72 DCHECK(OperatorProperties::HasContextInput(node->op())); | 81 DCHECK(OperatorProperties::HasContextInput(node->op())); |
| 73 return node->InputAt(FirstContextIndex(node)); | 82 return node->InputAt(FirstContextIndex(node)); |
| 74 } | 83 } |
| 75 | 84 |
| 85 inline Node* NodeProperties::GetFrameStateInput(Node* node) { |
| 86 DCHECK(OperatorProperties::HasFrameStateInput(node->op())); |
| 87 return node->InputAt(FirstFrameStateIndex(node)); |
| 88 } |
| 89 |
| 76 inline Node* NodeProperties::GetEffectInput(Node* node, int index) { | 90 inline Node* NodeProperties::GetEffectInput(Node* node, int index) { |
| 77 DCHECK(0 <= index && | 91 DCHECK(0 <= index && |
| 78 index < OperatorProperties::GetEffectInputCount(node->op())); | 92 index < OperatorProperties::GetEffectInputCount(node->op())); |
| 79 return node->InputAt(FirstEffectIndex(node) + index); | 93 return node->InputAt(FirstEffectIndex(node) + index); |
| 80 } | 94 } |
| 81 | 95 |
| 82 inline Node* NodeProperties::GetControlInput(Node* node, int index) { | 96 inline Node* NodeProperties::GetControlInput(Node* node, int index) { |
| 83 DCHECK(0 <= index && | 97 DCHECK(0 <= index && |
| 84 index < OperatorProperties::GetControlInputCount(node->op())); | 98 index < OperatorProperties::GetControlInputCount(node->op())); |
| 85 return node->InputAt(FirstControlIndex(node) + index); | 99 return node->InputAt(FirstControlIndex(node) + index); |
| 86 } | 100 } |
| 87 | 101 |
| 102 inline int NodeProperties::GetFrameStateIndex(Node* node) { |
| 103 DCHECK(OperatorProperties::HasFrameStateInput(node->op())); |
| 104 return FirstFrameStateIndex(node); |
| 105 } |
| 88 | 106 |
| 89 // ----------------------------------------------------------------------------- | 107 // ----------------------------------------------------------------------------- |
| 90 // Edge kinds. | 108 // Edge kinds. |
| 91 | 109 |
| 92 inline bool NodeProperties::IsInputRange(Node::Edge edge, int first, int num) { | 110 inline bool NodeProperties::IsInputRange(Node::Edge edge, int first, int num) { |
| 93 // TODO(titzer): edge.index() is linear time; | 111 // TODO(titzer): edge.index() is linear time; |
| 94 // edges maybe need to be marked as value/effect/control. | 112 // edges maybe need to be marked as value/effect/control. |
| 95 if (num == 0) return false; | 113 if (num == 0) return false; |
| 96 int index = edge.index(); | 114 int index = edge.index(); |
| 97 return first <= index && index < first + num; | 115 return first <= index && index < first + num; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 inline void NodeProperties::SetBounds(Node* node, Bounds b) { | 196 inline void NodeProperties::SetBounds(Node* node, Bounds b) { |
| 179 node->set_bounds(b); | 197 node->set_bounds(b); |
| 180 } | 198 } |
| 181 | 199 |
| 182 | 200 |
| 183 } | 201 } |
| 184 } | 202 } |
| 185 } // namespace v8::internal::compiler | 203 } // namespace v8::internal::compiler |
| 186 | 204 |
| 187 #endif // V8_COMPILER_NODE_PROPERTIES_INL_H_ | 205 #endif // V8_COMPILER_NODE_PROPERTIES_INL_H_ |
| OLD | NEW |