Revision: 23684
Author: [email protected]
Date: Thu Sep 4 10:55:58 2014 UTC
Log: [turbofan] More const-correctness changes.
Also get rid of the DeleteNode and ChangeOperator methods in Graph.
TEST=compiler-unittests,cctest,mjsunit
[email protected]
Review URL: https://codereview.chromium.org/540863002
https://code.google.com/p/v8/source/detail?r=23684
Modified:
/branches/bleeding_edge/src/compiler/graph.cc
/branches/bleeding_edge/src/compiler/graph.h
/branches/bleeding_edge/src/compiler/machine-operator-reducer.cc
/branches/bleeding_edge/src/compiler/simplified-operator-reducer.cc
=======================================
--- /branches/bleeding_edge/src/compiler/graph.cc Wed Sep 3 10:13:21 2014
UTC
+++ /branches/bleeding_edge/src/compiler/graph.cc Thu Sep 4 10:55:58 2014
UTC
@@ -21,7 +21,7 @@
Graph::Graph(Zone* zone) : GenericGraph<Node>(zone), decorators_(zone) {}
-Node* Graph::NewNode(Operator* op, int input_count, Node** inputs) {
+Node* Graph::NewNode(const Operator* op, int input_count, Node** inputs) {
DCHECK_LE(op->InputCount(), input_count);
Node* result = Node::New(this, input_count, inputs);
result->Initialize(op);
@@ -32,21 +32,6 @@
return result;
}
-
-void Graph::ChangeOperator(Node* node, Operator* op) { node->set_op(op); }
-
-
-void Graph::DeleteNode(Node* node) {
-#if DEBUG
- // Nodes can't be deleted if they have uses.
- Node::Uses::iterator use_iterator(node->uses().begin());
- DCHECK(use_iterator == node->uses().end());
-#endif
-
-#if DEBUG
- memset(node, 0xDE, sizeof(Node));
-#endif
-}
-}
-}
-} // namespace v8::internal::compiler
+} // namespace compiler
+} // namespace internal
+} // namespace v8
=======================================
--- /branches/bleeding_edge/src/compiler/graph.h Tue Aug 26 13:09:08 2014
UTC
+++ /branches/bleeding_edge/src/compiler/graph.h Thu Sep 4 10:55:58 2014
UTC
@@ -25,38 +25,35 @@
explicit Graph(Zone* zone);
// Base implementation used by all factory methods.
- Node* NewNode(Operator* op, int input_count, Node** inputs);
+ Node* NewNode(const Operator* op, int input_count, Node** inputs);
// Factories for nodes with static input counts.
- Node* NewNode(Operator* op) {
+ Node* NewNode(const Operator* op) {
return NewNode(op, 0, static_cast<Node**>(NULL));
}
- Node* NewNode(Operator* op, Node* n1) { return NewNode(op, 1, &n1); }
- Node* NewNode(Operator* op, Node* n1, Node* n2) {
+ Node* NewNode(const Operator* op, Node* n1) { return NewNode(op, 1,
&n1); }
+ Node* NewNode(const Operator* op, Node* n1, Node* n2) {
Node* nodes[] = {n1, n2};
return NewNode(op, arraysize(nodes), nodes);
}
- Node* NewNode(Operator* op, Node* n1, Node* n2, Node* n3) {
+ Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3) {
Node* nodes[] = {n1, n2, n3};
return NewNode(op, arraysize(nodes), nodes);
}
- Node* NewNode(Operator* op, Node* n1, Node* n2, Node* n3, Node* n4) {
+ Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node*
n4) {
Node* nodes[] = {n1, n2, n3, n4};
return NewNode(op, arraysize(nodes), nodes);
}
- Node* NewNode(Operator* op, Node* n1, Node* n2, Node* n3, Node* n4,
+ Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4,
Node* n5) {
Node* nodes[] = {n1, n2, n3, n4, n5};
return NewNode(op, arraysize(nodes), nodes);
}
- Node* NewNode(Operator* op, Node* n1, Node* n2, Node* n3, Node* n4,
Node* n5,
- Node* n6) {
+ Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4,
+ Node* n5, Node* n6) {
Node* nodes[] = {n1, n2, n3, n4, n5, n6};
return NewNode(op, arraysize(nodes), nodes);
}
-
- void ChangeOperator(Node* node, Operator* op);
- void DeleteNode(Node* node);
template <class Visitor>
void VisitNodeUsesFrom(Node* node, Visitor* visitor);
@@ -88,8 +85,9 @@
virtual ~GraphDecorator() {}
virtual void Decorate(Node* node) = 0;
};
-}
-}
-} // namespace v8::internal::compiler
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8
#endif // V8_COMPILER_GRAPH_H_
=======================================
--- /branches/bleeding_edge/src/compiler/machine-operator-reducer.cc Tue
Sep 2 05:08:54 2014 UTC
+++ /branches/bleeding_edge/src/compiler/machine-operator-reducer.cc Thu
Sep 4 10:55:58 2014 UTC
@@ -66,7 +66,7 @@
Int32BinopMatcher mrightright(mright.right().node());
if (mrightright.left().Is(32) &&
mrightright.right().node() == mleft.right().node()) {
- graph()->ChangeOperator(node, machine()->Word32Ror());
+ node->set_op(machine()->Word32Ror());
node->ReplaceInput(0, mleft.left().node());
node->ReplaceInput(1, mleft.right().node());
return Changed(node);
@@ -75,7 +75,7 @@
// (x << K) | (x >> (32 - K)) => x ror K
if (mleft.right().IsInRange(0, 31) &&
mright.right().Is(32 - mleft.right().Value())) {
- graph()->ChangeOperator(node, machine()->Word32Ror());
+ node->set_op(machine()->Word32Ror());
node->ReplaceInput(0, mleft.left().node());
node->ReplaceInput(1, mleft.right().node());
return Changed(node);
@@ -91,7 +91,7 @@
Int32BinopMatcher mleftright(mleft.right().node());
if (mleftright.left().Is(32) &&
mleftright.right().node() == mright.right().node()) {
- graph()->ChangeOperator(node, machine()->Word32Ror());
+ node->set_op(machine()->Word32Ror());
node->ReplaceInput(0, mright.left().node());
node->ReplaceInput(1, mright.right().node());
return Changed(node);
@@ -100,7 +100,7 @@
// (x >> (32 - K)) | (x << K) => x ror K
if (mright.right().IsInRange(0, 31) &&
mleft.right().Is(32 - mright.right().Value())) {
- graph()->ChangeOperator(node, machine()->Word32Ror());
+ node->set_op(machine()->Word32Ror());
node->ReplaceInput(0, mright.left().node());
node->ReplaceInput(1, mright.right().node());
return Changed(node);
@@ -193,13 +193,13 @@
return ReplaceInt32(m.left().Value() * m.right().Value());
}
if (m.right().Is(-1)) { // x * -1 => 0 - x
- graph()->ChangeOperator(node, machine()->Int32Sub());
+ node->set_op(machine()->Int32Sub());
node->ReplaceInput(0, Int32Constant(0));
node->ReplaceInput(1, m.left().node());
return Changed(node);
}
if (m.right().IsPowerOf2()) { // x * 2^n => x << n
- graph()->ChangeOperator(node, machine()->Word32Shl());
+ node->set_op(machine()->Word32Shl());
node->ReplaceInput(1,
Int32Constant(WhichPowerOf2(m.right().Value())));
return Changed(node);
}
@@ -217,7 +217,7 @@
return ReplaceInt32(m.left().Value() / m.right().Value());
}
if (m.right().Is(-1)) { // x / -1 => 0 - x
- graph()->ChangeOperator(node, machine()->Int32Sub());
+ node->set_op(machine()->Int32Sub());
node->ReplaceInput(0, Int32Constant(0));
node->ReplaceInput(1, m.left().node());
return Changed(node);
@@ -234,7 +234,7 @@
return ReplaceInt32(m.left().Value() / m.right().Value());
}
if (m.right().IsPowerOf2()) { // x / 2^n => x >> n
- graph()->ChangeOperator(node, machine()->Word32Shr());
+ node->set_op(machine()->Word32Shr());
node->ReplaceInput(1,
Int32Constant(WhichPowerOf2(m.right().Value())));
return Changed(node);
}
@@ -263,7 +263,7 @@
return ReplaceInt32(m.left().Value() % m.right().Value());
}
if (m.right().IsPowerOf2()) { // x % 2^n => x & 2^n-1
- graph()->ChangeOperator(node, machine()->Word32And());
+ node->set_op(machine()->Word32And());
node->ReplaceInput(1, Int32Constant(m.right().Value() - 1));
return Changed(node);
}
=======================================
--- /branches/bleeding_edge/src/compiler/simplified-operator-reducer.cc Thu
Aug 28 13:17:38 2014 UTC
+++ /branches/bleeding_edge/src/compiler/simplified-operator-reducer.cc Thu
Sep 4 10:55:58 2014 UTC
@@ -99,7 +99,7 @@
Reduction SimplifiedOperatorReducer::Change(Node* node, Operator* op,
Node* a) {
- graph()->ChangeOperator(node, op);
+ node->set_op(op);
node->ReplaceInput(0, a);
return Changed(node);
}
--
--
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.