OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/compilation-dependencies.h" | 6 #include "src/compilation-dependencies.h" |
7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/js-typed-lowering.h" | 9 #include "src/compiler/js-typed-lowering.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 // y:plain-primitive) => NumberModulus(ToNumber(x), ToNumber(y)) | 575 // y:plain-primitive) => NumberModulus(ToNumber(x), ToNumber(y)) |
576 r.ConvertInputsToNumber(); | 576 r.ConvertInputsToNumber(); |
577 return r.ChangeToPureOperator(simplified()->NumberModulus(), | 577 return r.ChangeToPureOperator(simplified()->NumberModulus(), |
578 Type::Number()); | 578 Type::Number()); |
579 } | 579 } |
580 return NoChange(); | 580 return NoChange(); |
581 } | 581 } |
582 | 582 |
583 Reduction JSTypedLowering::ReduceInt32Binop(Node* node, | 583 Reduction JSTypedLowering::ReduceInt32Binop(Node* node, |
584 const Operator* int_op) { | 584 const Operator* int_op) { |
585 if (flags() & kDisableIntegerBinaryOpReduction) return NoChange(); | |
586 JSBinopReduction r(this, node); | 585 JSBinopReduction r(this, node); |
587 BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback(); | 586 BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback(); |
588 if (feedback != BinaryOperationHints::kAny) { | 587 if (feedback != BinaryOperationHints::kAny) { |
589 Operator const* speculative_op; | 588 Operator const* speculative_op; |
590 if (int_op->opcode() == IrOpcode::kNumberBitwiseAnd) { | 589 if (int_op->opcode() == IrOpcode::kNumberBitwiseAnd) { |
591 speculative_op = simplified()->SpeculativeNumberBitwiseAnd(feedback); | 590 speculative_op = simplified()->SpeculativeNumberBitwiseAnd(feedback); |
592 } else if (int_op->opcode() == IrOpcode::kNumberBitwiseOr) { | 591 } else if (int_op->opcode() == IrOpcode::kNumberBitwiseOr) { |
593 speculative_op = simplified()->SpeculativeNumberBitwiseOr(feedback); | 592 speculative_op = simplified()->SpeculativeNumberBitwiseOr(feedback); |
594 } else { | 593 } else { |
595 DCHECK_EQ(IrOpcode::kNumberBitwiseXor, int_op->opcode()); | 594 DCHECK_EQ(IrOpcode::kNumberBitwiseXor, int_op->opcode()); |
596 speculative_op = simplified()->SpeculativeNumberBitwiseXor(feedback); | 595 speculative_op = simplified()->SpeculativeNumberBitwiseXor(feedback); |
597 } | 596 } |
598 return r.ChangeToSpeculativeOperator(speculative_op, Type::Signed32()); | 597 return r.ChangeToSpeculativeOperator(speculative_op, Type::Signed32()); |
599 } | 598 } |
600 r.ConvertInputsToNumber(); | 599 |
601 r.ConvertInputsToUI32(kSigned, kSigned); | 600 // If deoptimization is enabled we rely on type feedback. |
602 return r.ChangeToPureOperator(int_op, Type::Signed32()); | 601 if (r.BothInputsAre(Type::PlainPrimitive()) || |
| 602 !(flags() & kDeoptimizationEnabled)) { |
| 603 r.ConvertInputsToNumber(); |
| 604 r.ConvertInputsToUI32(kSigned, kSigned); |
| 605 return r.ChangeToPureOperator(int_op, Type::Signed32()); |
| 606 } |
| 607 return NoChange(); |
603 } | 608 } |
604 | 609 |
605 Reduction JSTypedLowering::ReduceUI32Shift(Node* node, | 610 Reduction JSTypedLowering::ReduceUI32Shift(Node* node, |
606 Signedness left_signedness, | 611 Signedness left_signedness, |
607 const Operator* shift_op) { | 612 const Operator* shift_op) { |
608 JSBinopReduction r(this, node); | 613 JSBinopReduction r(this, node); |
609 BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback(); | 614 BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback(); |
610 if (feedback != BinaryOperationHints::kAny) { | 615 if (feedback != BinaryOperationHints::kAny) { |
611 Operator const* speculative_op; | 616 Operator const* speculative_op; |
612 if (shift_op->opcode() == IrOpcode::kNumberShiftLeft) { | 617 if (shift_op->opcode() == IrOpcode::kNumberShiftLeft) { |
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2165 } | 2170 } |
2166 | 2171 |
2167 | 2172 |
2168 CompilationDependencies* JSTypedLowering::dependencies() const { | 2173 CompilationDependencies* JSTypedLowering::dependencies() const { |
2169 return dependencies_; | 2174 return dependencies_; |
2170 } | 2175 } |
2171 | 2176 |
2172 } // namespace compiler | 2177 } // namespace compiler |
2173 } // namespace internal | 2178 } // namespace internal |
2174 } // namespace v8 | 2179 } // namespace v8 |
OLD | NEW |