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" |
(...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1775 // if (start < 0) return false; | 1775 // if (start < 0) return false; |
1776 __ cmp(R1, Operand(0)); | 1776 __ cmp(R1, Operand(0)); |
1777 __ b(return_false, LT); | 1777 __ b(return_false, LT); |
1778 | 1778 |
1779 // if (start + other.length > this.length) return false; | 1779 // if (start + other.length > this.length) return false; |
1780 __ add(R3, R1, Operand(R9)); | 1780 __ add(R3, R1, Operand(R9)); |
1781 __ cmp(R3, Operand(R8)); | 1781 __ cmp(R3, Operand(R8)); |
1782 __ b(return_false, GT); | 1782 __ b(return_false, GT); |
1783 | 1783 |
1784 if (receiver_cid == kOneByteStringCid) { | 1784 if (receiver_cid == kOneByteStringCid) { |
1785 __ AddImmediate(R0, R0, OneByteString::data_offset() - kHeapObjectTag); | 1785 __ AddImmediate(R0, OneByteString::data_offset() - kHeapObjectTag); |
1786 __ add(R0, R0, Operand(R1)); | 1786 __ add(R0, R0, Operand(R1)); |
1787 } else { | 1787 } else { |
1788 ASSERT(receiver_cid == kTwoByteStringCid); | 1788 ASSERT(receiver_cid == kTwoByteStringCid); |
1789 __ AddImmediate(R0, R0, TwoByteString::data_offset() - kHeapObjectTag); | 1789 __ AddImmediate(R0, TwoByteString::data_offset() - kHeapObjectTag); |
1790 __ add(R0, R0, Operand(R1)); | 1790 __ add(R0, R0, Operand(R1)); |
1791 __ add(R0, R0, Operand(R1)); | 1791 __ add(R0, R0, Operand(R1)); |
1792 } | 1792 } |
1793 if (other_cid == kOneByteStringCid) { | 1793 if (other_cid == kOneByteStringCid) { |
1794 __ AddImmediate(R2, R2, OneByteString::data_offset() - kHeapObjectTag); | 1794 __ AddImmediate(R2, OneByteString::data_offset() - kHeapObjectTag); |
1795 } else { | 1795 } else { |
1796 ASSERT(other_cid == kTwoByteStringCid); | 1796 ASSERT(other_cid == kTwoByteStringCid); |
1797 __ AddImmediate(R2, R2, TwoByteString::data_offset() - kHeapObjectTag); | 1797 __ AddImmediate(R2, TwoByteString::data_offset() - kHeapObjectTag); |
1798 } | 1798 } |
1799 | 1799 |
1800 // i = 0 | 1800 // i = 0 |
1801 __ LoadImmediate(R3, 0); | 1801 __ LoadImmediate(R3, 0); |
1802 | 1802 |
1803 // do | 1803 // do |
1804 Label loop; | 1804 Label loop; |
1805 __ Bind(&loop); | 1805 __ Bind(&loop); |
1806 | 1806 |
1807 if (receiver_cid == kOneByteStringCid) { | 1807 if (receiver_cid == kOneByteStringCid) { |
1808 __ ldrb(R4, Address(R0, 0)); // this.codeUnitAt(i + start) | 1808 __ ldrb(R4, Address(R0, 0)); // this.codeUnitAt(i + start) |
1809 } else { | 1809 } else { |
1810 __ ldrh(R4, Address(R0, 0)); // this.codeUnitAt(i + start) | 1810 __ ldrh(R4, Address(R0, 0)); // this.codeUnitAt(i + start) |
1811 } | 1811 } |
1812 if (other_cid == kOneByteStringCid) { | 1812 if (other_cid == kOneByteStringCid) { |
1813 __ ldrb(NOTFP, Address(R2, 0)); // other.codeUnitAt(i) | 1813 __ ldrb(NOTFP, Address(R2, 0)); // other.codeUnitAt(i) |
1814 } else { | 1814 } else { |
1815 __ ldrh(NOTFP, Address(R2, 0)); // other.codeUnitAt(i) | 1815 __ ldrh(NOTFP, Address(R2, 0)); // other.codeUnitAt(i) |
1816 } | 1816 } |
1817 __ cmp(R4, Operand(NOTFP)); | 1817 __ cmp(R4, Operand(NOTFP)); |
1818 __ b(return_false, NE); | 1818 __ b(return_false, NE); |
1819 | 1819 |
1820 // i++, while (i < len) | 1820 // i++, while (i < len) |
1821 __ AddImmediate(R3, R3, 1); | 1821 __ AddImmediate(R3, 1); |
1822 __ AddImmediate(R0, R0, receiver_cid == kOneByteStringCid ? 1 : 2); | 1822 __ AddImmediate(R0, receiver_cid == kOneByteStringCid ? 1 : 2); |
1823 __ AddImmediate(R2, R2, other_cid == kOneByteStringCid ? 1 : 2); | 1823 __ AddImmediate(R2, other_cid == kOneByteStringCid ? 1 : 2); |
1824 __ cmp(R3, Operand(R9)); | 1824 __ cmp(R3, Operand(R9)); |
1825 __ b(&loop, LT); | 1825 __ b(&loop, LT); |
1826 | 1826 |
1827 __ b(return_true); | 1827 __ b(return_true); |
1828 } | 1828 } |
1829 | 1829 |
1830 | 1830 |
1831 // bool _substringMatches(int start, String other) | 1831 // bool _substringMatches(int start, String other) |
1832 // This intrinsic handles a OneByteString or TwoByteString receiver with a | 1832 // This intrinsic handles a OneByteString or TwoByteString receiver with a |
1833 // OneByteString other. | 1833 // OneByteString other. |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2229 // Incoming registers: | 2229 // Incoming registers: |
2230 // R0: Function. (Will be reloaded with the specialized matcher function.) | 2230 // R0: Function. (Will be reloaded with the specialized matcher function.) |
2231 // R4: Arguments descriptor. (Will be preserved.) | 2231 // R4: Arguments descriptor. (Will be preserved.) |
2232 // R9: Unknown. (Must be GC safe on tail call.) | 2232 // R9: Unknown. (Must be GC safe on tail call.) |
2233 | 2233 |
2234 // Load the specialized function pointer into R0. Leverage the fact the | 2234 // Load the specialized function pointer into R0. Leverage the fact the |
2235 // string CIDs as well as stored function pointers are in sequence. | 2235 // string CIDs as well as stored function pointers are in sequence. |
2236 __ ldr(R2, Address(SP, kRegExpParamOffset)); | 2236 __ ldr(R2, Address(SP, kRegExpParamOffset)); |
2237 __ ldr(R1, Address(SP, kStringParamOffset)); | 2237 __ ldr(R1, Address(SP, kStringParamOffset)); |
2238 __ LoadClassId(R1, R1); | 2238 __ LoadClassId(R1, R1); |
2239 __ AddImmediate(R1, R1, -kOneByteStringCid); | 2239 __ AddImmediate(R1, -kOneByteStringCid); |
2240 __ add(R1, R2, Operand(R1, LSL, kWordSizeLog2)); | 2240 __ add(R1, R2, Operand(R1, LSL, kWordSizeLog2)); |
2241 __ ldr(R0, | 2241 __ ldr(R0, |
2242 FieldAddress(R1, RegExp::function_offset(kOneByteStringCid, sticky))); | 2242 FieldAddress(R1, RegExp::function_offset(kOneByteStringCid, sticky))); |
2243 | 2243 |
2244 // Registers are now set up for the lazy compile stub. It expects the function | 2244 // Registers are now set up for the lazy compile stub. It expects the function |
2245 // in R0, the argument descriptor in R4, and IC-Data in R9. | 2245 // in R0, the argument descriptor in R4, and IC-Data in R9. |
2246 __ eor(R9, R9, Operand(R9)); | 2246 __ eor(R9, R9, Operand(R9)); |
2247 | 2247 |
2248 // Tail-call the function. | 2248 // Tail-call the function. |
2249 __ ldr(CODE_REG, FieldAddress(R0, Function::code_offset())); | 2249 __ ldr(CODE_REG, FieldAddress(R0, Function::code_offset())); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2310 | 2310 |
2311 void Intrinsifier::SetAsyncThreadStackTrace(Assembler* assembler) { | 2311 void Intrinsifier::SetAsyncThreadStackTrace(Assembler* assembler) { |
2312 __ ldr(R0, Address(THR, Thread::async_stack_trace_offset())); | 2312 __ ldr(R0, Address(THR, Thread::async_stack_trace_offset())); |
2313 __ LoadObject(R0, Object::null_object()); | 2313 __ LoadObject(R0, Object::null_object()); |
2314 __ Ret(); | 2314 __ Ret(); |
2315 } | 2315 } |
2316 | 2316 |
2317 } // namespace dart | 2317 } // namespace dart |
2318 | 2318 |
2319 #endif // defined TARGET_ARCH_ARM | 2319 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |