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 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1693 void Intrinsifier::OneByteString_equality(Assembler* assembler) { | 1693 void Intrinsifier::OneByteString_equality(Assembler* assembler) { |
1694 StringEquality(assembler, kOneByteStringCid); | 1694 StringEquality(assembler, kOneByteStringCid); |
1695 } | 1695 } |
1696 | 1696 |
1697 | 1697 |
1698 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 1698 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
1699 StringEquality(assembler, kTwoByteStringCid); | 1699 StringEquality(assembler, kTwoByteStringCid); |
1700 } | 1700 } |
1701 | 1701 |
1702 | 1702 |
1703 static void GenerateRegexpSpecializationFor( | |
1704 Assembler* assembler, | |
1705 intptr_t cid, | |
1706 Label* entry, | |
1707 Label* exit, | |
1708 bool jump_kind = Assembler::kFarJump) { | |
1709 ASSERT(cid == kOneByteStringCid || cid == kTwoByteStringCid || | |
1710 cid == kExternalOneByteStringCid || cid == kExternalTwoByteStringCid); | |
1711 | |
1712 __ Bind(entry); | |
1713 | |
1714 // The passed string is of class cid. | |
1715 | |
1716 __ movl(EAX, FieldAddress(EBX, JSRegExp::function_offset(cid))); | |
1717 | |
1718 // Set the subject if it is currently unset. | |
1719 | |
1720 __ LoadObject(ECX, Object::null_object()); | |
1721 __ cmpl(ECX, FieldAddress(EBX, JSRegExp::subject_offset(cid))); | |
1722 __ j(NOT_EQUAL, exit, jump_kind); | |
1723 | |
1724 __ StoreIntoObject(EBX, | |
1725 FieldAddress(EBX, JSRegExp::subject_offset(cid)), | |
1726 EDI, | |
1727 false); | |
1728 | |
1729 __ jmp(exit, jump_kind); | |
1730 } | |
1731 | |
1732 | |
1733 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { | |
1734 Label is_one_byte_string; | |
1735 Label is_two_byte_string; | |
1736 Label is_external_one_byte_string; | |
1737 Label is_external_two_byte_string; | |
1738 Label fallthrough; | |
1739 | |
1740 static const intptr_t kRegExpParamOffset = + 3 * kWordSize; | |
1741 static const intptr_t kStringParamOffset = + 2 * kWordSize; | |
1742 // const Smi& start_index is located at (+ 1 * kWordSize). | |
1743 | |
1744 // Register assignments are as follows: | |
1745 // EAX: The appropriate (one- or two-byte specialized) matcher function. | |
1746 // EBX: The regexp object. | |
1747 // ECX: Temp. | |
1748 // EDI: Temp, Pointer to the function's code which we then tail-call. | |
1749 | |
1750 __ movl(EBX, Address(ESP, kRegExpParamOffset)); | |
1751 __ movl(EDI, Address(ESP, kStringParamOffset)); | |
1752 | |
1753 // Check if the string is a one byte string. | |
1754 | |
1755 __ CompareClassId(EDI, kOneByteStringCid, ECX); | |
1756 __ j(EQUAL, &is_one_byte_string); | |
1757 | |
1758 __ CompareClassId(EDI, kTwoByteStringCid, ECX); | |
1759 __ j(EQUAL, &is_two_byte_string); | |
1760 | |
1761 __ CompareClassId(EDI, kExternalOneByteStringCid, ECX); | |
1762 __ j(EQUAL, &is_external_one_byte_string); | |
1763 | |
1764 __ CompareClassId(EDI, kExternalTwoByteStringCid, ECX); | |
1765 __ j(EQUAL, &is_external_two_byte_string); | |
1766 | |
1767 GenerateRegexpSpecializationFor(assembler, kExternalTwoByteStringCid, | |
1768 &is_external_two_byte_string, &fallthrough); | |
1769 GenerateRegexpSpecializationFor(assembler, kExternalOneByteStringCid, | |
1770 &is_external_one_byte_string, &fallthrough); | |
1771 GenerateRegexpSpecializationFor(assembler, kTwoByteStringCid, | |
1772 &is_two_byte_string, &fallthrough, | |
1773 Assembler::kNearJump); | |
1774 GenerateRegexpSpecializationFor(assembler, kOneByteStringCid, | |
1775 &is_one_byte_string, &fallthrough, | |
1776 Assembler::kNearJump); | |
1777 | |
1778 // EAX contains the appropriate (one- or two-byte string) function. | |
1779 | |
1780 __ Bind(&fallthrough); | |
1781 | |
1782 // Registers have been set up for the lazy compile stub at this point. | |
1783 // It expects the function in EAX while; EDX and ECX are unused. | |
1784 | |
srdjan
2014/09/22 22:34:07
Registers EDX (arguments descriptor) and ECX (func
jgruber1
2014/09/23 10:58:47
Done.
| |
1785 // Tail-call the function. | |
1786 __ movl(EDI, FieldAddress(EAX, Function::instructions_offset())); | |
1787 __ addl(EDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | |
1788 __ jmp(EDI); | |
1789 } | |
1790 | |
1791 | |
1703 // On stack: user tag (+1), return-address (+0). | 1792 // On stack: user tag (+1), return-address (+0). |
1704 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { | 1793 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
1705 Isolate* isolate = Isolate::Current(); | 1794 Isolate* isolate = Isolate::Current(); |
1706 const Address current_tag_addr = | 1795 const Address current_tag_addr = |
1707 Address::Absolute(reinterpret_cast<uword>(isolate) + | 1796 Address::Absolute(reinterpret_cast<uword>(isolate) + |
1708 Isolate::current_tag_offset()); | 1797 Isolate::current_tag_offset()); |
1709 const Address user_tag_addr = | 1798 const Address user_tag_addr = |
1710 Address::Absolute(reinterpret_cast<uword>(isolate) + | 1799 Address::Absolute(reinterpret_cast<uword>(isolate) + |
1711 Isolate::user_tag_offset()); | 1800 Isolate::user_tag_offset()); |
1712 // EAX: Current user tag. | 1801 // EAX: Current user tag. |
(...skipping 28 matching lines...) Expand all Loading... | |
1741 Isolate::current_tag_offset()); | 1830 Isolate::current_tag_offset()); |
1742 // Set return value to Isolate::current_tag_. | 1831 // Set return value to Isolate::current_tag_. |
1743 __ movl(EAX, current_tag_addr); | 1832 __ movl(EAX, current_tag_addr); |
1744 __ ret(); | 1833 __ ret(); |
1745 } | 1834 } |
1746 | 1835 |
1747 #undef __ | 1836 #undef __ |
1748 } // namespace dart | 1837 } // namespace dart |
1749 | 1838 |
1750 #endif // defined TARGET_ARCH_IA32 | 1839 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |