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 1814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1839 void Intrinsifier::OneByteString_equality(Assembler* assembler) { | 1841 void Intrinsifier::OneByteString_equality(Assembler* assembler) { |
1840 StringEquality(assembler, kOneByteStringCid); | 1842 StringEquality(assembler, kOneByteStringCid); |
1841 } | 1843 } |
1842 | 1844 |
1843 | 1845 |
1844 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 1846 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
1845 StringEquality(assembler, kTwoByteStringCid); | 1847 StringEquality(assembler, kTwoByteStringCid); |
1846 } | 1848 } |
1847 | 1849 |
1848 | 1850 |
| 1851 #ifndef USE_JSCRE |
| 1852 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { |
| 1853 static const intptr_t kRegExpParamOffset = + 2 * kWordSize; |
| 1854 static const intptr_t kStringParamOffset = + 1 * kWordSize; |
| 1855 // const Smi& start_index is located at (+ 0 * kWordSize). |
| 1856 |
| 1857 // Register assignments are as follows: |
| 1858 // R0: The appropriate specialized matcher function. |
| 1859 // R2: The regexp object. |
| 1860 // R5: Temp. |
| 1861 // R1: Temp, Pointer to the function's code which we then tail-call. |
| 1862 |
| 1863 __ ldr(R2, Address(SP, kRegExpParamOffset)); |
| 1864 __ ldr(R1, Address(SP, kStringParamOffset)); |
| 1865 |
| 1866 // Load the specialized function pointer into R0. Leverage the fact the |
| 1867 // string CIDs as well as stored function pointers are in sequence. |
| 1868 |
| 1869 __ LoadClassId(R1, R1); |
| 1870 __ AddImmediate(R1, R1, -kOneByteStringCid); |
| 1871 __ add(R1, R2, Operand(R1, LSL, kWordSizeLog2)); |
| 1872 __ ldr(R0, FieldAddress(R1, JSRegExp::function_offset(kOneByteStringCid))); |
| 1873 |
| 1874 // Registers have been set up for the lazy compile stub at this point. |
| 1875 // It expects the function in R0, the argument descriptor in R4, and |
| 1876 // IC-Data in R5. Explicitly null out IC-Data to ensure its validity. |
| 1877 |
| 1878 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; |
| 1879 __ LoadObject(R4, Array::Handle(ArgumentsDescriptor::New(arg_count))); |
| 1880 __ eor(R5, R5, Operand(R5)); |
| 1881 |
| 1882 // Tail-call the function. |
| 1883 __ ldr(R1, FieldAddress(R0, Function::instructions_offset())); |
| 1884 __ AddImmediate(R1, Instructions::HeaderSize() - kHeapObjectTag); |
| 1885 __ bx(R1); |
| 1886 } |
| 1887 #endif |
| 1888 |
| 1889 |
1849 // On stack: user tag (+0). | 1890 // On stack: user tag (+0). |
1850 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { | 1891 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
1851 // R1: Isolate. | 1892 // R1: Isolate. |
1852 Isolate* isolate = Isolate::Current(); | 1893 Isolate* isolate = Isolate::Current(); |
1853 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); | 1894 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); |
1854 // R0: Current user tag. | 1895 // R0: Current user tag. |
1855 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 1896 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
1856 // R2: UserTag. | 1897 // R2: UserTag. |
1857 __ ldr(R2, Address(SP, + 0 * kWordSize)); | 1898 __ ldr(R2, Address(SP, + 0 * kWordSize)); |
1858 // Set Isolate::current_tag_. | 1899 // Set Isolate::current_tag_. |
(...skipping 21 matching lines...) Expand all Loading... |
1880 Isolate* isolate = Isolate::Current(); | 1921 Isolate* isolate = Isolate::Current(); |
1881 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); | 1922 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); |
1882 // Set return value to Isolate::current_tag_. | 1923 // Set return value to Isolate::current_tag_. |
1883 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 1924 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
1884 __ Ret(); | 1925 __ Ret(); |
1885 } | 1926 } |
1886 | 1927 |
1887 } // namespace dart | 1928 } // namespace dart |
1888 | 1929 |
1889 #endif // defined TARGET_ARCH_ARM | 1930 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |