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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 return BinaryOperationHints::kAny; | 45 return BinaryOperationHints::kAny; |
46 } | 46 } |
47 | 47 |
48 CompareOperationHints::Hint GetNumberCompareOperationFeedback() { | 48 CompareOperationHints::Hint GetNumberCompareOperationFeedback() { |
49 if (!(lowering_->flags() & JSTypedLowering::kDeoptimizationEnabled) || | 49 if (!(lowering_->flags() & JSTypedLowering::kDeoptimizationEnabled) || |
50 !(lowering_->flags() & JSTypedLowering::kTypeFeedbackEnabled)) { | 50 !(lowering_->flags() & JSTypedLowering::kTypeFeedbackEnabled)) { |
51 return CompareOperationHints::kAny; | 51 return CompareOperationHints::kAny; |
52 } | 52 } |
53 DCHECK_NE(0, node_->op()->ControlOutputCount()); | 53 DCHECK_NE(0, node_->op()->ControlOutputCount()); |
54 DCHECK_EQ(1, node_->op()->EffectOutputCount()); | 54 DCHECK_EQ(1, node_->op()->EffectOutputCount()); |
55 DCHECK_EQ(2, OperatorProperties::GetFrameStateInputCount(node_->op())); | 55 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node_->op())); |
56 CompareOperationHints hints = CompareOperationHintsOf(node_->op()); | 56 CompareOperationHints hints = CompareOperationHintsOf(node_->op()); |
57 CompareOperationHints::Hint combined = hints.combined(); | 57 CompareOperationHints::Hint combined = hints.combined(); |
58 if (combined == CompareOperationHints::kSignedSmall || | 58 if (combined == CompareOperationHints::kSignedSmall || |
59 combined == CompareOperationHints::kNumber) { | 59 combined == CompareOperationHints::kNumber) { |
60 return combined; | 60 return combined; |
61 } | 61 } |
62 return CompareOperationHints::kAny; | 62 return CompareOperationHints::kAny; |
63 } | 63 } |
64 | 64 |
65 void ConvertInputsToNumber() { | 65 void ConvertInputsToNumber() { |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 } | 637 } |
638 | 638 |
639 CompareOperationHints::Hint hint = r.GetNumberCompareOperationFeedback(); | 639 CompareOperationHints::Hint hint = r.GetNumberCompareOperationFeedback(); |
640 if (hint != CompareOperationHints::kAny || | 640 if (hint != CompareOperationHints::kAny || |
641 r.OneInputCannotBe(Type::StringOrReceiver())) { | 641 r.OneInputCannotBe(Type::StringOrReceiver())) { |
642 const Operator* less_than; | 642 const Operator* less_than; |
643 const Operator* less_than_or_equal; | 643 const Operator* less_than_or_equal; |
644 if (hint != CompareOperationHints::kAny) { | 644 if (hint != CompareOperationHints::kAny) { |
645 less_than = simplified()->SpeculativeNumberLessThan(hint); | 645 less_than = simplified()->SpeculativeNumberLessThan(hint); |
646 less_than_or_equal = simplified()->SpeculativeNumberLessThanOrEqual(hint); | 646 less_than_or_equal = simplified()->SpeculativeNumberLessThanOrEqual(hint); |
647 } else { | 647 } else if (r.BothInputsAre(Type::PlainPrimitive()) || |
| 648 !(flags() & kDeoptimizationEnabled)) { |
648 r.ConvertInputsToNumber(); | 649 r.ConvertInputsToNumber(); |
649 less_than = simplified()->NumberLessThan(); | 650 less_than = simplified()->NumberLessThan(); |
650 less_than_or_equal = simplified()->NumberLessThanOrEqual(); | 651 less_than_or_equal = simplified()->NumberLessThanOrEqual(); |
| 652 } else { |
| 653 return NoChange(); |
651 } | 654 } |
652 const Operator* comparison; | 655 const Operator* comparison; |
653 switch (node->opcode()) { | 656 switch (node->opcode()) { |
654 case IrOpcode::kJSLessThan: | 657 case IrOpcode::kJSLessThan: |
655 comparison = less_than; | 658 comparison = less_than; |
656 break; | 659 break; |
657 case IrOpcode::kJSGreaterThan: | 660 case IrOpcode::kJSGreaterThan: |
658 comparison = less_than; | 661 comparison = less_than; |
659 r.SwapInputs(); // a > b => b < a | 662 r.SwapInputs(); // a > b => b < a |
660 break; | 663 break; |
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2069 } | 2072 } |
2070 | 2073 |
2071 | 2074 |
2072 CompilationDependencies* JSTypedLowering::dependencies() const { | 2075 CompilationDependencies* JSTypedLowering::dependencies() const { |
2073 return dependencies_; | 2076 return dependencies_; |
2074 } | 2077 } |
2075 | 2078 |
2076 } // namespace compiler | 2079 } // namespace compiler |
2077 } // namespace internal | 2080 } // namespace internal |
2078 } // namespace v8 | 2081 } // namespace v8 |
OLD | NEW |