Commit 570e8840 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[interpreter] Widen set of applied binary op reductions.

This widens the set of binary operator reductions that are applied by
TurboFan when graphs are built from bytecode. By now we only insert
number conversions to inputs of integer binary ops (i.e. bitwise and
shifts), others no longer require a "before" frame state input.

R=bmeurer@chromium.org

Review-Url: https://codereview.chromium.org/2135973003
Cr-Commit-Position: refs/heads/master@{#37674}
parent a0c7ab63
......@@ -433,10 +433,7 @@ JSTypedLowering::JSTypedLowering(Editor* editor,
Reduction JSTypedLowering::ReduceJSAdd(Node* node) {
if (flags() & kDisableBinaryOpReduction) return NoChange();
JSBinopReduction r(this, node);
BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback();
if (feedback == BinaryOperationHints::kNumberOrUndefined &&
r.BothInputsAre(Type::PlainPrimitive()) &&
......@@ -487,7 +484,6 @@ Reduction JSTypedLowering::ReduceJSAdd(Node* node) {
Reduction JSTypedLowering::ReduceJSSubtract(Node* node) {
if (flags() & kDisableBinaryOpReduction) return NoChange();
JSBinopReduction r(this, node);
BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback();
if (feedback == BinaryOperationHints::kNumberOrUndefined &&
......@@ -516,7 +512,6 @@ Reduction JSTypedLowering::ReduceJSSubtract(Node* node) {
}
Reduction JSTypedLowering::ReduceJSMultiply(Node* node) {
if (flags() & kDisableBinaryOpReduction) return NoChange();
JSBinopReduction r(this, node);
BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback();
if (feedback != BinaryOperationHints::kAny) {
......@@ -536,7 +531,6 @@ Reduction JSTypedLowering::ReduceJSMultiply(Node* node) {
}
Reduction JSTypedLowering::ReduceJSDivide(Node* node) {
if (flags() & kDisableBinaryOpReduction) return NoChange();
JSBinopReduction r(this, node);
BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback();
if (feedback == BinaryOperationHints::kNumberOrUndefined &&
......@@ -560,7 +554,6 @@ Reduction JSTypedLowering::ReduceJSDivide(Node* node) {
}
Reduction JSTypedLowering::ReduceJSModulus(Node* node) {
if (flags() & kDisableBinaryOpReduction) return NoChange();
JSBinopReduction r(this, node);
BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback();
if (feedback == BinaryOperationHints::kNumberOrUndefined &&
......@@ -586,7 +579,7 @@ Reduction JSTypedLowering::ReduceJSModulus(Node* node) {
}
Reduction JSTypedLowering::ReduceInt32Binop(Node* node, const Operator* intOp) {
if (flags() & kDisableBinaryOpReduction) return NoChange();
if (flags() & kDisableIntegerBinaryOpReduction) return NoChange();
JSBinopReduction r(this, node);
r.ConvertInputsToNumber();
......@@ -598,7 +591,7 @@ Reduction JSTypedLowering::ReduceInt32Binop(Node* node, const Operator* intOp) {
Reduction JSTypedLowering::ReduceUI32Shift(Node* node,
Signedness left_signedness,
const Operator* shift_op) {
if (flags() & kDisableBinaryOpReduction) return NoChange();
if (flags() & kDisableIntegerBinaryOpReduction) return NoChange();
JSBinopReduction r(this, node);
r.ConvertInputsToNumber();
......@@ -608,8 +601,6 @@ Reduction JSTypedLowering::ReduceUI32Shift(Node* node,
Reduction JSTypedLowering::ReduceJSComparison(Node* node) {
if (flags() & kDisableBinaryOpReduction) return NoChange();
JSBinopReduction r(this, node);
if (r.BothInputsAre(Type::String())) {
// If both inputs are definitely strings, perform a string comparison.
......@@ -721,8 +712,6 @@ Reduction JSTypedLowering::ReduceJSEqualTypeOf(Node* node, bool invert) {
}
Reduction JSTypedLowering::ReduceJSEqual(Node* node, bool invert) {
if (flags() & kDisableBinaryOpReduction) return NoChange();
Reduction const reduction = ReduceJSEqualTypeOf(node, invert);
if (reduction.Changed()) {
ReplaceWithValue(node, reduction.replacement());
......@@ -765,8 +754,6 @@ Reduction JSTypedLowering::ReduceJSEqual(Node* node, bool invert) {
Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) {
if (flags() & kDisableBinaryOpReduction) return NoChange();
JSBinopReduction r(this, node);
if (r.left() == r.right()) {
// x === x is always true if x != NaN
......
......@@ -35,7 +35,7 @@ class JSTypedLowering final : public AdvancedReducer {
enum Flag {
kNoFlags = 0u,
kDeoptimizationEnabled = 1u << 0,
kDisableBinaryOpReduction = 1u << 1,
kDisableIntegerBinaryOpReduction = 1u << 1,
kTypeFeedbackEnabled = 1u << 2,
};
typedef base::Flags<Flag> Flags;
......
......@@ -884,8 +884,8 @@ struct TypedLoweringPhase {
if (data->info()->is_deoptimization_enabled()) {
typed_lowering_flags |= JSTypedLowering::kDeoptimizationEnabled;
}
if (data->info()->shared_info()->HasBytecodeArray()) {
typed_lowering_flags |= JSTypedLowering::kDisableBinaryOpReduction;
if (data->info()->is_optimizing_from_bytecode()) {
typed_lowering_flags |= JSTypedLowering::kDisableIntegerBinaryOpReduction;
}
if (data->info()->is_type_feedback_enabled()) {
typed_lowering_flags |= JSTypedLowering::kTypeFeedbackEnabled;
......
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