diff --git a/src/compiler/js-intrinsic-lowering.cc b/src/compiler/js-intrinsic-lowering.cc index 70ce3a416f..98cd153a95 100644 --- a/src/compiler/js-intrinsic-lowering.cc +++ b/src/compiler/js-intrinsic-lowering.cc @@ -21,8 +21,9 @@ namespace v8 { namespace internal { namespace compiler { -JSIntrinsicLowering::JSIntrinsicLowering(Editor* editor, JSGraph* jsgraph) - : AdvancedReducer(editor), jsgraph_(jsgraph) {} +JSIntrinsicLowering::JSIntrinsicLowering(Editor* editor, JSGraph* jsgraph, + JSHeapBroker* broker) + : AdvancedReducer(editor), jsgraph_(jsgraph), broker_(broker) {} Reduction JSIntrinsicLowering::Reduce(Node* node) { DisallowHeapAccessIf no_heap_access(FLAG_concurrent_inlining); @@ -309,7 +310,7 @@ Reduction JSIntrinsicLowering::ReduceToObject(Node* node) { Reduction JSIntrinsicLowering::ReduceToString(Node* node) { // ToString is unnecessary if the input is a string. HeapObjectMatcher m(NodeProperties::GetValueInput(node, 0)); - if (m.HasValue() && m.Value()->IsString()) { + if (m.HasValue() && m.Ref(broker()).IsString()) { ReplaceWithValue(node, m.node()); return Replace(m.node()); } diff --git a/src/compiler/js-intrinsic-lowering.h b/src/compiler/js-intrinsic-lowering.h index 844e051d0a..f32b53b586 100644 --- a/src/compiler/js-intrinsic-lowering.h +++ b/src/compiler/js-intrinsic-lowering.h @@ -31,7 +31,7 @@ class SimplifiedOperatorBuilder; class V8_EXPORT_PRIVATE JSIntrinsicLowering final : public NON_EXPORTED_BASE(AdvancedReducer) { public: - JSIntrinsicLowering(Editor* editor, JSGraph* jsgraph); + JSIntrinsicLowering(Editor* editor, JSGraph* jsgraph, JSHeapBroker* broker); ~JSIntrinsicLowering() final = default; const char* reducer_name() const override { return "JSIntrinsicLowering"; } @@ -81,12 +81,14 @@ class V8_EXPORT_PRIVATE JSIntrinsicLowering final Graph* graph() const; JSGraph* jsgraph() const { return jsgraph_; } + JSHeapBroker* broker() const { return broker_; } Isolate* isolate() const; CommonOperatorBuilder* common() const; JSOperatorBuilder* javascript() const; SimplifiedOperatorBuilder* simplified() const; JSGraph* const jsgraph_; + JSHeapBroker* const broker_; }; } // namespace compiler diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc index 690e354451..0dafc330f8 100644 --- a/src/compiler/pipeline.cc +++ b/src/compiler/pipeline.cc @@ -1268,7 +1268,8 @@ struct InliningPhase { : JSInliningHeuristic::kRestrictedInlining, temp_zone, data->info(), data->jsgraph(), data->broker(), data->source_positions()); - JSIntrinsicLowering intrinsic_lowering(&graph_reducer, data->jsgraph()); + JSIntrinsicLowering intrinsic_lowering(&graph_reducer, data->jsgraph(), + data->broker()); AddReducer(data, &graph_reducer, &dead_code_elimination); AddReducer(data, &graph_reducer, &checkpoint_elimination); AddReducer(data, &graph_reducer, &common_reducer); diff --git a/test/unittests/compiler/js-intrinsic-lowering-unittest.cc b/test/unittests/compiler/js-intrinsic-lowering-unittest.cc index 3510cd4b74..5b4088f28e 100644 --- a/test/unittests/compiler/js-intrinsic-lowering-unittest.cc +++ b/test/unittests/compiler/js-intrinsic-lowering-unittest.cc @@ -37,7 +37,7 @@ class JSIntrinsicLoweringTest : public GraphTest { &machine); // TODO(titzer): mock the GraphReducer here for better unit testing. GraphReducer graph_reducer(zone(), graph(), tick_counter()); - JSIntrinsicLowering reducer(&graph_reducer, &jsgraph); + JSIntrinsicLowering reducer(&graph_reducer, &jsgraph, broker()); return reducer.Reduce(node); }