Reviewers: titzer,
Description:
Avoid usage of temporary MachineOperatorBuilder.
[email protected]
Please review this at https://codereview.chromium.org/562203004/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+40, -33 lines):
M src/compiler/ast-graph-builder.cc
M src/compiler/change-lowering.h
M src/compiler/change-lowering.cc
M src/compiler/change-lowering-unittest.cc
M src/compiler/js-typed-lowering.h
M src/compiler/machine-operator-reducer.h
M src/compiler/machine-operator-reducer.cc
M src/compiler/pipeline.cc
M src/compiler/representation-change.h
M src/compiler/simplified-lowering.h
M src/compiler/simplified-lowering.cc
M src/compiler/simplified-operator-reducer.h
M src/compiler/simplified-operator-reducer.cc
M src/compiler/simplified-operator-reducer-unittest.cc
M test/cctest/compiler/test-changes-lowering.cc
M test/cctest/compiler/test-representation-change.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
1877a681154fa5b047d26a70c15e5a319e9f58cf..8d2a9bf29bd567ba10a835b9e29e49e1944ef927
100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -1931,9 +1931,8 @@ Node*
AstGraphBuilder::BuildVariableAssignment(Variable* variable, Node* value,
Node* AstGraphBuilder::BuildLoadObjectField(Node* object, int offset) {
// TODO(sigurds) Use simplified load here once it is ready.
- MachineOperatorBuilder machine;
- Node* field_load = NewNode(machine.Load(kMachAnyTagged), object,
- jsgraph_->Int32Constant(offset -
kHeapObjectTag));
+ Node* field_load = NewNode(jsgraph()->machine()->Load(kMachAnyTagged),
object,
+ jsgraph()->Int32Constant(offset -
kHeapObjectTag));
return field_load;
}
Index: src/compiler/change-lowering-unittest.cc
diff --git a/src/compiler/change-lowering-unittest.cc
b/src/compiler/change-lowering-unittest.cc
index
769198afcf6bedccd498813fbd913563a39f3af5..994027a83caed7ce5263d43b6e1907c1ff994132
100644
--- a/src/compiler/change-lowering-unittest.cc
+++ b/src/compiler/change-lowering-unittest.cc
@@ -79,7 +79,7 @@ class ChangeLoweringTest : public GraphTest {
JSGraph jsgraph(graph(), common(), &javascript, &typer, &machine);
CompilationInfo info(isolate(), zone());
Linkage linkage(&info);
- ChangeLowering reducer(&jsgraph, &linkage, &machine);
+ ChangeLowering reducer(&jsgraph, &linkage);
return reducer.Reduce(node);
}
Index: src/compiler/change-lowering.cc
diff --git a/src/compiler/change-lowering.cc
b/src/compiler/change-lowering.cc
index
a885cf1e957a674f8dfb67c1e26f5d5285c5544f..b13db4cee9fec0e6d2bf9a02ccd88b2fd95b9f1f
100644
--- a/src/compiler/change-lowering.cc
+++ b/src/compiler/change-lowering.cc
@@ -246,6 +246,11 @@ CommonOperatorBuilder* ChangeLowering::common() const {
return jsgraph()->common();
}
+
+MachineOperatorBuilder* ChangeLowering::machine() const {
+ return jsgraph()->machine();
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
Index: src/compiler/change-lowering.h
diff --git a/src/compiler/change-lowering.h b/src/compiler/change-lowering.h
index
661d7bd619d5264c3f8eaf0eec39ec9a3f0dbff8..9f01febb9119ab8108ebe7244db55f3574b3a502
100644
--- a/src/compiler/change-lowering.h
+++ b/src/compiler/change-lowering.h
@@ -19,9 +19,8 @@ class MachineOperatorBuilder;
class ChangeLowering FINAL : public Reducer {
public:
- ChangeLowering(JSGraph* jsgraph, Linkage* linkage,
- MachineOperatorBuilder* machine)
- : jsgraph_(jsgraph), linkage_(linkage), machine_(machine) {}
+ ChangeLowering(JSGraph* jsgraph, Linkage* linkage)
+ : jsgraph_(jsgraph), linkage_(linkage) {}
virtual ~ChangeLowering();
virtual Reduction Reduce(Node* node) OVERRIDE;
@@ -50,11 +49,10 @@ class ChangeLowering FINAL : public Reducer {
JSGraph* jsgraph() const { return jsgraph_; }
Linkage* linkage() const { return linkage_; }
CommonOperatorBuilder* common() const;
- MachineOperatorBuilder* machine() const { return machine_; }
+ MachineOperatorBuilder* machine() const;
JSGraph* jsgraph_;
Linkage* linkage_;
- MachineOperatorBuilder* machine_;
};
} // namespace compiler
Index: src/compiler/js-typed-lowering.h
diff --git a/src/compiler/js-typed-lowering.h
b/src/compiler/js-typed-lowering.h
index
4a10092fa86a1ce294e4ee544c59bccf8cceeaff..2700fcf695de2e1bb273fe4381081b62311dfec3
100644
--- a/src/compiler/js-typed-lowering.h
+++ b/src/compiler/js-typed-lowering.h
@@ -51,11 +51,10 @@ class JSTypedLowering FINAL : public Reducer {
JSOperatorBuilder* javascript() { return jsgraph_->javascript(); }
CommonOperatorBuilder* common() { return jsgraph_->common(); }
SimplifiedOperatorBuilder* simplified() { return &simplified_; }
- MachineOperatorBuilder* machine() { return &machine_; }
+ MachineOperatorBuilder* machine() { return jsgraph_->machine(); }
JSGraph* jsgraph_;
SimplifiedOperatorBuilder simplified_;
- MachineOperatorBuilder machine_;
};
} // namespace compiler
Index: src/compiler/machine-operator-reducer.cc
diff --git a/src/compiler/machine-operator-reducer.cc
b/src/compiler/machine-operator-reducer.cc
index
a873fa2beeec9a0ba1068610c0fe2df8bbbcfa0e..936deca8b636deb3e1121cfb9cb360c6a23fc842
100644
--- a/src/compiler/machine-operator-reducer.cc
+++ b/src/compiler/machine-operator-reducer.cc
@@ -477,6 +477,11 @@ CommonOperatorBuilder*
MachineOperatorReducer::common() const {
}
+MachineOperatorBuilder* MachineOperatorReducer::machine() const {
+ return jsgraph()->machine();
+}
+
+
Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); }
} // namespace compiler
Index: src/compiler/machine-operator-reducer.h
diff --git a/src/compiler/machine-operator-reducer.h
b/src/compiler/machine-operator-reducer.h
index
509f5db62ac4af5a8dbc10e1843cb40c477c5a0f..57fcdee8e06a19177a55fd03af6e4833959efc7b
100644
--- a/src/compiler/machine-operator-reducer.h
+++ b/src/compiler/machine-operator-reducer.h
@@ -47,10 +47,9 @@ class MachineOperatorReducer FINAL : public Reducer {
Graph* graph() const;
JSGraph* jsgraph() const { return jsgraph_; }
CommonOperatorBuilder* common() const;
- MachineOperatorBuilder* machine() { return &machine_; }
+ MachineOperatorBuilder* machine() const;
JSGraph* jsgraph_;
- MachineOperatorBuilder machine_;
};
} // namespace compiler
Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index
5b6cf0928a826944de355f27e2b939737f269897..72f2093328facd81a8f93f2d098c781d341b4da6
100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -259,8 +259,8 @@ Handle<Code> Pipeline::GenerateCode() {
SourcePosition::Unknown());
Linkage linkage(info());
ValueNumberingReducer vn_reducer(zone());
- SimplifiedOperatorReducer simple_reducer(&jsgraph, &machine);
- ChangeLowering lowering(&jsgraph, &linkage, &machine);
+ SimplifiedOperatorReducer simple_reducer(&jsgraph);
+ ChangeLowering lowering(&jsgraph, &linkage);
MachineOperatorReducer mach_reducer(&jsgraph);
GraphReducer graph_reducer(&graph);
// TODO(titzer): Figure out if we should run all reducers at once
here.
Index: src/compiler/representation-change.h
diff --git a/src/compiler/representation-change.h
b/src/compiler/representation-change.h
index
98bcbbfb9211bb69b4c81d5730234bf6106018b1..3c6dcbac888ddf17336ef451da1675d5b5a88ad0
100644
--- a/src/compiler/representation-change.h
+++ b/src/compiler/representation-change.h
@@ -21,10 +21,9 @@ namespace compiler {
class RepresentationChanger {
public:
RepresentationChanger(JSGraph* jsgraph, SimplifiedOperatorBuilder*
simplified,
- MachineOperatorBuilder* machine, Isolate* isolate)
+ Isolate* isolate)
: jsgraph_(jsgraph),
simplified_(simplified),
- machine_(machine),
isolate_(isolate),
testing_type_errors_(false),
type_error_(false) {}
@@ -309,7 +308,6 @@ class RepresentationChanger {
private:
JSGraph* jsgraph_;
SimplifiedOperatorBuilder* simplified_;
- MachineOperatorBuilder* machine_;
Isolate* isolate_;
friend class RepresentationChangerTester; // accesses the below fields.
@@ -339,7 +337,7 @@ class RepresentationChanger {
JSGraph* jsgraph() { return jsgraph_; }
Isolate* isolate() { return isolate_; }
SimplifiedOperatorBuilder* simplified() { return simplified_; }
- MachineOperatorBuilder* machine() { return machine_; }
+ MachineOperatorBuilder* machine() { return jsgraph()->machine(); }
};
}
}
Index: src/compiler/simplified-lowering.cc
diff --git a/src/compiler/simplified-lowering.cc
b/src/compiler/simplified-lowering.cc
index
88cd1253b134f35f29d36ce38dae5e0ff91695fb..d1f2ee3bd1ec142819a2d4de28f31724851c21de
100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -764,7 +764,7 @@ Node* SimplifiedLowering::IsTagged(Node* node) {
void SimplifiedLowering::LowerAllNodes() {
SimplifiedOperatorBuilder simplified(graph()->zone());
- RepresentationChanger changer(jsgraph(), &simplified, machine(),
+ RepresentationChanger changer(jsgraph(), &simplified,
graph()->zone()->isolate());
RepresentationSelector selector(jsgraph(), zone(), &changer);
selector.Run(this);
@@ -805,7 +805,7 @@ static WriteBarrierKind
ComputeWriteBarrierKind(BaseTaggedness base_is_tagged,
void SimplifiedLowering::DoLoadField(Node* node) {
const FieldAccess& access = FieldAccessOf(node->op());
- node->set_op(machine_.Load(access.machine_type));
+ node->set_op(machine()->Load(access.machine_type));
Node* offset = jsgraph()->Int32Constant(access.offset - access.tag());
node->InsertInput(zone(), 1, offset);
}
@@ -815,7 +815,8 @@ void SimplifiedLowering::DoStoreField(Node* node) {
const FieldAccess& access = FieldAccessOf(node->op());
WriteBarrierKind kind = ComputeWriteBarrierKind(
access.base_is_tagged, access.machine_type, access.type);
- node->set_op(machine_.Store(StoreRepresentation(access.machine_type,
kind)));
+ node->set_op(
+ machine()->Store(StoreRepresentation(access.machine_type, kind)));
Node* offset = jsgraph()->Int32Constant(access.offset - access.tag());
node->InsertInput(zone(), 1, offset);
}
@@ -837,7 +838,7 @@ Node* SimplifiedLowering::ComputeIndex(const
ElementAccess& access,
void SimplifiedLowering::DoLoadElement(Node* node) {
const ElementAccess& access = ElementAccessOf(node->op());
- node->set_op(machine_.Load(access.machine_type));
+ node->set_op(machine()->Load(access.machine_type));
node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1)));
}
@@ -846,7 +847,8 @@ void SimplifiedLowering::DoStoreElement(Node* node) {
const ElementAccess& access = ElementAccessOf(node->op());
WriteBarrierKind kind = ComputeWriteBarrierKind(
access.base_is_tagged, access.machine_type, access.type);
- node->set_op(machine_.Store(StoreRepresentation(access.machine_type,
kind)));
+ node->set_op(
+ machine()->Store(StoreRepresentation(access.machine_type, kind)));
node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1)));
}
Index: src/compiler/simplified-lowering.h
diff --git a/src/compiler/simplified-lowering.h
b/src/compiler/simplified-lowering.h
index
9e83fdf652ee8c0c11e405fc994622c6648506e6..2ba7e3bd88b469199a096ecd1f2d8c467a1171f5
100644
--- a/src/compiler/simplified-lowering.h
+++ b/src/compiler/simplified-lowering.h
@@ -33,7 +33,6 @@ class SimplifiedLowering {
private:
JSGraph* jsgraph_;
- MachineOperatorBuilder machine_;
Node* SmiTag(Node* node);
Node* IsTagged(Node* node);
@@ -48,7 +47,7 @@ class SimplifiedLowering {
JSGraph* jsgraph() { return jsgraph_; }
Graph* graph() { return jsgraph()->graph(); }
CommonOperatorBuilder* common() { return jsgraph()->common(); }
- MachineOperatorBuilder* machine() { return &machine_; }
+ MachineOperatorBuilder* machine() { return jsgraph()->machine(); }
};
} // namespace compiler
Index: src/compiler/simplified-operator-reducer-unittest.cc
diff --git a/src/compiler/simplified-operator-reducer-unittest.cc
b/src/compiler/simplified-operator-reducer-unittest.cc
index
c5744d3fc1ae8075846b684b1419c0f0b49569ce..739264ed432d60c41e0436ee666d33b6227f0f95
100644
--- a/src/compiler/simplified-operator-reducer-unittest.cc
+++ b/src/compiler/simplified-operator-reducer-unittest.cc
@@ -25,7 +25,7 @@ class SimplifiedOperatorReducerTest : public GraphTest {
MachineOperatorBuilder machine;
JSOperatorBuilder javascript(zone());
JSGraph jsgraph(graph(), common(), &javascript, &typer, &machine);
- SimplifiedOperatorReducer reducer(&jsgraph, &machine);
+ SimplifiedOperatorReducer reducer(&jsgraph);
return reducer.Reduce(node);
}
Index: src/compiler/simplified-operator-reducer.cc
diff --git a/src/compiler/simplified-operator-reducer.cc
b/src/compiler/simplified-operator-reducer.cc
index
4dde2482b239ac3bc27626d04ad2872add193c66..f6181ea988ffca2e432ce7afd0847578ace1e8e2
100644
--- a/src/compiler/simplified-operator-reducer.cc
+++ b/src/compiler/simplified-operator-reducer.cc
@@ -137,6 +137,11 @@ Factory* SimplifiedOperatorReducer::factory() const {
return jsgraph()->isolate()->factory();
}
+
+MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const {
+ return jsgraph()->machine();
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
Index: src/compiler/simplified-operator-reducer.h
diff --git a/src/compiler/simplified-operator-reducer.h
b/src/compiler/simplified-operator-reducer.h
index
5932ed0309330efa0d8d6549dbda1debf931435d..32f49adc56e79b922ca6182ca38f47fe488ece63
100644
--- a/src/compiler/simplified-operator-reducer.h
+++ b/src/compiler/simplified-operator-reducer.h
@@ -21,8 +21,7 @@ class MachineOperatorBuilder;
class SimplifiedOperatorReducer FINAL : public Reducer {
public:
- SimplifiedOperatorReducer(JSGraph* jsgraph, MachineOperatorBuilder*
machine)
- : jsgraph_(jsgraph), machine_(machine) {}
+ explicit SimplifiedOperatorReducer(JSGraph* jsgraph) : jsgraph_(jsgraph)
{}
virtual ~SimplifiedOperatorReducer();
virtual Reduction Reduce(Node* node) OVERRIDE;
@@ -40,10 +39,9 @@ class SimplifiedOperatorReducer FINAL : public Reducer {
Graph* graph() const;
Factory* factory() const;
JSGraph* jsgraph() const { return jsgraph_; }
- MachineOperatorBuilder* machine() const { return machine_; }
+ MachineOperatorBuilder* machine() const;
JSGraph* jsgraph_;
- MachineOperatorBuilder* machine_;
DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorReducer);
};
Index: test/cctest/compiler/test-changes-lowering.cc
diff --git a/test/cctest/compiler/test-changes-lowering.cc
b/test/cctest/compiler/test-changes-lowering.cc
index
63b2973237c5e580b4f9e813fb833d166dc47a08..b91d5834eb2d38a41a6e05edf9e2d96cec884e96
100644
--- a/test/cctest/compiler/test-changes-lowering.cc
+++ b/test/cctest/compiler/test-changes-lowering.cc
@@ -149,7 +149,7 @@ class ChangesLoweringTester : public
GraphBuilderTester<ReturnType> {
// Run the graph reducer with changes lowering on a single node.
CompilationInfo info(this->isolate(), this->zone());
Linkage linkage(&info);
- ChangeLowering lowering(&jsgraph, &linkage, this->machine());
+ ChangeLowering lowering(&jsgraph, &linkage);
GraphReducer reducer(this->graph());
reducer.AddReducer(&lowering);
reducer.ReduceNode(change);
Index: test/cctest/compiler/test-representation-change.cc
diff --git a/test/cctest/compiler/test-representation-change.cc
b/test/cctest/compiler/test-representation-change.cc
index
36da572b4aaa99c32a42fc764429d6cfa6213972..9c55a802c2c924961b3b034e4f21e4a3ad4d658d
100644
--- a/test/cctest/compiler/test-representation-change.cc
+++ b/test/cctest/compiler/test-representation-change.cc
@@ -28,7 +28,7 @@ class RepresentationChangerTester : public
HandleAndZoneScope,
javascript_(main_zone()),
jsgraph_(main_graph_, &main_common_, &javascript_, &typer_,
&main_machine_),
- changer_(&jsgraph_, &main_simplified_, &main_machine_,
main_isolate()) {
+ changer_(&jsgraph_, &main_simplified_, main_isolate()) {
Node* s = graph()->NewNode(common()->Start(num_parameters));
graph()->SetStart(s);
}
--
--
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.