From: titzer Date: Mon, 18 May 2015 11:54:11 +0000 (-0700) Subject: [turbofan] JSTypeFeedbackSpecializer is now an AdvancedReducer. X-Git-Tag: upstream/4.7.83~2599 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=029a2d61a68541182f06ee41ba5ec8ba6b943edf;p=platform%2Fupstream%2Fv8.git [turbofan] JSTypeFeedbackSpecializer is now an AdvancedReducer. R=bmeurer@chromium.org BUG= Review URL: https://codereview.chromium.org/1136413002 Cr-Commit-Position: refs/heads/master@{#28441} --- diff --git a/src/compiler/js-type-feedback.cc b/src/compiler/js-type-feedback.cc index 7cccfa7..c82972a 100644 --- a/src/compiler/js-type-feedback.cc +++ b/src/compiler/js-type-feedback.cc @@ -196,7 +196,7 @@ Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamed(Node* node) { Node* deopt = graph()->NewNode(common()->Deoptimize(), frame_state_before, effect, check_failed); NodeProperties::MergeControlToEnd(graph(), common(), deopt); - NodeProperties::ReplaceWithValue(node, load, load, check_success); + ReplaceWithValue(node, load, load, check_success); return Replace(load); } @@ -211,7 +211,7 @@ Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamedForGlobalVariable( if (!constant_value.is_null()) { // Always optimize global constants. Node* constant = jsgraph()->Constant(constant_value); - NodeProperties::ReplaceWithValue(node, constant); + ReplaceWithValue(node, constant); return Replace(constant); } @@ -247,7 +247,7 @@ Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamedForGlobalVariable( String::Flatten(Handle::cast(constant_value)); } Node* constant = jsgraph()->Constant(constant_value); - NodeProperties::ReplaceWithValue(node, constant); + ReplaceWithValue(node, constant); return Replace(constant); } else { // Load directly from the property cell. @@ -256,7 +256,7 @@ Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamedForGlobalVariable( Node* load_field = graph()->NewNode( simplified()->LoadField(access), jsgraph()->Constant(cell), NodeProperties::GetEffectInput(node), control); - NodeProperties::ReplaceWithValue(node, load_field, load_field, control); + ReplaceWithValue(node, load_field, load_field, control); return Replace(load_field); } } @@ -313,7 +313,7 @@ Reduction JSTypeFeedbackSpecializer::ReduceJSStoreNamed(Node* node) { Node* deopt = graph()->NewNode(common()->Deoptimize(), frame_state_before, effect, check_failed); NodeProperties::MergeControlToEnd(graph(), common(), deopt); - NodeProperties::ReplaceWithValue(node, store, store, check_success); + ReplaceWithValue(node, store, store, check_success); return Replace(store); } diff --git a/src/compiler/js-type-feedback.h b/src/compiler/js-type-feedback.h index 3d55795..4f1f045 100644 --- a/src/compiler/js-type-feedback.h +++ b/src/compiler/js-type-feedback.h @@ -47,14 +47,15 @@ class JSTypeFeedbackTable : public ZoneObject { // Specializes a graph to the type feedback recorded in the // {js_type_feedback} provided to the constructor. -class JSTypeFeedbackSpecializer : public Reducer { +class JSTypeFeedbackSpecializer : public AdvancedReducer { public: - JSTypeFeedbackSpecializer(JSGraph* jsgraph, + JSTypeFeedbackSpecializer(Editor* editor, JSGraph* jsgraph, JSTypeFeedbackTable* js_type_feedback, TypeFeedbackOracle* oracle, Handle global_object, CompilationDependencies* dependencies) - : jsgraph_(jsgraph), + : AdvancedReducer(editor), + jsgraph_(jsgraph), simplified_(jsgraph->graph()->zone()), js_type_feedback_(js_type_feedback), oracle_(oracle), diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc index a65ea8d..7b364a7 100644 --- a/src/compiler/pipeline.cc +++ b/src/compiler/pipeline.cc @@ -545,8 +545,8 @@ struct JSTypeFeedbackPhase { // TODO(titzer): introduce a specialization mode/flags enum to control // specializing to the global object here. JSTypeFeedbackSpecializer specializer( - data->jsgraph(), data->js_type_feedback(), &oracle, global_object, - data->info()->dependencies()); + &graph_reducer, data->jsgraph(), data->js_type_feedback(), &oracle, + global_object, data->info()->dependencies()); AddReducer(data, &graph_reducer, &specializer); graph_reducer.ReduceGraph(); } diff --git a/test/unittests/compiler/js-type-feedback-unittest.cc b/test/unittests/compiler/js-type-feedback-unittest.cc index 46eb437..c243c5f 100644 --- a/test/unittests/compiler/js-type-feedback-unittest.cc +++ b/test/unittests/compiler/js-type-feedback-unittest.cc @@ -41,8 +41,10 @@ class JSTypeFeedbackTest : public TypedGraphTest { MachineOperatorBuilder machine(zone()); JSGraph jsgraph(isolate(), graph(), common(), javascript(), &machine); JSTypeFeedbackTable table(zone()); - JSTypeFeedbackSpecializer reducer(&jsgraph, &table, nullptr, global_object, - &dependencies_); + // TODO(titzer): mock the GraphReducer here for better unit testing. + GraphReducer graph_reducer(graph(), zone()); + JSTypeFeedbackSpecializer reducer(&graph_reducer, &jsgraph, &table, nullptr, + global_object, &dependencies_); return reducer.Reduce(node); }