Commit 5cefb367 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[turbofan] Turn LoadElimination into an AdvancedReducer.

This in turn allows usage of AdvancedReducer::ReplaceWithValue which
has access to the underlying graph reducer.

R=titzer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28817}
parent 050e8880
......@@ -36,7 +36,7 @@ Reduction LoadElimination::ReduceLoadField(Node* node) {
if (object == NodeProperties::GetValueInput(effect, 0) &&
access == FieldAccessOf(effect->op())) {
Node* const value = effect;
NodeProperties::ReplaceWithValue(node, value);
ReplaceWithValue(node, value);
return Replace(value);
}
break;
......@@ -45,7 +45,7 @@ Reduction LoadElimination::ReduceLoadField(Node* node) {
if (access == FieldAccessOf(effect->op())) {
if (object == NodeProperties::GetValueInput(effect, 0)) {
Node* const value = NodeProperties::GetValueInput(effect, 1);
NodeProperties::ReplaceWithValue(node, value);
ReplaceWithValue(node, value);
return Replace(value);
}
// TODO(turbofan): Alias analysis to the rescue?
......
......@@ -11,9 +11,9 @@ namespace v8 {
namespace internal {
namespace compiler {
class LoadElimination final : public Reducer {
class LoadElimination final : public AdvancedReducer {
public:
LoadElimination() {}
explicit LoadElimination(Editor* editor) : AdvancedReducer(editor) {}
~LoadElimination() final;
Reduction Reduce(Node* node) final;
......
......@@ -569,7 +569,7 @@ struct TypedLoweringPhase {
void Run(PipelineData* data, Zone* temp_zone) {
JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
LoadElimination load_elimination;
LoadElimination load_elimination(&graph_reducer);
JSBuiltinReducer builtin_reducer(&graph_reducer, data->jsgraph());
JSTypedLowering typed_lowering(&graph_reducer, data->jsgraph(), temp_zone);
JSIntrinsicLowering intrinsic_lowering(
......
......@@ -19,7 +19,9 @@ class LoadEliminationTest : public GraphTest {
protected:
Reduction Reduce(Node* node) {
LoadElimination reducer;
// TODO(titzer): mock the GraphReducer here for better unit testing.
GraphReducer graph_reducer(zone(), graph());
LoadElimination reducer(&graph_reducer);
return reducer.Reduce(node);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment