| Index: src/compiler/js-typed-lowering.cc
|
| diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
|
| index ad081968c9c522267703327b7199092ae337327f..cc8d6ce79f94bea083b6f59672deea137c6fd086 100644
|
| --- a/src/compiler/js-typed-lowering.cc
|
| +++ b/src/compiler/js-typed-lowering.cc
|
| @@ -228,12 +228,21 @@ Reduction JSTypedLowering::ReduceJSAdd(Node* node) {
|
| return r.ChangeToPureOperator(simplified()->NumberAdd());
|
| }
|
| Type* maybe_string = Type::Union(Type::String(), Type::Receiver(), zone());
|
| - if (r.NeitherInputCanBe(maybe_string)) {
|
| + if (r.BothInputsAre(Type::Primitive()) && r.NeitherInputCanBe(maybe_string)) {
|
| // JSAdd(x:-string, y:-string) => NumberAdd(ToNumber(x), ToNumber(y))
|
| r.ConvertInputsToNumber();
|
| return r.ChangeToPureOperator(simplified()->NumberAdd());
|
| }
|
| #if 0
|
| + // TODO(turbofan): General ToNumber disabled for now because:
|
| + // a) The inserted ToNumber operation screws up observability of valueOf.
|
| + // b) Deoptimization at ToNumber doesn't have corresponding bailout id.
|
| + Type* maybe_string = Type::Union(Type::String(), Type::Receiver(), zone());
|
| + if (r.NeitherInputCanBe(maybe_string)) {
|
| + ...
|
| + }
|
| +#endif
|
| +#if 0
|
| // TODO(turbofan): Lowering of StringAdd is disabled for now because:
|
| // a) The inserted ToString operation screws up valueOf vs. toString order.
|
| // b) Deoptimization at ToString doesn't have corresponding bailout id.
|
| @@ -253,6 +262,14 @@ Reduction JSTypedLowering::ReduceJSAdd(Node* node) {
|
| Reduction JSTypedLowering::ReduceNumberBinop(Node* node,
|
| const Operator* numberOp) {
|
| JSBinopReduction r(this, node);
|
| + if (r.BothInputsAre(Type::Primitive())) {
|
| + r.ConvertInputsToNumber();
|
| + return r.ChangeToPureOperator(numberOp);
|
| + }
|
| +#if 0
|
| + // TODO(turbofan): General ToNumber disabled for now because:
|
| + // a) The inserted ToNumber operation screws up observability of valueOf.
|
| + // b) Deoptimization at ToNumber doesn't have corresponding bailout id.
|
| if (r.OneInputIs(Type::Primitive())) {
|
| // If at least one input is a primitive, then insert appropriate conversions
|
| // to number and reduce this operator to the given numeric one.
|
| @@ -260,6 +277,7 @@ Reduction JSTypedLowering::ReduceNumberBinop(Node* node,
|
| r.ConvertInputsToNumber();
|
| return r.ChangeToPureOperator(numberOp);
|
| }
|
| +#endif
|
| // TODO(turbofan): relax/remove the effects of this operator in other cases.
|
| return NoChange();
|
| }
|
| @@ -269,20 +287,27 @@ Reduction JSTypedLowering::ReduceI32Binop(Node* node, bool left_signed,
|
| bool right_signed,
|
| const Operator* intOp) {
|
| JSBinopReduction r(this, node);
|
| - // TODO(titzer): some Smi bitwise operations don't really require going
|
| - // all the way to int32, which can save tagging/untagging for some operations
|
| - // on some platforms.
|
| - // TODO(turbofan): make this heuristic configurable for code size.
|
| - r.ConvertInputsToInt32(left_signed, right_signed);
|
| - return r.ChangeToPureOperator(intOp);
|
| + if (r.BothInputsAre(Type::Primitive())) {
|
| + // TODO(titzer): some Smi bitwise operations don't really require going
|
| + // all the way to int32, which can save tagging/untagging for some
|
| + // operations
|
| + // on some platforms.
|
| + // TODO(turbofan): make this heuristic configurable for code size.
|
| + r.ConvertInputsToInt32(left_signed, right_signed);
|
| + return r.ChangeToPureOperator(intOp);
|
| + }
|
| + return NoChange();
|
| }
|
|
|
|
|
| Reduction JSTypedLowering::ReduceI32Shift(Node* node, bool left_signed,
|
| const Operator* shift_op) {
|
| JSBinopReduction r(this, node);
|
| - r.ConvertInputsForShift(left_signed);
|
| - return r.ChangeToPureOperator(shift_op);
|
| + if (r.BothInputsAre(Type::Primitive())) {
|
| + r.ConvertInputsForShift(left_signed);
|
| + return r.ChangeToPureOperator(shift_op);
|
| + }
|
| + return NoChange();
|
| }
|
|
|
|
|
| @@ -311,9 +336,18 @@ Reduction JSTypedLowering::ReduceJSComparison(Node* node) {
|
| }
|
| return r.ChangeToPureOperator(stringOp);
|
| }
|
| +#if 0
|
| + // TODO(turbofan): General ToNumber disabled for now because:
|
| + // a) The inserted ToNumber operation screws up observability of valueOf.
|
| + // b) Deoptimization at ToNumber doesn't have corresponding bailout id.
|
| Type* maybe_string = Type::Union(Type::String(), Type::Receiver(), zone());
|
| if (r.OneInputCannotBe(maybe_string)) {
|
| // If one input cannot be a string, then emit a number comparison.
|
| + ...
|
| + }
|
| +#endif
|
| + Type* maybe_string = Type::Union(Type::String(), Type::Receiver(), zone());
|
| + if (r.BothInputsAre(Type::Primitive()) && r.OneInputCannotBe(maybe_string)) {
|
| const Operator* less_than;
|
| const Operator* less_than_or_equal;
|
| if (r.BothInputsAre(Type::Unsigned32())) {
|
|
|