| 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 #ifndef USE_JSCRE |
| 1641 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { |
| 1642 static const intptr_t kRegExpParamOffset = + 2 * kWordSize; |
| 1643 static const intptr_t kStringParamOffset = + 1 * kWordSize; |
| 1644 // const Smi& start_index is located at (+ 0 * kWordSize). |
| 1645 |
| 1646 // Register assignments are as follows: |
| 1647 // R0: The appropriate specialized matcher function. |
| 1648 // R2: The regexp object. |
| 1649 // R5: Temp. |
| 1650 // R1: Temp, Pointer to the function's code which we then tail-call. |
| 1651 |
| 1652 __ ldr(R2, Address(SP, kRegExpParamOffset)); |
| 1653 __ ldr(R1, Address(SP, kStringParamOffset)); |
| 1654 |
| 1655 // Load the specialized function pointer into R0. Leverage the fact the |
| 1656 // string CIDs as well as stored function pointers are in sequence. |
| 1657 |
| 1658 __ LoadClassId(R1, R1); |
| 1659 __ AddImmediate(R1, R1, -kOneByteStringCid); |
| 1660 __ add(R1, R2, Operand(R1, LSL, kWordSizeLog2)); |
| 1661 __ ldr(R0, FieldAddress(R1, JSRegExp::function_offset(kOneByteStringCid))); |
| 1662 |
| 1663 // Registers have been set up for the lazy compile stub at this point. |
| 1664 // It expects the function in R0, the argument descriptor in R4, and |
| 1665 // IC-Data in R5. Explicitly null out IC-Data to ensure its validity. |
| 1666 |
| 1667 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; |
| 1668 __ LoadObject(R4, Array::Handle(ArgumentsDescriptor::New(arg_count))); |
| 1669 __ eor(R5, R5, Operand(R5)); |
| 1670 |
| 1671 // Tail-call the function. |
| 1672 __ ldr(R1, FieldAddress(R0, Function::instructions_offset())); |
| 1673 __ AddImmediate(R1, Instructions::HeaderSize() - kHeapObjectTag); |
| 1674 __ bx(R1); |
| 1675 } |
| 1676 #endif |
| 1677 |
| 1678 |
| 1638 // On stack: user tag (+0). | 1679 // On stack: user tag (+0). |
| 1639 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { | 1680 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
| 1640 // R1: Isolate. | 1681 // R1: Isolate. |
| 1641 Isolate* isolate = Isolate::Current(); | 1682 Isolate* isolate = Isolate::Current(); |
| 1642 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); | 1683 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); |
| 1643 // R0: Current user tag. | 1684 // R0: Current user tag. |
| 1644 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 1685 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
| 1645 // R2: UserTag. | 1686 // R2: UserTag. |
| 1646 __ ldr(R2, Address(SP, + 0 * kWordSize)); | 1687 __ ldr(R2, Address(SP, + 0 * kWordSize)); |
| 1647 // Set Isolate::current_tag_. | 1688 // Set Isolate::current_tag_. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1669 Isolate* isolate = Isolate::Current(); | 1710 Isolate* isolate = Isolate::Current(); |
| 1670 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); | 1711 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); |
| 1671 // Set return value to Isolate::current_tag_. | 1712 // Set return value to Isolate::current_tag_. |
| 1672 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 1713 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
| 1673 __ Ret(); | 1714 __ Ret(); |
| 1674 } | 1715 } |
| 1675 | 1716 |
| 1676 } // namespace dart | 1717 } // namespace dart |
| 1677 | 1718 |
| 1678 #endif // defined TARGET_ARCH_ARM | 1719 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |