Chromium Code Reviews| 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 == kExternalOneByteStringCid || | |
| 1710 cid == kTwoByteStringCid || 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 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 which string class we have been passed. | |
| 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 __ Stop("Unexpected class id"); | |
| 1768 | |
| 1769 GenerateRegexpSpecializationFor(assembler, kExternalTwoByteStringCid, | |
| 1770 &is_external_two_byte_string, &fallthrough); | |
| 1771 GenerateRegexpSpecializationFor(assembler, kExternalOneByteStringCid, | |
| 1772 &is_external_one_byte_string, &fallthrough); | |
| 1773 GenerateRegexpSpecializationFor(assembler, kTwoByteStringCid, | |
| 1774 &is_two_byte_string, &fallthrough, | |
| 1775 Assembler::kNearJump); | |
| 1776 GenerateRegexpSpecializationFor(assembler, kOneByteStringCid, | |
| 1777 &is_one_byte_string, &fallthrough, | |
| 1778 Assembler::kNearJump); | |
| 1779 | |
| 1780 // EAX contains the appropriate specialized function. | |
| 1781 | |
| 1782 __ Bind(&fallthrough); | |
| 1783 | |
| 1784 // Registers have been set up for the lazy compile stub at this point. | |
| 1785 // It expects the function in EAX, the argument descriptor in EDX, and | |
| 1786 // IC-Data in ECX. Irregexp generated functions do not use either the | |
|
Florian Schneider
2014/10/01 17:04:13
ECX is destroyed by GenerateRegexpSpecializationFo
| |
| 1787 // arguments descriptor or IC-Data, and hence these are not set here. | |
| 1788 | |
| 1789 // Tail-call the function. | |
| 1790 __ movl(EDI, FieldAddress(EAX, Function::instructions_offset())); | |
| 1791 __ addl(EDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | |
| 1792 __ jmp(EDI); | |
| 1793 } | |
| 1794 | |
| 1795 | |
| 1703 // On stack: user tag (+1), return-address (+0). | 1796 // On stack: user tag (+1), return-address (+0). |
| 1704 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { | 1797 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
| 1705 Isolate* isolate = Isolate::Current(); | 1798 Isolate* isolate = Isolate::Current(); |
| 1706 const Address current_tag_addr = | 1799 const Address current_tag_addr = |
| 1707 Address::Absolute(reinterpret_cast<uword>(isolate) + | 1800 Address::Absolute(reinterpret_cast<uword>(isolate) + |
| 1708 Isolate::current_tag_offset()); | 1801 Isolate::current_tag_offset()); |
| 1709 const Address user_tag_addr = | 1802 const Address user_tag_addr = |
| 1710 Address::Absolute(reinterpret_cast<uword>(isolate) + | 1803 Address::Absolute(reinterpret_cast<uword>(isolate) + |
| 1711 Isolate::user_tag_offset()); | 1804 Isolate::user_tag_offset()); |
| 1712 // EAX: Current user tag. | 1805 // EAX: Current user tag. |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 1741 Isolate::current_tag_offset()); | 1834 Isolate::current_tag_offset()); |
| 1742 // Set return value to Isolate::current_tag_. | 1835 // Set return value to Isolate::current_tag_. |
| 1743 __ movl(EAX, current_tag_addr); | 1836 __ movl(EAX, current_tag_addr); |
| 1744 __ ret(); | 1837 __ ret(); |
| 1745 } | 1838 } |
| 1746 | 1839 |
| 1747 #undef __ | 1840 #undef __ |
| 1748 } // namespace dart | 1841 } // namespace dart |
| 1749 | 1842 |
| 1750 #endif // defined TARGET_ARCH_IA32 | 1843 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |