Commit 149c7773 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[compiler] Fix --trace-turbo-reduction in the presence of direct reads

... by unparking the local heap before accessing the handles.

Bug: v8:7790
Change-Id: I0910fd8ad2a1e9cbbf312acb4f26358a09891f0f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2404455Reviewed-by: 's avatarSantiago Aboy Solanes <solanes@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Auto-Submit: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69852}
parent e6f65401
......@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/compiler/graph-reducer.h"
#include <functional>
#include <limits>
#include "src/codegen/tick-counter.h"
#include "src/compiler/graph-reducer.h"
#include "src/compiler/graph.h"
#include "src/compiler/js-heap-broker.h"
#include "src/compiler/node-properties.h"
#include "src/compiler/node.h"
#include "src/compiler/verifier.h"
......@@ -27,14 +29,15 @@ enum class GraphReducer::State : uint8_t {
void Reducer::Finalize() {}
GraphReducer::GraphReducer(Zone* zone, Graph* graph, TickCounter* tick_counter,
Node* dead)
JSHeapBroker* broker, Node* dead)
: graph_(graph),
dead_(dead),
state_(graph, 4),
reducers_(zone),
revisit_(zone),
stack_(zone),
tick_counter_(tick_counter) {
tick_counter_(tick_counter),
broker_(broker) {
if (dead != nullptr) {
NodeProperties::SetType(dead_, Type::None());
}
......@@ -94,6 +97,9 @@ Reduction GraphReducer::Reduce(Node* const node) {
// all the other reducers for this node, as now there may be more
// opportunities for reduction.
if (FLAG_trace_turbo_reduction) {
UnparkedScopeIfNeeded unparked(broker_);
// TODO(neis): Disallow racy handle dereference once we stop
// supporting --no-local-heaps --no-turbo-direct-heap-access.
AllowHandleDereference allow_deref;
StdoutStream{} << "- In-place update of #" << *node << " by reducer "
<< (*i)->reducer_name() << std::endl;
......@@ -104,6 +110,9 @@ Reduction GraphReducer::Reduce(Node* const node) {
} else {
// {node} was replaced by another node.
if (FLAG_trace_turbo_reduction) {
UnparkedScopeIfNeeded unparked(broker_);
// TODO(neis): Disallow racy handle dereference once we stop
// supporting --no-local-heaps --no-turbo-direct-heap-access.
AllowHandleDereference allow_deref;
StdoutStream{} << "- Replacement of #" << *node << " with #"
<< *(reduction.replacement()) << " by reducer "
......
......@@ -17,8 +17,8 @@ class TickCounter;
namespace compiler {
// Forward declarations.
class Graph;
class JSHeapBroker;
class Node;
// NodeIds are identifying numbers for nodes that can be used to index auxiliary
......@@ -136,7 +136,7 @@ class V8_EXPORT_PRIVATE GraphReducer
: public NON_EXPORTED_BASE(AdvancedReducer::Editor) {
public:
GraphReducer(Zone* zone, Graph* graph, TickCounter* tick_counter,
Node* dead = nullptr);
JSHeapBroker* broker, Node* dead = nullptr);
~GraphReducer() override;
Graph* graph() const { return graph_; }
......@@ -189,6 +189,7 @@ class V8_EXPORT_PRIVATE GraphReducer
ZoneQueue<Node*> revisit_;
ZoneStack<NodeState> stack_;
TickCounter* const tick_counter_;
JSHeapBroker* const broker_;
DISALLOW_COPY_AND_ASSIGN(GraphReducer);
};
......
......@@ -442,6 +442,27 @@ class OffHeapBytecodeArray final : public interpreter::AbstractBytecodeArray {
BytecodeArrayRef array_;
};
// Scope that unparks the LocalHeap, if:
// a) We have a JSHeapBroker,
// b) Said JSHeapBroker has a LocalHeap, and
// c) Said LocalHeap has been parked.
// Used, for example, when printing the graph with --trace-turbo with a
// previously parked LocalHeap.
class UnparkedScopeIfNeeded {
public:
explicit UnparkedScopeIfNeeded(JSHeapBroker* broker) {
if (broker != nullptr) {
LocalHeap* local_heap = broker->local_heap();
if (local_heap != nullptr && local_heap->IsParked()) {
unparked_scope.emplace(local_heap);
}
}
}
private:
base::Optional<UnparkedScope> unparked_scope;
};
} // namespace compiler
} // namespace internal
} // namespace v8
......
......@@ -784,27 +784,6 @@ class LocalHeapScope {
OptimizedCompilationInfo* info_;
};
// Scope that unparks the LocalHeap, if:
// a) We have a JSHeapBroker,
// b) Said JSHeapBroker has a LocalHeap, and
// c) Said LocalHeap has been parked.
// Used, for example, when printing the graph with --trace-turbo with a
// previously parked LocalHeap.
class UnparkedScopeIfNeeded {
public:
explicit UnparkedScopeIfNeeded(JSHeapBroker* broker) {
if (broker != nullptr) {
LocalHeap* local_heap = broker->local_heap();
if (local_heap != nullptr && local_heap->IsParked()) {
unparked_scope.emplace(local_heap);
}
}
}
private:
base::Optional<UnparkedScope> unparked_scope;
};
void PrintFunctionSource(OptimizedCompilationInfo* info, Isolate* isolate,
int source_id, Handle<SharedFunctionInfo> shared) {
if (!shared->script().IsUndefined(isolate)) {
......@@ -1440,7 +1419,7 @@ struct InliningPhase {
void Run(PipelineData* data, Zone* temp_zone) {
OptimizedCompilationInfo* info = data->info();
GraphReducer graph_reducer(temp_zone, data->graph(), &info->tick_counter(),
data->jsgraph()->Dead());
data->broker(), data->jsgraph()->Dead());
DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
data->common(), temp_zone);
CheckpointElimination checkpoint_elimination(&graph_reducer);
......@@ -1539,7 +1518,7 @@ struct UntyperPhase {
}
GraphReducer graph_reducer(temp_zone, data->graph(),
&data->info()->tick_counter(),
&data->info()->tick_counter(), data->broker(),
data->jsgraph()->Dead());
RemoveTypeReducer remove_type_reducer;
AddReducer(data, &graph_reducer, &remove_type_reducer);
......@@ -1560,7 +1539,7 @@ struct CopyMetadataForConcurrentCompilePhase {
void Run(PipelineData* data, Zone* temp_zone) {
GraphReducer graph_reducer(temp_zone, data->graph(),
&data->info()->tick_counter(),
&data->info()->tick_counter(), data->broker(),
data->jsgraph()->Dead());
JSHeapCopyReducer heap_copy_reducer(data->broker());
AddReducer(data, &graph_reducer, &heap_copy_reducer);
......@@ -1606,7 +1585,7 @@ struct TypedLoweringPhase {
void Run(PipelineData* data, Zone* temp_zone) {
GraphReducer graph_reducer(temp_zone, data->graph(),
&data->info()->tick_counter(),
&data->info()->tick_counter(), data->broker(),
data->jsgraph()->Dead());
DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
data->common(), temp_zone);
......@@ -1650,7 +1629,7 @@ struct EscapeAnalysisPhase {
&data->info()->tick_counter(), temp_zone);
escape_analysis.ReduceGraph();
GraphReducer reducer(temp_zone, data->graph(),
&data->info()->tick_counter(),
&data->info()->tick_counter(), data->broker(),
data->jsgraph()->Dead());
EscapeAnalysisReducer escape_reducer(&reducer, data->jsgraph(),
escape_analysis.analysis_result(),
......@@ -1667,7 +1646,7 @@ struct TypeAssertionsPhase {
void Run(PipelineData* data, Zone* temp_zone) {
GraphReducer graph_reducer(temp_zone, data->graph(),
&data->info()->tick_counter(),
&data->info()->tick_counter(), data->broker(),
data->jsgraph()->Dead());
AddTypeAssertionsReducer type_assertions(&graph_reducer, data->jsgraph(),
temp_zone);
......@@ -1721,7 +1700,7 @@ struct GenericLoweringPhase {
void Run(PipelineData* data, Zone* temp_zone) {
GraphReducer graph_reducer(temp_zone, data->graph(),
&data->info()->tick_counter(),
&data->info()->tick_counter(), data->broker(),
data->jsgraph()->Dead());
JSGenericLowering generic_lowering(data->jsgraph(), &graph_reducer,
data->broker());
......@@ -1735,7 +1714,7 @@ struct EarlyOptimizationPhase {
void Run(PipelineData* data, Zone* temp_zone) {
GraphReducer graph_reducer(temp_zone, data->graph(),
&data->info()->tick_counter(),
&data->info()->tick_counter(), data->broker(),
data->jsgraph()->Dead());
DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
data->common(), temp_zone);
......@@ -1812,7 +1791,7 @@ struct EffectControlLinearizationPhase {
// doing a common operator reducer and dead code elimination just before
// it, to eliminate conditional deopts with a constant condition.
GraphReducer graph_reducer(temp_zone, data->graph(),
&data->info()->tick_counter(),
&data->info()->tick_counter(), data->broker(),
data->jsgraph()->Dead());
DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
data->common(), temp_zone);
......@@ -1845,7 +1824,7 @@ struct LoadEliminationPhase {
void Run(PipelineData* data, Zone* temp_zone) {
GraphReducer graph_reducer(temp_zone, data->graph(),
&data->info()->tick_counter(),
&data->info()->tick_counter(), data->broker(),
data->jsgraph()->Dead());
BranchElimination branch_condition_elimination(&graph_reducer,
data->jsgraph(), temp_zone,
......@@ -1906,7 +1885,7 @@ struct LateOptimizationPhase {
void Run(PipelineData* data, Zone* temp_zone) {
GraphReducer graph_reducer(temp_zone, data->graph(),
&data->info()->tick_counter(),
&data->info()->tick_counter(), data->broker(),
data->jsgraph()->Dead());
BranchElimination branch_condition_elimination(&graph_reducer,
data->jsgraph(), temp_zone);
......@@ -1934,7 +1913,7 @@ struct MachineOperatorOptimizationPhase {
void Run(PipelineData* data, Zone* temp_zone) {
GraphReducer graph_reducer(temp_zone, data->graph(),
&data->info()->tick_counter(),
&data->info()->tick_counter(), data->broker(),
data->jsgraph()->Dead());
ValueNumberingReducer value_numbering(temp_zone, data->graph()->zone());
MachineOperatorReducer machine_reducer(&graph_reducer, data->jsgraph());
......@@ -2005,7 +1984,7 @@ struct CsaEarlyOptimizationPhase {
void Run(PipelineData* data, Zone* temp_zone) {
GraphReducer graph_reducer(temp_zone, data->graph(),
&data->info()->tick_counter(),
&data->info()->tick_counter(), data->broker(),
data->jsgraph()->Dead());
MachineOperatorReducer machine_reducer(&graph_reducer, data->jsgraph());
BranchElimination branch_condition_elimination(&graph_reducer,
......@@ -2033,7 +2012,7 @@ struct CsaOptimizationPhase {
void Run(PipelineData* data, Zone* temp_zone) {
GraphReducer graph_reducer(temp_zone, data->graph(),
&data->info()->tick_counter(),
&data->info()->tick_counter(), data->broker(),
data->jsgraph()->Dead());
BranchElimination branch_condition_elimination(&graph_reducer,
data->jsgraph(), temp_zone);
......@@ -3168,7 +3147,7 @@ void Pipeline::GenerateCodeForWasmFunction(
PipelineRunScope scope(&data, "V8.WasmFullOptimization",
RuntimeCallCounterId::kOptimizeWasmFullOptimization);
GraphReducer graph_reducer(scope.zone(), data.graph(),
&data.info()->tick_counter(),
&data.info()->tick_counter(), data.broker(),
data.mcgraph()->Dead());
DeadCodeElimination dead_code_elimination(&graph_reducer, data.graph(),
data.common(), scope.zone());
......@@ -3188,7 +3167,7 @@ void Pipeline::GenerateCodeForWasmFunction(
PipelineRunScope scope(&data, "V8.OptimizeWasmBaseOptimization",
RuntimeCallCounterId::kOptimizeWasmBaseOptimization);
GraphReducer graph_reducer(scope.zone(), data.graph(),
&data.info()->tick_counter(),
&data.info()->tick_counter(), data.broker(),
data.mcgraph()->Dead());
ValueNumberingReducer value_numbering(scope.zone(), data.graph()->zone());
AddReducer(&data, &graph_reducer, &value_numbering);
......
......@@ -325,7 +325,7 @@ void Typer::Run(const NodeVector& roots,
induction_vars->ChangeToInductionVariablePhis();
}
Visitor visitor(this, induction_vars);
GraphReducer graph_reducer(zone(), graph(), tick_counter_);
GraphReducer graph_reducer(zone(), graph(), tick_counter_, broker());
graph_reducer.AddReducer(&visitor);
for (Node* const root : roots) graph_reducer.ReduceNode(root);
graph_reducer.ReduceGraph();
......
......@@ -33,7 +33,7 @@ class ContextSpecializationTester : public HandleAndZoneScope {
simplified_(main_zone()),
jsgraph_(main_isolate(), graph(), common(), &javascript_, &simplified_,
&machine_),
reducer_(main_zone(), graph(), &tick_counter_),
reducer_(main_zone(), graph(), &tick_counter_, &js_heap_broker_),
js_heap_broker_(main_isolate(), main_zone()),
spec_(&reducer_, jsgraph(), &js_heap_broker_, context,
MaybeHandle<JSFunction>()) {}
......
......@@ -93,8 +93,8 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
CHECK(!heap_copy_reducer.Reduce(node).Changed());
JSGraph jsgraph(main_isolate(), &graph, &common, &javascript, &simplified,
&machine);
// TODO(titzer): mock the GraphReducer here for better unit testing.
GraphReducer graph_reducer(main_zone(), &graph, &tick_counter);
GraphReducer graph_reducer(main_zone(), &graph, &tick_counter,
&js_heap_broker);
JSTypedLowering reducer(&graph_reducer, &jsgraph, &js_heap_broker,
main_zone());
Reduction reduction = reducer.Reduce(node);
......
......@@ -88,7 +88,8 @@ class ReducerTester : public HandleAndZoneScope {
javascript(main_zone()),
jsgraph(isolate, &graph, &common, &javascript, nullptr, &machine),
maxuint32(Constant<int32_t>(kMaxUInt32)),
graph_reducer(main_zone(), &graph, &tick_counter, jsgraph.Dead()) {
graph_reducer(main_zone(), &graph, &tick_counter, nullptr,
jsgraph.Dead()) {
Node* s = graph.NewNode(common.Start(num_parameters));
graph.SetStart(s);
}
......
......@@ -28,7 +28,8 @@ class BranchEliminationTest : public GraphTest {
JSOperatorBuilder javascript(zone());
JSGraph jsgraph(isolate(), graph(), common(), &javascript, nullptr,
machine());
GraphReducer graph_reducer(zone(), graph(), tick_counter(), jsgraph.Dead());
GraphReducer graph_reducer(zone(), graph(), tick_counter(), broker(),
jsgraph.Dead());
BranchElimination branch_condition_elimination(&graph_reducer, &jsgraph,
zone());
graph_reducer.AddReducer(&branch_condition_elimination);
......
......@@ -74,8 +74,7 @@ class ConstantFoldingReducerTest : public TypedGraphTest {
JSOperatorBuilder javascript(zone());
JSGraph jsgraph(isolate(), graph(), common(), &javascript, simplified(),
&machine);
// TODO(titzer): mock the GraphReducer here for better unit testing.
GraphReducer graph_reducer(zone(), graph(), tick_counter());
GraphReducer graph_reducer(zone(), graph(), tick_counter(), broker());
ConstantFoldingReducer reducer(&graph_reducer, &jsgraph, broker());
return reducer.Reduce(node);
}
......
......@@ -314,7 +314,7 @@ TEST_F(AdvancedReducerTest, ReplaceWithValue_ValueUse) {
Node* zero = graph()->NewNode(common.Int32Constant(0));
Node* use_value = graph()->NewNode(common.Return(), zero, node, start, start);
Node* replacement = graph()->NewNode(&kMockOperator);
GraphReducer graph_reducer(zone(), graph(), nullptr);
GraphReducer graph_reducer(zone(), graph(), nullptr, nullptr);
ReplaceWithValueReducer r(&graph_reducer);
r.ReplaceWithValue(node, replacement);
EXPECT_EQ(replacement, use_value->InputAt(1));
......@@ -331,7 +331,7 @@ TEST_F(AdvancedReducerTest, ReplaceWithValue_EffectUse) {
Node* use_control = graph()->NewNode(common.Merge(1), start);
Node* use_effect = graph()->NewNode(common.EffectPhi(1), node, use_control);
Node* replacement = graph()->NewNode(&kMockOperator);
GraphReducer graph_reducer(zone(), graph(), nullptr);
GraphReducer graph_reducer(zone(), graph(), nullptr, nullptr);
ReplaceWithValueReducer r(&graph_reducer);
r.ReplaceWithValue(node, replacement);
EXPECT_EQ(start, use_effect->InputAt(0));
......@@ -350,7 +350,7 @@ TEST_F(AdvancedReducerTest, ReplaceWithValue_ControlUse1) {
Node* success = graph()->NewNode(common.IfSuccess(), node);
Node* use_control = graph()->NewNode(common.Merge(1), success);
Node* replacement = graph()->NewNode(&kMockOperator);
GraphReducer graph_reducer(zone(), graph(), nullptr);
GraphReducer graph_reducer(zone(), graph(), nullptr, nullptr);
ReplaceWithValueReducer r(&graph_reducer);
r.ReplaceWithValue(node, replacement);
EXPECT_EQ(start, use_control->InputAt(0));
......@@ -371,7 +371,7 @@ TEST_F(AdvancedReducerTest, ReplaceWithValue_ControlUse2) {
Node* exception = graph()->NewNode(common.IfException(), effect, node);
Node* use_control = graph()->NewNode(common.Merge(1), success);
Node* replacement = graph()->NewNode(&kMockOperator);
GraphReducer graph_reducer(zone(), graph(), tick_counter(), dead);
GraphReducer graph_reducer(zone(), graph(), tick_counter(), nullptr, dead);
ReplaceWithValueReducer r(&graph_reducer);
r.ReplaceWithValue(node, replacement);
EXPECT_EQ(start, use_control->InputAt(0));
......@@ -395,7 +395,7 @@ TEST_F(AdvancedReducerTest, ReplaceWithValue_ControlUse3) {
Node* exception = graph()->NewNode(common.IfException(), effect, node);
Node* use_control = graph()->NewNode(common.Merge(1), success);
Node* replacement = graph()->NewNode(&kMockOperator);
GraphReducer graph_reducer(zone(), graph(), tick_counter(), dead);
GraphReducer graph_reducer(zone(), graph(), tick_counter(), nullptr, dead);
ReplaceWithValueReducer r(&graph_reducer);
r.ReplaceWithValue(node, replacement);
EXPECT_EQ(start, use_control->InputAt(0));
......@@ -425,20 +425,20 @@ class GraphReducerTest : public TestWithZone {
protected:
void ReduceNode(Node* node, Reducer* r) {
GraphReducer reducer(zone(), graph(), tick_counter());
GraphReducer reducer(zone(), graph(), tick_counter(), nullptr);
reducer.AddReducer(r);
reducer.ReduceNode(node);
}
void ReduceNode(Node* node, Reducer* r1, Reducer* r2) {
GraphReducer reducer(zone(), graph(), tick_counter());
GraphReducer reducer(zone(), graph(), tick_counter(), nullptr);
reducer.AddReducer(r1);
reducer.AddReducer(r2);
reducer.ReduceNode(node);
}
void ReduceNode(Node* node, Reducer* r1, Reducer* r2, Reducer* r3) {
GraphReducer reducer(zone(), graph(), tick_counter());
GraphReducer reducer(zone(), graph(), tick_counter(), nullptr);
reducer.AddReducer(r1);
reducer.AddReducer(r2);
reducer.AddReducer(r3);
......@@ -446,20 +446,20 @@ class GraphReducerTest : public TestWithZone {
}
void ReduceGraph(Reducer* r1) {
GraphReducer reducer(zone(), graph(), tick_counter());
GraphReducer reducer(zone(), graph(), tick_counter(), nullptr);
reducer.AddReducer(r1);
reducer.ReduceGraph();
}
void ReduceGraph(Reducer* r1, Reducer* r2) {
GraphReducer reducer(zone(), graph(), tick_counter());
GraphReducer reducer(zone(), graph(), tick_counter(), nullptr);
reducer.AddReducer(r1);
reducer.AddReducer(r2);
reducer.ReduceGraph();
}
void ReduceGraph(Reducer* r1, Reducer* r2, Reducer* r3) {
GraphReducer reducer(zone(), graph(), tick_counter());
GraphReducer reducer(zone(), graph(), tick_counter(), nullptr);
reducer.AddReducer(r1);
reducer.AddReducer(r2);
reducer.AddReducer(r3);
......
......@@ -34,9 +34,7 @@ class JSCallReducerTest : public TypedGraphTest {
SimplifiedOperatorBuilder simplified(zone());
JSGraph jsgraph(isolate(), graph(), common(), javascript(), &simplified,
&machine);
// TODO(titzer): mock the GraphReducer here for better unit testing.
GraphReducer graph_reducer(zone(), graph(), tick_counter());
GraphReducer graph_reducer(zone(), graph(), tick_counter(), broker());
JSCallReducer reducer(&graph_reducer, &jsgraph, broker(), zone(),
JSCallReducer::kNoFlags, &deps_);
return reducer.Reduce(node);
......
......@@ -43,8 +43,7 @@ class JSCreateLoweringTest : public TypedGraphTest {
SimplifiedOperatorBuilder simplified(zone());
JSGraph jsgraph(isolate(), graph(), common(), javascript(), &simplified,
&machine);
// TODO(titzer): mock the GraphReducer here for better unit testing.
GraphReducer graph_reducer(zone(), graph(), tick_counter());
GraphReducer graph_reducer(zone(), graph(), tick_counter(), broker());
JSCreateLowering reducer(&graph_reducer, &deps_, &jsgraph, broker(),
zone());
return reducer.Reduce(node);
......
......@@ -35,8 +35,7 @@ class JSIntrinsicLoweringTest : public GraphTest {
SimplifiedOperatorBuilder simplified(zone());
JSGraph jsgraph(isolate(), graph(), common(), javascript(), &simplified,
&machine);
// TODO(titzer): mock the GraphReducer here for better unit testing.
GraphReducer graph_reducer(zone(), graph(), tick_counter());
GraphReducer graph_reducer(zone(), graph(), tick_counter(), broker());
JSIntrinsicLowering reducer(&graph_reducer, &jsgraph, broker());
return reducer.Reduce(node);
}
......
......@@ -50,8 +50,7 @@ class JSTypedLoweringTest : public TypedGraphTest {
SimplifiedOperatorBuilder simplified(zone());
JSGraph jsgraph(isolate(), graph(), common(), javascript(), &simplified,
&machine);
// TODO(titzer): mock the GraphReducer here for better unit testing.
GraphReducer graph_reducer(zone(), graph(), tick_counter());
GraphReducer graph_reducer(zone(), graph(), tick_counter(), broker());
JSTypedLowering reducer(&graph_reducer, &jsgraph, broker(), zone());
return reducer.Reduce(node);
}
......
......@@ -34,7 +34,8 @@ class MachineOperatorReducerTest : public GraphTest {
javascript_(zone()),
jsgraph_(isolate(), graph(), &common_, &javascript_, nullptr,
&machine_),
graph_reducer_(zone(), graph(), tick_counter(), jsgraph_.Dead()) {}
graph_reducer_(zone(), graph(), tick_counter(), broker(),
jsgraph_.Dead()) {}
protected:
Reduction Reduce(Node* node) {
......
......@@ -30,13 +30,12 @@ class SimplifiedOperatorReducerTest : public GraphTest {
protected:
Reduction Reduce(Node* node) {
JSHeapBroker broker(isolate(), zone());
MachineOperatorBuilder machine(zone());
JSOperatorBuilder javascript(zone());
JSGraph jsgraph(isolate(), graph(), common(), &javascript, simplified(),
&machine);
GraphReducer graph_reducer(zone(), graph(), tick_counter());
SimplifiedOperatorReducer reducer(&graph_reducer, &jsgraph, &broker);
GraphReducer graph_reducer(zone(), graph(), tick_counter(), broker());
SimplifiedOperatorReducer reducer(&graph_reducer, &jsgraph, broker());
return reducer.Reduce(node);
}
......
......@@ -36,8 +36,7 @@ class TypedOptimizationTest : public TypedGraphTest {
JSOperatorBuilder javascript(zone());
JSGraph jsgraph(isolate(), graph(), common(), &javascript, simplified(),
&machine);
// TODO(titzer): mock the GraphReducer here for better unit testing.
GraphReducer graph_reducer(zone(), graph(), tick_counter());
GraphReducer graph_reducer(zone(), graph(), tick_counter(), broker());
TypedOptimization reducer(&graph_reducer, &deps_, &jsgraph, broker());
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