Commit 8236bfba authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Pass deoptimization mode to intrinsic lowering.

R=jarin@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#28515}
parent e77c69b5
...@@ -16,9 +16,11 @@ namespace v8 { ...@@ -16,9 +16,11 @@ namespace v8 {
namespace internal { namespace internal {
namespace compiler { namespace compiler {
JSIntrinsicLowering::JSIntrinsicLowering(Editor* editor, JSGraph* jsgraph) JSIntrinsicLowering::JSIntrinsicLowering(Editor* editor, JSGraph* jsgraph,
DeoptimizationMode mode)
: AdvancedReducer(editor), : AdvancedReducer(editor),
jsgraph_(jsgraph), jsgraph_(jsgraph),
mode_(mode),
simplified_(jsgraph->zone()) {} simplified_(jsgraph->zone()) {}
...@@ -103,9 +105,7 @@ Reduction JSIntrinsicLowering::ReduceConstructDouble(Node* node) { ...@@ -103,9 +105,7 @@ Reduction JSIntrinsicLowering::ReduceConstructDouble(Node* node) {
Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) { Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) {
// TODO(jarin): This should not depend on the global flag. if (mode() != kDeoptimizationEnabled) return NoChange();
if (!FLAG_turbo_deoptimization) return NoChange();
Node* frame_state = NodeProperties::GetFrameStateInput(node, 0); Node* frame_state = NodeProperties::GetFrameStateInput(node, 0);
DCHECK_EQ(frame_state->opcode(), IrOpcode::kFrameState); DCHECK_EQ(frame_state->opcode(), IrOpcode::kFrameState);
......
...@@ -22,7 +22,10 @@ class MachineOperatorBuilder; ...@@ -22,7 +22,10 @@ class MachineOperatorBuilder;
// Lowers certain JS-level runtime calls. // Lowers certain JS-level runtime calls.
class JSIntrinsicLowering final : public AdvancedReducer { class JSIntrinsicLowering final : public AdvancedReducer {
public: public:
JSIntrinsicLowering(Editor* editor, JSGraph* jsgraph); enum DeoptimizationMode { kDeoptimizationEnabled, kDeoptimizationDisabled };
JSIntrinsicLowering(Editor* editor, JSGraph* jsgraph,
DeoptimizationMode mode);
~JSIntrinsicLowering() final {} ~JSIntrinsicLowering() final {}
Reduction Reduce(Node* node) final; Reduction Reduce(Node* node) final;
...@@ -60,9 +63,11 @@ class JSIntrinsicLowering final : public AdvancedReducer { ...@@ -60,9 +63,11 @@ class JSIntrinsicLowering final : public AdvancedReducer {
JSGraph* jsgraph() const { return jsgraph_; } JSGraph* jsgraph() const { return jsgraph_; }
CommonOperatorBuilder* common() const; CommonOperatorBuilder* common() const;
MachineOperatorBuilder* machine() const; MachineOperatorBuilder* machine() const;
DeoptimizationMode mode() const { return mode_; }
SimplifiedOperatorBuilder* simplified() { return &simplified_; } SimplifiedOperatorBuilder* simplified() { return &simplified_; }
JSGraph* jsgraph_; JSGraph* const jsgraph_;
DeoptimizationMode const mode_;
SimplifiedOperatorBuilder simplified_; SimplifiedOperatorBuilder simplified_;
}; };
......
...@@ -561,7 +561,11 @@ struct TypedLoweringPhase { ...@@ -561,7 +561,11 @@ struct TypedLoweringPhase {
LoadElimination load_elimination; LoadElimination load_elimination;
JSBuiltinReducer builtin_reducer(data->jsgraph()); JSBuiltinReducer builtin_reducer(data->jsgraph());
JSTypedLowering typed_lowering(&graph_reducer, data->jsgraph(), temp_zone); JSTypedLowering typed_lowering(&graph_reducer, data->jsgraph(), temp_zone);
JSIntrinsicLowering intrinsic_lowering(&graph_reducer, data->jsgraph()); JSIntrinsicLowering intrinsic_lowering(
&graph_reducer, data->jsgraph(),
data->info()->is_deoptimization_enabled()
? JSIntrinsicLowering::kDeoptimizationEnabled
: JSIntrinsicLowering::kDeoptimizationDisabled);
SimplifiedOperatorReducer simple_reducer(data->jsgraph()); SimplifiedOperatorReducer simple_reducer(data->jsgraph());
CommonOperatorReducer common_reducer(data->jsgraph()); CommonOperatorReducer common_reducer(data->jsgraph());
AddReducer(data, &graph_reducer, &builtin_reducer); AddReducer(data, &graph_reducer, &builtin_reducer);
......
...@@ -35,7 +35,8 @@ class JSIntrinsicLoweringTest : public GraphTest { ...@@ -35,7 +35,8 @@ class JSIntrinsicLoweringTest : public GraphTest {
JSGraph jsgraph(isolate(), graph(), common(), javascript(), &machine); JSGraph jsgraph(isolate(), graph(), common(), javascript(), &machine);
// TODO(titzer): mock the GraphReducer here for better unit testing. // TODO(titzer): mock the GraphReducer here for better unit testing.
GraphReducer graph_reducer(graph(), zone()); GraphReducer graph_reducer(graph(), zone());
JSIntrinsicLowering reducer(&graph_reducer, &jsgraph); JSIntrinsicLowering reducer(&graph_reducer, &jsgraph,
JSIntrinsicLowering::kDeoptimizationEnabled);
return reducer.Reduce(node); 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