Reviewers: jarin,
Description:
[turbofan] Pass deoptimization mode to intrinsic lowering.
[email protected]
Please review this at https://codereview.chromium.org/1148033002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+18, -8 lines):
M src/compiler/js-intrinsic-lowering.h
M src/compiler/js-intrinsic-lowering.cc
M src/compiler/pipeline.cc
M test/unittests/compiler/js-intrinsic-lowering-unittest.cc
Index: src/compiler/js-intrinsic-lowering.cc
diff --git a/src/compiler/js-intrinsic-lowering.cc
b/src/compiler/js-intrinsic-lowering.cc
index
5e063a7bff04f811175c940758a267d66b43367c..2a3bdf8fa85bfe3dd54589852432fdefce70d93a
100644
--- a/src/compiler/js-intrinsic-lowering.cc
+++ b/src/compiler/js-intrinsic-lowering.cc
@@ -16,9 +16,11 @@ namespace v8 {
namespace internal {
namespace compiler {
-JSIntrinsicLowering::JSIntrinsicLowering(Editor* editor, JSGraph* jsgraph)
+JSIntrinsicLowering::JSIntrinsicLowering(Editor* editor, JSGraph* jsgraph,
+ DeoptimizationMode mode)
: AdvancedReducer(editor),
jsgraph_(jsgraph),
+ mode_(mode),
simplified_(jsgraph->zone()) {}
@@ -103,9 +105,7 @@ Reduction
JSIntrinsicLowering::ReduceConstructDouble(Node* node) {
Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) {
- // TODO(jarin): This should not depend on the global flag.
- if (!FLAG_turbo_deoptimization) return NoChange();
-
+ if (mode() != kDeoptimizationEnabled) return NoChange();
Node* frame_state = NodeProperties::GetFrameStateInput(node, 0);
DCHECK_EQ(frame_state->opcode(), IrOpcode::kFrameState);
Index: src/compiler/js-intrinsic-lowering.h
diff --git a/src/compiler/js-intrinsic-lowering.h
b/src/compiler/js-intrinsic-lowering.h
index
339000b2ba47ae9808adbf7d1ae4bb63cc9c8a76..75a889246baf1024c5dd43ae05a48720f06d8a2b
100644
--- a/src/compiler/js-intrinsic-lowering.h
+++ b/src/compiler/js-intrinsic-lowering.h
@@ -22,7 +22,10 @@ class MachineOperatorBuilder;
// Lowers certain JS-level runtime calls.
class JSIntrinsicLowering final : public AdvancedReducer {
public:
- JSIntrinsicLowering(Editor* editor, JSGraph* jsgraph);
+ enum DeoptimizationMode { kDeoptimizationEnabled,
kDeoptimizationDisabled };
+
+ JSIntrinsicLowering(Editor* editor, JSGraph* jsgraph,
+ DeoptimizationMode mode);
~JSIntrinsicLowering() final {}
Reduction Reduce(Node* node) final;
@@ -60,9 +63,11 @@ class JSIntrinsicLowering final : public AdvancedReducer
{
JSGraph* jsgraph() const { return jsgraph_; }
CommonOperatorBuilder* common() const;
MachineOperatorBuilder* machine() const;
+ DeoptimizationMode mode() const { return mode_; }
SimplifiedOperatorBuilder* simplified() { return &simplified_; }
- JSGraph* jsgraph_;
+ JSGraph* const jsgraph_;
+ DeoptimizationMode const mode_;
SimplifiedOperatorBuilder simplified_;
};
Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index
7387b46d2fb504cdff3a6d43ec235a41f450ecf2..2340c6f99ffdd8494fc19bfd286a2df9d3f46ac3
100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -561,7 +561,11 @@ struct TypedLoweringPhase {
LoadElimination load_elimination;
JSBuiltinReducer builtin_reducer(data->jsgraph());
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());
CommonOperatorReducer common_reducer(data->jsgraph());
AddReducer(data, &graph_reducer, &builtin_reducer);
Index: test/unittests/compiler/js-intrinsic-lowering-unittest.cc
diff --git a/test/unittests/compiler/js-intrinsic-lowering-unittest.cc
b/test/unittests/compiler/js-intrinsic-lowering-unittest.cc
index
7c561315b6485efa20a4cc1d790c9b0e50acae13..92b59d29270551d98bbb020f8e3d65c36d3e4860
100644
--- a/test/unittests/compiler/js-intrinsic-lowering-unittest.cc
+++ b/test/unittests/compiler/js-intrinsic-lowering-unittest.cc
@@ -35,7 +35,8 @@ class JSIntrinsicLoweringTest : public GraphTest {
JSGraph jsgraph(isolate(), graph(), common(), javascript(), &machine);
// TODO(titzer): mock the GraphReducer here for better unit testing.
GraphReducer graph_reducer(graph(), zone());
- JSIntrinsicLowering reducer(&graph_reducer, &jsgraph);
+ JSIntrinsicLowering reducer(&graph_reducer, &jsgraph,
+
JSIntrinsicLowering::kDeoptimizationEnabled);
return reducer.Reduce(node);
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.