| 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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 __ jmp(&done); | 778 __ jmp(&done); |
| 779 __ Bind(&non_null_compare); // Receiver is not null. | 779 __ Bind(&non_null_compare); // Receiver is not null. |
| 780 __ pushq(left); | 780 __ pushq(left); |
| 781 __ pushq(right); | 781 __ pushq(right); |
| 782 EmitEqualityAsPolymorphicCall(compiler, ic_data, locs, branch, kind, | 782 EmitEqualityAsPolymorphicCall(compiler, ic_data, locs, branch, kind, |
| 783 deopt_id, token_pos); | 783 deopt_id, token_pos); |
| 784 __ Bind(&done); | 784 __ Bind(&done); |
| 785 } | 785 } |
| 786 | 786 |
| 787 | 787 |
| 788 static Condition FlipCondition(Condition condition) { |
| 789 switch (condition) { |
| 790 case EQUAL: return EQUAL; |
| 791 case NOT_EQUAL: return NOT_EQUAL; |
| 792 case LESS: return GREATER; |
| 793 case LESS_EQUAL: return GREATER_EQUAL; |
| 794 case GREATER: return LESS; |
| 795 case GREATER_EQUAL: return LESS_EQUAL; |
| 796 case BELOW: return ABOVE; |
| 797 case BELOW_EQUAL: return ABOVE_EQUAL; |
| 798 case ABOVE: return BELOW; |
| 799 case ABOVE_EQUAL: return BELOW_EQUAL; |
| 800 default: |
| 801 UNIMPLEMENTED(); |
| 802 return EQUAL; |
| 803 } |
| 804 } |
| 805 |
| 806 |
| 788 static void EmitSmiComparisonOp(FlowGraphCompiler* compiler, | 807 static void EmitSmiComparisonOp(FlowGraphCompiler* compiler, |
| 789 const LocationSummary& locs, | 808 const LocationSummary& locs, |
| 790 Token::Kind kind, | 809 Token::Kind kind, |
| 791 BranchInstr* branch) { | 810 BranchInstr* branch) { |
| 792 Location left = locs.in(0); | 811 Location left = locs.in(0); |
| 793 Location right = locs.in(1); | 812 Location right = locs.in(1); |
| 794 ASSERT(!left.IsConstant() || !right.IsConstant()); | 813 ASSERT(!left.IsConstant() || !right.IsConstant()); |
| 795 | 814 |
| 796 Condition true_condition = TokenKindToSmiCondition(kind); | 815 Condition true_condition = TokenKindToSmiCondition(kind); |
| 797 | 816 |
| 798 if (left.IsConstant()) { | 817 if (left.IsConstant()) { |
| 799 __ CompareObject(right.reg(), left.constant()); | 818 __ CompareObject(right.reg(), left.constant()); |
| 800 true_condition = FlowGraphCompiler::FlipCondition(true_condition); | 819 true_condition = FlipCondition(true_condition); |
| 801 } else if (right.IsConstant()) { | 820 } else if (right.IsConstant()) { |
| 802 __ CompareObject(left.reg(), right.constant()); | 821 __ CompareObject(left.reg(), right.constant()); |
| 803 } else if (right.IsStackSlot()) { | 822 } else if (right.IsStackSlot()) { |
| 804 __ cmpq(left.reg(), right.ToStackSlotAddress()); | 823 __ cmpq(left.reg(), right.ToStackSlotAddress()); |
| 805 } else { | 824 } else { |
| 806 __ cmpq(left.reg(), right.reg()); | 825 __ cmpq(left.reg(), right.reg()); |
| 807 } | 826 } |
| 808 | 827 |
| 809 if (branch != NULL) { | 828 if (branch != NULL) { |
| 810 branch->EmitBranchOnCondition(compiler, true_condition); | 829 branch->EmitBranchOnCondition(compiler, true_condition); |
| (...skipping 3524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4335 PcDescriptors::kOther, | 4354 PcDescriptors::kOther, |
| 4336 locs()); | 4355 locs()); |
| 4337 __ Drop(2); // Discard type arguments and receiver. | 4356 __ Drop(2); // Discard type arguments and receiver. |
| 4338 } | 4357 } |
| 4339 | 4358 |
| 4340 } // namespace dart | 4359 } // namespace dart |
| 4341 | 4360 |
| 4342 #undef __ | 4361 #undef __ |
| 4343 | 4362 |
| 4344 #endif // defined TARGET_ARCH_X64 | 4363 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |