| 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 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1831 | 1831 |
| 1832 bool Intrinsifier::String_getLength(Assembler* assembler) { | 1832 bool Intrinsifier::String_getLength(Assembler* assembler) { |
| 1833 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // String object. | 1833 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // String object. |
| 1834 __ movl(EAX, FieldAddress(EAX, String::length_offset())); | 1834 __ movl(EAX, FieldAddress(EAX, String::length_offset())); |
| 1835 __ ret(); | 1835 __ ret(); |
| 1836 return true; | 1836 return true; |
| 1837 } | 1837 } |
| 1838 | 1838 |
| 1839 | 1839 |
| 1840 // TODO(srdjan): Implement for two and four byte strings as well. | 1840 // TODO(srdjan): Implement for two and four byte strings as well. |
| 1841 bool Intrinsifier::String_charCodeAt(Assembler* assembler) { | 1841 bool Intrinsifier::String_codeUnitAt(Assembler* assembler) { |
| 1842 Label fall_through; | 1842 Label fall_through; |
| 1843 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Index. | 1843 __ movl(EBX, Address(ESP, + 1 * kWordSize)); // Index. |
| 1844 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // String. | 1844 __ movl(EAX, Address(ESP, + 2 * kWordSize)); // String. |
| 1845 __ testl(EBX, Immediate(kSmiTagMask)); | 1845 __ testl(EBX, Immediate(kSmiTagMask)); |
| 1846 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index. | 1846 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index. |
| 1847 // Range check. | 1847 // Range check. |
| 1848 __ cmpl(EBX, FieldAddress(EAX, String::length_offset())); | 1848 __ cmpl(EBX, FieldAddress(EAX, String::length_offset())); |
| 1849 // Runtime throws exception. | 1849 // Runtime throws exception. |
| 1850 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); | 1850 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); |
| 1851 __ CompareClassId(EAX, kOneByteStringCid, EDI); | 1851 __ CompareClassId(EAX, kOneByteStringCid, EDI); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1871 __ Bind(&is_true); | 1871 __ Bind(&is_true); |
| 1872 __ LoadObject(EAX, Bool::True()); | 1872 __ LoadObject(EAX, Bool::True()); |
| 1873 __ ret(); | 1873 __ ret(); |
| 1874 return true; | 1874 return true; |
| 1875 } | 1875 } |
| 1876 | 1876 |
| 1877 #undef __ | 1877 #undef __ |
| 1878 } // namespace dart | 1878 } // namespace dart |
| 1879 | 1879 |
| 1880 #endif // defined TARGET_ARCH_IA32 | 1880 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |