Commit 4a1ab1ca authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Pass deoptimization mode to type feedback specializer.

R=jarin@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28524}
parent 1ec55616
...@@ -173,7 +173,7 @@ Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamed(Node* node) { ...@@ -173,7 +173,7 @@ Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamed(Node* node) {
return ReduceJSLoadNamedForGlobalVariable(node); return ReduceJSLoadNamedForGlobalVariable(node);
} }
if (!FLAG_turbo_deoptimization) return NoChange(); if (mode() != kDeoptimizationEnabled) return NoChange();
Node* frame_state_before = GetFrameStateBefore(node); Node* frame_state_before = GetFrameStateBefore(node);
if (frame_state_before == nullptr) return NoChange(); if (frame_state_before == nullptr) return NoChange();
...@@ -245,7 +245,7 @@ Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamedForGlobalVariable( ...@@ -245,7 +245,7 @@ Reduction JSTypeFeedbackSpecializer::ReduceJSLoadNamedForGlobalVariable(
return NoChange(); return NoChange();
} }
if (FLAG_turbo_deoptimization) { if (mode() == kDeoptimizationEnabled) {
// Handle lookups in the script context. // Handle lookups in the script context.
{ {
Handle<ScriptContextTable> script_contexts( Handle<ScriptContextTable> script_contexts(
......
...@@ -62,10 +62,13 @@ class JSTypeFeedbackTable : public ZoneObject { ...@@ -62,10 +62,13 @@ class JSTypeFeedbackTable : public ZoneObject {
// {js_type_feedback} provided to the constructor. // {js_type_feedback} provided to the constructor.
class JSTypeFeedbackSpecializer : public AdvancedReducer { class JSTypeFeedbackSpecializer : public AdvancedReducer {
public: public:
enum DeoptimizationMode { kDeoptimizationEnabled, kDeoptimizationDisabled };
JSTypeFeedbackSpecializer(Editor* editor, JSGraph* jsgraph, JSTypeFeedbackSpecializer(Editor* editor, JSGraph* jsgraph,
JSTypeFeedbackTable* js_type_feedback, JSTypeFeedbackTable* js_type_feedback,
TypeFeedbackOracle* oracle, TypeFeedbackOracle* oracle,
Handle<GlobalObject> global_object, Handle<GlobalObject> global_object,
DeoptimizationMode mode,
CompilationDependencies* dependencies) CompilationDependencies* dependencies)
: AdvancedReducer(editor), : AdvancedReducer(editor),
jsgraph_(jsgraph), jsgraph_(jsgraph),
...@@ -73,8 +76,9 @@ class JSTypeFeedbackSpecializer : public AdvancedReducer { ...@@ -73,8 +76,9 @@ class JSTypeFeedbackSpecializer : public AdvancedReducer {
js_type_feedback_(js_type_feedback), js_type_feedback_(js_type_feedback),
oracle_(oracle), oracle_(oracle),
global_object_(global_object), global_object_(global_object),
mode_(mode),
dependencies_(dependencies) { dependencies_(dependencies) {
CHECK(js_type_feedback); CHECK_NOT_NULL(js_type_feedback);
} }
Reduction Reduce(Node* node) override; Reduction Reduce(Node* node) override;
...@@ -92,12 +96,14 @@ class JSTypeFeedbackSpecializer : public AdvancedReducer { ...@@ -92,12 +96,14 @@ class JSTypeFeedbackSpecializer : public AdvancedReducer {
JSTypeFeedbackTable* js_type_feedback_; JSTypeFeedbackTable* js_type_feedback_;
TypeFeedbackOracle* oracle_; TypeFeedbackOracle* oracle_;
Handle<GlobalObject> global_object_; Handle<GlobalObject> global_object_;
DeoptimizationMode const mode_;
CompilationDependencies* dependencies_; CompilationDependencies* dependencies_;
TypeFeedbackOracle* oracle() { return oracle_; } TypeFeedbackOracle* oracle() { return oracle_; }
Graph* graph() { return jsgraph_->graph(); } Graph* graph() { return jsgraph_->graph(); }
JSGraph* jsgraph() { return jsgraph_; } JSGraph* jsgraph() { return jsgraph_; }
CommonOperatorBuilder* common() { return jsgraph_->common(); } CommonOperatorBuilder* common() { return jsgraph_->common(); }
DeoptimizationMode mode() const { return mode_; }
SimplifiedOperatorBuilder* simplified() { return &simplified_; } SimplifiedOperatorBuilder* simplified() { return &simplified_; }
void BuildMapCheck(Node* receiver, Handle<Map> map, bool smi_check, void BuildMapCheck(Node* receiver, Handle<Map> map, bool smi_check,
......
...@@ -546,7 +546,10 @@ struct JSTypeFeedbackPhase { ...@@ -546,7 +546,10 @@ struct JSTypeFeedbackPhase {
// specializing to the global object here. // specializing to the global object here.
JSTypeFeedbackSpecializer specializer( JSTypeFeedbackSpecializer specializer(
&graph_reducer, data->jsgraph(), data->js_type_feedback(), &oracle, &graph_reducer, data->jsgraph(), data->js_type_feedback(), &oracle,
global_object, data->info()->dependencies()); global_object, data->info()->is_deoptimization_enabled()
? JSTypeFeedbackSpecializer::kDeoptimizationEnabled
: JSTypeFeedbackSpecializer::kDeoptimizationDisabled,
data->info()->dependencies());
AddReducer(data, &graph_reducer, &specializer); AddReducer(data, &graph_reducer, &specializer);
graph_reducer.ReduceGraph(); graph_reducer.ReduceGraph();
} }
...@@ -1048,9 +1051,7 @@ Handle<Code> Pipeline::GenerateCode() { ...@@ -1048,9 +1051,7 @@ Handle<Code> Pipeline::GenerateCode() {
RunPrintAndVerify("OSR deconstruction"); RunPrintAndVerify("OSR deconstruction");
} }
// TODO(turbofan): Type feedback currently requires deoptimization. if (info()->is_type_feedback_enabled()) {
if (info()->is_deoptimization_enabled() &&
info()->is_type_feedback_enabled()) {
Run<JSTypeFeedbackPhase>(); Run<JSTypeFeedbackPhase>();
RunPrintAndVerify("JSType feedback"); RunPrintAndVerify("JSType feedback");
} }
......
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