| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/intrinsifier.h" | 8 #include "vm/intrinsifier.h" |
| 9 | 9 |
| 10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 Label receiver_not_smi; | 780 Label receiver_not_smi; |
| 781 __ Bind(&check_for_mint); | 781 __ Bind(&check_for_mint); |
| 782 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Receiver. | 782 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Receiver. |
| 783 __ testq(RAX, Immediate(kSmiTagMask)); | 783 __ testq(RAX, Immediate(kSmiTagMask)); |
| 784 __ j(NOT_ZERO, &receiver_not_smi); | 784 __ j(NOT_ZERO, &receiver_not_smi); |
| 785 | 785 |
| 786 // Left (receiver) is Smi, return false if right is not Double. | 786 // Left (receiver) is Smi, return false if right is not Double. |
| 787 // Note that an instance of Mint or Bigint never contains a value that can be | 787 // Note that an instance of Mint or Bigint never contains a value that can be |
| 788 // represented by Smi. | 788 // represented by Smi. |
| 789 __ movq(RAX, Address(RSP, + 1 * kWordSize)); | 789 __ movq(RAX, Address(RSP, + 1 * kWordSize)); |
| 790 __ CompareClassId(RAX, kDouble); | 790 __ CompareClassId(RAX, kDoubleCid); |
| 791 __ j(EQUAL, &fall_through); | 791 __ j(EQUAL, &fall_through); |
| 792 __ LoadObject(RAX, bool_false); | 792 __ LoadObject(RAX, bool_false); |
| 793 __ ret(); | 793 __ ret(); |
| 794 | 794 |
| 795 __ Bind(&receiver_not_smi); | 795 __ Bind(&receiver_not_smi); |
| 796 // RAX:: receiver. | 796 // RAX:: receiver. |
| 797 __ CompareClassId(RAX, kMint); | 797 __ CompareClassId(RAX, kMintCid); |
| 798 __ j(NOT_EQUAL, &fall_through); | 798 __ j(NOT_EQUAL, &fall_through); |
| 799 // Receiver is Mint, return false if right is Smi. | 799 // Receiver is Mint, return false if right is Smi. |
| 800 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // Right argument. | 800 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // Right argument. |
| 801 __ testq(RAX, Immediate(kSmiTagMask)); | 801 __ testq(RAX, Immediate(kSmiTagMask)); |
| 802 __ j(NOT_ZERO, &fall_through); | 802 __ j(NOT_ZERO, &fall_through); |
| 803 __ LoadObject(RAX, bool_false); // Smi == Mint -> false. | 803 __ LoadObject(RAX, bool_false); // Smi == Mint -> false. |
| 804 __ ret(); | 804 __ ret(); |
| 805 // TODO(srdjan): Implement Mint == Mint comparison. | 805 // TODO(srdjan): Implement Mint == Mint comparison. |
| 806 | 806 |
| 807 __ Bind(&fall_through); | 807 __ Bind(&fall_through); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 | 852 |
| 853 // Check if the last argument is a double, jump to label 'is_smi' if smi | 853 // Check if the last argument is a double, jump to label 'is_smi' if smi |
| 854 // (easy to convert to double), otherwise jump to label 'not_double_smi', | 854 // (easy to convert to double), otherwise jump to label 'not_double_smi', |
| 855 // Returns the last argument in RAX. | 855 // Returns the last argument in RAX. |
| 856 static void TestLastArgumentIsDouble(Assembler* assembler, | 856 static void TestLastArgumentIsDouble(Assembler* assembler, |
| 857 Label* is_smi, | 857 Label* is_smi, |
| 858 Label* not_double_smi) { | 858 Label* not_double_smi) { |
| 859 __ movq(RAX, Address(RSP, + 1 * kWordSize)); | 859 __ movq(RAX, Address(RSP, + 1 * kWordSize)); |
| 860 __ testq(RAX, Immediate(kSmiTagMask)); | 860 __ testq(RAX, Immediate(kSmiTagMask)); |
| 861 __ j(ZERO, is_smi, Assembler::kNearJump); // Jump if Smi. | 861 __ j(ZERO, is_smi, Assembler::kNearJump); // Jump if Smi. |
| 862 __ CompareClassId(RAX, kDouble); | 862 __ CompareClassId(RAX, kDoubleCid); |
| 863 __ j(NOT_EQUAL, not_double_smi, Assembler::kNearJump); | 863 __ j(NOT_EQUAL, not_double_smi, Assembler::kNearJump); |
| 864 // Fall through if double. | 864 // Fall through if double. |
| 865 } | 865 } |
| 866 | 866 |
| 867 | 867 |
| 868 // Both arguments on stack, left argument is a double, right argument is of | 868 // Both arguments on stack, left argument is a double, right argument is of |
| 869 // unknown type. Return true or false object in RAX. Any NaN argument | 869 // unknown type. Return true or false object in RAX. Any NaN argument |
| 870 // returns false. Any non-double argument causes control flow to fall through | 870 // returns false. Any non-double argument causes control flow to fall through |
| 871 // to the slow case (compiled method body). | 871 // to the slow case (compiled method body). |
| 872 static bool CompareDoubles(Assembler* assembler, Condition true_condition) { | 872 static bool CompareDoubles(Assembler* assembler, Condition true_condition) { |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1274 bool Intrinsifier::String_charCodeAt(Assembler* assembler) { | 1274 bool Intrinsifier::String_charCodeAt(Assembler* assembler) { |
| 1275 Label fall_through; | 1275 Label fall_through; |
| 1276 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Index. | 1276 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Index. |
| 1277 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // String. | 1277 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // String. |
| 1278 __ testq(RCX, Immediate(kSmiTagMask)); | 1278 __ testq(RCX, Immediate(kSmiTagMask)); |
| 1279 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index. | 1279 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index. |
| 1280 // Range check. | 1280 // Range check. |
| 1281 __ cmpq(RCX, FieldAddress(RAX, String::length_offset())); | 1281 __ cmpq(RCX, FieldAddress(RAX, String::length_offset())); |
| 1282 // Runtime throws exception. | 1282 // Runtime throws exception. |
| 1283 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); | 1283 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); |
| 1284 __ CompareClassId(RAX, kOneByteString); | 1284 __ CompareClassId(RAX, kOneByteStringCid); |
| 1285 __ j(NOT_EQUAL, &fall_through); | 1285 __ j(NOT_EQUAL, &fall_through); |
| 1286 __ SmiUntag(RCX); | 1286 __ SmiUntag(RCX); |
| 1287 __ movzxb(RAX, FieldAddress(RAX, RCX, TIMES_1, OneByteString::data_offset())); | 1287 __ movzxb(RAX, FieldAddress(RAX, RCX, TIMES_1, OneByteString::data_offset())); |
| 1288 __ SmiTag(RAX); | 1288 __ SmiTag(RAX); |
| 1289 __ ret(); | 1289 __ ret(); |
| 1290 __ Bind(&fall_through); | 1290 __ Bind(&fall_through); |
| 1291 return false; | 1291 return false; |
| 1292 } | 1292 } |
| 1293 | 1293 |
| 1294 | 1294 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1320 __ LoadObject(RAX, bool_true); | 1320 __ LoadObject(RAX, bool_true); |
| 1321 __ ret(); | 1321 __ ret(); |
| 1322 return true; | 1322 return true; |
| 1323 } | 1323 } |
| 1324 | 1324 |
| 1325 #undef __ | 1325 #undef __ |
| 1326 | 1326 |
| 1327 } // namespace dart | 1327 } // namespace dart |
| 1328 | 1328 |
| 1329 #endif // defined TARGET_ARCH_X64 | 1329 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |