Reviewers: Benedikt Meurer,
Description:
[turbofan] Introduce DeadValue and DeadEffect operators.
[email protected]
Please review this at https://codereview.chromium.org/1186033006/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+39, -9 lines):
M src/compiler/ast-graph-builder.cc
M src/compiler/common-operator.h
M src/compiler/common-operator.cc
M src/compiler/js-graph.h
M src/compiler/js-graph.cc
M src/compiler/opcodes.h
M src/compiler/pipeline.cc
M src/compiler/typer.cc
M src/compiler/verifier.cc
M test/unittests/compiler/common-operator-unittest.cc
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc
b/src/compiler/ast-graph-builder.cc
index
b1ad32f0dae9fcd7d27563a9e6636bf5afd1f1b3..159536c2e1a8405ae2c8313eb0c467e3dfb67e21
100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -403,7 +403,7 @@ class AstGraphBuilder::FrameStateBeforeAndAfter {
if (count >= 1) {
// Add the frame state for after the operation.
- DCHECK_EQ(IrOpcode::kDead,
+ DCHECK_EQ(IrOpcode::kDeadValue,
NodeProperties::GetFrameStateInput(node, 0)->opcode());
Node* frame_state_after =
@@ -416,7 +416,7 @@ class AstGraphBuilder::FrameStateBeforeAndAfter {
if (count >= 2) {
// Add the frame state for before the operation.
- DCHECK_EQ(IrOpcode::kDead,
+ DCHECK_EQ(IrOpcode::kDeadValue,
NodeProperties::GetFrameStateInput(node, 1)->opcode());
NodeProperties::ReplaceFrameStateInput(node, 1, frame_state_before_);
}
@@ -3759,8 +3759,7 @@ void AstGraphBuilder::PrepareFrameState(Node* node,
BailoutId ast_id,
OutputFrameStateCombine combine) {
if (OperatorProperties::GetFrameStateInputCount(node->op()) > 0) {
DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op()));
-
- DCHECK_EQ(IrOpcode::kDead,
+ DCHECK_EQ(IrOpcode::kDeadValue,
NodeProperties::GetFrameStateInput(node, 0)->opcode());
NodeProperties::ReplaceFrameStateInput(
node, 0, environment()->Checkpoint(ast_id, combine));
@@ -3815,9 +3814,9 @@ Node* AstGraphBuilder::MakeNode(const Operator* op,
int value_input_count,
}
for (int i = 0; i < frame_state_count; i++) {
// The frame state will be inserted later. Here we misuse
- // the {DeadControl} node as a sentinel to be later overwritten
+ // the {DeadValue} node as a sentinel to be later overwritten
// with the real frame state.
- *current_input++ = jsgraph()->DeadControl();
+ *current_input++ = jsgraph()->DeadValue();
}
if (has_effect) {
*current_input++ = environment_->GetEffectDependency();
Index: src/compiler/common-operator.cc
diff --git a/src/compiler/common-operator.cc
b/src/compiler/common-operator.cc
index
a8cfbb3049f3035e5ac6a15bba3abc9bef890481..3af96bd08f2cb9895f6426ea5d8bf96b8866cf8c
100644
--- a/src/compiler/common-operator.cc
+++ b/src/compiler/common-operator.cc
@@ -117,6 +117,8 @@ std::ostream& operator<<(std::ostream& os,
ParameterInfo const& i) {
#define CACHED_OP_LIST(V) \
V(Dead, Operator::kFoldable, 0, 0, 0, 0, 0, 1) \
+ V(DeadValue, Operator::kPure, 0, 0, 0, 1, 0, 0) \
+ V(DeadEffect, Operator::kPure, 0, 0, 0, 0, 1, 0) \
V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
Index: src/compiler/common-operator.h
diff --git a/src/compiler/common-operator.h b/src/compiler/common-operator.h
index
08553bceaa6ec7650d4ba96318c1c87f976f7a56..c3decbd82d71f7f8cca73b9394432a359484fef5
100644
--- a/src/compiler/common-operator.h
+++ b/src/compiler/common-operator.h
@@ -96,7 +96,6 @@ class CommonOperatorBuilder final : public ZoneObject {
public:
explicit CommonOperatorBuilder(Zone* zone);
- const Operator* Dead();
const Operator* End(size_t control_input_count);
const Operator* Branch(BranchHint = BranchHint::kNone);
const Operator* IfTrue();
@@ -111,6 +110,10 @@ class CommonOperatorBuilder final : public ZoneObject {
const Operator* Return();
const Operator* Terminate();
+ const Operator* Dead();
+ const Operator* DeadValue();
+ const Operator* DeadEffect();
+
const Operator* Start(int num_formal_parameters);
const Operator* Loop(int control_input_count);
const Operator* Merge(int control_input_count);
Index: src/compiler/js-graph.cc
diff --git a/src/compiler/js-graph.cc b/src/compiler/js-graph.cc
index
35984b8357b08a6aa5f2c88958605922aee06d43..1414de8f057e569f06ac73c50c33031644d41668
100644
--- a/src/compiler/js-graph.cc
+++ b/src/compiler/js-graph.cc
@@ -203,6 +203,11 @@ Node* JSGraph::EmptyFrameState() {
}
+Node* JSGraph::DeadValue() {
+ return CACHED(kDeadValue, graph()->NewNode(common()->DeadValue()));
+}
+
+
Node* JSGraph::DeadControl() {
return CACHED(kDeadControl, graph()->NewNode(common()->Dead()));
}
Index: src/compiler/js-graph.h
diff --git a/src/compiler/js-graph.h b/src/compiler/js-graph.h
index
dda1277419437389e9dcd46a29e7eedad4f5e2f9..b6b1322f331c9a0c1fd508a7e5245eed61f96ebf
100644
--- a/src/compiler/js-graph.h
+++ b/src/compiler/js-graph.h
@@ -117,7 +117,10 @@ class JSGraph : public ZoneObject {
// cannot deopt.
Node* EmptyFrameState();
- // Create a control node that serves as control dependency for dead
nodes.
+ // Creates a value node that servers as value input for dead nodes.
+ Node* DeadValue();
+
+ // Creates a control node that serves as control dependency for dead
nodes.
Node* DeadControl();
JSOperatorBuilder* javascript() const { return javascript_; }
@@ -142,6 +145,7 @@ class JSGraph : public ZoneObject {
kOneConstant,
kNaNConstant,
kEmptyFrameState,
+ kDeadValue,
kDeadControl,
kNumCachedNodes // Must remain last.
};
Index: src/compiler/opcodes.h
diff --git a/src/compiler/opcodes.h b/src/compiler/opcodes.h
index
fc67e740f6cd149279994de3cdba44873d586a9d..afae7867b4caf701ba3dcd10ea11d602a48ffebc
100644
--- a/src/compiler/opcodes.h
+++ b/src/compiler/opcodes.h
@@ -47,6 +47,8 @@
V(EffectPhi) \
V(ValueEffect) \
V(Finish) \
+ V(DeadValue) \
+ V(DeadEffect) \
V(FrameState) \
V(StateValues) \
V(TypedStateValues) \
Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index
84995be5970643168447e8af529c49bbe6aeadf8..1aa84a8d1ae7b566ffa8e22db9cd8abe8cbe86ce
100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -407,7 +407,7 @@ class SourcePositionWrapper final : public Reducer {
class JSGraphReducer final : public GraphReducer {
public:
JSGraphReducer(JSGraph* jsgraph, Zone* zone)
- : GraphReducer(zone, jsgraph->graph(), jsgraph->TheHoleConstant(),
+ : GraphReducer(zone, jsgraph->graph(), jsgraph->DeadValue(),
jsgraph->DeadControl()) {}
~JSGraphReducer() final {}
};
Index: src/compiler/typer.cc
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc
index
f92de92013249e981d62a5deec48ca9786117f61..5732cc238b20c2d0efe1ade8c2e0c3c7ee8b1463
100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -742,6 +742,17 @@ Bounds Typer::Visitor::TypeFinish(Node* node) {
}
+Bounds Typer::Visitor::TypeDeadValue(Node* node) {
+ return Bounds(Type::None(zone()), Type::Any(zone()));
+}
+
+
+Bounds Typer::Visitor::TypeDeadEffect(Node* node) {
+ UNREACHABLE();
+ return Bounds();
+}
+
+
Bounds Typer::Visitor::TypeFrameState(Node* node) {
// TODO(rossberg): Ideally FrameState wouldn't have a value output.
return Bounds(Type::None(zone()), Type::Internal(zone()));
Index: src/compiler/verifier.cc
diff --git a/src/compiler/verifier.cc b/src/compiler/verifier.cc
index
e678f4e6a5e955e31bf12586e20b0de067c04069..46790eb09837a4bed75d9401426a17594e6c4fdd
100644
--- a/src/compiler/verifier.cc
+++ b/src/compiler/verifier.cc
@@ -193,6 +193,8 @@ void Verifier::Visitor::Check(Node* node) {
CheckNotTyped(node);
break;
case IrOpcode::kDead:
+ case IrOpcode::kDeadValue:
+ case IrOpcode::kDeadEffect:
// Dead is never connected to the graph.
// TODO(mstarzinger): Make the GraphReducer immediately perform
control
// reduction in case control is killed. This will prevent {Dead} from
Index: test/unittests/compiler/common-operator-unittest.cc
diff --git a/test/unittests/compiler/common-operator-unittest.cc
b/test/unittests/compiler/common-operator-unittest.cc
index
26e861c1b67684cb7b8fa040318dd1c20c6dd642..ccea222fa45fc27594fd309de43ef15936ed2e2d
100644
--- a/test/unittests/compiler/common-operator-unittest.cc
+++ b/test/unittests/compiler/common-operator-unittest.cc
@@ -49,6 +49,8 @@ const SharedOperator kSharedOperators[] = {
value_output_count, effect_output_count,
control_output_count \
}
SHARED(Dead, Operator::kFoldable, 0, 0, 0, 0, 0, 1),
+ SHARED(DeadValue, Operator::kPure, 0, 0, 0, 1, 0, 0),
+ SHARED(DeadEffect, Operator::kPure, 0, 0, 0, 0, 1, 0),
SHARED(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1),
SHARED(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1),
SHARED(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1),
--
--
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.