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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 __ leal(EDI, FieldAddress(EAX, sizeof(RawArray))); | 122 __ leal(EDI, FieldAddress(EAX, sizeof(RawArray))); |
123 Label done; | 123 Label done; |
124 Label init_loop; | 124 Label init_loop; |
125 __ Bind(&init_loop); | 125 __ Bind(&init_loop); |
126 __ cmpl(EDI, EBX); | 126 __ cmpl(EDI, EBX); |
127 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump); | 127 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump); |
128 __ movl(Address(EDI, 0), raw_null); | 128 __ movl(Address(EDI, 0), raw_null); |
129 __ addl(EDI, Immediate(kWordSize)); | 129 __ addl(EDI, Immediate(kWordSize)); |
130 __ jmp(&init_loop, Assembler::kNearJump); | 130 __ jmp(&init_loop, Assembler::kNearJump); |
131 __ Bind(&done); | 131 __ Bind(&done); |
| 132 __ BumpAllocationCount(kArrayCid, EBX); |
132 __ ret(); // returns the newly allocated object in EAX. | 133 __ ret(); // returns the newly allocated object in EAX. |
133 | 134 |
134 __ Bind(&fall_through); | 135 __ Bind(&fall_through); |
135 } | 136 } |
136 | 137 |
137 | 138 |
138 void Intrinsifier::Array_getLength(Assembler* assembler) { | 139 void Intrinsifier::Array_getLength(Assembler* assembler) { |
139 __ movl(EAX, Address(ESP, + 1 * kWordSize)); | 140 __ movl(EAX, Address(ESP, + 1 * kWordSize)); |
140 __ movl(EAX, FieldAddress(EAX, Array::length_offset())); | 141 __ movl(EAX, FieldAddress(EAX, Array::length_offset())); |
141 __ ret(); | 142 __ ret(); |
(...skipping 154 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 __ BumpAllocationCount(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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 __ xorl(ECX, ECX); /* Zero. */ \ | 530 __ xorl(ECX, ECX); /* Zero. */ \ |
529 __ leal(EDI, FieldAddress(EAX, sizeof(Raw##type_name))); \ | 531 __ leal(EDI, FieldAddress(EAX, sizeof(Raw##type_name))); \ |
530 Label done, init_loop; \ | 532 Label done, init_loop; \ |
531 __ Bind(&init_loop); \ | 533 __ Bind(&init_loop); \ |
532 __ cmpl(EDI, EBX); \ | 534 __ cmpl(EDI, EBX); \ |
533 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump); \ | 535 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump); \ |
534 __ movl(Address(EDI, 0), ECX); \ | 536 __ movl(Address(EDI, 0), ECX); \ |
535 __ addl(EDI, Immediate(kWordSize)); \ | 537 __ addl(EDI, Immediate(kWordSize)); \ |
536 __ jmp(&init_loop, Assembler::kNearJump); \ | 538 __ jmp(&init_loop, Assembler::kNearJump); \ |
537 __ Bind(&done); \ | 539 __ Bind(&done); \ |
538 \ | 540 __ BumpAllocationCount(cid, EBX); \ |
539 __ ret(); \ | 541 __ ret(); \ |
540 __ Bind(&fall_through); \ | 542 __ Bind(&fall_through); \ |
541 | 543 |
542 | 544 |
543 | 545 |
544 // Gets the length of a TypedData. | 546 // Gets the length of a TypedData. |
545 void Intrinsifier::TypedData_getLength(Assembler* assembler) { | 547 void Intrinsifier::TypedData_getLength(Assembler* assembler) { |
546 __ movl(EAX, Address(ESP, + 1 * kWordSize)); | 548 __ movl(EAX, Address(ESP, + 1 * kWordSize)); |
547 __ movl(EAX, FieldAddress(EAX, TypedData::length_offset())); | 549 __ movl(EAX, FieldAddress(EAX, TypedData::length_offset())); |
548 __ ret(); | 550 __ ret(); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 // Arguments are Smi but the shift produced an overflow to Mint. | 867 // Arguments are Smi but the shift produced an overflow to Mint. |
866 __ cmpl(EBX, Immediate(0)); | 868 __ cmpl(EBX, Immediate(0)); |
867 // TODO(srdjan): Implement negative values, for now fall through. | 869 // TODO(srdjan): Implement negative values, for now fall through. |
868 __ j(LESS, &fall_through, Assembler::kNearJump); | 870 __ j(LESS, &fall_through, Assembler::kNearJump); |
869 __ SmiUntag(EBX); | 871 __ SmiUntag(EBX); |
870 __ movl(EAX, EBX); | 872 __ movl(EAX, EBX); |
871 __ shll(EBX, ECX); | 873 __ shll(EBX, ECX); |
872 __ xorl(EDI, EDI); | 874 __ xorl(EDI, EDI); |
873 __ shld(EDI, EAX); | 875 __ shld(EDI, EAX); |
874 // Result in EDI (high) and EBX (low). | 876 // Result in EDI (high) and EBX (low). |
| 877 __ pushl(EBX); |
875 const Class& mint_class = Class::Handle( | 878 const Class& mint_class = Class::Handle( |
876 Isolate::Current()->object_store()->mint_class()); | 879 Isolate::Current()->object_store()->mint_class()); |
877 __ TryAllocate(mint_class, | 880 __ TryAllocate(mint_class, |
878 &fall_through, | 881 &fall_through, |
879 Assembler::kNearJump, | 882 Assembler::kNearJump, |
880 EAX); // Result register. | 883 EAX); // Result register. |
| 884 __ popl(EBX); |
881 // EBX and EDI are not objects but integer values. | 885 // EBX and EDI are not objects but integer values. |
882 __ movl(FieldAddress(EAX, Mint::value_offset()), EBX); | 886 __ movl(FieldAddress(EAX, Mint::value_offset()), EBX); |
883 __ movl(FieldAddress(EAX, Mint::value_offset() + kWordSize), EDI); | 887 __ movl(FieldAddress(EAX, Mint::value_offset() + kWordSize), EDI); |
884 __ ret(); | 888 __ ret(); |
885 __ Bind(&fall_through); | 889 __ Bind(&fall_through); |
886 } | 890 } |
887 | 891 |
888 | 892 |
889 static void Push64SmiOrMint(Assembler* assembler, | 893 static void Push64SmiOrMint(Assembler* assembler, |
890 Register reg, | 894 Register reg, |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1653 __ movl(FieldAddress(EAX, String::tags_offset()), EDI); // Tags. | 1657 __ movl(FieldAddress(EAX, String::tags_offset()), EDI); // Tags. |
1654 } | 1658 } |
1655 | 1659 |
1656 // Set the length field. | 1660 // Set the length field. |
1657 __ popl(EDI); | 1661 __ popl(EDI); |
1658 __ StoreIntoObjectNoBarrier(EAX, | 1662 __ StoreIntoObjectNoBarrier(EAX, |
1659 FieldAddress(EAX, String::length_offset()), | 1663 FieldAddress(EAX, String::length_offset()), |
1660 EDI); | 1664 EDI); |
1661 // Clear hash. | 1665 // Clear hash. |
1662 __ movl(FieldAddress(EAX, String::hash_offset()), Immediate(0)); | 1666 __ movl(FieldAddress(EAX, String::hash_offset()), Immediate(0)); |
| 1667 __ BumpAllocationCount(kOneByteStringCid, EBX); |
1663 __ jmp(ok, Assembler::kNearJump); | 1668 __ jmp(ok, Assembler::kNearJump); |
1664 | 1669 |
1665 __ Bind(&pop_and_fail); | 1670 __ Bind(&pop_and_fail); |
1666 __ popl(EDI); | 1671 __ popl(EDI); |
1667 __ jmp(failure); | 1672 __ jmp(failure); |
1668 } | 1673 } |
1669 | 1674 |
1670 | 1675 |
1671 // Arg0: Onebyte String | 1676 // Arg0: Onebyte String |
1672 // Arg1: Start index as Smi. | 1677 // Arg1: Start index as Smi. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1799 | 1804 |
1800 | 1805 |
1801 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 1806 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
1802 StringEquality(assembler, kTwoByteStringCid); | 1807 StringEquality(assembler, kTwoByteStringCid); |
1803 } | 1808 } |
1804 | 1809 |
1805 #undef __ | 1810 #undef __ |
1806 } // namespace dart | 1811 } // namespace dart |
1807 | 1812 |
1808 #endif // defined TARGET_ARCH_IA32 | 1813 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |