| Index: src/compiler/node-properties.h
|
| diff --git a/src/compiler/node-properties.h b/src/compiler/node-properties.h
|
| index 50a5ee4dab734783f62e29c0cdc6ad53d4b94411..b40faf39d407916c48501dc0d5d7dfe3ad92ed99 100644
|
| --- a/src/compiler/node-properties.h
|
| +++ b/src/compiler/node-properties.h
|
| @@ -15,51 +15,103 @@ namespace compiler {
|
| class Operator;
|
|
|
| // A facade that simplifies access to the different kinds of inputs to a node.
|
| -class NodeProperties {
|
| +class NodeProperties FINAL {
|
| public:
|
| - static inline Node* GetValueInput(Node* node, int index);
|
| - static inline Node* GetContextInput(Node* node);
|
| - static inline Node* GetFrameStateInput(Node* node);
|
| - static inline Node* GetEffectInput(Node* node, int index = 0);
|
| - static inline Node* GetControlInput(Node* node, int index = 0);
|
| -
|
| - static inline int GetFrameStateIndex(Node* node);
|
| -
|
| - static inline bool IsValueEdge(Edge edge);
|
| - static inline bool IsContextEdge(Edge edge);
|
| - static inline bool IsEffectEdge(Edge edge);
|
| - static inline bool IsControlEdge(Edge edge);
|
| -
|
| - static inline bool IsControl(Node* node);
|
| -
|
| - static inline void ReplaceContextInput(Node* node, Node* context);
|
| - static inline void ReplaceControlInput(Node* node, Node* control);
|
| - static inline void ReplaceEffectInput(Node* node, Node* effect,
|
| - int index = 0);
|
| - static inline void ReplaceFrameStateInput(Node* node, Node* frame_state);
|
| - static inline void RemoveNonValueInputs(Node* node);
|
| - static inline void ReplaceWithValue(Node* node, Node* value,
|
| - Node* effect = nullptr);
|
| + // ---------------------------------------------------------------------------
|
| + // Input layout.
|
| + // Inputs are always arranged in order as follows:
|
| + // 0 [ values, context, frame state, effects, control ] node->InputCount()
|
| +
|
| + static int FirstValueIndex(Node* node) { return 0; }
|
| + static int FirstContextIndex(Node* node) { return PastValueIndex(node); }
|
| + static int FirstFrameStateIndex(Node* node) { return PastContextIndex(node); }
|
| + static int FirstEffectIndex(Node* node) { return PastFrameStateIndex(node); }
|
| + static int FirstControlIndex(Node* node) { return PastEffectIndex(node); }
|
| + static int PastValueIndex(Node* node);
|
| + static int PastContextIndex(Node* node);
|
| + static int PastFrameStateIndex(Node* node);
|
| + static int PastEffectIndex(Node* node);
|
| + static int PastControlIndex(Node* node);
|
| +
|
| +
|
| + // ---------------------------------------------------------------------------
|
| + // Input accessors.
|
| +
|
| + static Node* GetValueInput(Node* node, int index);
|
| + static Node* GetContextInput(Node* node);
|
| + static Node* GetFrameStateInput(Node* node);
|
| + static Node* GetEffectInput(Node* node, int index = 0);
|
| + static Node* GetControlInput(Node* node, int index = 0);
|
| +
|
| +
|
| + // ---------------------------------------------------------------------------
|
| + // Edge kinds.
|
| +
|
| + static bool IsValueEdge(Edge edge);
|
| + static bool IsContextEdge(Edge edge);
|
| + static bool IsFrameStateEdge(Edge edge);
|
| + static bool IsEffectEdge(Edge edge);
|
| + static bool IsControlEdge(Edge edge);
|
| +
|
| +
|
| + // ---------------------------------------------------------------------------
|
| + // Miscellaneous predicates.
|
| +
|
| + static bool IsCommon(Node* node) {
|
| + return IrOpcode::IsCommonOpcode(node->opcode());
|
| + }
|
| + static bool IsControl(Node* node) {
|
| + return IrOpcode::IsControlOpcode(node->opcode());
|
| + }
|
| + static bool IsConstant(Node* node) {
|
| + return IrOpcode::IsConstantOpcode(node->opcode());
|
| + }
|
| + static bool IsPhi(Node* node) {
|
| + return IrOpcode::IsPhiOpcode(node->opcode());
|
| + }
|
| +
|
| +
|
| + // ---------------------------------------------------------------------------
|
| + // Miscellaneous mutators.
|
| +
|
| + static void ReplaceContextInput(Node* node, Node* context);
|
| + static void ReplaceControlInput(Node* node, Node* control);
|
| + static void ReplaceEffectInput(Node* node, Node* effect, int index = 0);
|
| + static void ReplaceFrameStateInput(Node* node, Node* frame_state);
|
| + static void RemoveNonValueInputs(Node* node);
|
| +
|
| + // Replace value uses of {node} with {value} and effect uses of {node} with
|
| + // {effect}. If {effect == NULL}, then use the effect input to {node}.
|
| + static void ReplaceWithValue(Node* node, Node* value, Node* effect = nullptr);
|
| +
|
| +
|
| + // ---------------------------------------------------------------------------
|
| + // Miscellaneous utilities.
|
|
|
| static Node* FindProjection(Node* node, size_t projection_index);
|
|
|
| - static inline bool IsTyped(Node* node);
|
| - static inline Bounds GetBounds(Node* node);
|
| - static inline void SetBounds(Node* node, Bounds bounds);
|
| - static inline void RemoveBounds(Node* node);
|
| - static inline bool AllValueInputsAreTyped(Node* node);
|
| -
|
| - static inline int FirstValueIndex(Node* node);
|
| - static inline int FirstContextIndex(Node* node);
|
| - static inline int FirstFrameStateIndex(Node* node);
|
| - static inline int FirstEffectIndex(Node* node);
|
| - static inline int FirstControlIndex(Node* node);
|
| - static inline int PastValueIndex(Node* node);
|
| - static inline int PastContextIndex(Node* node);
|
| - static inline int PastFrameStateIndex(Node* node);
|
| - static inline int PastEffectIndex(Node* node);
|
| - static inline int PastControlIndex(Node* node);
|
|
|
| + // ---------------------------------------------------------------------------
|
| + // Type Bounds.
|
| +
|
| + static bool IsTyped(Node* node) {
|
| + Bounds const bounds = node->bounds();
|
| + DCHECK(!bounds.lower == !bounds.upper);
|
| + return bounds.upper;
|
| + }
|
| + static Bounds GetBounds(Node* node) {
|
| + DCHECK(IsTyped(node));
|
| + return node->bounds();
|
| + }
|
| + static void SetBounds(Node* node, Bounds bounds) {
|
| + DCHECK_NOT_NULL(bounds.lower);
|
| + DCHECK_NOT_NULL(bounds.upper);
|
| + node->set_bounds(bounds);
|
| + }
|
| + static void RemoveBounds(Node* node) { node->set_bounds(Bounds()); }
|
| + static bool AllValueInputsAreTyped(Node* node);
|
| +
|
| + private:
|
| static inline bool IsInputRange(Edge edge, int first, int count);
|
| };
|
|
|
|
|