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" | |
13 #include "vm/flow_graph_compiler.h" | 12 #include "vm/flow_graph_compiler.h" |
14 #include "vm/object.h" | 13 #include "vm/object.h" |
15 #include "vm/object_store.h" | 14 #include "vm/object_store.h" |
16 #include "vm/regexp_assembler.h" | |
17 #include "vm/symbols.h" | 15 #include "vm/symbols.h" |
18 | 16 |
19 namespace dart { | 17 namespace dart { |
20 | 18 |
21 DECLARE_FLAG(bool, enable_type_checks); | 19 DECLARE_FLAG(bool, enable_type_checks); |
22 | 20 |
23 | 21 |
24 #define __ assembler-> | 22 #define __ assembler-> |
25 | 23 |
26 | 24 |
(...skipping 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1973 void Intrinsifier::OneByteString_equality(Assembler* assembler) { | 1971 void Intrinsifier::OneByteString_equality(Assembler* assembler) { |
1974 StringEquality(assembler, kOneByteStringCid); | 1972 StringEquality(assembler, kOneByteStringCid); |
1975 } | 1973 } |
1976 | 1974 |
1977 | 1975 |
1978 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 1976 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
1979 StringEquality(assembler, kTwoByteStringCid); | 1977 StringEquality(assembler, kTwoByteStringCid); |
1980 } | 1978 } |
1981 | 1979 |
1982 | 1980 |
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 | |
2017 // On stack: user tag (+0). | 1981 // On stack: user tag (+0). |
2018 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { | 1982 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
2019 // R1: Isolate. | 1983 // R1: Isolate. |
2020 Isolate* isolate = Isolate::Current(); | 1984 Isolate* isolate = Isolate::Current(); |
2021 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); | 1985 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); |
2022 // R0: Current user tag. | 1986 // R0: Current user tag. |
2023 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 1987 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
2024 // R2: UserTag. | 1988 // R2: UserTag. |
2025 __ ldr(R2, Address(SP, + 0 * kWordSize)); | 1989 __ ldr(R2, Address(SP, + 0 * kWordSize)); |
2026 // Set Isolate::current_tag_. | 1990 // Set Isolate::current_tag_. |
(...skipping 21 matching lines...) Expand all Loading... |
2048 Isolate* isolate = Isolate::Current(); | 2012 Isolate* isolate = Isolate::Current(); |
2049 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); | 2013 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); |
2050 // Set return value to Isolate::current_tag_. | 2014 // Set return value to Isolate::current_tag_. |
2051 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 2015 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
2052 __ Ret(); | 2016 __ Ret(); |
2053 } | 2017 } |
2054 | 2018 |
2055 } // namespace dart | 2019 } // namespace dart |
2056 | 2020 |
2057 #endif // defined TARGET_ARCH_ARM | 2021 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |