| 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 // The intrinsic code below is executed before a method has built its frame. | 5 // The intrinsic code below is executed before a method has built its frame. |
| 6 // The return address is on the stack and the arguments below it. | 6 // The return address is on the stack and the arguments below it. |
| 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. | 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. |
| 8 // Each intrinsification method returns true if the corresponding | 8 // Each intrinsification method returns true if the corresponding |
| 9 // Dart method was intrinsified. | 9 // Dart method was intrinsified. |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // EAX: potential new object start. | 69 // EAX: potential new object start. |
| 70 // EBX: potential next object start. | 70 // EBX: potential next object start. |
| 71 // EDI: allocation size. | 71 // EDI: allocation size. |
| 72 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); | 72 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); |
| 73 __ j(ABOVE_EQUAL, &fall_through); | 73 __ j(ABOVE_EQUAL, &fall_through); |
| 74 | 74 |
| 75 // Successfully allocated the object(s), now update top to point to | 75 // Successfully allocated the object(s), now update top to point to |
| 76 // next object start and initialize the object. | 76 // next object start and initialize the object. |
| 77 __ movl(Address::Absolute(heap->TopAddress()), EBX); | 77 __ movl(Address::Absolute(heap->TopAddress()), EBX); |
| 78 __ addl(EAX, Immediate(kHeapObjectTag)); | 78 __ addl(EAX, Immediate(kHeapObjectTag)); |
| 79 __ UpdateAllocationStatsWithSize(kArrayCid, EDI, kNoRegister); |
| 79 | 80 |
| 80 // Initialize the tags. | 81 // Initialize the tags. |
| 81 // EAX: new object start as a tagged pointer. | 82 // EAX: new object start as a tagged pointer. |
| 82 // EBX: new object end address. | 83 // EBX: new object end address. |
| 83 // EDI: allocation size. | 84 // EDI: allocation size. |
| 84 { | 85 { |
| 85 Label size_tag_overflow, done; | 86 Label size_tag_overflow, done; |
| 86 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); | 87 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); |
| 87 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); | 88 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); |
| 88 __ shll(EDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); | 89 __ shll(EDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 // Store the type argument field in the growable array object. | 297 // Store the type argument field in the growable array object. |
| 297 __ movl(EBX, Address(ESP, kTypeArgumentsOffset)); // type argument. | 298 __ movl(EBX, Address(ESP, kTypeArgumentsOffset)); // type argument. |
| 298 __ StoreIntoObjectNoBarrier( | 299 __ StoreIntoObjectNoBarrier( |
| 299 EAX, | 300 EAX, |
| 300 FieldAddress(EAX, GrowableObjectArray::type_arguments_offset()), | 301 FieldAddress(EAX, GrowableObjectArray::type_arguments_offset()), |
| 301 EBX); | 302 EBX); |
| 302 | 303 |
| 303 // Set the length field in the growable array object to 0. | 304 // Set the length field in the growable array object to 0. |
| 304 __ movl(FieldAddress(EAX, GrowableObjectArray::length_offset()), | 305 __ movl(FieldAddress(EAX, GrowableObjectArray::length_offset()), |
| 305 Immediate(0)); | 306 Immediate(0)); |
| 307 __ UpdateAllocationStats(kGrowableObjectArrayCid, EBX); |
| 306 __ ret(); // returns the newly allocated object in EAX. | 308 __ ret(); // returns the newly allocated object in EAX. |
| 307 | 309 |
| 308 __ Bind(&fall_through); | 310 __ Bind(&fall_through); |
| 309 } | 311 } |
| 310 | 312 |
| 311 | 313 |
| 312 // Get length of growable object array. | 314 // Get length of growable object array. |
| 313 // On stack: growable array (+1), return-address (+0). | 315 // On stack: growable array (+1), return-address (+0). |
| 314 void Intrinsifier::GrowableList_getLength(Assembler* assembler) { | 316 void Intrinsifier::GrowableList_getLength(Assembler* assembler) { |
| 315 __ movl(EAX, Address(ESP, + 1 * kWordSize)); | 317 __ movl(EAX, Address(ESP, + 1 * kWordSize)); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 /* EAX: potential new object start. */ \ | 487 /* EAX: potential new object start. */ \ |
| 486 /* EBX: potential next object start. */ \ | 488 /* EBX: potential next object start. */ \ |
| 487 /* EDI: allocation size. */ \ | 489 /* EDI: allocation size. */ \ |
| 488 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); \ | 490 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); \ |
| 489 __ j(ABOVE_EQUAL, &fall_through); \ | 491 __ j(ABOVE_EQUAL, &fall_through); \ |
| 490 \ | 492 \ |
| 491 /* Successfully allocated the object(s), now update top to point to */ \ | 493 /* Successfully allocated the object(s), now update top to point to */ \ |
| 492 /* next object start and initialize the object. */ \ | 494 /* next object start and initialize the object. */ \ |
| 493 __ movl(Address::Absolute(heap->TopAddress()), EBX); \ | 495 __ movl(Address::Absolute(heap->TopAddress()), EBX); \ |
| 494 __ addl(EAX, Immediate(kHeapObjectTag)); \ | 496 __ addl(EAX, Immediate(kHeapObjectTag)); \ |
| 497 __ UpdateAllocationStatsWithSize(cid, EDI, kNoRegister); \ |
| 495 \ | 498 \ |
| 496 /* Initialize the tags. */ \ | 499 /* Initialize the tags. */ \ |
| 497 /* EAX: new object start as a tagged pointer. */ \ | 500 /* EAX: new object start as a tagged pointer. */ \ |
| 498 /* EBX: new object end address. */ \ | 501 /* EBX: new object end address. */ \ |
| 499 /* EDI: allocation size. */ \ | 502 /* EDI: allocation size. */ \ |
| 500 { \ | 503 { \ |
| 501 Label size_tag_overflow, done; \ | 504 Label size_tag_overflow, done; \ |
| 502 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \ | 505 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); \ |
| 503 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); \ | 506 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); \ |
| 504 __ shll(EDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); \ | 507 __ shll(EDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); \ |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 __ movl(EAX, EBX); | 852 __ movl(EAX, EBX); |
| 850 __ shll(EBX, ECX); | 853 __ shll(EBX, ECX); |
| 851 __ xorl(EDI, EDI); | 854 __ xorl(EDI, EDI); |
| 852 __ shld(EDI, EAX); | 855 __ shld(EDI, EAX); |
| 853 // Result in EDI (high) and EBX (low). | 856 // Result in EDI (high) and EBX (low). |
| 854 const Class& mint_class = Class::Handle( | 857 const Class& mint_class = Class::Handle( |
| 855 Isolate::Current()->object_store()->mint_class()); | 858 Isolate::Current()->object_store()->mint_class()); |
| 856 __ TryAllocate(mint_class, | 859 __ TryAllocate(mint_class, |
| 857 &fall_through, | 860 &fall_through, |
| 858 Assembler::kNearJump, | 861 Assembler::kNearJump, |
| 859 EAX); // Result register. | 862 EAX, // Result register. |
| 863 kNoRegister); |
| 860 // EBX and EDI are not objects but integer values. | 864 // EBX and EDI are not objects but integer values. |
| 861 __ movl(FieldAddress(EAX, Mint::value_offset()), EBX); | 865 __ movl(FieldAddress(EAX, Mint::value_offset()), EBX); |
| 862 __ movl(FieldAddress(EAX, Mint::value_offset() + kWordSize), EDI); | 866 __ movl(FieldAddress(EAX, Mint::value_offset() + kWordSize), EDI); |
| 863 __ ret(); | 867 __ ret(); |
| 864 __ Bind(&fall_through); | 868 __ Bind(&fall_through); |
| 865 } | 869 } |
| 866 | 870 |
| 867 | 871 |
| 868 static void Push64SmiOrMint(Assembler* assembler, | 872 static void Push64SmiOrMint(Assembler* assembler, |
| 869 Register reg, | 873 Register reg, |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1170 case Token::kSUB: __ subsd(XMM0, XMM1); break; | 1174 case Token::kSUB: __ subsd(XMM0, XMM1); break; |
| 1171 case Token::kMUL: __ mulsd(XMM0, XMM1); break; | 1175 case Token::kMUL: __ mulsd(XMM0, XMM1); break; |
| 1172 case Token::kDIV: __ divsd(XMM0, XMM1); break; | 1176 case Token::kDIV: __ divsd(XMM0, XMM1); break; |
| 1173 default: UNREACHABLE(); | 1177 default: UNREACHABLE(); |
| 1174 } | 1178 } |
| 1175 const Class& double_class = Class::Handle( | 1179 const Class& double_class = Class::Handle( |
| 1176 Isolate::Current()->object_store()->double_class()); | 1180 Isolate::Current()->object_store()->double_class()); |
| 1177 __ TryAllocate(double_class, | 1181 __ TryAllocate(double_class, |
| 1178 &fall_through, | 1182 &fall_through, |
| 1179 Assembler::kNearJump, | 1183 Assembler::kNearJump, |
| 1180 EAX); // Result register. | 1184 EAX, // Result register. |
| 1185 EBX); |
| 1181 __ movsd(FieldAddress(EAX, Double::value_offset()), XMM0); | 1186 __ movsd(FieldAddress(EAX, Double::value_offset()), XMM0); |
| 1182 __ ret(); | 1187 __ ret(); |
| 1183 __ Bind(&fall_through); | 1188 __ Bind(&fall_through); |
| 1184 } | 1189 } |
| 1185 | 1190 |
| 1186 | 1191 |
| 1187 void Intrinsifier::Double_add(Assembler* assembler) { | 1192 void Intrinsifier::Double_add(Assembler* assembler) { |
| 1188 return DoubleArithmeticOperations(assembler, Token::kADD); | 1193 return DoubleArithmeticOperations(assembler, Token::kADD); |
| 1189 } | 1194 } |
| 1190 | 1195 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1215 __ SmiUntag(EAX); | 1220 __ SmiUntag(EAX); |
| 1216 __ cvtsi2sd(XMM1, EAX); | 1221 __ cvtsi2sd(XMM1, EAX); |
| 1217 __ movl(EAX, Address(ESP, + 2 * kWordSize)); | 1222 __ movl(EAX, Address(ESP, + 2 * kWordSize)); |
| 1218 __ movsd(XMM0, FieldAddress(EAX, Double::value_offset())); | 1223 __ movsd(XMM0, FieldAddress(EAX, Double::value_offset())); |
| 1219 __ mulsd(XMM0, XMM1); | 1224 __ mulsd(XMM0, XMM1); |
| 1220 const Class& double_class = Class::Handle( | 1225 const Class& double_class = Class::Handle( |
| 1221 Isolate::Current()->object_store()->double_class()); | 1226 Isolate::Current()->object_store()->double_class()); |
| 1222 __ TryAllocate(double_class, | 1227 __ TryAllocate(double_class, |
| 1223 &fall_through, | 1228 &fall_through, |
| 1224 Assembler::kNearJump, | 1229 Assembler::kNearJump, |
| 1225 EAX); // Result register. | 1230 EAX, // Result register. |
| 1231 EBX); |
| 1226 __ movsd(FieldAddress(EAX, Double::value_offset()), XMM0); | 1232 __ movsd(FieldAddress(EAX, Double::value_offset()), XMM0); |
| 1227 __ ret(); | 1233 __ ret(); |
| 1228 __ Bind(&fall_through); | 1234 __ Bind(&fall_through); |
| 1229 } | 1235 } |
| 1230 | 1236 |
| 1231 | 1237 |
| 1232 void Intrinsifier::Double_fromInteger(Assembler* assembler) { | 1238 void Intrinsifier::Double_fromInteger(Assembler* assembler) { |
| 1233 Label fall_through; | 1239 Label fall_through; |
| 1234 __ movl(EAX, Address(ESP, +1 * kWordSize)); | 1240 __ movl(EAX, Address(ESP, +1 * kWordSize)); |
| 1235 __ testl(EAX, Immediate(kSmiTagMask)); | 1241 __ testl(EAX, Immediate(kSmiTagMask)); |
| 1236 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); | 1242 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); |
| 1237 // Is Smi. | 1243 // Is Smi. |
| 1238 __ SmiUntag(EAX); | 1244 __ SmiUntag(EAX); |
| 1239 __ cvtsi2sd(XMM0, EAX); | 1245 __ cvtsi2sd(XMM0, EAX); |
| 1240 const Class& double_class = Class::Handle( | 1246 const Class& double_class = Class::Handle( |
| 1241 Isolate::Current()->object_store()->double_class()); | 1247 Isolate::Current()->object_store()->double_class()); |
| 1242 __ TryAllocate(double_class, | 1248 __ TryAllocate(double_class, |
| 1243 &fall_through, | 1249 &fall_through, |
| 1244 Assembler::kNearJump, | 1250 Assembler::kNearJump, |
| 1245 EAX); // Result register. | 1251 EAX, // Result register. |
| 1252 EBX); |
| 1246 __ movsd(FieldAddress(EAX, Double::value_offset()), XMM0); | 1253 __ movsd(FieldAddress(EAX, Double::value_offset()), XMM0); |
| 1247 __ ret(); | 1254 __ ret(); |
| 1248 __ Bind(&fall_through); | 1255 __ Bind(&fall_through); |
| 1249 } | 1256 } |
| 1250 | 1257 |
| 1251 | 1258 |
| 1252 void Intrinsifier::Double_getIsNaN(Assembler* assembler) { | 1259 void Intrinsifier::Double_getIsNaN(Assembler* assembler) { |
| 1253 Label is_true; | 1260 Label is_true; |
| 1254 __ movl(EAX, Address(ESP, +1 * kWordSize)); | 1261 __ movl(EAX, Address(ESP, +1 * kWordSize)); |
| 1255 __ movsd(XMM0, FieldAddress(EAX, Double::value_offset())); | 1262 __ movsd(XMM0, FieldAddress(EAX, Double::value_offset())); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 TestLastArgumentIsDouble(assembler, &is_smi, &fall_through); | 1315 TestLastArgumentIsDouble(assembler, &is_smi, &fall_through); |
| 1309 // Argument is double and is in EAX. | 1316 // Argument is double and is in EAX. |
| 1310 __ movsd(XMM1, FieldAddress(EAX, Double::value_offset())); | 1317 __ movsd(XMM1, FieldAddress(EAX, Double::value_offset())); |
| 1311 __ Bind(&double_op); | 1318 __ Bind(&double_op); |
| 1312 __ sqrtsd(XMM0, XMM1); | 1319 __ sqrtsd(XMM0, XMM1); |
| 1313 const Class& double_class = Class::Handle( | 1320 const Class& double_class = Class::Handle( |
| 1314 Isolate::Current()->object_store()->double_class()); | 1321 Isolate::Current()->object_store()->double_class()); |
| 1315 __ TryAllocate(double_class, | 1322 __ TryAllocate(double_class, |
| 1316 &fall_through, | 1323 &fall_through, |
| 1317 Assembler::kNearJump, | 1324 Assembler::kNearJump, |
| 1318 EAX); // Result register. | 1325 EAX, // Result register. |
| 1326 EBX); |
| 1319 __ movsd(FieldAddress(EAX, Double::value_offset()), XMM0); | 1327 __ movsd(FieldAddress(EAX, Double::value_offset()), XMM0); |
| 1320 __ ret(); | 1328 __ ret(); |
| 1321 __ Bind(&is_smi); | 1329 __ Bind(&is_smi); |
| 1322 __ SmiUntag(EAX); | 1330 __ SmiUntag(EAX); |
| 1323 __ cvtsi2sd(XMM1, EAX); | 1331 __ cvtsi2sd(XMM1, EAX); |
| 1324 __ jmp(&double_op); | 1332 __ jmp(&double_op); |
| 1325 __ Bind(&fall_through); | 1333 __ Bind(&fall_through); |
| 1326 } | 1334 } |
| 1327 | 1335 |
| 1328 | 1336 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1549 // EBX: potential next object start. | 1557 // EBX: potential next object start. |
| 1550 // EDI: allocation size. | 1558 // EDI: allocation size. |
| 1551 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); | 1559 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); |
| 1552 __ j(ABOVE_EQUAL, &pop_and_fail, Assembler::kNearJump); | 1560 __ j(ABOVE_EQUAL, &pop_and_fail, Assembler::kNearJump); |
| 1553 | 1561 |
| 1554 // Successfully allocated the object(s), now update top to point to | 1562 // Successfully allocated the object(s), now update top to point to |
| 1555 // next object start and initialize the object. | 1563 // next object start and initialize the object. |
| 1556 __ movl(Address::Absolute(heap->TopAddress()), EBX); | 1564 __ movl(Address::Absolute(heap->TopAddress()), EBX); |
| 1557 __ addl(EAX, Immediate(kHeapObjectTag)); | 1565 __ addl(EAX, Immediate(kHeapObjectTag)); |
| 1558 | 1566 |
| 1567 __ UpdateAllocationStatsWithSize(kOneByteStringCid, EDI, kNoRegister); |
| 1568 |
| 1559 // Initialize the tags. | 1569 // Initialize the tags. |
| 1560 // EAX: new object start as a tagged pointer. | 1570 // EAX: new object start as a tagged pointer. |
| 1561 // EBX: new object end address. | 1571 // EBX: new object end address. |
| 1562 // EDI: allocation size. | 1572 // EDI: allocation size. |
| 1563 { | 1573 { |
| 1564 Label size_tag_overflow, done; | 1574 Label size_tag_overflow, done; |
| 1565 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); | 1575 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); |
| 1566 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); | 1576 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); |
| 1567 __ shll(EDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); | 1577 __ shll(EDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); |
| 1568 __ jmp(&done, Assembler::kNearJump); | 1578 __ jmp(&done, Assembler::kNearJump); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1729 | 1739 |
| 1730 | 1740 |
| 1731 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 1741 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
| 1732 StringEquality(assembler, kTwoByteStringCid); | 1742 StringEquality(assembler, kTwoByteStringCid); |
| 1733 } | 1743 } |
| 1734 | 1744 |
| 1735 #undef __ | 1745 #undef __ |
| 1736 } // namespace dart | 1746 } // namespace dart |
| 1737 | 1747 |
| 1738 #endif // defined TARGET_ARCH_IA32 | 1748 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |