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 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1722 | 1722 |
1723 bool Intrinsifier::String_getLength(Assembler* assembler) { | 1723 bool Intrinsifier::String_getLength(Assembler* assembler) { |
1724 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // String object. | 1724 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // String object. |
1725 __ movq(RAX, FieldAddress(RAX, String::length_offset())); | 1725 __ movq(RAX, FieldAddress(RAX, String::length_offset())); |
1726 __ ret(); | 1726 __ ret(); |
1727 return true; | 1727 return true; |
1728 } | 1728 } |
1729 | 1729 |
1730 | 1730 |
1731 // TODO(srdjan): Implement for two and four byte strings as well. | 1731 // TODO(srdjan): Implement for two and four byte strings as well. |
1732 bool Intrinsifier::String_charCodeAt(Assembler* assembler) { | 1732 bool Intrinsifier::String_codeUnitAt(Assembler* assembler) { |
1733 Label fall_through; | 1733 Label fall_through; |
1734 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Index. | 1734 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Index. |
1735 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // String. | 1735 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // String. |
1736 __ testq(RCX, Immediate(kSmiTagMask)); | 1736 __ testq(RCX, Immediate(kSmiTagMask)); |
1737 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index. | 1737 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index. |
1738 // Range check. | 1738 // Range check. |
1739 __ cmpq(RCX, FieldAddress(RAX, String::length_offset())); | 1739 __ cmpq(RCX, FieldAddress(RAX, String::length_offset())); |
1740 // Runtime throws exception. | 1740 // Runtime throws exception. |
1741 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); | 1741 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); |
1742 __ CompareClassId(RAX, kOneByteStringCid); | 1742 __ CompareClassId(RAX, kOneByteStringCid); |
(...skipping 20 matching lines...) Expand all Loading... |
1763 __ LoadObject(RAX, Bool::True()); | 1763 __ LoadObject(RAX, Bool::True()); |
1764 __ ret(); | 1764 __ ret(); |
1765 return true; | 1765 return true; |
1766 } | 1766 } |
1767 | 1767 |
1768 #undef __ | 1768 #undef __ |
1769 | 1769 |
1770 } // namespace dart | 1770 } // namespace dart |
1771 | 1771 |
1772 #endif // defined TARGET_ARCH_X64 | 1772 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |