| 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 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // String object. | 1566 __ movq(RAX, Address(RSP, + 1 * kWordSize)); // String object. |
| 1567 __ movq(RAX, FieldAddress(RAX, String::hash_offset())); | 1567 __ movq(RAX, FieldAddress(RAX, String::hash_offset())); |
| 1568 __ cmpq(RAX, Immediate(0)); | 1568 __ cmpq(RAX, Immediate(0)); |
| 1569 __ j(EQUAL, &fall_through, Assembler::kNearJump); | 1569 __ j(EQUAL, &fall_through, Assembler::kNearJump); |
| 1570 __ ret(); | 1570 __ ret(); |
| 1571 __ Bind(&fall_through); | 1571 __ Bind(&fall_through); |
| 1572 // Hash not yet computed. | 1572 // Hash not yet computed. |
| 1573 } | 1573 } |
| 1574 | 1574 |
| 1575 | 1575 |
| 1576 void Intrinsifier::StringBaseCodeUnitAt(Assembler* assembler) { | |
| 1577 Label fall_through, try_two_byte_string; | |
| 1578 __ movq(RCX, Address(RSP, + 1 * kWordSize)); // Index. | |
| 1579 __ movq(RAX, Address(RSP, + 2 * kWordSize)); // String. | |
| 1580 __ testq(RCX, Immediate(kSmiTagMask)); | |
| 1581 __ j(NOT_ZERO, &fall_through, Assembler::kNearJump); // Non-smi index. | |
| 1582 // Range check. | |
| 1583 __ cmpq(RCX, FieldAddress(RAX, String::length_offset())); | |
| 1584 // Runtime throws exception. | |
| 1585 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); | |
| 1586 __ CompareClassId(RAX, kOneByteStringCid); | |
| 1587 __ j(NOT_EQUAL, &try_two_byte_string, Assembler::kNearJump); | |
| 1588 __ SmiUntag(RCX); | |
| 1589 __ movzxb(RAX, FieldAddress(RAX, RCX, TIMES_1, OneByteString::data_offset())); | |
| 1590 __ SmiTag(RAX); | |
| 1591 __ ret(); | |
| 1592 | |
| 1593 __ Bind(&try_two_byte_string); | |
| 1594 __ CompareClassId(RAX, kTwoByteStringCid); | |
| 1595 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); | |
| 1596 ASSERT(kSmiTagShift == 1); | |
| 1597 __ movzxw(RAX, FieldAddress(RAX, RCX, TIMES_1, OneByteString::data_offset())); | |
| 1598 __ SmiTag(RAX); | |
| 1599 __ ret(); | |
| 1600 | |
| 1601 __ Bind(&fall_through); | |
| 1602 } | |
| 1603 | |
| 1604 | |
| 1605 void GenerateSubstringMatchesSpecialization(Assembler* assembler, | 1576 void GenerateSubstringMatchesSpecialization(Assembler* assembler, |
| 1606 intptr_t receiver_cid, | 1577 intptr_t receiver_cid, |
| 1607 intptr_t other_cid, | 1578 intptr_t other_cid, |
| 1608 Label* return_true, | 1579 Label* return_true, |
| 1609 Label* return_false) { | 1580 Label* return_false) { |
| 1610 __ movq(R8, FieldAddress(RAX, String::length_offset())); | 1581 __ movq(R8, FieldAddress(RAX, String::length_offset())); |
| 1611 __ movq(R9, FieldAddress(RCX, String::length_offset())); | 1582 __ movq(R9, FieldAddress(RCX, String::length_offset())); |
| 1612 | 1583 |
| 1613 // if (other.length == 0) return true; | 1584 // if (other.length == 0) return true; |
| 1614 __ testq(R9, R9); | 1585 __ testq(R9, R9); |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2113 __ LoadIsolate(RAX); | 2084 __ LoadIsolate(RAX); |
| 2114 __ movq(RAX, Address(RAX, Isolate::current_tag_offset())); | 2085 __ movq(RAX, Address(RAX, Isolate::current_tag_offset())); |
| 2115 __ ret(); | 2086 __ ret(); |
| 2116 } | 2087 } |
| 2117 | 2088 |
| 2118 #undef __ | 2089 #undef __ |
| 2119 | 2090 |
| 2120 } // namespace dart | 2091 } // namespace dart |
| 2121 | 2092 |
| 2122 #endif // defined TARGET_ARCH_X64 | 2093 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |