| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 __ jmp(&done); | 622 __ jmp(&done); |
| 623 __ Bind(&non_null_compare); // Receiver is not null. | 623 __ Bind(&non_null_compare); // Receiver is not null. |
| 624 __ pushl(left); | 624 __ pushl(left); |
| 625 __ pushl(right); | 625 __ pushl(right); |
| 626 EmitEqualityAsPolymorphicCall(compiler, ic_data, locs, branch, kind, | 626 EmitEqualityAsPolymorphicCall(compiler, ic_data, locs, branch, kind, |
| 627 deopt_id, token_pos); | 627 deopt_id, token_pos); |
| 628 __ Bind(&done); | 628 __ Bind(&done); |
| 629 } | 629 } |
| 630 | 630 |
| 631 | 631 |
| 632 static Condition FlipCondition(Condition condition) { |
| 633 switch (condition) { |
| 634 case EQUAL: return EQUAL; |
| 635 case NOT_EQUAL: return NOT_EQUAL; |
| 636 case LESS: return GREATER; |
| 637 case LESS_EQUAL: return GREATER_EQUAL; |
| 638 case GREATER: return LESS; |
| 639 case GREATER_EQUAL: return LESS_EQUAL; |
| 640 case BELOW: return ABOVE; |
| 641 case BELOW_EQUAL: return ABOVE_EQUAL; |
| 642 case ABOVE: return BELOW; |
| 643 case ABOVE_EQUAL: return BELOW_EQUAL; |
| 644 default: |
| 645 UNIMPLEMENTED(); |
| 646 return EQUAL; |
| 647 } |
| 648 } |
| 649 |
| 650 |
| 632 static void EmitSmiComparisonOp(FlowGraphCompiler* compiler, | 651 static void EmitSmiComparisonOp(FlowGraphCompiler* compiler, |
| 633 const LocationSummary& locs, | 652 const LocationSummary& locs, |
| 634 Token::Kind kind, | 653 Token::Kind kind, |
| 635 BranchInstr* branch) { | 654 BranchInstr* branch) { |
| 636 Location left = locs.in(0); | 655 Location left = locs.in(0); |
| 637 Location right = locs.in(1); | 656 Location right = locs.in(1); |
| 638 ASSERT(!left.IsConstant() || !right.IsConstant()); | 657 ASSERT(!left.IsConstant() || !right.IsConstant()); |
| 639 | 658 |
| 640 Condition true_condition = TokenKindToSmiCondition(kind); | 659 Condition true_condition = TokenKindToSmiCondition(kind); |
| 641 | 660 |
| 642 if (left.IsConstant()) { | 661 if (left.IsConstant()) { |
| 643 __ CompareObject(right.reg(), left.constant()); | 662 __ CompareObject(right.reg(), left.constant()); |
| 644 true_condition = FlowGraphCompiler::FlipCondition(true_condition); | 663 true_condition = FlipCondition(true_condition); |
| 645 } else if (right.IsConstant()) { | 664 } else if (right.IsConstant()) { |
| 646 __ CompareObject(left.reg(), right.constant()); | 665 __ CompareObject(left.reg(), right.constant()); |
| 647 } else if (right.IsStackSlot()) { | 666 } else if (right.IsStackSlot()) { |
| 648 __ cmpl(left.reg(), right.ToStackSlotAddress()); | 667 __ cmpl(left.reg(), right.ToStackSlotAddress()); |
| 649 } else { | 668 } else { |
| 650 __ cmpl(left.reg(), right.reg()); | 669 __ cmpl(left.reg(), right.reg()); |
| 651 } | 670 } |
| 652 | 671 |
| 653 if (branch != NULL) { | 672 if (branch != NULL) { |
| 654 branch->EmitBranchOnCondition(compiler, true_condition); | 673 branch->EmitBranchOnCondition(compiler, true_condition); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 break; | 761 break; |
| 743 } | 762 } |
| 744 ASSERT(hi_cond != OVERFLOW && lo_cond != OVERFLOW); | 763 ASSERT(hi_cond != OVERFLOW && lo_cond != OVERFLOW); |
| 745 Label is_true, is_false; | 764 Label is_true, is_false; |
| 746 // Compare upper halves first. | 765 // Compare upper halves first. |
| 747 __ pextrd(left_tmp, left, Immediate(1)); | 766 __ pextrd(left_tmp, left, Immediate(1)); |
| 748 __ pextrd(right_tmp, right, Immediate(1)); | 767 __ pextrd(right_tmp, right, Immediate(1)); |
| 749 __ cmpl(left_tmp, right_tmp); | 768 __ cmpl(left_tmp, right_tmp); |
| 750 if (branch != NULL) { | 769 if (branch != NULL) { |
| 751 __ j(hi_cond, compiler->GetJumpLabel(branch->true_successor())); | 770 __ j(hi_cond, compiler->GetJumpLabel(branch->true_successor())); |
| 752 __ j(FlowGraphCompiler::FlipCondition(hi_cond), | 771 __ j(FlipCondition(hi_cond), |
| 753 compiler->GetJumpLabel(branch->false_successor())); | 772 compiler->GetJumpLabel(branch->false_successor())); |
| 754 } else { | 773 } else { |
| 755 __ j(hi_cond, &is_true); | 774 __ j(hi_cond, &is_true); |
| 756 __ j(FlowGraphCompiler::FlipCondition(hi_cond), &is_false); | 775 __ j(FlipCondition(hi_cond), &is_false); |
| 757 } | 776 } |
| 758 | 777 |
| 759 // If upper is equal, compare lower half. | 778 // If upper is equal, compare lower half. |
| 760 __ pextrd(left_tmp, left, Immediate(0)); | 779 __ pextrd(left_tmp, left, Immediate(0)); |
| 761 __ pextrd(right_tmp, right, Immediate(0)); | 780 __ pextrd(right_tmp, right, Immediate(0)); |
| 762 __ cmpl(left_tmp, right_tmp); | 781 __ cmpl(left_tmp, right_tmp); |
| 763 if (branch != NULL) { | 782 if (branch != NULL) { |
| 764 branch->EmitBranchOnCondition(compiler, lo_cond); | 783 branch->EmitBranchOnCondition(compiler, lo_cond); |
| 765 } else { | 784 } else { |
| 766 Label done; | 785 Label done; |
| (...skipping 3924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4691 PcDescriptors::kOther, | 4710 PcDescriptors::kOther, |
| 4692 locs()); | 4711 locs()); |
| 4693 __ Drop(2); // Discard type arguments and receiver. | 4712 __ Drop(2); // Discard type arguments and receiver. |
| 4694 } | 4713 } |
| 4695 | 4714 |
| 4696 } // namespace dart | 4715 } // namespace dart |
| 4697 | 4716 |
| 4698 #undef __ | 4717 #undef __ |
| 4699 | 4718 |
| 4700 #endif // defined TARGET_ARCH_IA32 | 4719 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |