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_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" |
| 11 #include "vm/dart_entry.h" |
11 #include "vm/flow_graph_compiler.h" | 12 #include "vm/flow_graph_compiler.h" |
12 #include "vm/object.h" | 13 #include "vm/object.h" |
13 #include "vm/object_store.h" | 14 #include "vm/object_store.h" |
| 15 #include "vm/regexp_assembler.h" |
14 #include "vm/symbols.h" | 16 #include "vm/symbols.h" |
15 | 17 |
16 namespace dart { | 18 namespace dart { |
17 | 19 |
18 DECLARE_FLAG(bool, enable_type_checks); | 20 DECLARE_FLAG(bool, enable_type_checks); |
19 | 21 |
20 #define __ assembler-> | 22 #define __ assembler-> |
21 | 23 |
22 | 24 |
23 intptr_t Intrinsifier::ParameterSlotFromSp() { return -1; } | 25 intptr_t Intrinsifier::ParameterSlotFromSp() { return -1; } |
(...skipping 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1662 | 1664 |
1663 void Intrinsifier::OneByteString_equality(Assembler* assembler) { | 1665 void Intrinsifier::OneByteString_equality(Assembler* assembler) { |
1664 StringEquality(assembler, kOneByteStringCid); | 1666 StringEquality(assembler, kOneByteStringCid); |
1665 } | 1667 } |
1666 | 1668 |
1667 | 1669 |
1668 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 1670 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
1669 StringEquality(assembler, kTwoByteStringCid); | 1671 StringEquality(assembler, kTwoByteStringCid); |
1670 } | 1672 } |
1671 | 1673 |
| 1674 |
| 1675 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { |
| 1676 static const intptr_t kRegExpParamOffset = + 2 * kWordSize; |
| 1677 static const intptr_t kStringParamOffset = + 1 * kWordSize; |
| 1678 // const Smi& start_index is located at (+ 0 * kWordSize). |
| 1679 |
| 1680 // Register assignments are as follows: |
| 1681 // T0: The appropriate specialized matcher function. |
| 1682 // T1: The regexp object. |
| 1683 // T2: Temp. |
| 1684 // T3: Temp, Pointer to the function's code which we then tail-call. |
| 1685 |
| 1686 __ lw(T1, Address(SP, kRegExpParamOffset)); |
| 1687 __ lw(T3, Address(SP, kStringParamOffset)); |
| 1688 |
| 1689 // Load the specialized function pointer into T0. Leverage the fact the |
| 1690 // string CIDs as well as stored function pointers are in sequence. |
| 1691 |
| 1692 __ LoadClassId(T2, T3); |
| 1693 __ AddImmediate(T2, -kOneByteStringCid); |
| 1694 __ sll(T2, T2, kWordSizeLog2); |
| 1695 __ addu(T2, T2, T1); |
| 1696 __ lw(T0, FieldAddress(T2, JSRegExp::function_offset(kOneByteStringCid))); |
| 1697 |
| 1698 // Registers have been set up for the lazy compile stub at this point. |
| 1699 // It expects the function in T0, the argument descriptor in S4, and |
| 1700 // IC-Data in S5. Explicitly null out IC-Data to ensure its validity. |
| 1701 |
| 1702 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; |
| 1703 __ LoadObject(S4, Array::Handle(ArgumentsDescriptor::New(arg_count))); |
| 1704 __ LoadImmediate(S5, reinterpret_cast<intptr_t>(Object::null())); |
| 1705 |
| 1706 // Tail-call the function. |
| 1707 __ lw(T3, FieldAddress(T0, Function::instructions_offset())); |
| 1708 __ AddImmediate(T3, Instructions::HeaderSize() - kHeapObjectTag); |
| 1709 __ jr(T3); |
| 1710 } |
| 1711 |
1672 // On stack: user tag (+0). | 1712 // On stack: user tag (+0). |
1673 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { | 1713 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
1674 // T1: Isolate. | 1714 // T1: Isolate. |
1675 Isolate* isolate = Isolate::Current(); | 1715 Isolate* isolate = Isolate::Current(); |
1676 __ LoadImmediate(T1, reinterpret_cast<uword>(isolate)); | 1716 __ LoadImmediate(T1, reinterpret_cast<uword>(isolate)); |
1677 // V0: Current user tag. | 1717 // V0: Current user tag. |
1678 __ lw(V0, Address(T1, Isolate::current_tag_offset())); | 1718 __ lw(V0, Address(T1, Isolate::current_tag_offset())); |
1679 // T2: UserTag. | 1719 // T2: UserTag. |
1680 __ lw(T2, Address(SP, + 0 * kWordSize)); | 1720 __ lw(T2, Address(SP, + 0 * kWordSize)); |
1681 // Set Isolate::current_tag_. | 1721 // Set Isolate::current_tag_. |
(...skipping 22 matching lines...) Expand all Loading... |
1704 Isolate* isolate = Isolate::Current(); | 1744 Isolate* isolate = Isolate::Current(); |
1705 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); | 1745 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); |
1706 // Set return value. | 1746 // Set return value. |
1707 __ Ret(); | 1747 __ Ret(); |
1708 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); | 1748 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); |
1709 } | 1749 } |
1710 | 1750 |
1711 } // namespace dart | 1751 } // namespace dart |
1712 | 1752 |
1713 #endif // defined TARGET_ARCH_MIPS | 1753 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |