OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1599 __ LoadObject(EAX, bool_false); | 1599 __ LoadObject(EAX, bool_false); |
1600 __ ret(); | 1600 __ ret(); |
1601 __ Bind(&is_true); | 1601 __ Bind(&is_true); |
1602 __ LoadObject(EAX, bool_true); | 1602 __ LoadObject(EAX, bool_true); |
1603 __ ret(); | 1603 __ ret(); |
1604 __ Bind(&fall_through); | 1604 __ Bind(&fall_through); |
1605 return false; | 1605 return false; |
1606 } | 1606 } |
1607 | 1607 |
1608 | 1608 |
| 1609 bool Intrinsifier::String_getHashCode(Assembler* assembler) { |
| 1610 Label fall_through; |
| 1611 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // String object. |
| 1612 __ movl(EAX, FieldAddress(EAX, String::hash_offset())); |
| 1613 __ cmpl(EAX, Immediate(0)); |
| 1614 __ j(EQUAL, &fall_through, Assembler::kNearJump); |
| 1615 __ ret(); |
| 1616 __ Bind(&fall_through); |
| 1617 // Hash not yet computed. |
| 1618 return false; |
| 1619 } |
| 1620 |
| 1621 |
1609 bool Intrinsifier::String_getLength(Assembler* assembler) { | 1622 bool Intrinsifier::String_getLength(Assembler* assembler) { |
1610 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // String object. | 1623 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // String object. |
1611 __ movl(EAX, FieldAddress(EAX, String::length_offset())); | 1624 __ movl(EAX, FieldAddress(EAX, String::length_offset())); |
1612 __ ret(); | 1625 __ ret(); |
1613 return true; | 1626 return true; |
1614 } | 1627 } |
1615 | 1628 |
1616 | 1629 |
1617 // TODO(srdjan): Implement for two and four byte strings as well. | 1630 // TODO(srdjan): Implement for two and four byte strings as well. |
1618 bool Intrinsifier::String_charCodeAt(Assembler* assembler) { | 1631 bool Intrinsifier::String_charCodeAt(Assembler* assembler) { |
(...skipping 10 matching lines...) Expand all Loading... |
1629 __ j(NOT_EQUAL, &fall_through); | 1642 __ j(NOT_EQUAL, &fall_through); |
1630 __ SmiUntag(EBX); | 1643 __ SmiUntag(EBX); |
1631 __ movzxb(EAX, FieldAddress(EAX, EBX, TIMES_1, OneByteString::data_offset())); | 1644 __ movzxb(EAX, FieldAddress(EAX, EBX, TIMES_1, OneByteString::data_offset())); |
1632 __ SmiTag(EAX); | 1645 __ SmiTag(EAX); |
1633 __ ret(); | 1646 __ ret(); |
1634 __ Bind(&fall_through); | 1647 __ Bind(&fall_through); |
1635 return false; | 1648 return false; |
1636 } | 1649 } |
1637 | 1650 |
1638 | 1651 |
1639 bool Intrinsifier::String_hashCode(Assembler* assembler) { | |
1640 Label fall_through; | |
1641 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // String object. | |
1642 __ movl(EAX, FieldAddress(EAX, String::hash_offset())); | |
1643 __ cmpl(EAX, Immediate(0)); | |
1644 __ j(EQUAL, &fall_through, Assembler::kNearJump); | |
1645 __ ret(); | |
1646 __ Bind(&fall_through); | |
1647 // Hash not yet computed. | |
1648 return false; | |
1649 } | |
1650 | |
1651 | |
1652 bool Intrinsifier::String_isEmpty(Assembler* assembler) { | 1652 bool Intrinsifier::String_isEmpty(Assembler* assembler) { |
1653 Label is_true; | 1653 Label is_true; |
1654 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); | 1654 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); |
1655 const Bool& bool_false = Bool::ZoneHandle(Bool::False()); | 1655 const Bool& bool_false = Bool::ZoneHandle(Bool::False()); |
1656 // Get length. | 1656 // Get length. |
1657 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // String object. | 1657 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // String object. |
1658 __ movl(EAX, FieldAddress(EAX, String::length_offset())); | 1658 __ movl(EAX, FieldAddress(EAX, String::length_offset())); |
1659 __ cmpl(EAX, Immediate(Smi::RawValue(0))); | 1659 __ cmpl(EAX, Immediate(Smi::RawValue(0))); |
1660 __ j(EQUAL, &is_true, Assembler::kNearJump); | 1660 __ j(EQUAL, &is_true, Assembler::kNearJump); |
1661 __ LoadObject(EAX, bool_false); | 1661 __ LoadObject(EAX, bool_false); |
1662 __ ret(); | 1662 __ ret(); |
1663 __ Bind(&is_true); | 1663 __ Bind(&is_true); |
1664 __ LoadObject(EAX, bool_true); | 1664 __ LoadObject(EAX, bool_true); |
1665 __ ret(); | 1665 __ ret(); |
1666 return true; | 1666 return true; |
1667 } | 1667 } |
1668 | 1668 |
1669 #undef __ | 1669 #undef __ |
1670 } // namespace dart | 1670 } // namespace dart |
1671 | 1671 |
1672 #endif // defined TARGET_ARCH_IA32 | 1672 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |