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" | |
12 #include "vm/flow_graph_compiler.h" | 11 #include "vm/flow_graph_compiler.h" |
13 #include "vm/object.h" | 12 #include "vm/object.h" |
14 #include "vm/object_store.h" | 13 #include "vm/object_store.h" |
15 #include "vm/regexp_assembler.h" | |
16 #include "vm/symbols.h" | 14 #include "vm/symbols.h" |
17 | 15 |
18 namespace dart { | 16 namespace dart { |
19 | 17 |
20 DECLARE_FLAG(bool, enable_type_checks); | 18 DECLARE_FLAG(bool, enable_type_checks); |
21 | 19 |
22 | 20 |
23 #define __ assembler-> | 21 #define __ assembler-> |
24 | 22 |
25 | 23 |
(...skipping 1902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1928 void Intrinsifier::OneByteString_equality(Assembler* assembler) { | 1926 void Intrinsifier::OneByteString_equality(Assembler* assembler) { |
1929 StringEquality(assembler, kOneByteStringCid); | 1927 StringEquality(assembler, kOneByteStringCid); |
1930 } | 1928 } |
1931 | 1929 |
1932 | 1930 |
1933 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 1931 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
1934 StringEquality(assembler, kTwoByteStringCid); | 1932 StringEquality(assembler, kTwoByteStringCid); |
1935 } | 1933 } |
1936 | 1934 |
1937 | 1935 |
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 | |
1972 // On stack: user tag (+0). | 1936 // On stack: user tag (+0). |
1973 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { | 1937 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
1974 // R1: Isolate. | 1938 // R1: Isolate. |
1975 Isolate* isolate = Isolate::Current(); | 1939 Isolate* isolate = Isolate::Current(); |
1976 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); | 1940 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); |
1977 // R0: Current user tag. | 1941 // R0: Current user tag. |
1978 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 1942 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
1979 // R2: UserTag. | 1943 // R2: UserTag. |
1980 __ ldr(R2, Address(SP, + 0 * kWordSize)); | 1944 __ ldr(R2, Address(SP, + 0 * kWordSize)); |
1981 // Set Isolate::current_tag_. | 1945 // Set Isolate::current_tag_. |
(...skipping 22 matching lines...) Expand all Loading... |
2004 Isolate* isolate = Isolate::Current(); | 1968 Isolate* isolate = Isolate::Current(); |
2005 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); | 1969 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate), kNoPP); |
2006 // Set return value to Isolate::current_tag_. | 1970 // Set return value to Isolate::current_tag_. |
2007 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 1971 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
2008 __ ret(); | 1972 __ ret(); |
2009 } | 1973 } |
2010 | 1974 |
2011 } // namespace dart | 1975 } // namespace dart |
2012 | 1976 |
2013 #endif // defined TARGET_ARCH_ARM64 | 1977 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |