Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: runtime/vm/intrinsifier_mips.cc

Issue 539153002: Port and integrate the irregexp engine from V8 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Port remaining V8 regexp tests and fix exposed bugs. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
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 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after
1633 1633
1634 void Intrinsifier::OneByteString_equality(Assembler* assembler) { 1634 void Intrinsifier::OneByteString_equality(Assembler* assembler) {
1635 StringEquality(assembler, kOneByteStringCid); 1635 StringEquality(assembler, kOneByteStringCid);
1636 } 1636 }
1637 1637
1638 1638
1639 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { 1639 void Intrinsifier::TwoByteString_equality(Assembler* assembler) {
1640 StringEquality(assembler, kTwoByteStringCid); 1640 StringEquality(assembler, kTwoByteStringCid);
1641 } 1641 }
1642 1642
1643
1644 static void GenerateRegexpSpecializationFor(
1645 Assembler* assembler,
1646 intptr_t cid,
1647 Label* entry,
1648 Label* exit) {
1649 ASSERT(cid == kOneByteStringCid || cid == kExternalOneByteStringCid ||
1650 cid == kTwoByteStringCid || cid == kExternalTwoByteStringCid);
1651
1652 __ Bind(entry);
1653
1654 // The passed string is of class cid.
1655
1656 __ lw(T0, FieldAddress(T1, JSRegExp::function_offset(cid)));
1657
1658 // Set the subject if it is currently unset.
1659
1660 __ LoadObject(T2, Object::null_object());
1661 __ lw(T4, FieldAddress(T1, JSRegExp::subject_offset(cid)));
1662 __ bnel(T2, T4, exit);
1663
1664 __ StoreIntoObject(T1,
1665 FieldAddress(T1, JSRegExp::subject_offset(cid)),
1666 T3,
1667 false);
1668
1669 __ b(exit);
1670 }
1671
1672
1673 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) {
1674 Label is_one_byte_string;
1675 Label is_two_byte_string;
1676 Label is_external_one_byte_string;
1677 Label is_external_two_byte_string;
1678 Label fallthrough;
1679
1680 static const intptr_t kRegExpParamOffset = + 2 * kWordSize;
1681 static const intptr_t kStringParamOffset = + 1 * kWordSize;
1682 // const Smi& start_index is located at (+ 0 * kWordSize).
1683
1684 // Register assignments are as follows:
1685 // T0: The appropriate specialized matcher function.
1686 // T1: The regexp object.
1687 // T2: Temp.
1688 // T4: Temp.
1689 // T3: Temp, Pointer to the function's code which we then tail-call.
1690
1691 __ lw(T1, Address(SP, kRegExpParamOffset));
1692 __ lw(T3, Address(SP, kStringParamOffset));
1693
1694 // Check which string class we have been passed.
1695
1696 __ LoadClassId(T2, T3);
1697
1698 __ BranchEqual(T2, kOneByteStringCid, &is_one_byte_string);
1699 __ BranchEqual(T2, kTwoByteStringCid, &is_two_byte_string);
1700 __ BranchEqual(T2, kExternalOneByteStringCid, &is_external_one_byte_string);
1701 __ BranchEqual(T2, kExternalTwoByteStringCid, &is_external_two_byte_string);
1702
1703 __ Stop("Unexpected class id");
1704
1705 GenerateRegexpSpecializationFor(assembler, kExternalTwoByteStringCid,
1706 &is_external_two_byte_string, &fallthrough);
1707 GenerateRegexpSpecializationFor(assembler, kExternalOneByteStringCid,
1708 &is_external_one_byte_string, &fallthrough);
1709 GenerateRegexpSpecializationFor(assembler, kTwoByteStringCid,
1710 &is_two_byte_string, &fallthrough);
1711 GenerateRegexpSpecializationFor(assembler, kOneByteStringCid,
1712 &is_one_byte_string, &fallthrough);
1713
1714 // T0 contains the appropriate specialized function.
1715
1716 __ Bind(&fallthrough);
1717
1718 // Registers have been set up for the lazy compile stub at this point.
1719 // It expects the function in T0, the argument descriptor in S4, and
1720 // IC-Data in S5. Irregexp generated functions do not use either the
1721 // arguments descriptor or IC-Data, and hence these are not set here.
1722
1723 // Tail-call the function.
1724 __ lw(T3, FieldAddress(T0, Function::instructions_offset()));
1725 __ AddImmediate(T3, Instructions::HeaderSize() - kHeapObjectTag);
1726 __ jr(T3);
1727 }
1728
1643 // On stack: user tag (+0). 1729 // On stack: user tag (+0).
1644 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { 1730 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) {
1645 // T1: Isolate. 1731 // T1: Isolate.
1646 Isolate* isolate = Isolate::Current(); 1732 Isolate* isolate = Isolate::Current();
1647 __ LoadImmediate(T1, reinterpret_cast<uword>(isolate)); 1733 __ LoadImmediate(T1, reinterpret_cast<uword>(isolate));
1648 // V0: Current user tag. 1734 // V0: Current user tag.
1649 __ lw(V0, Address(T1, Isolate::current_tag_offset())); 1735 __ lw(V0, Address(T1, Isolate::current_tag_offset()));
1650 // T2: UserTag. 1736 // T2: UserTag.
1651 __ lw(T2, Address(SP, + 0 * kWordSize)); 1737 __ lw(T2, Address(SP, + 0 * kWordSize));
1652 // Set Isolate::current_tag_. 1738 // Set Isolate::current_tag_.
(...skipping 22 matching lines...) Expand all
1675 Isolate* isolate = Isolate::Current(); 1761 Isolate* isolate = Isolate::Current();
1676 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); 1762 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate));
1677 // Set return value. 1763 // Set return value.
1678 __ Ret(); 1764 __ Ret();
1679 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); 1765 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset()));
1680 } 1766 }
1681 1767
1682 } // namespace dart 1768 } // namespace dart
1683 1769
1684 #endif // defined TARGET_ARCH_MIPS 1770 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698