// Reducer implementation: perform reductions on a node.
//===========================================================================
Node* ReduceNode(Node* node) {
- if (OperatorProperties::GetControlInputCount(node->op()) == 1) {
+ if (node->op()->ControlInputCount() == 1) {
// If a node has only one control input and it is dead, replace with dead.
Node* control = NodeProperties::GetControlInput(node);
if (control->opcode() == IrOpcode::kDead) {
bool has_context = OperatorProperties::HasContextInput(op);
bool has_framestate = OperatorProperties::HasFrameStateInput(op);
- bool has_control = OperatorProperties::GetControlInputCount(op) == 1;
- bool has_effect = OperatorProperties::GetEffectInputCount(op) == 1;
+ bool has_control = op->ControlInputCount() == 1;
+ bool has_effect = op->EffectInputCount() == 1;
- DCHECK(OperatorProperties::GetControlInputCount(op) < 2);
- DCHECK(OperatorProperties::GetEffectInputCount(op) < 2);
+ DCHECK(op->ControlInputCount() < 2);
+ DCHECK(op->EffectInputCount() < 2);
Node* result = NULL;
if (!has_context && !has_framestate && !has_control && !has_effect) {
if (has_effect) {
environment_->UpdateEffectDependency(result);
}
- if (OperatorProperties::HasControlOutput(result->op()) &&
+ if (result->op()->ControlOutputCount() > 0 &&
!environment()->IsMarkedAsUnreachable()) {
environment_->UpdateControlDependency(result);
}
Node* StructuredGraphBuilder::MergeControl(Node* control, Node* other) {
- int inputs = OperatorProperties::GetControlInputCount(control->op()) + 1;
+ int inputs = control->op()->ControlInputCount() + 1;
if (control->opcode() == IrOpcode::kLoop) {
// Control node for loop exists, add input.
const Operator* op = common()->Loop(inputs);
Node* StructuredGraphBuilder::MergeEffect(Node* value, Node* other,
Node* control) {
- int inputs = OperatorProperties::GetControlInputCount(control->op());
+ int inputs = control->op()->ControlInputCount();
if (value->opcode() == IrOpcode::kEffectPhi &&
NodeProperties::GetControlInput(value) == control) {
// Phi already exists, add input.
Node* StructuredGraphBuilder::MergeValue(Node* value, Node* other,
Node* control) {
- int inputs = OperatorProperties::GetControlInputCount(control->op());
+ int inputs = control->op()->ControlInputCount();
if (value->opcode() == IrOpcode::kPhi &&
NodeProperties::GetControlInput(value) == control) {
// Phi already exists, add input.
PrintF("%d", op->InputCount());
break;
case IrOpcode::kEffectPhi:
- PrintF("%d", OperatorProperties::GetEffectInputCount(op));
+ PrintF("%d", op->EffectInputCount());
break;
case IrOpcode::kLoop:
case IrOpcode::kMerge:
- PrintF("%d", OperatorProperties::GetControlInputCount(op));
+ PrintF("%d", op->ControlInputCount());
break;
default:
break;
static Node* GetControlCluster(Node* node) {
if (OperatorProperties::IsBasicBlockBegin(node->op())) {
return node;
- } else if (OperatorProperties::GetControlInputCount(node->op()) == 1) {
+ } else if (node->op()->ControlInputCount() == 1) {
Node* control = NodeProperties::GetControlInput(node, 0);
return OperatorProperties::IsBasicBlockBegin(control->op()) ? control
: NULL;
os_ << " label=\"{{#" << node->id() << ":" << Escaped(label);
InputIter i = node->inputs().begin();
- for (int j = OperatorProperties::GetValueInputCount(node->op()); j > 0;
- ++i, j--) {
+ for (int j = node->op()->ValueInputCount(); j > 0; ++i, j--) {
os_ << "|<I" << i.index() << ">#" << (*i)->id();
}
for (int j = OperatorProperties::GetContextInputCount(node->op()); j > 0;
++i, j--) {
os_ << "|<I" << i.index() << ">F #" << (*i)->id();
}
- for (int j = OperatorProperties::GetEffectInputCount(node->op()); j > 0;
- ++i, j--) {
+ for (int j = node->op()->EffectInputCount(); j > 0; ++i, j--) {
os_ << "|<I" << i.index() << ">E #" << (*i)->id();
}
if (!use_to_def_ || OperatorProperties::IsBasicBlockBegin(node->op()) ||
GetControlCluster(node) == NULL) {
- for (int j = OperatorProperties::GetControlInputCount(node->op()); j > 0;
- ++i, j--) {
+ for (int j = node->op()->ControlInputCount(); j > 0; ++i, j--) {
os_ << "|<I" << i.index() << ">C #" << (*i)->id();
}
}
os_ << ":I" << index << ":n -> DEAD_INPUT";
} else if (OperatorProperties::IsBasicBlockBegin(from->op()) ||
GetControlCluster(from) == NULL ||
- (OperatorProperties::GetControlInputCount(from->op()) > 0 &&
+ (from->op()->ControlInputCount() > 0 &&
NodeProperties::GetControlInput(from) != to)) {
os_ << ":I" << index << ":n -> ID" << to->id() << ":s"
<< "[" << (unconstrained ? "constraint=false, " : "")
void GraphC1Visualizer::PrintInputs(Node* node) {
InputIter i = node->inputs().begin();
- PrintInputs(&i, OperatorProperties::GetValueInputCount(node->op()), " ");
+ PrintInputs(&i, node->op()->ValueInputCount(), " ");
PrintInputs(&i, OperatorProperties::GetContextInputCount(node->op()),
" Ctx:");
PrintInputs(&i, OperatorProperties::GetFrameStateInputCount(node->op()),
" FS:");
- PrintInputs(&i, OperatorProperties::GetEffectInputCount(node->op()), " Eff:");
- PrintInputs(&i, OperatorProperties::GetControlInputCount(node->op()),
- " Ctrl:");
+ PrintInputs(&i, node->op()->EffectInputCount(), " Eff:");
+ PrintInputs(&i, node->op()->ControlInputCount(), " Ctrl:");
}
DCHECK_EQ(call->op()->OutputCount(),
static_cast<int>(buffer->descriptor->ReturnCount()));
DCHECK_EQ(
- OperatorProperties::GetValueInputCount(call->op()),
+ call->op()->ValueInputCount(),
static_cast<int>(buffer->input_count() + buffer->frame_state_count()));
if (buffer->descriptor->ReturnCount() > 0) {
int GetJSCallArity() {
DCHECK_EQ(IrOpcode::kJSCallFunction, node_->opcode());
// Skip first (i.e. callee) and second (i.e. receiver) operand.
- return OperatorProperties::GetValueInputCount(node_->op()) - 2;
+ return node_->op()->ValueInputCount() - 2;
}
Node* GetJSCallInput(int index) {
}
DCHECK_EQ(IrOpcode::kMerge, final_merge->opcode());
- int predecessors =
- OperatorProperties::GetControlInputCount(final_merge->op());
+ int predecessors = final_merge->op()->ControlInputCount();
const Operator* op_phi = jsgraph->common()->Phi(kMachAnyTagged, predecessors);
const Operator* op_ephi = jsgraph->common()->EffectPhi(predecessors);
int inlinee_context_index = static_cast<int>(total_parameters()) - 1;
// {inliner_inputs} counts JSFunction, Receiver, arguments, but not
// context, effect, control.
- int inliner_inputs = OperatorProperties::GetValueInputCount(call->op());
+ int inliner_inputs = call->op()->ValueInputCount();
// Iterate over all uses of the start node.
UseIter iter = start_->uses().begin();
while (iter != start_->uses().end()) {
size_t formal_arguments() {
// {value_inputs} includes jsfunction and receiver.
- size_t value_inputs = OperatorProperties::GetValueInputCount(call_->op());
+ size_t value_inputs = call_->op()->ValueInputCount();
DCHECK_GE(call_->InputCount(), 2);
return value_inputs - 2;
}
}
size_t formal_arguments() {
- size_t value_inputs = OperatorProperties::GetValueInputCount(call_->op());
+ size_t value_inputs = call_->op()->ValueInputCount();
return value_inputs;
}
// Remove all effect and control inputs and outputs to this node and change
// to the pure operator {op}, possibly inserting a boolean inversion.
Reduction ChangeToPureOperator(const Operator* op, bool invert = false) {
- DCHECK_EQ(0, OperatorProperties::GetEffectInputCount(op));
+ DCHECK_EQ(0, op->EffectInputCount());
DCHECK_EQ(false, OperatorProperties::HasContextInput(op));
- DCHECK_EQ(0, OperatorProperties::GetControlInputCount(op));
- DCHECK_EQ(2, OperatorProperties::GetValueInputCount(op));
+ DCHECK_EQ(0, op->ControlInputCount());
+ DCHECK_EQ(2, op->ValueInputCount());
// Remove the effects from the node, if any, and update its effect usages.
- if (OperatorProperties::GetEffectInputCount(node_->op()) > 0) {
+ if (node_->op()->EffectInputCount() > 0) {
RelaxEffects(node_);
}
// Remove the inputs corresponding to context, effect, and control.
if (NodeProperties::IsTyped(node) &&
NodeProperties::GetBounds(node).upper->IsConstant() &&
!IrOpcode::IsLeafOpcode(node->opcode()) &&
- !OperatorProperties::HasEffectOutput(node->op())) {
+ node->op()->EffectOutputCount() == 0) {
return ReplaceEagerly(node, jsgraph()->Constant(
NodeProperties::GetBounds(node).upper->AsConstant()->Value()));
// TODO(neis): Extend this to Range(x,x), NaN, MinusZero, ...?
inline int NodeProperties::PastValueIndex(Node* node) {
- return FirstValueIndex(node) +
- OperatorProperties::GetValueInputCount(node->op());
+ return FirstValueIndex(node) + node->op()->ValueInputCount();
}
inline int NodeProperties::PastContextIndex(Node* node) {
}
inline int NodeProperties::PastEffectIndex(Node* node) {
- return FirstEffectIndex(node) +
- OperatorProperties::GetEffectInputCount(node->op());
+ return FirstEffectIndex(node) + node->op()->EffectInputCount();
}
inline int NodeProperties::PastControlIndex(Node* node) {
- return FirstControlIndex(node) +
- OperatorProperties::GetControlInputCount(node->op());
+ return FirstControlIndex(node) + node->op()->ControlInputCount();
}
// Input accessors.
inline Node* NodeProperties::GetValueInput(Node* node, int index) {
- DCHECK(0 <= index &&
- index < OperatorProperties::GetValueInputCount(node->op()));
+ DCHECK(0 <= index && index < node->op()->ValueInputCount());
return node->InputAt(FirstValueIndex(node) + index);
}
}
inline Node* NodeProperties::GetEffectInput(Node* node, int index) {
- DCHECK(0 <= index &&
- index < OperatorProperties::GetEffectInputCount(node->op()));
+ DCHECK(0 <= index && index < node->op()->EffectInputCount());
return node->InputAt(FirstEffectIndex(node) + index);
}
inline Node* NodeProperties::GetControlInput(Node* node, int index) {
- DCHECK(0 <= index &&
- index < OperatorProperties::GetControlInputCount(node->op()));
+ DCHECK(0 <= index && index < node->op()->ControlInputCount());
return node->InputAt(FirstControlIndex(node) + index);
}
inline bool NodeProperties::IsValueEdge(Node::Edge edge) {
Node* node = edge.from();
return IsInputRange(edge, FirstValueIndex(node),
- OperatorProperties::GetValueInputCount(node->op()));
+ node->op()->ValueInputCount());
}
inline bool NodeProperties::IsContextEdge(Node::Edge edge) {
inline bool NodeProperties::IsEffectEdge(Node::Edge edge) {
Node* node = edge.from();
return IsInputRange(edge, FirstEffectIndex(node),
- OperatorProperties::GetEffectInputCount(node->op()));
+ node->op()->EffectInputCount());
}
inline bool NodeProperties::IsControlEdge(Node::Edge edge) {
Node* node = edge.from();
return IsInputRange(edge, FirstControlIndex(node),
- OperatorProperties::GetControlInputCount(node->op()));
+ node->op()->ControlInputCount());
}
inline void NodeProperties::ReplaceEffectInput(Node* node, Node* effect,
int index) {
- DCHECK(index < OperatorProperties::GetEffectInputCount(node->op()));
+ DCHECK(index < node->op()->EffectInputCount());
return node->ReplaceInput(FirstEffectIndex(node) + index, effect);
}
}
inline void NodeProperties::RemoveNonValueInputs(Node* node) {
- node->TrimInputCount(OperatorProperties::GetValueInputCount(node->op()));
+ node->TrimInputCount(node->op()->ValueInputCount());
}
// {effect}. If {effect == NULL}, then use the effect input to {node}.
inline void NodeProperties::ReplaceWithValue(Node* node, Node* value,
Node* effect) {
- DCHECK(!OperatorProperties::HasControlOutput(node->op()));
- if (effect == NULL && OperatorProperties::HasEffectInput(node->op())) {
+ DCHECK(node->op()->ControlOutputCount() == 0);
+ if (effect == NULL && node->op()->EffectInputCount() > 0) {
effect = NodeProperties::GetEffectInput(node);
}
}
inline bool NodeProperties::AllValueInputsAreTyped(Node* node) {
- int input_count = OperatorProperties::GetValueInputCount(node->op());
+ int input_count = node->op()->ValueInputCount();
for (int i = 0; i < input_count; ++i) {
if (!IsTyped(GetValueInput(node, i))) return false;
}
std::ostream& operator<<(std::ostream& os, const Node& n) {
os << n.id() << ": " << *n.op();
- if (n.op()->InputCount() != 0) {
+ if (n.op()->InputCount() > 0) {
os << "(";
for (int i = 0; i < n.op()->InputCount(); ++i) {
if (i != 0) os << ", ";
namespace internal {
namespace compiler {
-inline bool OperatorProperties::HasValueInput(const Operator* op) {
- return op->ValueInputCount() > 0;
-}
-
inline bool OperatorProperties::HasContextInput(const Operator* op) {
IrOpcode::Value opcode = static_cast<IrOpcode::Value>(op->opcode());
return IrOpcode::IsJsOpcode(opcode);
}
-inline bool OperatorProperties::HasEffectInput(const Operator* op) {
- return op->EffectInputCount() > 0;
-}
-
-inline bool OperatorProperties::HasControlInput(const Operator* op) {
- return op->ControlInputCount() > 0;
-}
-
inline bool OperatorProperties::HasFrameStateInput(const Operator* op) {
if (!FLAG_turbo_deoptimization) {
return false;
}
}
-inline int OperatorProperties::GetValueInputCount(const Operator* op) {
- return op->ValueInputCount();
-}
-
inline int OperatorProperties::GetContextInputCount(const Operator* op) {
return OperatorProperties::HasContextInput(op) ? 1 : 0;
}
return OperatorProperties::HasFrameStateInput(op) ? 1 : 0;
}
-inline int OperatorProperties::GetEffectInputCount(const Operator* op) {
- return op->EffectInputCount();
-}
-
-inline int OperatorProperties::GetControlInputCount(const Operator* op) {
- return op->ControlInputCount();
-}
-
inline int OperatorProperties::GetTotalInputCount(const Operator* op) {
- return GetValueInputCount(op) + GetContextInputCount(op) +
- GetFrameStateInputCount(op) + GetEffectInputCount(op) +
- GetControlInputCount(op);
+ return op->ValueInputCount() + GetContextInputCount(op) +
+ GetFrameStateInputCount(op) + op->EffectInputCount() +
+ op->ControlInputCount();
}
// -----------------------------------------------------------------------------
// Output properties.
-inline bool OperatorProperties::HasValueOutput(const Operator* op) {
- return op->ValueOutputCount() > 0;
-}
-
-inline bool OperatorProperties::HasEffectOutput(const Operator* op) {
- return op->EffectOutputCount() > 0;
-}
-
-inline bool OperatorProperties::HasControlOutput(const Operator* op) {
- return op->ControlOutputCount() > 0;
-}
-
-
-inline int OperatorProperties::GetValueOutputCount(const Operator* op) {
- return op->ValueOutputCount();
-}
-
-inline int OperatorProperties::GetEffectOutputCount(const Operator* op) {
- return op->EffectOutputCount();
-}
-
-inline int OperatorProperties::GetControlOutputCount(const Operator* op) {
- return op->ControlOutputCount();
-}
-
-
inline bool OperatorProperties::IsBasicBlockBegin(const Operator* op) {
uint8_t opcode = op->opcode();
return opcode == IrOpcode::kStart || opcode == IrOpcode::kEnd ||
class OperatorProperties {
public:
- static inline bool HasValueInput(const Operator* op);
static inline bool HasContextInput(const Operator* op);
- static inline bool HasEffectInput(const Operator* op);
- static inline bool HasControlInput(const Operator* op);
static inline bool HasFrameStateInput(const Operator* op);
- static inline int GetValueInputCount(const Operator* op);
static inline int GetContextInputCount(const Operator* op);
- static inline int GetEffectInputCount(const Operator* op);
- static inline int GetControlInputCount(const Operator* op);
static inline int GetFrameStateInputCount(const Operator* op);
static inline int GetTotalInputCount(const Operator* op);
- static inline bool HasValueOutput(const Operator* op);
- static inline bool HasEffectOutput(const Operator* op);
- static inline bool HasControlOutput(const Operator* op);
-
- static inline int GetValueOutputCount(const Operator* op);
- static inline int GetEffectOutputCount(const Operator* op);
- static inline int GetControlOutputCount(const Operator* op);
-
static inline bool IsBasicBlockBegin(const Operator* op);
};
// {kRepTagged} representation and can observe all output values {kTypeAny}.
void VisitInputs(Node* node) {
InputIter i = node->inputs().begin();
- for (int j = OperatorProperties::GetValueInputCount(node->op()); j > 0;
- ++i, j--) {
+ for (int j = node->op()->ValueInputCount(); j > 0; ++i, j--) {
ProcessInput(node, i.index(), kMachAnyTagged); // Value inputs
}
for (int j = OperatorProperties::GetContextInputCount(node->op()); j > 0;
++i, j--) {
ProcessInput(node, i.index(), kMachAnyTagged); // Context inputs
}
- for (int j = OperatorProperties::GetEffectInputCount(node->op()); j > 0;
- ++i, j--) {
+ for (int j = node->op()->EffectInputCount(); j > 0; ++i, j--) {
Enqueue(*i); // Effect inputs: just visit
}
- for (int j = OperatorProperties::GetControlInputCount(node->op()); j > 0;
- ++i, j--) {
+ for (int j = node->op()->ControlInputCount(); j > 0; ++i, j--) {
Enqueue(*i); // Control inputs: just visit
}
SetOutput(node, kMachAnyTagged);
static_cast<MachineType>(changer_->TypeFromUpperBound(upper) | output);
SetOutput(node, output_type);
- int values = OperatorProperties::GetValueInputCount(node->op());
+ int values = node->op()->ValueInputCount();
if (lower()) {
// Update the phi operator.
redo(NodeSet::key_compare(), NodeSet::allocator_type(typer->zone())) {}
GenericGraphVisit::Control Post(Node* node) {
- if (OperatorProperties::HasValueOutput(node->op()) &&
- !NodeProperties::IsTyped(node)) {
+ if (node->op()->ValueOutputCount() > 0 && !NodeProperties::IsTyped(node)) {
Bounds bounds = TypeNode(node);
NodeProperties::SetBounds(node, bounds);
// Remember incompletely typed nodes for least fixpoint iteration.
explicit NarrowVisitor(Typer* typer) : Visitor(typer) {}
GenericGraphVisit::Control Pre(Node* node) {
- if (OperatorProperties::HasValueOutput(node->op())) {
+ if (node->op()->ValueOutputCount() > 0) {
Bounds previous = NodeProperties::GetBounds(node);
Bounds current = TypeNode(node);
NodeProperties::SetBounds(node, Bounds::Both(current, previous, zone()));
explicit WidenVisitor(Typer* typer) : Visitor(typer) {}
GenericGraphVisit::Control Pre(Node* node) {
- if (OperatorProperties::HasValueOutput(node->op())) {
+ if (node->op()->ValueOutputCount() > 0) {
Bounds previous = BoundsOrNone(node);
Bounds current = TypeNode(node);
void Typer::Decorator::Decorate(Node* node) {
- if (OperatorProperties::HasValueOutput(node->op())) {
+ if (node->op()->ValueOutputCount() > 0) {
// Only eagerly type-decorate nodes with known input types.
// Other cases will generally require a proper fixpoint iteration with Run.
bool is_typed = NodeProperties::IsTyped(node);
Bounds Typer::Visitor::TypePhi(Node* node) {
- int arity = OperatorProperties::GetValueInputCount(node->op());
+ int arity = node->op()->ValueInputCount();
Bounds bounds = Operand(node, 0);
for (int i = 1; i < arity; ++i) {
bounds = Bounds::Either(bounds, Operand(node, i), zone());
GenericGraphVisit::Control Verifier::Visitor::Pre(Node* node) {
- int value_count = OperatorProperties::GetValueInputCount(node->op());
+ int value_count = node->op()->ValueInputCount();
int context_count = OperatorProperties::GetContextInputCount(node->op());
int frame_state_count =
OperatorProperties::GetFrameStateInputCount(node->op());
- int effect_count = OperatorProperties::GetEffectInputCount(node->op());
- int control_count = OperatorProperties::GetControlInputCount(node->op());
+ int effect_count = node->op()->EffectInputCount();
+ int control_count = node->op()->ControlInputCount();
// Verify number of inputs matches up.
int input_count = value_count + context_count + frame_state_count +
// Verify all value inputs actually produce a value.
for (int i = 0; i < value_count; ++i) {
Node* value = NodeProperties::GetValueInput(node, i);
- CHECK(OperatorProperties::HasValueOutput(value->op()));
+ CHECK(value->op()->ValueOutputCount() > 0);
CHECK(IsDefUseChainLinkPresent(value, node));
CHECK(IsUseDefChainLinkPresent(value, node));
}
// Verify all context inputs are value nodes.
for (int i = 0; i < context_count; ++i) {
Node* context = NodeProperties::GetContextInput(node);
- CHECK(OperatorProperties::HasValueOutput(context->op()));
+ CHECK(context->op()->ValueOutputCount() > 0);
CHECK(IsDefUseChainLinkPresent(context, node));
CHECK(IsUseDefChainLinkPresent(context, node));
}
// Verify all effect inputs actually have an effect.
for (int i = 0; i < effect_count; ++i) {
Node* effect = NodeProperties::GetEffectInput(node);
- CHECK(OperatorProperties::HasEffectOutput(effect->op()));
+ CHECK(effect->op()->EffectOutputCount() > 0);
CHECK(IsDefUseChainLinkPresent(effect, node));
CHECK(IsUseDefChainLinkPresent(effect, node));
}
// Verify all control inputs are control nodes.
for (int i = 0; i < control_count; ++i) {
Node* control = NodeProperties::GetControlInput(node, i);
- CHECK(OperatorProperties::HasControlOutput(control->op()));
+ CHECK(control->op()->ControlOutputCount() > 0);
CHECK(IsDefUseChainLinkPresent(control, node));
CHECK(IsUseDefChainLinkPresent(control, node));
}
// Verify all successors are projections if multiple value outputs exist.
- if (OperatorProperties::GetValueOutputCount(node->op()) > 1) {
+ if (node->op()->ValueOutputCount() > 1) {
Node::Uses uses = node->uses();
for (Node::Uses::iterator it = uses.begin(); it != uses.end(); ++it) {
CHECK(!NodeProperties::IsValueEdge(it.edge()) ||
break;
case IrOpcode::kEnd:
// End has no outputs.
- CHECK(!OperatorProperties::HasValueOutput(node->op()));
- CHECK(!OperatorProperties::HasEffectOutput(node->op()));
- CHECK(!OperatorProperties::HasControlOutput(node->op()));
+ CHECK(node->op()->ValueOutputCount() == 0);
+ CHECK(node->op()->EffectOutputCount() == 0);
+ CHECK(node->op()->ControlOutputCount() == 0);
// Type is empty.
CheckNotTyped(node);
break;
int index = OpParameter<int>(node);
Node* input = NodeProperties::GetValueInput(node, 0);
// Currently, parameter indices start at -1 instead of 0.
- CHECK_GT(OperatorProperties::GetValueOutputCount(input->op()), index + 1);
+ CHECK_GT(input->op()->ValueOutputCount(), index + 1);
// Type can be anything.
CheckUpperIs(node, Type::Any());
break;
// Projection has an input that produces enough values.
int index = static_cast<int>(OpParameter<size_t>(node->op()));
Node* input = NodeProperties::GetValueInput(node, 0);
- CHECK_GT(OperatorProperties::GetValueOutputCount(input->op()), index);
+ CHECK_GT(input->op()->ValueOutputCount(), index);
// Type can be anything.
// TODO(rossberg): Introduce tuple types for this.
// TODO(titzer): Convince rossberg not to.
CHECK_EQ(0, effect_count);
CHECK_EQ(1, control_count);
Node* control = NodeProperties::GetControlInput(node, 0);
- CHECK_EQ(value_count,
- OperatorProperties::GetControlInputCount(control->op()));
+ CHECK_EQ(value_count, control->op()->ControlInputCount());
CHECK_EQ(input_count, 1 + value_count);
// Type must be subsumed by all input types.
// TODO(rossberg): for now at least, narrowing does not really hold.
CHECK_EQ(0, value_count);
CHECK_EQ(1, control_count);
Node* control = NodeProperties::GetControlInput(node, 0);
- CHECK_EQ(effect_count,
- OperatorProperties::GetControlInputCount(control->op()));
+ CHECK_EQ(effect_count, control->op()->ControlInputCount());
CHECK_EQ(input_count, 1 + effect_count);
break;
}
static void CheckInputsDominate(Schedule* schedule, BasicBlock* block,
Node* node, int use_pos) {
- for (int j = OperatorProperties::GetValueInputCount(node->op()) - 1; j >= 0;
- j--) {
+ for (int j = node->op()->ValueInputCount() - 1; j >= 0; j--) {
BasicBlock* use_block = block;
if (node->opcode() == IrOpcode::kPhi) {
use_block = use_block->PredecessorAt(j);
// Ensure that nodes are dominated by their control inputs;
// kEnd is an exception, as unreachable blocks resulting from kMerge
// are not in the RPO.
- if (OperatorProperties::GetControlInputCount(node->op()) == 1 &&
+ if (node->op()->ControlInputCount() == 1 &&
node->opcode() != IrOpcode::kEnd) {
Node* ctl = NodeProperties::GetControlInput(node);
if (!Dominates(schedule, ctl, node)) {
if (phi->opcode() != IrOpcode::kPhi) continue;
// TODO(titzer): Nasty special case. Phis from RawMachineAssembler
// schedules don't have control inputs.
- if (phi->InputCount() >
- OperatorProperties::GetValueInputCount(phi->op())) {
+ if (phi->InputCount() > phi->op()->ValueInputCount()) {
Node* control = NodeProperties::GetControlInput(phi);
CHECK(control->opcode() == IrOpcode::kMerge ||
control->opcode() == IrOpcode::kLoop);
DCHECK(!OperatorProperties::HasContextInput(op));
DCHECK(!OperatorProperties::HasFrameStateInput(op));
- bool has_control = OperatorProperties::GetControlInputCount(op) == 1;
- bool has_effect = OperatorProperties::GetEffectInputCount(op) == 1;
+ bool has_control = op->ControlInputCount() == 1;
+ bool has_effect = op->EffectInputCount() == 1;
- DCHECK(OperatorProperties::GetControlInputCount(op) < 2);
- DCHECK(OperatorProperties::GetEffectInputCount(op) < 2);
+ DCHECK(op->ControlInputCount() < 2);
+ DCHECK(op->EffectInputCount() < 2);
Node* result = NULL;
if (!has_control && !has_effect) {
Node* i2 = NULL) {
CHECK_EQ(IrOpcode::kMerge, node->opcode());
int count = CheckInputs(node, i0, i1, i2);
- CHECK_EQ(count, OperatorProperties::GetControlInputCount(node->op()));
+ CHECK_EQ(count, node->op()->ControlInputCount());
return count;
}
Node* i2 = NULL) {
CHECK_EQ(IrOpcode::kLoop, node->opcode());
int count = CheckInputs(node, i0, i1, i2);
- CHECK_EQ(count, OperatorProperties::GetControlInputCount(node->op()));
+ CHECK_EQ(count, node->op()->ControlInputCount());
return count;
}
R.ReduceMerge(merge, merge);
CHECK_EQ(IrOpcode::kEffectPhi, phi->opcode());
CHECK_EQ(0, phi->op()->InputCount());
- CHECK_EQ(2, OperatorProperties::GetEffectInputCount(phi->op()));
+ CHECK_EQ(2, phi->op()->EffectInputCount());
CHECK_EQ(3, phi->InputCount());
CHECK_EQ(R.leaf[i < 1 ? 1 : 0], phi->InputAt(0));
CHECK_EQ(R.leaf[i < 2 ? 2 : 1], phi->InputAt(1));
CHECK_EQ(ephi, ephi_use->InputAt(0));
CHECK_EQ(count, phi->op()->InputCount());
CHECK_EQ(count + 1, phi->InputCount());
- CHECK_EQ(count, OperatorProperties::GetEffectInputCount(ephi->op()));
+ CHECK_EQ(count, ephi->op()->EffectInputCount());
CHECK_EQ(count + 1, ephi->InputCount());
}
}
Node* terminate = end->InputAt(0);
CHECK_EQ(IrOpcode::kTerminate, terminate->opcode());
CHECK_EQ(2, terminate->InputCount());
- CHECK_EQ(1, OperatorProperties::GetEffectInputCount(terminate->op()));
- CHECK_EQ(1, OperatorProperties::GetControlInputCount(terminate->op()));
+ CHECK_EQ(1, terminate->op()->EffectInputCount());
+ CHECK_EQ(1, terminate->op()->ControlInputCount());
CheckInputs(terminate, effect, loop);
}
Node* terminate = end->InputAt(0);
CHECK_EQ(IrOpcode::kTerminate, terminate->opcode());
CHECK_EQ(3, terminate->InputCount());
- CHECK_EQ(2, OperatorProperties::GetEffectInputCount(terminate->op()));
- CHECK_EQ(1, OperatorProperties::GetControlInputCount(terminate->op()));
+ CHECK_EQ(2, terminate->op()->EffectInputCount());
+ CHECK_EQ(1, terminate->op()->ControlInputCount());
Node* e0 = terminate->InputAt(0);
Node* e1 = terminate->InputAt(1);
CHECK(e0 == effect1 || e1 == effect1);
Node* merge = end->InputAt(0);
CHECK_EQ(IrOpcode::kMerge, merge->opcode());
CHECK_EQ(2, merge->InputCount());
- CHECK_EQ(2, OperatorProperties::GetControlInputCount(merge->op()));
+ CHECK_EQ(2, merge->op()->ControlInputCount());
CHECK_EQ(R.start, merge->InputAt(0));
Node* terminate = merge->InputAt(1);
CHECK_EQ(IrOpcode::kTerminate, terminate->opcode());
CHECK_EQ(2, terminate->InputCount());
- CHECK_EQ(1, OperatorProperties::GetEffectInputCount(terminate->op()));
- CHECK_EQ(1, OperatorProperties::GetControlInputCount(terminate->op()));
+ CHECK_EQ(1, terminate->op()->EffectInputCount());
+ CHECK_EQ(1, terminate->op()->ControlInputCount());
CHECK_EQ(effect, terminate->InputAt(0));
CHECK_EQ(loop, terminate->InputAt(1));
}
Node* CheckConverted(IrOpcode::Value opcode, Node* node, bool effects) {
CHECK_EQ(opcode, node->opcode());
if (effects) {
- CHECK_LT(0, OperatorProperties::GetEffectInputCount(node->op()));
+ CHECK_LT(0, node->op()->EffectInputCount());
} else {
- CHECK_EQ(0, OperatorProperties::GetEffectInputCount(node->op()));
+ CHECK_EQ(0, node->op()->EffectInputCount());
}
return node;
}
const SharedOperator& sop = GetParam();
const Operator* op = (common.*sop.constructor)();
- EXPECT_EQ(sop.value_input_count, OperatorProperties::GetValueInputCount(op));
- EXPECT_EQ(sop.effect_input_count,
- OperatorProperties::GetEffectInputCount(op));
- EXPECT_EQ(sop.control_input_count,
- OperatorProperties::GetControlInputCount(op));
+ EXPECT_EQ(sop.value_input_count, op->ValueInputCount());
+ EXPECT_EQ(sop.effect_input_count, op->EffectInputCount());
+ EXPECT_EQ(sop.control_input_count, op->ControlInputCount());
EXPECT_EQ(
sop.value_input_count + sop.effect_input_count + sop.control_input_count,
OperatorProperties::GetTotalInputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetValueOutputCount(op));
- EXPECT_EQ(sop.effect_output_count,
- OperatorProperties::GetEffectOutputCount(op));
- EXPECT_EQ(sop.control_output_count,
- OperatorProperties::GetControlOutputCount(op));
+ EXPECT_EQ(0, op->ValueOutputCount());
+ EXPECT_EQ(sop.effect_output_count, op->EffectOutputCount());
+ EXPECT_EQ(sop.control_output_count, op->ControlOutputCount());
}
EXPECT_EQ(IrOpcode::kBranch, op->opcode());
EXPECT_EQ(Operator::kFoldable, op->properties());
EXPECT_EQ(hint, BranchHintOf(op));
- EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetEffectInputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetControlInputCount(op));
+ EXPECT_EQ(1, op->ValueInputCount());
+ EXPECT_EQ(0, op->EffectInputCount());
+ EXPECT_EQ(1, op->ControlInputCount());
EXPECT_EQ(2, OperatorProperties::GetTotalInputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetValueOutputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op));
- EXPECT_EQ(2, OperatorProperties::GetControlOutputCount(op));
+ EXPECT_EQ(0, op->ValueOutputCount());
+ EXPECT_EQ(0, op->EffectOutputCount());
+ EXPECT_EQ(2, op->ControlOutputCount());
}
}
EXPECT_EQ(Operator::kPure, op->properties());
EXPECT_EQ(type, SelectParametersOf(op).type());
EXPECT_EQ(hint, SelectParametersOf(op).hint());
- EXPECT_EQ(3, OperatorProperties::GetValueInputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetEffectInputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetControlInputCount(op));
+ EXPECT_EQ(3, op->ValueInputCount());
+ EXPECT_EQ(0, op->EffectInputCount());
+ EXPECT_EQ(0, op->ControlInputCount());
EXPECT_EQ(3, OperatorProperties::GetTotalInputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
+ EXPECT_EQ(1, op->ValueOutputCount());
+ EXPECT_EQ(0, op->EffectOutputCount());
+ EXPECT_EQ(0, op->ControlOutputCount());
}
}
}
TRACED_FOREACH(float, value, kFloatValues) {
const Operator* op = common()->Float32Constant(value);
EXPECT_PRED2(base::bit_equal_to<float>(), value, OpParameter<float>(op));
- EXPECT_EQ(0, OperatorProperties::GetValueInputCount(op));
+ EXPECT_EQ(0, op->ValueInputCount());
EXPECT_EQ(0, OperatorProperties::GetTotalInputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op));
+ EXPECT_EQ(0, op->ControlOutputCount());
+ EXPECT_EQ(0, op->EffectOutputCount());
+ EXPECT_EQ(1, op->ValueOutputCount());
}
TRACED_FOREACH(float, v1, kFloatValues) {
TRACED_FOREACH(float, v2, kFloatValues) {
TRACED_FOREACH(double, value, kFloatValues) {
const Operator* op = common()->Float64Constant(value);
EXPECT_PRED2(base::bit_equal_to<double>(), value, OpParameter<double>(op));
- EXPECT_EQ(0, OperatorProperties::GetValueInputCount(op));
+ EXPECT_EQ(0, op->ValueInputCount());
EXPECT_EQ(0, OperatorProperties::GetTotalInputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op));
+ EXPECT_EQ(0, op->ControlOutputCount());
+ EXPECT_EQ(0, op->EffectOutputCount());
+ EXPECT_EQ(1, op->ValueOutputCount());
}
TRACED_FOREACH(double, v1, kFloatValues) {
TRACED_FOREACH(double, v2, kFloatValues) {
TRACED_FOREACH(double, value, kFloatValues) {
const Operator* op = common()->NumberConstant(value);
EXPECT_PRED2(base::bit_equal_to<double>(), value, OpParameter<double>(op));
- EXPECT_EQ(0, OperatorProperties::GetValueInputCount(op));
+ EXPECT_EQ(0, op->ValueInputCount());
EXPECT_EQ(0, OperatorProperties::GetTotalInputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op));
+ EXPECT_EQ(0, op->ControlOutputCount());
+ EXPECT_EQ(0, op->EffectOutputCount());
+ EXPECT_EQ(1, op->ValueOutputCount());
}
TRACED_FOREACH(double, v1, kFloatValues) {
TRACED_FOREACH(double, v2, kFloatValues) {
TEST_F(CommonOperatorTest, ValueEffect) {
TRACED_FOREACH(int, arguments, kArguments) {
const Operator* op = common()->ValueEffect(arguments);
- EXPECT_EQ(arguments, OperatorProperties::GetValueInputCount(op));
+ EXPECT_EQ(arguments, op->ValueInputCount());
EXPECT_EQ(arguments, OperatorProperties::GetTotalInputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetEffectOutputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetValueOutputCount(op));
+ EXPECT_EQ(0, op->ControlOutputCount());
+ EXPECT_EQ(1, op->EffectOutputCount());
+ EXPECT_EQ(0, op->ValueOutputCount());
}
}
TEST_F(CommonOperatorTest, Finish) {
TRACED_FOREACH(int, arguments, kArguments) {
const Operator* op = common()->Finish(arguments);
- EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op));
- EXPECT_EQ(arguments, OperatorProperties::GetEffectInputCount(op));
+ EXPECT_EQ(1, op->ValueInputCount());
+ EXPECT_EQ(arguments, op->EffectInputCount());
EXPECT_EQ(arguments + 1, OperatorProperties::GetTotalInputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op));
+ EXPECT_EQ(0, op->ControlOutputCount());
+ EXPECT_EQ(0, op->EffectOutputCount());
+ EXPECT_EQ(1, op->ValueOutputCount());
}
}
// TODO(jarin): Get rid of this hack.
const int frame_state_input_count =
FLAG_turbo_deoptimization ? sop.frame_state_input_count : 0;
- EXPECT_EQ(sop.value_input_count, OperatorProperties::GetValueInputCount(op));
+ EXPECT_EQ(sop.value_input_count, op->ValueInputCount());
EXPECT_EQ(context_input_count, OperatorProperties::GetContextInputCount(op));
EXPECT_EQ(frame_state_input_count,
OperatorProperties::GetFrameStateInputCount(op));
- EXPECT_EQ(sop.effect_input_count,
- OperatorProperties::GetEffectInputCount(op));
- EXPECT_EQ(sop.control_input_count,
- OperatorProperties::GetControlInputCount(op));
+ EXPECT_EQ(sop.effect_input_count, op->EffectInputCount());
+ EXPECT_EQ(sop.control_input_count, op->ControlInputCount());
EXPECT_EQ(sop.value_input_count + context_input_count +
frame_state_input_count + sop.effect_input_count +
sop.control_input_count,
OperatorProperties::GetTotalInputCount(op));
- EXPECT_EQ(sop.value_output_count,
- OperatorProperties::GetValueOutputCount(op));
- EXPECT_EQ(sop.effect_output_count,
- OperatorProperties::GetEffectOutputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
+ EXPECT_EQ(sop.value_output_count, op->ValueOutputCount());
+ EXPECT_EQ(sop.effect_output_count, op->EffectOutputCount());
+ EXPECT_EQ(0, op->ControlOutputCount());
}
MachineOperatorBuilder machine(type());
const Operator* op = machine.Load(GetParam());
- EXPECT_EQ(2, OperatorProperties::GetValueInputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetEffectInputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetControlInputCount(op));
+ EXPECT_EQ(2, op->ValueInputCount());
+ EXPECT_EQ(1, op->EffectInputCount());
+ EXPECT_EQ(1, op->ControlInputCount());
EXPECT_EQ(4, OperatorProperties::GetTotalInputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetEffectOutputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
+ EXPECT_EQ(1, op->ValueOutputCount());
+ EXPECT_EQ(1, op->EffectOutputCount());
+ EXPECT_EQ(0, op->ControlOutputCount());
}
MachineOperatorBuilder machine(type());
const Operator* op = machine.Store(GetParam());
- EXPECT_EQ(3, OperatorProperties::GetValueInputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetEffectInputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetControlInputCount(op));
+ EXPECT_EQ(3, op->ValueInputCount());
+ EXPECT_EQ(1, op->EffectInputCount());
+ EXPECT_EQ(1, op->ControlInputCount());
EXPECT_EQ(5, OperatorProperties::GetTotalInputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetValueOutputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetEffectOutputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
+ EXPECT_EQ(0, op->ValueOutputCount());
+ EXPECT_EQ(1, op->EffectOutputCount());
+ EXPECT_EQ(0, op->ControlOutputCount());
}
const PureOperator& pop = GetParam();
const Operator* op = (machine.*pop.constructor)();
- EXPECT_EQ(pop.value_input_count, OperatorProperties::GetValueInputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetEffectInputCount(op));
- EXPECT_EQ(pop.control_input_count,
- OperatorProperties::GetControlInputCount(op));
+ EXPECT_EQ(pop.value_input_count, op->ValueInputCount());
+ EXPECT_EQ(0, op->EffectInputCount());
+ EXPECT_EQ(pop.control_input_count, op->ControlInputCount());
EXPECT_EQ(pop.value_input_count + pop.control_input_count,
OperatorProperties::GetTotalInputCount(op));
- EXPECT_EQ(pop.value_output_count,
- OperatorProperties::GetValueOutputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
+ EXPECT_EQ(pop.value_output_count, op->ValueOutputCount());
+ EXPECT_EQ(0, op->EffectOutputCount());
+ EXPECT_EQ(0, op->ControlOutputCount());
}
const PureOperator& pop = GetParam();
const Operator* op = (simplified.*pop.constructor)();
- EXPECT_EQ(pop.value_input_count, OperatorProperties::GetValueInputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetEffectInputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetControlInputCount(op));
+ EXPECT_EQ(pop.value_input_count, op->ValueInputCount());
+ EXPECT_EQ(0, op->EffectInputCount());
+ EXPECT_EQ(0, op->ControlInputCount());
EXPECT_EQ(pop.value_input_count, OperatorProperties::GetTotalInputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
+ EXPECT_EQ(1, op->ValueOutputCount());
+ EXPECT_EQ(0, op->EffectOutputCount());
+ EXPECT_EQ(0, op->ControlOutputCount());
}
EXPECT_EQ(Operator::kNoThrow | Operator::kNoWrite, op->properties());
EXPECT_EQ(access, ElementAccessOf(op));
- EXPECT_EQ(3, OperatorProperties::GetValueInputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetEffectInputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetControlInputCount(op));
+ EXPECT_EQ(3, op->ValueInputCount());
+ EXPECT_EQ(1, op->EffectInputCount());
+ EXPECT_EQ(0, op->ControlInputCount());
EXPECT_EQ(4, OperatorProperties::GetTotalInputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetEffectOutputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
+ EXPECT_EQ(1, op->ValueOutputCount());
+ EXPECT_EQ(1, op->EffectOutputCount());
+ EXPECT_EQ(0, op->ControlOutputCount());
}
EXPECT_EQ(Operator::kNoRead | Operator::kNoThrow, op->properties());
EXPECT_EQ(access, ElementAccessOf(op));
- EXPECT_EQ(4, OperatorProperties::GetValueInputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetEffectInputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetControlInputCount(op));
+ EXPECT_EQ(4, op->ValueInputCount());
+ EXPECT_EQ(1, op->EffectInputCount());
+ EXPECT_EQ(1, op->ControlInputCount());
EXPECT_EQ(6, OperatorProperties::GetTotalInputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetValueOutputCount(op));
- EXPECT_EQ(1, OperatorProperties::GetEffectOutputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
+ EXPECT_EQ(0, op->ValueOutputCount());
+ EXPECT_EQ(1, op->EffectOutputCount());
+ EXPECT_EQ(0, op->ControlOutputCount());
}