// 0 [ values, context, effects, control ] node->InputCount()
inline bool NodeProperties::HasValueInput(Node* node) {
- return OperatorProperties::GetValueInputCount(node->op()) > 0;
+ return OperatorProperties::HasValueInput(node->op());
}
inline bool NodeProperties::HasContextInput(Node* node) {
}
inline bool NodeProperties::HasEffectInput(Node* node) {
- return OperatorProperties::GetEffectInputCount(node->op()) > 0;
+ return OperatorProperties::HasEffectInput(node->op());
}
inline bool NodeProperties::HasControlInput(Node* node) {
- return OperatorProperties::GetControlInputCount(node->op()) > 0;
+ return OperatorProperties::HasControlInput(node->op());
}
}
inline int NodeProperties::GetContextInputCount(Node* node) {
- return OperatorProperties::HasContextInput(node->op()) ? 1 : 0;
+ return OperatorProperties::GetContextInputCount(node->op());
}
inline int NodeProperties::GetEffectInputCount(Node* node) {
}
-inline int NodeProperties::FirstValueIndex(Node* node) { return 0; }
-
-inline int NodeProperties::FirstContextIndex(Node* node) {
+inline int NodeProperties::GetContextIndex(Node* node) {
return PastValueIndex(node);
}
+
+inline int NodeProperties::FirstValueIndex(Node* node) { return 0; }
+
inline int NodeProperties::FirstEffectIndex(Node* node) {
return PastContextIndex(node);
}
}
inline int NodeProperties::PastContextIndex(Node* node) {
- return FirstContextIndex(node) + GetContextInputCount(node);
+ return GetContextIndex(node) + GetContextInputCount(node);
}
inline int NodeProperties::PastEffectIndex(Node* node) {
}
inline Node* NodeProperties::GetContextInput(Node* node) {
- DCHECK(GetContextInputCount(node) > 0);
- return node->InputAt(FirstContextIndex(node));
+ DCHECK(HasContextInput(node));
+ return node->InputAt(GetContextIndex(node));
}
inline Node* NodeProperties::GetEffectInput(Node* node, int index) {
// Output counts.
inline bool NodeProperties::HasValueOutput(Node* node) {
- return GetValueOutputCount(node) > 0;
+ return OperatorProperties::HasValueOutput(node->op());
}
inline bool NodeProperties::HasEffectOutput(Node* node) {
- return node->opcode() == IrOpcode::kStart ||
- NodeProperties::GetEffectInputCount(node) > 0;
+ return OperatorProperties::HasEffectOutput(node->op());
}
inline bool NodeProperties::HasControlOutput(Node* node) {
- return (node->opcode() != IrOpcode::kEnd && IsControl(node)) ||
- NodeProperties::CanLazilyDeoptimize(node);
+ return OperatorProperties::HasControlOutput(node->op());
}
}
inline int NodeProperties::GetEffectOutputCount(Node* node) {
- return HasEffectOutput(node) ? 1 : 0;
+ return OperatorProperties::GetEffectOutputCount(node->op());
}
inline int NodeProperties::GetControlOutputCount(Node* node) {
- return node->opcode() == IrOpcode::kBranch ? 2 : HasControlOutput(node) ? 1
- : 0;
+ return OperatorProperties::GetControlOutputCount(node->op());
}
inline bool NodeProperties::IsContextEdge(Node::Edge edge) {
Node* node = edge.from();
- return IsInputRange(edge, FirstContextIndex(node),
- GetContextInputCount(node));
+ return IsInputRange(edge, GetContextIndex(node), GetContextInputCount(node));
}
inline bool NodeProperties::IsEffectEdge(Node::Edge edge) {
static inline int GetContextInputCount(Node* node);
static inline int GetEffectInputCount(Node* node);
static inline int GetControlInputCount(Node* node);
+ static inline int GetTotalInputCount(Node* node);
static inline Node* GetValueInput(Node* node, int index);
static inline Node* GetContextInput(Node* node);
static inline bool CanLazilyDeoptimize(Node* node);
+ static inline int GetContextIndex(Node* node);
+
private:
static inline int FirstValueIndex(Node* node);
- static inline int FirstContextIndex(Node* node);
static inline int FirstEffectIndex(Node* node);
static inline int FirstControlIndex(Node* node);
static inline int PastValueIndex(Node* node);
namespace internal {
namespace compiler {
-inline int OperatorProperties::GetValueOutputCount(Operator* op) {
- return op->OutputCount();
+inline bool OperatorProperties::HasValueInput(Operator* op) {
+ return OperatorProperties::GetValueInputCount(op) > 0;
+}
+
+inline bool OperatorProperties::HasContextInput(Operator* op) {
+ IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode());
+ return IrOpcode::IsJsOpcode(opcode);
+}
+
+inline bool OperatorProperties::HasEffectInput(Operator* op) {
+ return OperatorProperties::GetEffectInputCount(op) > 0;
}
+inline bool OperatorProperties::HasControlInput(Operator* op) {
+ return OperatorProperties::GetControlInputCount(op) > 0;
+}
+
+
inline int OperatorProperties::GetValueInputCount(Operator* op) {
return op->InputCount();
}
+inline int OperatorProperties::GetContextInputCount(Operator* op) {
+ return OperatorProperties::HasContextInput(op) ? 1 : 0;
+}
+
+inline int OperatorProperties::GetEffectInputCount(Operator* op) {
+ if (op->opcode() == IrOpcode::kEffectPhi) {
+ return static_cast<Operator1<int>*>(op)->parameter();
+ }
+ if (op->HasProperty(Operator::kNoRead) && op->HasProperty(Operator::kNoWrite))
+ return 0; // no effects.
+ return 1;
+}
+
inline int OperatorProperties::GetControlInputCount(Operator* op) {
switch (op->opcode()) {
case IrOpcode::kPhi:
return 0;
}
-inline int OperatorProperties::GetEffectInputCount(Operator* op) {
- if (op->opcode() == IrOpcode::kEffectPhi) {
- return static_cast<Operator1<int>*>(op)->parameter();
- }
- if (op->HasProperty(Operator::kNoRead) && op->HasProperty(Operator::kNoWrite))
- return 0; // no effects.
- return 1;
+inline int OperatorProperties::GetTotalInputCount(Operator* op) {
+ return GetValueInputCount(op) + GetContextInputCount(op) +
+ GetEffectInputCount(op) + GetControlInputCount(op);
}
-inline bool OperatorProperties::HasContextInput(Operator* op) {
+// -----------------------------------------------------------------------------
+// Output properties.
+
+inline bool OperatorProperties::HasValueOutput(Operator* op) {
+ return GetValueOutputCount(op) > 0;
+}
+
+inline bool OperatorProperties::HasEffectOutput(Operator* op) {
+ return op->opcode() == IrOpcode::kStart || GetEffectInputCount(op) > 0;
+}
+
+inline bool OperatorProperties::HasControlOutput(Operator* op) {
IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode());
- return IrOpcode::IsJsOpcode(opcode);
+ return (opcode != IrOpcode::kEnd && IrOpcode::IsControlOpcode(opcode)) ||
+ CanLazilyDeoptimize(op);
+}
+
+
+inline int OperatorProperties::GetValueOutputCount(Operator* op) {
+ return op->OutputCount();
}
+inline int OperatorProperties::GetEffectOutputCount(Operator* op) {
+ return HasEffectOutput(op) ? 1 : 0;
+}
+
+inline int OperatorProperties::GetControlOutputCount(Operator* node) {
+ return node->opcode() == IrOpcode::kBranch ? 2 : HasControlOutput(node) ? 1
+ : 0;
+}
+
+
inline bool OperatorProperties::IsBasicBlockBegin(Operator* op) {
uint8_t opcode = op->opcode();
return opcode == IrOpcode::kStart || opcode == IrOpcode::kEnd ||
class OperatorProperties {
public:
- static int GetValueOutputCount(Operator* op);
- static int GetValueInputCount(Operator* op);
- static bool HasContextInput(Operator* op);
- static int GetEffectInputCount(Operator* op);
- static int GetControlInputCount(Operator* op);
+ static inline bool HasValueInput(Operator* node);
+ static inline bool HasContextInput(Operator* node);
+ static inline bool HasEffectInput(Operator* node);
+ static inline bool HasControlInput(Operator* node);
- static bool IsBasicBlockBegin(Operator* op);
+ static inline int GetValueInputCount(Operator* op);
+ static inline int GetContextInputCount(Operator* op);
+ static inline int GetEffectInputCount(Operator* op);
+ static inline int GetControlInputCount(Operator* op);
+ static inline int GetTotalInputCount(Operator* op);
- static bool CanBeScheduled(Operator* op);
- static bool HasFixedSchedulePosition(Operator* op);
- static bool IsScheduleRoot(Operator* op);
+ static inline bool HasValueOutput(Operator* op);
+ static inline bool HasEffectOutput(Operator* op);
+ static inline bool HasControlOutput(Operator* op);
- static bool CanLazilyDeoptimize(Operator* op);
+ static inline int GetValueOutputCount(Operator* op);
+ static inline int GetEffectOutputCount(Operator* op);
+ static inline int GetControlOutputCount(Operator* op);
+
+ static inline bool IsBasicBlockBegin(Operator* op);
+
+ static inline bool CanBeScheduled(Operator* op);
+ static inline bool HasFixedSchedulePosition(Operator* op);
+ static inline bool IsScheduleRoot(Operator* op);
+
+ static inline bool CanLazilyDeoptimize(Operator* op);
};
}
}