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/intrinsifier.h" | 8 #include "vm/intrinsifier.h" |
9 | 9 |
10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 __ movq(RDI, Address(RSP, kArrayLengthOffset)); // Array Length. | 110 __ movq(RDI, Address(RSP, kArrayLengthOffset)); // Array Length. |
111 __ StoreIntoObjectNoBarrier(RAX, | 111 __ StoreIntoObjectNoBarrier(RAX, |
112 FieldAddress(RAX, Array::length_offset()), | 112 FieldAddress(RAX, Array::length_offset()), |
113 RDI); | 113 RDI); |
114 | 114 |
115 // Initialize all array elements to raw_null. | 115 // Initialize all array elements to raw_null. |
116 // RAX: new object start as a tagged pointer. | 116 // RAX: new object start as a tagged pointer. |
117 // RCX: new object end address. | 117 // RCX: new object end address. |
118 // RDI: iterator which initially points to the start of the variable | 118 // RDI: iterator which initially points to the start of the variable |
119 // data area to be initialized. | 119 // data area to be initialized. |
120 const Immediate& raw_null = | 120 __ LoadObject(R12, Object::Handle(), PP); |
121 Immediate(reinterpret_cast<intptr_t>(Object::null())); | |
122 __ leaq(RDI, FieldAddress(RAX, sizeof(RawArray))); | 121 __ leaq(RDI, FieldAddress(RAX, sizeof(RawArray))); |
123 Label done; | 122 Label done; |
124 Label init_loop; | 123 Label init_loop; |
125 __ Bind(&init_loop); | 124 __ Bind(&init_loop); |
126 __ cmpq(RDI, RCX); | 125 __ cmpq(RDI, RCX); |
127 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump); | 126 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump); |
128 __ movq(Address(RDI, 0), raw_null); | 127 __ movq(Address(RDI, 0), R12); |
129 __ addq(RDI, Immediate(kWordSize)); | 128 __ addq(RDI, Immediate(kWordSize)); |
130 __ jmp(&init_loop, Assembler::kNearJump); | 129 __ jmp(&init_loop, Assembler::kNearJump); |
131 __ Bind(&done); | 130 __ Bind(&done); |
132 __ ret(); // returns the newly allocated object in RAX. | 131 __ ret(); // returns the newly allocated object in RAX. |
133 | 132 |
134 __ Bind(&fall_through); | 133 __ Bind(&fall_through); |
135 } | 134 } |
136 | 135 |
137 | 136 |
138 void Intrinsifier::Array_getLength(Assembler* assembler) { | 137 void Intrinsifier::Array_getLength(Assembler* assembler) { |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 __ j(EQUAL, &fall_through); // Must grow data. | 384 __ j(EQUAL, &fall_through); // Must grow data. |
386 const Immediate& value_one = | 385 const Immediate& value_one = |
387 Immediate(reinterpret_cast<int64_t>(Smi::New(1))); | 386 Immediate(reinterpret_cast<int64_t>(Smi::New(1))); |
388 // len = len + 1; | 387 // len = len + 1; |
389 __ addq(FieldAddress(RAX, GrowableObjectArray::length_offset()), value_one); | 388 __ addq(FieldAddress(RAX, GrowableObjectArray::length_offset()), value_one); |
390 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // Value | 389 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // Value |
391 ASSERT(kSmiTagShift == 1); | 390 ASSERT(kSmiTagShift == 1); |
392 __ StoreIntoObject(RDX, | 391 __ StoreIntoObject(RDX, |
393 FieldAddress(RDX, RCX, TIMES_4, Array::data_offset()), | 392 FieldAddress(RDX, RCX, TIMES_4, Array::data_offset()), |
394 RAX); | 393 RAX); |
395 const Immediate& raw_null = | 394 __ LoadObject(RAX, Object::Handle(), PP); |
396 Immediate(reinterpret_cast<int64_t>(Object::null())); | |
397 __ movq(RAX, raw_null); | |
398 __ ret(); | 395 __ ret(); |
399 __ Bind(&fall_through); | 396 __ Bind(&fall_through); |
400 } | 397 } |
401 | 398 |
402 | 399 |
403 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_factor) \ | 400 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_factor) \ |
404 Label fall_through; \ | 401 Label fall_through; \ |
405 const intptr_t kArrayLengthStackOffset = 1 * kWordSize; \ | 402 const intptr_t kArrayLengthStackOffset = 1 * kWordSize; \ |
406 __ movq(RDI, Address(RSP, kArrayLengthStackOffset)); /* Array length. */ \ | 403 __ movq(RDI, Address(RSP, kArrayLengthStackOffset)); /* Array length. */ \ |
407 /* Check that length is a positive Smi. */ \ | 404 /* Check that length is a positive Smi. */ \ |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 __ Bind(&fall_through); | 869 __ Bind(&fall_through); |
873 } | 870 } |
874 | 871 |
875 | 872 |
876 static void CompareIntegers(Assembler* assembler, Condition true_condition) { | 873 static void CompareIntegers(Assembler* assembler, Condition true_condition) { |
877 Label fall_through, true_label; | 874 Label fall_through, true_label; |
878 TestBothArgumentsSmis(assembler, &fall_through); | 875 TestBothArgumentsSmis(assembler, &fall_through); |
879 // RAX contains the right argument. | 876 // RAX contains the right argument. |
880 __ cmpq(Address(RSP, + 2 * kWordSize), RAX); | 877 __ cmpq(Address(RSP, + 2 * kWordSize), RAX); |
881 __ j(true_condition, &true_label, Assembler::kNearJump); | 878 __ j(true_condition, &true_label, Assembler::kNearJump); |
882 __ LoadObject(RAX, Bool::False()); | 879 __ LoadObject(RAX, Bool::False(), PP); |
883 __ ret(); | 880 __ ret(); |
884 __ Bind(&true_label); | 881 __ Bind(&true_label); |
885 __ LoadObject(RAX, Bool::True()); | 882 __ LoadObject(RAX, Bool::True(), PP); |
886 __ ret(); | 883 __ ret(); |
887 __ Bind(&fall_through); | 884 __ Bind(&fall_through); |
888 } | 885 } |
889 | 886 |
890 | 887 |
891 | 888 |
892 void Intrinsifier::Integer_lessThan(Assembler* assembler) { | 889 void Intrinsifier::Integer_lessThan(Assembler* assembler) { |
893 return CompareIntegers(assembler, LESS); | 890 return CompareIntegers(assembler, LESS); |
894 } | 891 } |
895 | 892 |
(...skipping 16 matching lines...) Expand all Loading... |
912 void Intrinsifier::Integer_greaterEqualThan(Assembler* assembler) { | 909 void Intrinsifier::Integer_greaterEqualThan(Assembler* assembler) { |
913 return CompareIntegers(assembler, GREATER_EQUAL); | 910 return CompareIntegers(assembler, GREATER_EQUAL); |
914 } | 911 } |
915 | 912 |
916 | 913 |
917 // This is called for Smi, Mint and Bigint receivers. The right argument | 914 // This is called for Smi, Mint and Bigint receivers. The right argument |
918 // can be Smi, Mint, Bigint or double. | 915 // can be Smi, Mint, Bigint or double. |
919 void Intrinsifier::Integer_equalToInteger(Assembler* assembler) { | 916 void Intrinsifier::Integer_equalToInteger(Assembler* assembler) { |
920 Label fall_through, true_label, check_for_mint; | 917 Label fall_through, true_label, check_for_mint; |
921 // For integer receiver '===' check first. | 918 // For integer receiver '===' check first. |
922 __ movq(RAX, Address(RSP, + 1 * kWordSize)); | 919 // Entering a dart frame so we can use the PP for loading True and False. |
923 __ movq(RCX, Address(RSP, + 2 * kWordSize)); | 920 __ EnterDartFrame(0); |
| 921 __ movq(RAX, Address(RSP, + 4 * kWordSize)); |
| 922 __ movq(RCX, Address(RSP, + 5 * kWordSize)); |
924 __ cmpq(RAX, RCX); | 923 __ cmpq(RAX, RCX); |
925 __ j(EQUAL, &true_label, Assembler::kNearJump); | 924 __ j(EQUAL, &true_label, Assembler::kNearJump); |
926 __ orq(RAX, RCX); | 925 __ orq(RAX, RCX); |
927 __ testq(RAX, Immediate(kSmiTagMask)); | 926 __ testq(RAX, Immediate(kSmiTagMask)); |
928 __ j(NOT_ZERO, &check_for_mint, Assembler::kNearJump); | 927 __ j(NOT_ZERO, &check_for_mint, Assembler::kNearJump); |
929 // Both arguments are smi, '===' is good enough. | 928 // Both arguments are smi, '===' is good enough. |
930 __ LoadObject(RAX, Bool::False()); | 929 __ LoadObject(RAX, Bool::False(), PP); |
| 930 __ LeaveFrameWithPP(); |
931 __ ret(); | 931 __ ret(); |
932 __ Bind(&true_label); | 932 __ Bind(&true_label); |
933 __ LoadObject(RAX, Bool::True()); | 933 __ LoadObject(RAX, Bool::True(), PP); |
| 934 __ LeaveFrameWithPP(); |
934 __ ret(); | 935 __ ret(); |
935 | 936 |
936 // At least one of the arguments was not Smi. | 937 // At least one of the arguments was not Smi. |
937 Label receiver_not_smi; | 938 Label receiver_not_smi; |
938 __ Bind(&check_for_mint); | 939 __ Bind(&check_for_mint); |
939 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Receiver. | 940 __ movq(RAX, Address(RSP, + 5 * kWordSize)); // Receiver. |
940 __ testq(RAX, Immediate(kSmiTagMask)); | 941 __ testq(RAX, Immediate(kSmiTagMask)); |
941 __ j(NOT_ZERO, &receiver_not_smi); | 942 __ j(NOT_ZERO, &receiver_not_smi); |
942 | 943 |
943 // Left (receiver) is Smi, return false if right is not Double. | 944 // Left (receiver) is Smi, return false if right is not Double. |
944 // Note that an instance of Mint or Bigint never contains a value that can be | 945 // Note that an instance of Mint or Bigint never contains a value that can be |
945 // represented by Smi. | 946 // represented by Smi. |
946 __ movq(RAX, Address(RSP, + 1 * kWordSize)); | 947 __ movq(RAX, Address(RSP, + 4 * kWordSize)); |
947 __ CompareClassId(RAX, kDoubleCid); | 948 __ CompareClassId(RAX, kDoubleCid); |
948 __ j(EQUAL, &fall_through); | 949 __ j(EQUAL, &fall_through); |
949 __ LoadObject(RAX, Bool::False()); | 950 __ LoadObject(RAX, Bool::False(), PP); |
| 951 __ LeaveFrameWithPP(); |
950 __ ret(); | 952 __ ret(); |
951 | 953 |
952 __ Bind(&receiver_not_smi); | 954 __ Bind(&receiver_not_smi); |
953 // RAX:: receiver. | 955 // RAX:: receiver. |
954 __ CompareClassId(RAX, kMintCid); | 956 __ CompareClassId(RAX, kMintCid); |
955 __ j(NOT_EQUAL, &fall_through); | 957 __ j(NOT_EQUAL, &fall_through); |
956 // Receiver is Mint, return false if right is Smi. | 958 // Receiver is Mint, return false if right is Smi. |
957 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // Right argument. | 959 __ movq(RAX, Address(RSP, + 4 * kWordSize)); // Right argument. |
958 __ testq(RAX, Immediate(kSmiTagMask)); | 960 __ testq(RAX, Immediate(kSmiTagMask)); |
959 __ j(NOT_ZERO, &fall_through); | 961 __ j(NOT_ZERO, &fall_through); |
960 __ LoadObject(RAX, Bool::False()); // Smi == Mint -> false. | 962 // Smi == Mint -> false. |
| 963 __ LoadObject(RAX, Bool::False(), PP); |
| 964 __ LeaveFrameWithPP(); |
961 __ ret(); | 965 __ ret(); |
962 // TODO(srdjan): Implement Mint == Mint comparison. | 966 // TODO(srdjan): Implement Mint == Mint comparison. |
963 | 967 |
964 __ Bind(&fall_through); | 968 __ Bind(&fall_through); |
| 969 __ LeaveFrameWithPP(); |
965 } | 970 } |
966 | 971 |
967 | 972 |
968 void Intrinsifier::Integer_equal(Assembler* assembler) { | 973 void Intrinsifier::Integer_equal(Assembler* assembler) { |
969 return Integer_equalToInteger(assembler); | 974 return Integer_equalToInteger(assembler); |
970 } | 975 } |
971 | 976 |
972 | 977 |
973 void Intrinsifier::Integer_sar(Assembler* assembler) { | 978 void Intrinsifier::Integer_sar(Assembler* assembler) { |
974 Label fall_through, shift_count_ok; | 979 Label fall_through, shift_count_ok; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 // Both arguments are double, right operand is in RAX. | 1039 // Both arguments are double, right operand is in RAX. |
1035 __ movsd(XMM1, FieldAddress(RAX, Double::value_offset())); | 1040 __ movsd(XMM1, FieldAddress(RAX, Double::value_offset())); |
1036 __ Bind(&double_op); | 1041 __ Bind(&double_op); |
1037 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Left argument. | 1042 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // Left argument. |
1038 __ movsd(XMM0, FieldAddress(RAX, Double::value_offset())); | 1043 __ movsd(XMM0, FieldAddress(RAX, Double::value_offset())); |
1039 __ comisd(XMM0, XMM1); | 1044 __ comisd(XMM0, XMM1); |
1040 __ j(PARITY_EVEN, &is_false, Assembler::kNearJump); // NaN -> false; | 1045 __ j(PARITY_EVEN, &is_false, Assembler::kNearJump); // NaN -> false; |
1041 __ j(true_condition, &is_true, Assembler::kNearJump); | 1046 __ j(true_condition, &is_true, Assembler::kNearJump); |
1042 // Fall through false. | 1047 // Fall through false. |
1043 __ Bind(&is_false); | 1048 __ Bind(&is_false); |
1044 __ LoadObject(RAX, Bool::False()); | 1049 __ LoadObject(RAX, Bool::False(), PP); |
1045 __ ret(); | 1050 __ ret(); |
1046 __ Bind(&is_true); | 1051 __ Bind(&is_true); |
1047 __ LoadObject(RAX, Bool::True()); | 1052 __ LoadObject(RAX, Bool::True(), PP); |
1048 __ ret(); | 1053 __ ret(); |
1049 __ Bind(&is_smi); | 1054 __ Bind(&is_smi); |
1050 __ SmiUntag(RAX); | 1055 __ SmiUntag(RAX); |
1051 __ cvtsi2sd(XMM1, RAX); | 1056 __ cvtsi2sd(XMM1, RAX); |
1052 __ jmp(&double_op); | 1057 __ jmp(&double_op); |
1053 __ Bind(&fall_through); | 1058 __ Bind(&fall_through); |
1054 } | 1059 } |
1055 | 1060 |
1056 | 1061 |
1057 void Intrinsifier::Double_greaterThan(Assembler* assembler) { | 1062 void Intrinsifier::Double_greaterThan(Assembler* assembler) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1171 __ Bind(&fall_through); | 1176 __ Bind(&fall_through); |
1172 } | 1177 } |
1173 | 1178 |
1174 | 1179 |
1175 void Intrinsifier::Double_getIsNaN(Assembler* assembler) { | 1180 void Intrinsifier::Double_getIsNaN(Assembler* assembler) { |
1176 Label is_true; | 1181 Label is_true; |
1177 __ movq(RAX, Address(RSP, +1 * kWordSize)); | 1182 __ movq(RAX, Address(RSP, +1 * kWordSize)); |
1178 __ movsd(XMM0, FieldAddress(RAX, Double::value_offset())); | 1183 __ movsd(XMM0, FieldAddress(RAX, Double::value_offset())); |
1179 __ comisd(XMM0, XMM0); | 1184 __ comisd(XMM0, XMM0); |
1180 __ j(PARITY_EVEN, &is_true, Assembler::kNearJump); // NaN -> true; | 1185 __ j(PARITY_EVEN, &is_true, Assembler::kNearJump); // NaN -> true; |
1181 __ LoadObject(RAX, Bool::False()); | 1186 __ LoadObject(RAX, Bool::False(), PP); |
1182 __ ret(); | 1187 __ ret(); |
1183 __ Bind(&is_true); | 1188 __ Bind(&is_true); |
1184 __ LoadObject(RAX, Bool::True()); | 1189 __ LoadObject(RAX, Bool::True(), PP); |
1185 __ ret(); | 1190 __ ret(); |
1186 } | 1191 } |
1187 | 1192 |
1188 | 1193 |
1189 void Intrinsifier::Double_getIsNegative(Assembler* assembler) { | 1194 void Intrinsifier::Double_getIsNegative(Assembler* assembler) { |
1190 Label is_false, is_true, is_zero; | 1195 Label is_false, is_true, is_zero; |
1191 __ movq(RAX, Address(RSP, +1 * kWordSize)); | 1196 __ movq(RAX, Address(RSP, +1 * kWordSize)); |
1192 __ movsd(XMM0, FieldAddress(RAX, Double::value_offset())); | 1197 __ movsd(XMM0, FieldAddress(RAX, Double::value_offset())); |
1193 __ xorpd(XMM1, XMM1); // 0.0 -> XMM1. | 1198 __ xorpd(XMM1, XMM1); // 0.0 -> XMM1. |
1194 __ comisd(XMM0, XMM1); | 1199 __ comisd(XMM0, XMM1); |
1195 __ j(PARITY_EVEN, &is_false, Assembler::kNearJump); // NaN -> false. | 1200 __ j(PARITY_EVEN, &is_false, Assembler::kNearJump); // NaN -> false. |
1196 __ j(EQUAL, &is_zero, Assembler::kNearJump); // Check for negative zero. | 1201 __ j(EQUAL, &is_zero, Assembler::kNearJump); // Check for negative zero. |
1197 __ j(ABOVE_EQUAL, &is_false, Assembler::kNearJump); // >= 0 -> false. | 1202 __ j(ABOVE_EQUAL, &is_false, Assembler::kNearJump); // >= 0 -> false. |
1198 __ Bind(&is_true); | 1203 __ Bind(&is_true); |
1199 __ LoadObject(RAX, Bool::True()); | 1204 __ LoadObject(RAX, Bool::True(), PP); |
1200 __ ret(); | 1205 __ ret(); |
1201 __ Bind(&is_false); | 1206 __ Bind(&is_false); |
1202 __ LoadObject(RAX, Bool::False()); | 1207 __ LoadObject(RAX, Bool::False(), PP); |
1203 __ ret(); | 1208 __ ret(); |
1204 __ Bind(&is_zero); | 1209 __ Bind(&is_zero); |
1205 // Check for negative zero (get the sign bit). | 1210 // Check for negative zero (get the sign bit). |
1206 __ movmskpd(RAX, XMM0); | 1211 __ movmskpd(RAX, XMM0); |
1207 __ testq(RAX, Immediate(1)); | 1212 __ testq(RAX, Immediate(1)); |
1208 __ j(NOT_ZERO, &is_true, Assembler::kNearJump); | 1213 __ j(NOT_ZERO, &is_true, Assembler::kNearJump); |
1209 __ jmp(&is_false, Assembler::kNearJump); | 1214 __ jmp(&is_false, Assembler::kNearJump); |
1210 } | 1215 } |
1211 | 1216 |
1212 | 1217 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1340 __ imulq(RCX, RAX); | 1345 __ imulq(RCX, RAX); |
1341 __ movl(RDX, addr_1); | 1346 __ movl(RDX, addr_1); |
1342 __ addq(RDX, RCX); | 1347 __ addq(RDX, RCX); |
1343 __ movl(addr_0, RDX); | 1348 __ movl(addr_0, RDX); |
1344 __ shrq(RDX, Immediate(32)); | 1349 __ shrq(RDX, Immediate(32)); |
1345 __ movl(addr_1, RDX); | 1350 __ movl(addr_1, RDX); |
1346 __ ret(); | 1351 __ ret(); |
1347 } | 1352 } |
1348 | 1353 |
1349 | 1354 |
1350 | |
1351 // Identity comparison. | 1355 // Identity comparison. |
1352 void Intrinsifier::Object_equal(Assembler* assembler) { | 1356 void Intrinsifier::Object_equal(Assembler* assembler) { |
1353 Label is_true; | 1357 Label is_true; |
1354 __ movq(RAX, Address(RSP, + 1 * kWordSize)); | 1358 // This intrinsic is used from the API even when we have not entered any |
1355 __ cmpq(RAX, Address(RSP, + 2 * kWordSize)); | 1359 // Dart frame, yet, so the PP would otherwise be null in this case unless |
| 1360 // we enter a Dart frame here. |
| 1361 __ EnterDartFrame(0); |
| 1362 __ movq(RAX, Address(RSP, + 4 * kWordSize)); |
| 1363 __ cmpq(RAX, Address(RSP, + 5 * kWordSize)); |
1356 __ j(EQUAL, &is_true, Assembler::kNearJump); | 1364 __ j(EQUAL, &is_true, Assembler::kNearJump); |
1357 __ LoadObject(RAX, Bool::False()); | 1365 __ movq(RAX, Immediate(reinterpret_cast<int64_t>(Bool::False().raw()))); |
| 1366 __ LoadObject(RAX, Bool::False(), PP); |
| 1367 __ LeaveFrameWithPP(); |
1358 __ ret(); | 1368 __ ret(); |
1359 __ Bind(&is_true); | 1369 __ Bind(&is_true); |
1360 __ LoadObject(RAX, Bool::True()); | 1370 __ LoadObject(RAX, Bool::True(), PP); |
| 1371 __ LeaveFrameWithPP(); |
1361 __ ret(); | 1372 __ ret(); |
1362 } | 1373 } |
1363 | 1374 |
1364 | 1375 |
1365 void Intrinsifier::String_getHashCode(Assembler* assembler) { | 1376 void Intrinsifier::String_getHashCode(Assembler* assembler) { |
1366 Label fall_through; | 1377 Label fall_through; |
1367 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // String object. | 1378 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // String object. |
1368 __ movq(RAX, FieldAddress(RAX, String::hash_offset())); | 1379 __ movq(RAX, FieldAddress(RAX, String::hash_offset())); |
1369 __ cmpq(RAX, Immediate(0)); | 1380 __ cmpq(RAX, Immediate(0)); |
1370 __ j(EQUAL, &fall_through, Assembler::kNearJump); | 1381 __ j(EQUAL, &fall_through, Assembler::kNearJump); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1410 } | 1421 } |
1411 | 1422 |
1412 | 1423 |
1413 void Intrinsifier::String_getIsEmpty(Assembler* assembler) { | 1424 void Intrinsifier::String_getIsEmpty(Assembler* assembler) { |
1414 Label is_true; | 1425 Label is_true; |
1415 // Get length. | 1426 // Get length. |
1416 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // String object. | 1427 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // String object. |
1417 __ movq(RAX, FieldAddress(RAX, String::length_offset())); | 1428 __ movq(RAX, FieldAddress(RAX, String::length_offset())); |
1418 __ cmpq(RAX, Immediate(Smi::RawValue(0))); | 1429 __ cmpq(RAX, Immediate(Smi::RawValue(0))); |
1419 __ j(EQUAL, &is_true, Assembler::kNearJump); | 1430 __ j(EQUAL, &is_true, Assembler::kNearJump); |
1420 __ LoadObject(RAX, Bool::False()); | 1431 __ LoadObject(RAX, Bool::False(), PP); |
1421 __ ret(); | 1432 __ ret(); |
1422 __ Bind(&is_true); | 1433 __ Bind(&is_true); |
1423 __ LoadObject(RAX, Bool::True()); | 1434 __ LoadObject(RAX, Bool::True(), PP); |
1424 __ ret(); | 1435 __ ret(); |
1425 } | 1436 } |
1426 | 1437 |
1427 | 1438 |
1428 void Intrinsifier::OneByteString_getHashCode(Assembler* assembler) { | 1439 void Intrinsifier::OneByteString_getHashCode(Assembler* assembler) { |
1429 Label compute_hash; | 1440 Label compute_hash; |
1430 __ movq(RBX, Address(RSP, + 1 * kWordSize)); // OneByteString object. | 1441 __ movq(RBX, Address(RSP, + 1 * kWordSize)); // OneByteString object. |
1431 __ movq(RAX, FieldAddress(RBX, String::hash_offset())); | 1442 __ movq(RAX, FieldAddress(RBX, String::hash_offset())); |
1432 __ cmpq(RAX, Immediate(0)); | 1443 __ cmpq(RAX, Immediate(0)); |
1433 __ j(EQUAL, &compute_hash, Assembler::kNearJump); | 1444 __ j(EQUAL, &compute_hash, Assembler::kNearJump); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1638 | 1649 |
1639 __ Bind(&fall_through); | 1650 __ Bind(&fall_through); |
1640 } | 1651 } |
1641 | 1652 |
1642 | 1653 |
1643 #undef __ | 1654 #undef __ |
1644 | 1655 |
1645 } // namespace dart | 1656 } // namespace dart |
1646 | 1657 |
1647 #endif // defined TARGET_ARCH_X64 | 1658 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |