Commit 263a96b2 authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

[turbofan] Fix Projection operator parameter type.

R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/549063002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23764 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ccf6c266
......@@ -114,8 +114,9 @@ class CommonOperatorBuilder {
1, "Parameter", index);
}
Operator* Int32Constant(int32_t value) {
return new (zone_) Operator1<int>(IrOpcode::kInt32Constant, Operator::kPure,
0, 1, "Int32Constant", value);
return new (zone_)
Operator1<int32_t>(IrOpcode::kInt32Constant, Operator::kPure, 0, 1,
"Int32Constant", value);
}
Operator* Int64Constant(int64_t value) {
return new (zone_)
......@@ -177,9 +178,9 @@ class CommonOperatorBuilder {
Operator* Call(CallDescriptor* descriptor) {
return new (zone_) CallOperator(descriptor, "Call");
}
Operator* Projection(int index) {
return new (zone_) Operator1<int>(IrOpcode::kProjection, Operator::kPure, 1,
1, "Projection", index);
Operator* Projection(size_t index) {
return new (zone_) Operator1<size_t>(IrOpcode::kProjection, Operator::kPure,
1, 1, "Projection", index);
}
private:
......
......@@ -331,7 +331,7 @@ class IsPhiMatcher FINAL : public NodeMatcher {
class IsProjectionMatcher FINAL : public NodeMatcher {
public:
IsProjectionMatcher(const Matcher<int32_t>& index_matcher,
IsProjectionMatcher(const Matcher<size_t>& index_matcher,
const Matcher<Node*>& base_matcher)
: NodeMatcher(IrOpcode::kProjection),
index_matcher_(index_matcher),
......@@ -349,14 +349,14 @@ class IsProjectionMatcher FINAL : public NodeMatcher {
virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const
OVERRIDE {
return (NodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(OpParameter<int32_t>(node), "index",
PrintMatchAndExplain(OpParameter<size_t>(node), "index",
index_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
base_matcher_, listener));
}
private:
const Matcher<int32_t> index_matcher_;
const Matcher<size_t> index_matcher_;
const Matcher<Node*> base_matcher_;
};
......@@ -685,7 +685,7 @@ Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher,
}
Matcher<Node*> IsProjection(const Matcher<int32_t>& index_matcher,
Matcher<Node*> IsProjection(const Matcher<size_t>& index_matcher,
const Matcher<Node*>& base_matcher) {
return MakeMatcher(new IsProjectionMatcher(index_matcher, base_matcher));
}
......
......@@ -73,7 +73,7 @@ Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher,
const Matcher<Node*>& value0_matcher,
const Matcher<Node*>& value1_matcher,
const Matcher<Node*>& merge_matcher);
Matcher<Node*> IsProjection(const Matcher<int32_t>& index_matcher,
Matcher<Node*> IsProjection(const Matcher<size_t>& index_matcher,
const Matcher<Node*>& base_matcher);
Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher,
const Matcher<Node*>& value0_matcher,
......
......@@ -822,10 +822,10 @@ void InstructionSelector::VisitProjection(Node* node) {
switch (value->opcode()) {
case IrOpcode::kInt32AddWithOverflow:
case IrOpcode::kInt32SubWithOverflow:
if (OpParameter<int>(node) == 0) {
if (OpParameter<size_t>(node) == 0) {
Emit(kArchNop, g.DefineSameAsFirst(node), g.Use(value));
} else {
DCHECK_EQ(1, OpParameter<int>(node));
DCHECK(OpParameter<size_t>(node) == 1u);
MarkAsUsed(value);
}
break;
......@@ -933,7 +933,7 @@ void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch,
case IrOpcode::kProjection:
// Check if this is the overflow output projection of an
// <Operation>WithOverflow node.
if (OpParameter<int>(value) == 1) {
if (OpParameter<size_t>(value) == 1u) {
// We cannot combine the <Operation>WithOverflow with this branch
// unless the 0th projection (the use of the actual value of the
// <Operation> is either NULL, which means there's no use of the
......
......@@ -23,19 +23,18 @@ void Node::CollectProjections(NodeVector* projections) {
}
for (UseIter i = uses().begin(); i != uses().end(); ++i) {
if ((*i)->opcode() != IrOpcode::kProjection) continue;
int32_t index = OpParameter<int32_t>(*i);
DCHECK_GE(index, 0);
DCHECK_LT(index, static_cast<int32_t>(projections->size()));
size_t index = OpParameter<size_t>(*i);
DCHECK_LT(index, projections->size());
DCHECK_EQ(NULL, (*projections)[index]);
(*projections)[index] = *i;
}
}
Node* Node::FindProjection(int32_t projection_index) {
Node* Node::FindProjection(size_t projection_index) {
for (UseIter i = uses().begin(); i != uses().end(); ++i) {
if ((*i)->opcode() == IrOpcode::kProjection &&
OpParameter<int32_t>(*i) == projection_index) {
OpParameter<size_t>(*i) == projection_index) {
return *i;
}
}
......
......@@ -58,7 +58,7 @@ class Node FINAL : public GenericNode<NodeData, Node> {
void Kill();
void CollectProjections(ZoneVector<Node*>* projections);
Node* FindProjection(int32_t projection_index);
Node* FindProjection(size_t projection_index);
};
OStream& operator<<(OStream& os, const Node& n);
......
......@@ -213,9 +213,10 @@ GenericGraphVisit::Control Verifier::Visitor::Pre(Node* node) {
break;
case IrOpcode::kProjection: {
// Projection has an input that produces enough values.
int index = OpParameter<int>(node);
size_t index = OpParameter<size_t>(node);
Node* input = NodeProperties::GetValueInput(node, 0);
CHECK_GT(OperatorProperties::GetValueOutputCount(input->op()), index);
CHECK_GT(OperatorProperties::GetValueOutputCount(input->op()),
static_cast<int>(index));
break;
}
default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment