diff --git a/src/compiler/control-reducer.cc b/src/compiler/control-reducer.cc index b06076457e..89b05d0c07 100644 --- a/src/compiler/control-reducer.cc +++ b/src/compiler/control-reducer.cc @@ -306,7 +306,7 @@ class ControlReducerImpl { // 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) { diff --git a/src/compiler/graph-builder.cc b/src/compiler/graph-builder.cc index e10efb1b57..2ca068835f 100644 --- a/src/compiler/graph-builder.cc +++ b/src/compiler/graph-builder.cc @@ -49,11 +49,11 @@ Node* StructuredGraphBuilder::MakeNode(const Operator* op, 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) { @@ -86,7 +86,7 @@ Node* StructuredGraphBuilder::MakeNode(const Operator* op, if (has_effect) { environment_->UpdateEffectDependency(result); } - if (OperatorProperties::HasControlOutput(result->op()) && + if (result->op()->ControlOutputCount() > 0 && !environment()->IsMarkedAsUnreachable()) { environment_->UpdateControlDependency(result); } @@ -209,7 +209,7 @@ Node* StructuredGraphBuilder::NewEffectPhi(int count, Node* input, 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); @@ -232,7 +232,7 @@ Node* StructuredGraphBuilder::MergeControl(Node* control, Node* other) { 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. @@ -249,7 +249,7 @@ Node* StructuredGraphBuilder::MergeEffect(Node* value, Node* other, 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. diff --git a/src/compiler/graph-replay.cc b/src/compiler/graph-replay.cc index 494d4313fe..0109adc987 100644 --- a/src/compiler/graph-replay.cc +++ b/src/compiler/graph-replay.cc @@ -63,11 +63,11 @@ void GraphReplayPrinter::PrintReplayOpCreator(const Operator* op) { 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; diff --git a/src/compiler/graph-visualizer.cc b/src/compiler/graph-visualizer.cc index 31256ec389..67b933f14e 100644 --- a/src/compiler/graph-visualizer.cc +++ b/src/compiler/graph-visualizer.cc @@ -191,7 +191,7 @@ class GraphVisualizer : public NullNodeVisitor { 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; @@ -259,8 +259,7 @@ void GraphVisualizer::AnnotateNode(Node* node) { 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)->id(); } for (int j = OperatorProperties::GetContextInputCount(node->op()); j > 0; @@ -271,15 +270,13 @@ void GraphVisualizer::AnnotateNode(Node* node) { ++i, j--) { os_ << "|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_ << "|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_ << "|C #" << (*i)->id(); } } @@ -307,7 +304,7 @@ void GraphVisualizer::PrintEdge(Node::Edge edge) { 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, " : "") @@ -515,14 +512,13 @@ void GraphC1Visualizer::PrintInputs(InputIter* i, int count, 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:"); } diff --git a/src/compiler/instruction-selector.cc b/src/compiler/instruction-selector.cc index 70ab500108..22da0b51c3 100644 --- a/src/compiler/instruction-selector.cc +++ b/src/compiler/instruction-selector.cc @@ -278,7 +278,7 @@ void InstructionSelector::InitializeCallBuffer(Node* call, CallBuffer* buffer, DCHECK_EQ(call->op()->OutputCount(), static_cast(buffer->descriptor->ReturnCount())); DCHECK_EQ( - OperatorProperties::GetValueInputCount(call->op()), + call->op()->ValueInputCount(), static_cast(buffer->input_count() + buffer->frame_state_count())); if (buffer->descriptor->ReturnCount() > 0) { diff --git a/src/compiler/js-builtin-reducer.cc b/src/compiler/js-builtin-reducer.cc index ec73742fd2..b40288d5a9 100644 --- a/src/compiler/js-builtin-reducer.cc +++ b/src/compiler/js-builtin-reducer.cc @@ -80,7 +80,7 @@ class JSCallReduction { 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) { diff --git a/src/compiler/js-inlining.cc b/src/compiler/js-inlining.cc index 587d3ae1c7..58fc858734 100644 --- a/src/compiler/js-inlining.cc +++ b/src/compiler/js-inlining.cc @@ -119,8 +119,7 @@ void Inlinee::UnifyReturn(JSGraph* jsgraph) { } 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); @@ -245,7 +244,7 @@ void Inlinee::InlineAtCall(JSGraph* jsgraph, Node* call) { int inlinee_context_index = static_cast(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()) { @@ -308,7 +307,7 @@ class JSCallFunctionAccessor { 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; } @@ -441,7 +440,7 @@ class JSCallRuntimeAccessor { } size_t formal_arguments() { - size_t value_inputs = OperatorProperties::GetValueInputCount(call_->op()); + size_t value_inputs = call_->op()->ValueInputCount(); return value_inputs; } diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc index 535e585f40..970e31394a 100644 --- a/src/compiler/js-typed-lowering.cc +++ b/src/compiler/js-typed-lowering.cc @@ -84,13 +84,13 @@ class JSBinopReduction { // 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. @@ -677,7 +677,7 @@ Reduction JSTypedLowering::Reduce(Node* node) { 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, ...? diff --git a/src/compiler/node-properties-inl.h b/src/compiler/node-properties-inl.h index 78baf4d142..541c302e70 100644 --- a/src/compiler/node-properties-inl.h +++ b/src/compiler/node-properties-inl.h @@ -44,8 +44,7 @@ inline int NodeProperties::FirstControlIndex(Node* node) { 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) { @@ -59,13 +58,11 @@ inline int NodeProperties::PastFrameStateIndex(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(); } @@ -73,8 +70,7 @@ inline int NodeProperties::PastControlIndex(Node* node) { // 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); } @@ -89,14 +85,12 @@ inline Node* NodeProperties::GetFrameStateInput(Node* node) { } 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); } @@ -119,7 +113,7 @@ inline bool NodeProperties::IsInputRange(Node::Edge edge, int first, int num) { 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) { @@ -131,13 +125,13 @@ 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()); } @@ -158,7 +152,7 @@ inline void NodeProperties::ReplaceControlInput(Node* node, Node* control) { 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); } @@ -169,7 +163,7 @@ inline void NodeProperties::ReplaceFrameStateInput(Node* node, } inline void NodeProperties::RemoveNonValueInputs(Node* node) { - node->TrimInputCount(OperatorProperties::GetValueInputCount(node->op())); + node->TrimInputCount(node->op()->ValueInputCount()); } @@ -177,8 +171,8 @@ inline void NodeProperties::RemoveNonValueInputs(Node* node) { // {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); } @@ -215,7 +209,7 @@ inline void NodeProperties::SetBounds(Node* node, Bounds b) { } 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; } diff --git a/src/compiler/node.cc b/src/compiler/node.cc index fb4ef846ab..28be39986b 100644 --- a/src/compiler/node.cc +++ b/src/compiler/node.cc @@ -44,7 +44,7 @@ Node* Node::FindProjection(size_t projection_index) { 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 << ", "; diff --git a/src/compiler/operator-properties-inl.h b/src/compiler/operator-properties-inl.h index 409e4f00df..f958e74790 100644 --- a/src/compiler/operator-properties-inl.h +++ b/src/compiler/operator-properties-inl.h @@ -15,23 +15,11 @@ namespace v8 { 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(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; @@ -93,10 +81,6 @@ inline bool OperatorProperties::HasFrameStateInput(const Operator* op) { } } -inline int OperatorProperties::GetValueInputCount(const Operator* op) { - return op->ValueInputCount(); -} - inline int OperatorProperties::GetContextInputCount(const Operator* op) { return OperatorProperties::HasContextInput(op) ? 1 : 0; } @@ -105,49 +89,15 @@ inline int OperatorProperties::GetFrameStateInputCount(const Operator* op) { 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 || diff --git a/src/compiler/operator-properties.h b/src/compiler/operator-properties.h index 718eea0e2a..70186c9af9 100644 --- a/src/compiler/operator-properties.h +++ b/src/compiler/operator-properties.h @@ -13,27 +13,13 @@ class Operator; 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); }; diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc index ea691f95a8..cd11f1a6b7 100644 --- a/src/compiler/simplified-lowering.cc +++ b/src/compiler/simplified-lowering.cc @@ -239,20 +239,17 @@ class RepresentationSelector { // {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); @@ -434,7 +431,7 @@ class RepresentationSelector { static_cast(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. diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc index 45004af18d..994a6384fd 100644 --- a/src/compiler/typer.cc +++ b/src/compiler/typer.cc @@ -252,8 +252,7 @@ class Typer::RunVisitor : public Typer::Visitor { 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. @@ -271,7 +270,7 @@ class Typer::NarrowVisitor : public Typer::Visitor { 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())); @@ -295,7 +294,7 @@ class Typer::WidenVisitor : public Typer::Visitor { 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); @@ -340,7 +339,7 @@ void Typer::Narrow(Node* start) { 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); @@ -541,7 +540,7 @@ Bounds Typer::Visitor::TypeSelect(Node* 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()); diff --git a/src/compiler/verifier.cc b/src/compiler/verifier.cc index 013613de9a..1f573b1a79 100644 --- a/src/compiler/verifier.cc +++ b/src/compiler/verifier.cc @@ -121,12 +121,12 @@ class Verifier::Visitor : public NullNodeVisitor { 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 + @@ -147,7 +147,7 @@ GenericGraphVisit::Control Verifier::Visitor::Pre(Node* node) { // 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)); } @@ -155,7 +155,7 @@ GenericGraphVisit::Control Verifier::Visitor::Pre(Node* 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)); } @@ -163,7 +163,7 @@ GenericGraphVisit::Control Verifier::Visitor::Pre(Node* 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)); } @@ -171,13 +171,13 @@ GenericGraphVisit::Control Verifier::Visitor::Pre(Node* 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()) || @@ -196,9 +196,9 @@ GenericGraphVisit::Control Verifier::Visitor::Pre(Node* node) { 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; @@ -261,7 +261,7 @@ GenericGraphVisit::Control Verifier::Visitor::Pre(Node* node) { int index = OpParameter(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; @@ -303,7 +303,7 @@ GenericGraphVisit::Control Verifier::Visitor::Pre(Node* node) { // Projection has an input that produces enough values. int index = static_cast(OpParameter(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. @@ -321,8 +321,7 @@ GenericGraphVisit::Control Verifier::Visitor::Pre(Node* node) { 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. @@ -340,8 +339,7 @@ GenericGraphVisit::Control Verifier::Visitor::Pre(Node* node) { 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; } @@ -777,8 +775,7 @@ static bool Dominates(Schedule* schedule, Node* dominator, Node* dominatee) { 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); @@ -796,7 +793,7 @@ static void CheckInputsDominate(Schedule* schedule, BasicBlock* block, // 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)) { @@ -951,8 +948,7 @@ void ScheduleVerifier::Run(Schedule* schedule) { 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); diff --git a/test/cctest/compiler/simplified-graph-builder.cc b/test/cctest/compiler/simplified-graph-builder.cc index 03a7887671..8d6844f28e 100644 --- a/test/cctest/compiler/simplified-graph-builder.cc +++ b/test/cctest/compiler/simplified-graph-builder.cc @@ -50,11 +50,11 @@ Node* SimplifiedGraphBuilder::MakeNode(const Operator* op, 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) { diff --git a/test/cctest/compiler/test-control-reducer.cc b/test/cctest/compiler/test-control-reducer.cc index dc80cc383f..58437c5fd1 100644 --- a/test/cctest/compiler/test-control-reducer.cc +++ b/test/cctest/compiler/test-control-reducer.cc @@ -37,7 +37,7 @@ static int CheckMerge(Node* node, Node* i0 = NULL, Node* i1 = NULL, 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; } @@ -46,7 +46,7 @@ static int CheckLoop(Node* node, Node* i0 = NULL, Node* i1 = NULL, 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; } @@ -792,7 +792,7 @@ TEST(CMergeReduce_edit_effect_phi1) { 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)); @@ -885,7 +885,7 @@ TEST(CMergeReduce_exhaustive_4) { 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()); } } @@ -1274,8 +1274,8 @@ TEST(CNonTermLoop_terminate1) { 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); } @@ -1299,8 +1299,8 @@ TEST(CNonTermLoop_terminate2) { 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); @@ -1322,14 +1322,14 @@ TEST(CNonTermLoop_terminate_m1) { 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)); } diff --git a/test/cctest/compiler/test-js-typed-lowering.cc b/test/cctest/compiler/test-js-typed-lowering.cc index 8a78c9386e..28cc90a33e 100644 --- a/test/cctest/compiler/test-js-typed-lowering.cc +++ b/test/cctest/compiler/test-js-typed-lowering.cc @@ -867,9 +867,9 @@ class BinopEffectsTester { 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; } diff --git a/test/unittests/compiler/common-operator-unittest.cc b/test/unittests/compiler/common-operator-unittest.cc index 269049e034..2c88c4bbd7 100644 --- a/test/unittests/compiler/common-operator-unittest.cc +++ b/test/unittests/compiler/common-operator-unittest.cc @@ -75,20 +75,16 @@ TEST_P(CommonSharedOperatorTest, NumberOfInputsAndOutputs) { 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()); } @@ -169,13 +165,13 @@ TEST_F(CommonOperatorTest, Branch) { 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()); } } @@ -192,13 +188,13 @@ TEST_F(CommonOperatorTest, Select) { 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()); } } } @@ -208,11 +204,11 @@ TEST_F(CommonOperatorTest, Float32Constant) { TRACED_FOREACH(float, value, kFloatValues) { const Operator* op = common()->Float32Constant(value); EXPECT_PRED2(base::bit_equal_to(), value, OpParameter(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) { @@ -229,11 +225,11 @@ TEST_F(CommonOperatorTest, Float64Constant) { TRACED_FOREACH(double, value, kFloatValues) { const Operator* op = common()->Float64Constant(value); EXPECT_PRED2(base::bit_equal_to(), value, OpParameter(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) { @@ -250,11 +246,11 @@ TEST_F(CommonOperatorTest, NumberConstant) { TRACED_FOREACH(double, value, kFloatValues) { const Operator* op = common()->NumberConstant(value); EXPECT_PRED2(base::bit_equal_to(), value, OpParameter(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) { @@ -270,11 +266,11 @@ TEST_F(CommonOperatorTest, NumberConstant) { 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()); } } @@ -282,12 +278,12 @@ TEST_F(CommonOperatorTest, ValueEffect) { 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()); } } diff --git a/test/unittests/compiler/js-operator-unittest.cc b/test/unittests/compiler/js-operator-unittest.cc index 08fabfd500..31d5a034d2 100644 --- a/test/unittests/compiler/js-operator-unittest.cc +++ b/test/unittests/compiler/js-operator-unittest.cc @@ -106,24 +106,20 @@ TEST_P(JSSharedOperatorTest, NumberOfInputsAndOutputs) { // 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()); } diff --git a/test/unittests/compiler/machine-operator-unittest.cc b/test/unittests/compiler/machine-operator-unittest.cc index 74e55174a4..6e41faa38d 100644 --- a/test/unittests/compiler/machine-operator-unittest.cc +++ b/test/unittests/compiler/machine-operator-unittest.cc @@ -57,14 +57,14 @@ TEST_P(MachineLoadOperatorTest, NumberOfInputsAndOutputs) { 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()); } @@ -115,14 +115,14 @@ TEST_P(MachineStoreOperatorTest, NumberOfInputsAndOutputs) { 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()); } @@ -226,17 +226,15 @@ TEST_P(MachinePureOperatorTest, NumberOfInputsAndOutputs) { 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()); } diff --git a/test/unittests/compiler/simplified-operator-unittest.cc b/test/unittests/compiler/simplified-operator-unittest.cc index dcabc1ac74..031a8974f8 100644 --- a/test/unittests/compiler/simplified-operator-unittest.cc +++ b/test/unittests/compiler/simplified-operator-unittest.cc @@ -83,14 +83,14 @@ TEST_P(SimplifiedPureOperatorTest, NumberOfInputsAndOutputs) { 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()); } @@ -175,14 +175,14 @@ TEST_P(SimplifiedElementAccessOperatorTest, LoadElement) { 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()); } @@ -195,14 +195,14 @@ TEST_P(SimplifiedElementAccessOperatorTest, StoreElement) { 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()); }