[turbofan] LoadElement should not have a control input.

TEST=unittests
R=dcarney@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#24935}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24935 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
bmeurer@chromium.org 2014-10-28 13:00:11 +00:00
parent 1881cee691
commit 2c78a23c56
8 changed files with 27 additions and 39 deletions

View File

@ -614,11 +614,10 @@ Reduction JSTypedLowering::ReduceJSLoadProperty(Node* node) {
bit_cast<intptr_t>(elements->external_pointer()));
Node* length = jsgraph()->Constant(byte_length / array->element_size());
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
Node* load = graph()->NewNode(
simplified()->LoadElement(
AccessBuilder::ForTypedArrayElement(type, true)),
pointer, key, length, effect, control);
pointer, key, length, effect);
return ReplaceEagerly(node, load);
}
}

View File

@ -122,7 +122,6 @@ inline int OperatorProperties::GetControlInputCount(const Operator* op) {
case IrOpcode::kPhi:
case IrOpcode::kEffectPhi:
case IrOpcode::kLoad:
case IrOpcode::kLoadElement:
case IrOpcode::kLoadField:
return 1;
#define OPCODE_CASE(x) case IrOpcode::k##x:

View File

@ -1079,23 +1079,23 @@ void SimplifiedLowering::DoLoadElement(Node* node, MachineType output_type) {
const ElementAccess& access = ElementAccessOf(node->op());
const Operator* op = machine()->Load(access.machine_type);
Node* key = node->InputAt(1);
Node* effect = node->InputAt(3);
Node* index = ComputeIndex(access, key);
if (access.bounds_check == kNoBoundsCheck) {
DCHECK_EQ(access.machine_type, output_type);
node->set_op(op);
node->ReplaceInput(1, index);
node->RemoveInput(2);
node->ReplaceInput(2, effect);
node->ReplaceInput(3, graph()->start());
} else {
DCHECK_EQ(kTypedArrayBoundsCheck, access.bounds_check);
Node* base = node->InputAt(0);
Node* length = node->InputAt(2);
Node* effect = node->InputAt(3);
Node* control = node->InputAt(4);
Node* check = graph()->NewNode(machine()->Uint32LessThan(), key, length);
Node* branch =
graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), check,
graph()->start());
Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
Node* load = graph()->NewNode(op, base, index, effect, if_true);

View File

@ -143,7 +143,7 @@ TEST_F(JSTypedLoweringTest, JSLoadPropertyFromExternalTypedArray) {
IsLoadElement(AccessBuilder::ForTypedArrayElement(type, true),
IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])),
key, IsNumberConstant(static_cast<double>(kLength)),
effect, control));
effect));
}
}

View File

@ -403,15 +403,13 @@ class IsLoadElementMatcher FINAL : public NodeMatcher {
const Matcher<Node*>& base_matcher,
const Matcher<Node*>& index_matcher,
const Matcher<Node*>& length_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher)
const Matcher<Node*>& effect_matcher)
: NodeMatcher(IrOpcode::kLoadElement),
access_matcher_(access_matcher),
base_matcher_(base_matcher),
index_matcher_(index_matcher),
length_matcher_(length_matcher),
effect_matcher_(effect_matcher),
control_matcher_(control_matcher) {}
effect_matcher_(effect_matcher) {}
virtual void DescribeTo(std::ostream* os) const OVERRIDE {
NodeMatcher::DescribeTo(os);
@ -423,10 +421,8 @@ class IsLoadElementMatcher FINAL : public NodeMatcher {
index_matcher_.DescribeTo(os);
*os << "), length (";
length_matcher_.DescribeTo(os);
*os << "), effect (";
*os << ") and effect (";
effect_matcher_.DescribeTo(os);
*os << ") and control (";
control_matcher_.DescribeTo(os);
*os << ")";
}
@ -442,9 +438,7 @@ class IsLoadElementMatcher FINAL : public NodeMatcher {
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
"length", length_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
effect_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
"control", control_matcher_, listener));
effect_matcher_, listener));
}
private:
@ -453,7 +447,6 @@ class IsLoadElementMatcher FINAL : public NodeMatcher {
const Matcher<Node*> index_matcher_;
const Matcher<Node*> length_matcher_;
const Matcher<Node*> effect_matcher_;
const Matcher<Node*> control_matcher_;
};
@ -813,11 +806,10 @@ Matcher<Node*> IsLoadElement(const Matcher<ElementAccess>& access_matcher,
const Matcher<Node*>& base_matcher,
const Matcher<Node*>& index_matcher,
const Matcher<Node*>& length_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher) {
const Matcher<Node*>& effect_matcher) {
return MakeMatcher(new IsLoadElementMatcher(access_matcher, base_matcher,
index_matcher, length_matcher,
effect_matcher, control_matcher));
effect_matcher));
}

View File

@ -77,8 +77,7 @@ Matcher<Node*> IsLoadElement(const Matcher<ElementAccess>& access_matcher,
const Matcher<Node*>& base_matcher,
const Matcher<Node*>& index_matcher,
const Matcher<Node*>& length_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher);
const Matcher<Node*>& effect_matcher);
Matcher<Node*> IsStoreElement(const Matcher<ElementAccess>& access_matcher,
const Matcher<Node*>& base_matcher,
const Matcher<Node*>& index_matcher,

View File

@ -490,46 +490,45 @@ TEST_F(SimplifiedOperatorReducerTest, LoadElementWithConstantKeyAndLength) {
access_nocheck.bounds_check = kNoBoundsCheck;
Node* const base = Parameter(0);
Node* const effect = graph()->start();
Node* const control = graph()->start();
{
Node* const key = NumberConstant(-42.0);
Node* const length = NumberConstant(100.0);
Reduction r = Reduce(graph()->NewNode(simplified()->LoadElement(access),
base, key, length, effect, control));
base, key, length, effect));
ASSERT_FALSE(r.Changed());
}
{
Node* const key = NumberConstant(-0.0);
Node* const length = NumberConstant(1.0);
Reduction r = Reduce(graph()->NewNode(simplified()->LoadElement(access),
base, key, length, effect, control));
base, key, length, effect));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsLoadElement(access_nocheck, base, key,
length, effect, control));
EXPECT_THAT(r.replacement(),
IsLoadElement(access_nocheck, base, key, length, effect));
}
{
Node* const key = NumberConstant(0);
Node* const length = NumberConstant(1);
Reduction r = Reduce(graph()->NewNode(simplified()->LoadElement(access),
base, key, length, effect, control));
base, key, length, effect));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsLoadElement(access_nocheck, base, key,
length, effect, control));
EXPECT_THAT(r.replacement(),
IsLoadElement(access_nocheck, base, key, length, effect));
}
{
Node* const key = NumberConstant(42.2);
Node* const length = NumberConstant(128);
Reduction r = Reduce(graph()->NewNode(simplified()->LoadElement(access),
base, key, length, effect, control));
base, key, length, effect));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsLoadElement(access_nocheck, base, key,
length, effect, control));
EXPECT_THAT(r.replacement(),
IsLoadElement(access_nocheck, base, key, length, effect));
}
{
Node* const key = NumberConstant(39.2);
Node* const length = NumberConstant(32.0);
Reduction r = Reduce(graph()->NewNode(simplified()->LoadElement(access),
base, key, length, effect, control));
base, key, length, effect));
ASSERT_FALSE(r.Changed());
}
}

View File

@ -177,8 +177,8 @@ TEST_P(SimplifiedElementAccessOperatorTest, LoadElement) {
EXPECT_EQ(3, OperatorProperties::GetValueInputCount(op));
EXPECT_EQ(1, OperatorProperties::GetEffectInputCount(op));
EXPECT_EQ(1, OperatorProperties::GetControlInputCount(op));
EXPECT_EQ(5, OperatorProperties::GetTotalInputCount(op));
EXPECT_EQ(0, OperatorProperties::GetControlInputCount(op));
EXPECT_EQ(4, OperatorProperties::GetTotalInputCount(op));
EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op));
EXPECT_EQ(1, OperatorProperties::GetEffectOutputCount(op));