OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
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 | 22 |
21 #define __ assembler-> | 23 #define __ assembler-> |
22 | 24 |
23 | 25 |
(...skipping 1902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1926 void Intrinsifier::OneByteString_equality(Assembler* assembler) { | 1928 void Intrinsifier::OneByteString_equality(Assembler* assembler) { |
1927 StringEquality(assembler, kOneByteStringCid); | 1929 StringEquality(assembler, kOneByteStringCid); |
1928 } | 1930 } |
1929 | 1931 |
1930 | 1932 |
1931 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 1933 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
1932 StringEquality(assembler, kTwoByteStringCid); | 1934 StringEquality(assembler, kTwoByteStringCid); |
1933 } | 1935 } |
1934 | 1936 |
1935 | 1937 |
| 1938 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { |
| 1939 if (FLAG_use_jscre) { |
| 1940 return; |
| 1941 } |
| 1942 static const intptr_t kRegExpParamOffset = 2 * kWordSize; |
| 1943 static const intptr_t kStringParamOffset = 1 * kWordSize; |
| 1944 // start_index smi is located at offset 0. |
| 1945 |
| 1946 // Incoming registers: |
| 1947 // R0: Function. (Will be reloaded with the specialized matcher function.) |
| 1948 // R4: Arguments descriptor. (Will be preserved.) |
| 1949 // R5: IC-Data. (Will be preserved.) |
| 1950 |
| 1951 // Load the specialized function pointer into R0. Leverage the fact the |
| 1952 // string CIDs as well as stored function pointers are in sequence. |
| 1953 __ ldr(R2, Address(SP, kRegExpParamOffset)); |
| 1954 __ ldr(R1, Address(SP, kStringParamOffset)); |
| 1955 __ LoadClassId(R1, R1, kNoPP); |
| 1956 __ AddImmediate(R1, R1, -kOneByteStringCid, kNoPP); |
| 1957 __ add(R1, R2, Operand(R1, LSL, kWordSizeLog2)); |
| 1958 __ ldr(R0, FieldAddress(R1, JSRegExp::function_offset(kOneByteStringCid))); |
| 1959 |
| 1960 // Registers are now set up for the lazy compile stub. It expects the function |
| 1961 // in R0, the argument descriptor in R4, and IC-Data in R5. |
| 1962 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; |
| 1963 __ LoadObject(R4, Array::Handle(ArgumentsDescriptor::New(arg_count)), kNoPP); |
| 1964 |
| 1965 // Tail-call the function. |
| 1966 __ ldr(R1, FieldAddress(R0, Function::instructions_offset())); |
| 1967 __ AddImmediate(R1, R1, Instructions::HeaderSize() - kHeapObjectTag, kNoPP); |
| 1968 __ br(R1); |
| 1969 } |
| 1970 |
| 1971 |
1936 // On stack: user tag (+0). | 1972 // On stack: user tag (+0). |
1937 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { | 1973 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
1938 // R1: Isolate. | 1974 // R1: Isolate. |
1939 Isolate* isolate = Isolate::Current(); | 1975 Isolate* isolate = Isolate::Current(); |
1940 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); | 1976 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); |
1941 // R0: Current user tag. | 1977 // R0: Current user tag. |
1942 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 1978 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
1943 // R2: UserTag. | 1979 // R2: UserTag. |
1944 __ ldr(R2, Address(SP, + 0 * kWordSize)); | 1980 __ ldr(R2, Address(SP, + 0 * kWordSize)); |
1945 // Set Isolate::current_tag_. | 1981 // Set Isolate::current_tag_. |
(...skipping 22 matching lines...) Expand all Loading... |
1968 Isolate* isolate = Isolate::Current(); | 2004 Isolate* isolate = Isolate::Current(); |
1969 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); | 2005 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); |
1970 // Set return value to Isolate::current_tag_. | 2006 // Set return value to Isolate::current_tag_. |
1971 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 2007 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
1972 __ ret(); | 2008 __ ret(); |
1973 } | 2009 } |
1974 | 2010 |
1975 } // namespace dart | 2011 } // namespace dart |
1976 | 2012 |
1977 #endif // defined TARGET_ARCH_ARM64 | 2013 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |