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 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1971 void Intrinsifier::OneByteString_equality(Assembler* assembler) { | 1973 void Intrinsifier::OneByteString_equality(Assembler* assembler) { |
1972 StringEquality(assembler, kOneByteStringCid); | 1974 StringEquality(assembler, kOneByteStringCid); |
1973 } | 1975 } |
1974 | 1976 |
1975 | 1977 |
1976 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 1978 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
1977 StringEquality(assembler, kTwoByteStringCid); | 1979 StringEquality(assembler, kTwoByteStringCid); |
1978 } | 1980 } |
1979 | 1981 |
1980 | 1982 |
| 1983 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { |
| 1984 if (FLAG_use_jscre) { |
| 1985 return; |
| 1986 } |
| 1987 static const intptr_t kRegExpParamOffset = 2 * kWordSize; |
| 1988 static const intptr_t kStringParamOffset = 1 * kWordSize; |
| 1989 // start_index smi is located at offset 0. |
| 1990 |
| 1991 // Incoming registers: |
| 1992 // R0: Function. (Will be reloaded with the specialized matcher function.) |
| 1993 // R4: Arguments descriptor. (Will be preserved.) |
| 1994 // R5: IC-Data. (Will be preserved.) |
| 1995 |
| 1996 // Load the specialized function pointer into R0. Leverage the fact the |
| 1997 // string CIDs as well as stored function pointers are in sequence. |
| 1998 __ ldr(R2, Address(SP, kRegExpParamOffset)); |
| 1999 __ ldr(R1, Address(SP, kStringParamOffset)); |
| 2000 __ LoadClassId(R1, R1); |
| 2001 __ AddImmediate(R1, R1, -kOneByteStringCid); |
| 2002 __ add(R1, R2, Operand(R1, LSL, kWordSizeLog2)); |
| 2003 __ ldr(R0, FieldAddress(R1, JSRegExp::function_offset(kOneByteStringCid))); |
| 2004 |
| 2005 // Registers are now set up for the lazy compile stub. It expects the function |
| 2006 // in R0, the argument descriptor in R4, and IC-Data in R5. |
| 2007 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; |
| 2008 __ LoadObject(R4, Array::Handle(ArgumentsDescriptor::New(arg_count))); |
| 2009 |
| 2010 // Tail-call the function. |
| 2011 __ ldr(R1, FieldAddress(R0, Function::instructions_offset())); |
| 2012 __ AddImmediate(R1, Instructions::HeaderSize() - kHeapObjectTag); |
| 2013 __ bx(R1); |
| 2014 } |
| 2015 |
| 2016 |
1981 // On stack: user tag (+0). | 2017 // On stack: user tag (+0). |
1982 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { | 2018 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
1983 // R1: Isolate. | 2019 // R1: Isolate. |
1984 Isolate* isolate = Isolate::Current(); | 2020 Isolate* isolate = Isolate::Current(); |
1985 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); | 2021 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); |
1986 // R0: Current user tag. | 2022 // R0: Current user tag. |
1987 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 2023 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
1988 // R2: UserTag. | 2024 // R2: UserTag. |
1989 __ ldr(R2, Address(SP, + 0 * kWordSize)); | 2025 __ ldr(R2, Address(SP, + 0 * kWordSize)); |
1990 // Set Isolate::current_tag_. | 2026 // Set Isolate::current_tag_. |
(...skipping 21 matching lines...) Expand all Loading... |
2012 Isolate* isolate = Isolate::Current(); | 2048 Isolate* isolate = Isolate::Current(); |
2013 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); | 2049 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); |
2014 // Set return value to Isolate::current_tag_. | 2050 // Set return value to Isolate::current_tag_. |
2015 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 2051 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
2016 __ Ret(); | 2052 __ Ret(); |
2017 } | 2053 } |
2018 | 2054 |
2019 } // namespace dart | 2055 } // namespace dart |
2020 | 2056 |
2021 #endif // defined TARGET_ARCH_ARM | 2057 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |