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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
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/cpu.h" | 11 #include "vm/cpu.h" |
| 12 #include "vm/dart_entry.h" |
12 #include "vm/flow_graph_compiler.h" | 13 #include "vm/flow_graph_compiler.h" |
13 #include "vm/object.h" | 14 #include "vm/object.h" |
14 #include "vm/object_store.h" | 15 #include "vm/object_store.h" |
| 16 #include "vm/regexp_assembler.h" |
15 #include "vm/symbols.h" | 17 #include "vm/symbols.h" |
16 | 18 |
17 namespace dart { | 19 namespace dart { |
18 | 20 |
19 DECLARE_FLAG(bool, enable_type_checks); | 21 DECLARE_FLAG(bool, enable_type_checks); |
20 | 22 |
21 | 23 |
22 #define __ assembler-> | 24 #define __ assembler-> |
23 | 25 |
24 | 26 |
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1628 void Intrinsifier::OneByteString_equality(Assembler* assembler) { | 1630 void Intrinsifier::OneByteString_equality(Assembler* assembler) { |
1629 StringEquality(assembler, kOneByteStringCid); | 1631 StringEquality(assembler, kOneByteStringCid); |
1630 } | 1632 } |
1631 | 1633 |
1632 | 1634 |
1633 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 1635 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
1634 StringEquality(assembler, kTwoByteStringCid); | 1636 StringEquality(assembler, kTwoByteStringCid); |
1635 } | 1637 } |
1636 | 1638 |
1637 | 1639 |
| 1640 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { |
| 1641 static const intptr_t kRegExpParamOffset = + 2 * kWordSize; |
| 1642 static const intptr_t kStringParamOffset = + 1 * kWordSize; |
| 1643 // const Smi& start_index is located at (+ 0 * kWordSize). |
| 1644 |
| 1645 // Register assignments are as follows: |
| 1646 // R0: The appropriate specialized matcher function. |
| 1647 // R2: The regexp object. |
| 1648 // R5: Temp. |
| 1649 // R1: Temp, Pointer to the function's code which we then tail-call. |
| 1650 |
| 1651 __ ldr(R2, Address(SP, kRegExpParamOffset)); |
| 1652 __ ldr(R1, Address(SP, kStringParamOffset)); |
| 1653 |
| 1654 // Load the specialized function pointer into R0. Leverage the fact the |
| 1655 // string CIDs as well as stored function pointers are in sequence. |
| 1656 |
| 1657 __ LoadClassId(R1, R1); |
| 1658 __ AddImmediate(R1, R1, -kOneByteStringCid); |
| 1659 __ add(R1, R2, Operand(R1, LSL, kWordSizeLog2)); |
| 1660 __ ldr(R0, FieldAddress(R1, JSRegExp::function_offset(kOneByteStringCid))); |
| 1661 |
| 1662 // Registers have been set up for the lazy compile stub at this point. |
| 1663 // It expects the function in R0, the argument descriptor in R4, and |
| 1664 // IC-Data in R5. Explicitly null out IC-Data to ensure its validity. |
| 1665 |
| 1666 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; |
| 1667 __ LoadObject(R4, Array::Handle(ArgumentsDescriptor::New(arg_count))); |
| 1668 __ LoadImmediate(R5, reinterpret_cast<intptr_t>(Object::null())); |
| 1669 |
| 1670 // Tail-call the function. |
| 1671 __ ldr(R1, FieldAddress(R0, Function::instructions_offset())); |
| 1672 __ AddImmediate(R1, Instructions::HeaderSize() - kHeapObjectTag); |
| 1673 __ bx(R1); |
| 1674 } |
| 1675 |
| 1676 |
1638 // On stack: user tag (+0). | 1677 // On stack: user tag (+0). |
1639 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { | 1678 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
1640 // R1: Isolate. | 1679 // R1: Isolate. |
1641 Isolate* isolate = Isolate::Current(); | 1680 Isolate* isolate = Isolate::Current(); |
1642 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); | 1681 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); |
1643 // R0: Current user tag. | 1682 // R0: Current user tag. |
1644 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 1683 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
1645 // R2: UserTag. | 1684 // R2: UserTag. |
1646 __ ldr(R2, Address(SP, + 0 * kWordSize)); | 1685 __ ldr(R2, Address(SP, + 0 * kWordSize)); |
1647 // Set Isolate::current_tag_. | 1686 // Set Isolate::current_tag_. |
(...skipping 21 matching lines...) Expand all Loading... |
1669 Isolate* isolate = Isolate::Current(); | 1708 Isolate* isolate = Isolate::Current(); |
1670 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); | 1709 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); |
1671 // Set return value to Isolate::current_tag_. | 1710 // Set return value to Isolate::current_tag_. |
1672 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 1711 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
1673 __ Ret(); | 1712 __ Ret(); |
1674 } | 1713 } |
1675 | 1714 |
1676 } // namespace dart | 1715 } // namespace dart |
1677 | 1716 |
1678 #endif // defined TARGET_ARCH_ARM | 1717 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |