Revision: 24359
Author: [email protected]
Date: Wed Oct 1 11:08:37 2014 UTC
Log: [turbofan] Add control input to Load and LoadElements.
Also remove the now obsolete ControlEffect operator.
TEST=cctest,mjsunit,unittests
[email protected]
Review URL: https://codereview.chromium.org/620803003
https://code.google.com/p/v8/source/detail?r=24359
Modified:
/branches/bleeding_edge/src/compiler/ast-graph-builder.cc
/branches/bleeding_edge/src/compiler/change-lowering.cc
/branches/bleeding_edge/src/compiler/common-operator.cc
/branches/bleeding_edge/src/compiler/common-operator.h
/branches/bleeding_edge/src/compiler/js-generic-lowering.cc
/branches/bleeding_edge/src/compiler/js-typed-lowering.cc
/branches/bleeding_edge/src/compiler/opcodes.h
/branches/bleeding_edge/src/compiler/operator-properties-inl.h
/branches/bleeding_edge/src/compiler/simplified-lowering.cc
/branches/bleeding_edge/src/compiler/typer.cc
/branches/bleeding_edge/test/cctest/compiler/test-changes-lowering.cc
/branches/bleeding_edge/test/cctest/compiler/test-simplified-lowering.cc
/branches/bleeding_edge/test/unittests/compiler/change-lowering-unittest.cc
/branches/bleeding_edge/test/unittests/compiler/common-operator-unittest.cc
/branches/bleeding_edge/test/unittests/compiler/graph-unittest.cc
/branches/bleeding_edge/test/unittests/compiler/graph-unittest.h
/branches/bleeding_edge/test/unittests/compiler/machine-operator-unittest.cc
/branches/bleeding_edge/test/unittests/compiler/simplified-operator-unittest.cc
=======================================
--- /branches/bleeding_edge/src/compiler/ast-graph-builder.cc Tue Sep 30
10:42:44 2014 UTC
+++ /branches/bleeding_edge/src/compiler/ast-graph-builder.cc Wed Oct 1
11:08:37 2014 UTC
@@ -1975,7 +1975,6 @@
Node* AstGraphBuilder::BuildLoadObjectField(Node* object, int offset) {
- // TODO(sigurds) Use simplified load here once it is ready.
Node* field_load = NewNode(jsgraph()->machine()->Load(kMachAnyTagged),
object,
jsgraph()->Int32Constant(offset -
kHeapObjectTag));
return field_load;
=======================================
--- /branches/bleeding_edge/src/compiler/change-lowering.cc Tue Sep 30
10:42:44 2014 UTC
+++ /branches/bleeding_edge/src/compiler/change-lowering.cc Wed Oct 1
11:08:37 2014 UTC
@@ -97,8 +97,8 @@
Node* ChangeLowering::LoadHeapNumberValue(Node* value, Node* control) {
return graph()->NewNode(machine()->Load(kMachFloat64), value,
- HeapNumberValueIndexConstant(),
- graph()->NewNode(common()->ControlEffect(),
control));
+ HeapNumberValueIndexConstant(), graph()->start(),
+ control);
}
=======================================
--- /branches/bleeding_edge/src/compiler/common-operator.cc Tue Sep 30
12:49:25 2014 UTC
+++ /branches/bleeding_edge/src/compiler/common-operator.cc Wed Oct 1
11:08:37 2014 UTC
@@ -75,13 +75,6 @@
Name##Operator k##Name##Operator;
SHARED_OP_LIST(SHARED)
#undef SHARED
-
- struct ControlEffectOperator FINAL : public SimpleOperator {
- ControlEffectOperator()
- : SimpleOperator(IrOpcode::kControlEffect, Operator::kPure, 0, 0,
- "ControlEffect") {}
- };
- ControlEffectOperator kControlEffectOperator;
};
@@ -187,11 +180,6 @@
return new (zone()) Operator1<int>(IrOpcode::kEffectPhi,
Operator::kPure, 0,
0, "EffectPhi", arguments);
}
-
-
-const Operator* CommonOperatorBuilder::ControlEffect() {
- return &impl_.kControlEffectOperator;
-}
const Operator* CommonOperatorBuilder::ValueEffect(int arguments) {
=======================================
--- /branches/bleeding_edge/src/compiler/common-operator.h Tue Sep 30
10:29:32 2014 UTC
+++ /branches/bleeding_edge/src/compiler/common-operator.h Wed Oct 1
11:08:37 2014 UTC
@@ -111,7 +111,6 @@
const Operator* Phi(MachineType type, int arguments);
const Operator* EffectPhi(int arguments);
- const Operator* ControlEffect();
const Operator* ValueEffect(int arguments);
const Operator* Finish(int arguments);
const Operator* StateValues(int arguments);
=======================================
--- /branches/bleeding_edge/src/compiler/js-generic-lowering.cc Wed Oct 1
10:54:51 2014 UTC
+++ /branches/bleeding_edge/src/compiler/js-generic-lowering.cc Wed Oct 1
11:08:37 2014 UTC
@@ -328,33 +328,30 @@
void JSGenericLowering::LowerJSLoadContext(Node* node) {
const ContextAccess& access = ContextAccessOf(node->op());
- // TODO(mstarzinger): Use simplified operators instead of machine
operators
- // here so that load/store optimization can be applied afterwards.
for (size_t i = 0; i < access.depth(); ++i) {
node->ReplaceInput(
0, graph()->NewNode(
machine()->Load(kMachAnyTagged),
NodeProperties::GetValueInput(node, 0),
Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)),
- NodeProperties::GetEffectInput(node)));
+ NodeProperties::GetEffectInput(node), graph()->start()));
}
node->ReplaceInput(
1,
Int32Constant(Context::SlotOffset(static_cast<int>(access.index()))));
+ node->AppendInput(zone(), graph()->start());
PatchOperator(node, machine()->Load(kMachAnyTagged));
}
void JSGenericLowering::LowerJSStoreContext(Node* node) {
const ContextAccess& access = ContextAccessOf(node->op());
- // TODO(mstarzinger): Use simplified operators instead of machine
operators
- // here so that load/store optimization can be applied afterwards.
for (size_t i = 0; i < access.depth(); ++i) {
node->ReplaceInput(
0, graph()->NewNode(
machine()->Load(kMachAnyTagged),
NodeProperties::GetValueInput(node, 0),
Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)),
- NodeProperties::GetEffectInput(node)));
+ NodeProperties::GetEffectInput(node), graph()->start()));
}
node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1));
node->ReplaceInput(
=======================================
--- /branches/bleeding_edge/src/compiler/js-typed-lowering.cc Wed Oct 1
07:42:54 2014 UTC
+++ /branches/bleeding_edge/src/compiler/js-typed-lowering.cc Wed Oct 1
11:08:37 2014 UTC
@@ -557,10 +557,10 @@
DCHECK(IsFixedTypedArrayElementsKind(elements_kind));
element_access = AccessBuilder::ForTypedArrayElement(type, false);
}
- Node* value =
- graph()->NewNode(simplified()->LoadElement(element_access),
elements,
- key, jsgraph()->Uint32Constant(length),
- NodeProperties::GetEffectInput(node));
+ Node* value = graph()->NewNode(
+ simplified()->LoadElement(element_access), elements, key,
+ jsgraph()->Uint32Constant(length),
NodeProperties::GetEffectInput(node),
+ NodeProperties::GetControlInput(node));
return ReplaceEagerly(node, value);
}
return NoChange();
=======================================
--- /branches/bleeding_edge/src/compiler/opcodes.h Wed Oct 1 10:39:11 2014
UTC
+++ /branches/bleeding_edge/src/compiler/opcodes.h Wed Oct 1 11:08:37 2014
UTC
@@ -34,7 +34,6 @@
#define INNER_OP_LIST(V) \
V(Phi) \
V(EffectPhi) \
- V(ControlEffect) \
V(ValueEffect) \
V(Finish) \
V(FrameState) \
=======================================
--- /branches/bleeding_edge/src/compiler/operator-properties-inl.h Tue Sep
30 10:42:44 2014 UTC
+++ /branches/bleeding_edge/src/compiler/operator-properties-inl.h Wed Oct
1 11:08:37 2014 UTC
@@ -116,7 +116,8 @@
switch (op->opcode()) {
case IrOpcode::kPhi:
case IrOpcode::kEffectPhi:
- case IrOpcode::kControlEffect:
+ case IrOpcode::kLoad:
+ case IrOpcode::kLoadElement:
return 1;
#define OPCODE_CASE(x) case IrOpcode::k##x:
CONTROL_OP_LIST(OPCODE_CASE)
@@ -149,7 +150,6 @@
inline bool OperatorProperties::HasEffectOutput(const Operator* op) {
return op->opcode() == IrOpcode::kStart ||
- op->opcode() == IrOpcode::kControlEffect ||
op->opcode() == IrOpcode::kValueEffect ||
(op->opcode() != IrOpcode::kFinish && GetEffectInputCount(op) >
0);
}
=======================================
--- /branches/bleeding_edge/src/compiler/simplified-lowering.cc Wed Oct 1
10:39:11 2014 UTC
+++ /branches/bleeding_edge/src/compiler/simplified-lowering.cc Wed Oct 1
11:08:37 2014 UTC
@@ -841,6 +841,7 @@
node->set_op(machine()->Load(access.machine_type));
Node* offset = jsgraph()->Int32Constant(access.offset - access.tag());
node->InsertInput(zone(), 1, offset);
+ node->AppendInput(zone(), graph()->start());
}
=======================================
--- /branches/bleeding_edge/src/compiler/typer.cc Tue Sep 30 10:42:44 2014
UTC
+++ /branches/bleeding_edge/src/compiler/typer.cc Wed Oct 1 11:08:37 2014
UTC
@@ -307,12 +307,6 @@
UNREACHABLE();
return Bounds();
}
-
-
-Bounds Typer::Visitor::TypeControlEffect(Node* node) {
- UNREACHABLE();
- return Bounds();
-}
Bounds Typer::Visitor::TypeValueEffect(Node* node) {
=======================================
--- /branches/bleeding_edge/test/cctest/compiler/test-changes-lowering.cc
Wed Sep 17 12:34:46 2014 UTC
+++ /branches/bleeding_edge/test/cctest/compiler/test-changes-lowering.cc
Wed Oct 1 11:08:37 2014 UTC
@@ -132,9 +132,9 @@
void* location) {
// We build a graph by hand here, because the raw machine assembler
// does not add the correct control and effect nodes.
- Node* load =
- this->graph()->NewNode(load_op, this->PointerConstant(location),
- this->Int32Constant(0), this->start());
+ Node* load = this->graph()->NewNode(
+ load_op, this->PointerConstant(location), this->Int32Constant(0),
+ this->start(), this->start());
Node* change = this->graph()->NewNode(op, load);
Node* ret = this->graph()->NewNode(this->common()->Return(), change,
this->start(), this->start());
=======================================
---
/branches/bleeding_edge/test/cctest/compiler/test-simplified-lowering.cc
Wed Oct 1 07:42:54 2014 UTC
+++
/branches/bleeding_edge/test/cctest/compiler/test-simplified-lowering.cc
Wed Oct 1 11:08:37 2014 UTC
@@ -1355,7 +1355,7 @@
Node* load =
t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0, t.p1,
- t.jsgraph.Int32Constant(1024), t.start);
+ t.jsgraph.Int32Constant(1024), t.start,
t.start);
Node* use = t.Use(load, machine_reps[i]);
t.Return(use);
t.Lower();
@@ -1405,7 +1405,7 @@
kMachAnyTagged};
Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access),
t.p0,
- t.p1, t.p2, t.start);
+ t.p1, t.p2, t.start, t.start);
t.Return(load);
t.Lower();
CHECK_EQ(IrOpcode::kLoad, load->opcode());
@@ -1445,7 +1445,7 @@
kMachFloat64};
Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access),
t.p0,
- t.p1, t.p1, t.start);
+ t.p1, t.p1, t.start, t.start);
t.Return(load);
t.Lower();
CHECK_EQ(IrOpcode::kLoad, load->opcode());
=======================================
---
/branches/bleeding_edge/test/unittests/compiler/change-lowering-unittest.cc
Wed Oct 1 08:34:25 2014 UTC
+++
/branches/bleeding_edge/test/unittests/compiler/change-lowering-unittest.cc
Wed Oct 1 11:08:37 2014 UTC
@@ -87,6 +87,12 @@
IsInt32Constant(0), IsNumberConstant(0.0), effect_matcher,
control_matcher);
}
+ Matcher<Node*> IsLoadHeapNumber(const Matcher<Node*>& value_matcher,
+ const Matcher<Node*>& control_matcher) {
+ return IsLoad(kMachFloat64, value_matcher,
+ IsInt32Constant(HeapNumberValueOffset()),
graph()->start(),
+ control_matcher);
+ }
Matcher<Node*> IsWordEqual(const Matcher<Node*>& lhs_matcher,
const Matcher<Node*>& rhs_matcher) {
return Is32() ? IsWord32Equal(lhs_matcher, rhs_matcher)
@@ -226,9 +232,7 @@
EXPECT_THAT(
phi,
IsPhi(
- kMachFloat64,
- IsLoad(kMachFloat64, val,
IsInt32Constant(HeapNumberValueOffset()),
- IsControlEffect(CaptureEq(&if_true))),
+ kMachFloat64, IsLoadHeapNumber(val, CaptureEq(&if_true)),
IsChangeInt32ToFloat64(
IsWord32Sar(val, IsInt32Constant(SmiShiftAmount()))),
IsMerge(
@@ -255,9 +259,7 @@
EXPECT_THAT(
phi,
IsPhi(kMachInt32,
- IsChangeFloat64ToInt32(IsLoad(
- kMachFloat64, val,
IsInt32Constant(HeapNumberValueOffset()),
- IsControlEffect(CaptureEq(&if_true)))),
+ IsChangeFloat64ToInt32(IsLoadHeapNumber(val,
CaptureEq(&if_true))),
IsWord32Sar(val, IsInt32Constant(SmiShiftAmount())),
IsMerge(AllOf(CaptureEq(&if_true),
IsIfTrue(CaptureEq(&branch))),
IsIfFalse(AllOf(
@@ -281,9 +283,7 @@
EXPECT_THAT(
phi,
IsPhi(kMachUint32,
- IsChangeFloat64ToUint32(IsLoad(
- kMachFloat64, val,
IsInt32Constant(HeapNumberValueOffset()),
- IsControlEffect(CaptureEq(&if_true)))),
+ IsChangeFloat64ToUint32(IsLoadHeapNumber(val,
CaptureEq(&if_true))),
IsWord32Sar(val, IsInt32Constant(SmiShiftAmount())),
IsMerge(AllOf(CaptureEq(&if_true),
IsIfTrue(CaptureEq(&branch))),
IsIfFalse(AllOf(
@@ -363,9 +363,7 @@
EXPECT_THAT(
phi,
IsPhi(
- kMachFloat64,
- IsLoad(kMachFloat64, val,
IsInt32Constant(HeapNumberValueOffset()),
- IsControlEffect(CaptureEq(&if_true))),
+ kMachFloat64, IsLoadHeapNumber(val, CaptureEq(&if_true)),
IsChangeInt32ToFloat64(IsTruncateInt64ToInt32(
IsWord64Sar(val, IsInt32Constant(SmiShiftAmount())))),
IsMerge(
@@ -392,9 +390,7 @@
EXPECT_THAT(
phi,
IsPhi(kMachInt32,
- IsChangeFloat64ToInt32(IsLoad(
- kMachFloat64, val,
IsInt32Constant(HeapNumberValueOffset()),
- IsControlEffect(CaptureEq(&if_true)))),
+ IsChangeFloat64ToInt32(IsLoadHeapNumber(val,
CaptureEq(&if_true))),
IsTruncateInt64ToInt32(
IsWord64Sar(val, IsInt32Constant(SmiShiftAmount()))),
IsMerge(AllOf(CaptureEq(&if_true),
IsIfTrue(CaptureEq(&branch))),
@@ -419,9 +415,7 @@
EXPECT_THAT(
phi,
IsPhi(kMachUint32,
- IsChangeFloat64ToUint32(IsLoad(
- kMachFloat64, val,
IsInt32Constant(HeapNumberValueOffset()),
- IsControlEffect(CaptureEq(&if_true)))),
+ IsChangeFloat64ToUint32(IsLoadHeapNumber(val,
CaptureEq(&if_true))),
IsTruncateInt64ToInt32(
IsWord64Sar(val, IsInt32Constant(SmiShiftAmount()))),
IsMerge(AllOf(CaptureEq(&if_true),
IsIfTrue(CaptureEq(&branch))),
=======================================
---
/branches/bleeding_edge/test/unittests/compiler/common-operator-unittest.cc
Wed Oct 1 08:34:25 2014 UTC
+++
/branches/bleeding_edge/test/unittests/compiler/common-operator-unittest.cc
Wed Oct 1 11:08:37 2014 UTC
@@ -51,8 +51,7 @@
SHARED(IfTrue, Operator::kFoldable, 0, 0, 1, 0, 1),
SHARED(IfFalse, Operator::kFoldable, 0, 0, 1, 0, 1),
SHARED(Throw, Operator::kFoldable, 1, 0, 1, 0, 1),
- SHARED(Return, Operator::kNoProperties, 1, 1, 1, 1, 1),
- SHARED(ControlEffect, Operator::kPure, 0, 0, 1, 1, 0)
+ SHARED(Return, Operator::kNoProperties, 1, 1, 1, 1, 1)
#undef SHARED
};
=======================================
--- /branches/bleeding_edge/test/unittests/compiler/graph-unittest.cc Wed
Oct 1 08:34:25 2014 UTC
+++ /branches/bleeding_edge/test/unittests/compiler/graph-unittest.cc Wed
Oct 1 11:08:37 2014 UTC
@@ -435,12 +435,14 @@
IsLoadMatcher(const Matcher<LoadRepresentation>& rep_matcher,
const Matcher<Node*>& base_matcher,
const Matcher<Node*>& index_matcher,
- const Matcher<Node*>& effect_matcher)
+ const Matcher<Node*>& effect_matcher,
+ const Matcher<Node*>& control_matcher)
: NodeMatcher(IrOpcode::kLoad),
rep_matcher_(rep_matcher),
base_matcher_(base_matcher),
index_matcher_(index_matcher),
- effect_matcher_(effect_matcher) {}
+ effect_matcher_(effect_matcher),
+ control_matcher_(control_matcher) {}
virtual void DescribeTo(std::ostream* os) const OVERRIDE {
NodeMatcher::DescribeTo(os);
@@ -450,8 +452,10 @@
base_matcher_.DescribeTo(os);
*os << "), index (";
index_matcher_.DescribeTo(os);
- *os << ") and effect (";
+ *os << "), effect (";
effect_matcher_.DescribeTo(os);
+ *os << ") and control (";
+ control_matcher_.DescribeTo(os);
*os << ")";
}
@@ -465,7 +469,9 @@
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
"index", index_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
- effect_matcher_, listener));
+ effect_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetControlInput(node),
+ "control", control_matcher_, listener));
}
private:
@@ -473,6 +479,7 @@
const Matcher<Node*> base_matcher_;
const Matcher<Node*> index_matcher_;
const Matcher<Node*> effect_matcher_;
+ const Matcher<Node*> control_matcher_;
};
@@ -623,12 +630,6 @@
return MakeMatcher(
new IsControl1Matcher(IrOpcode::kIfFalse, control_matcher));
}
-
-
-Matcher<Node*> IsControlEffect(const Matcher<Node*>& control_matcher) {
- return MakeMatcher(
- new IsControl1Matcher(IrOpcode::kControlEffect, control_matcher));
-}
Matcher<Node*> IsValueEffect(const Matcher<Node*>& value_matcher) {
@@ -717,9 +718,10 @@
Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher,
const Matcher<Node*>& base_matcher,
const Matcher<Node*>& index_matcher,
- const Matcher<Node*>& effect_matcher) {
+ const Matcher<Node*>& effect_matcher,
+ const Matcher<Node*>& control_matcher) {
return MakeMatcher(new IsLoadMatcher(rep_matcher, base_matcher,
index_matcher,
- effect_matcher));
+ effect_matcher, control_matcher));
}
=======================================
--- /branches/bleeding_edge/test/unittests/compiler/graph-unittest.h Wed
Oct 1 08:34:25 2014 UTC
+++ /branches/bleeding_edge/test/unittests/compiler/graph-unittest.h Wed
Oct 1 11:08:37 2014 UTC
@@ -58,7 +58,6 @@
const Matcher<Node*>& control1_matcher);
Matcher<Node*> IsIfTrue(const Matcher<Node*>& control_matcher);
Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher);
-Matcher<Node*> IsControlEffect(const Matcher<Node*>& control_matcher);
Matcher<Node*> IsValueEffect(const Matcher<Node*>& value_matcher);
Matcher<Node*> IsFinish(const Matcher<Node*>& value_matcher,
const Matcher<Node*>& effect_matcher);
@@ -93,7 +92,8 @@
Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher,
const Matcher<Node*>& base_matcher,
const Matcher<Node*>& index_matcher,
- const Matcher<Node*>& effect_matcher);
+ const Matcher<Node*>& effect_matcher,
+ const Matcher<Node*>& control_matcher);
Matcher<Node*> IsStore(const Matcher<MachineType>& type_matcher,
const Matcher<WriteBarrierKind>&
write_barrier_matcher,
const Matcher<Node*>& base_matcher,
=======================================
---
/branches/bleeding_edge/test/unittests/compiler/machine-operator-unittest.cc
Wed Oct 1 10:39:11 2014 UTC
+++
/branches/bleeding_edge/test/unittests/compiler/machine-operator-unittest.cc
Wed Oct 1 11:08:37 2014 UTC
@@ -59,8 +59,8 @@
EXPECT_EQ(2, OperatorProperties::GetValueInputCount(op));
EXPECT_EQ(1, OperatorProperties::GetEffectInputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetControlInputCount(op));
- EXPECT_EQ(3, OperatorProperties::GetTotalInputCount(op));
+ EXPECT_EQ(1, OperatorProperties::GetControlInputCount(op));
+ EXPECT_EQ(4, OperatorProperties::GetTotalInputCount(op));
EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op));
EXPECT_EQ(1, OperatorProperties::GetEffectOutputCount(op));
=======================================
---
/branches/bleeding_edge/test/unittests/compiler/simplified-operator-unittest.cc
Wed Oct 1 08:34:25 2014 UTC
+++
/branches/bleeding_edge/test/unittests/compiler/simplified-operator-unittest.cc
Wed Oct 1 11:08:37 2014 UTC
@@ -177,8 +177,8 @@
EXPECT_EQ(3, OperatorProperties::GetValueInputCount(op));
EXPECT_EQ(1, OperatorProperties::GetEffectInputCount(op));
- EXPECT_EQ(0, OperatorProperties::GetControlInputCount(op));
- EXPECT_EQ(4, OperatorProperties::GetTotalInputCount(op));
+ EXPECT_EQ(1, OperatorProperties::GetControlInputCount(op));
+ EXPECT_EQ(5, OperatorProperties::GetTotalInputCount(op));
EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op));
EXPECT_EQ(1, OperatorProperties::GetEffectOutputCount(op));
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.