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 1938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1963 void Intrinsifier::OneByteString_equality(Assembler* assembler) { | 1965 void Intrinsifier::OneByteString_equality(Assembler* assembler) { |
1964 StringEquality(assembler, kOneByteStringCid); | 1966 StringEquality(assembler, kOneByteStringCid); |
1965 } | 1967 } |
1966 | 1968 |
1967 | 1969 |
1968 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 1970 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
1969 StringEquality(assembler, kTwoByteStringCid); | 1971 StringEquality(assembler, kTwoByteStringCid); |
1970 } | 1972 } |
1971 | 1973 |
1972 | 1974 |
1975 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { | |
1976 static const intptr_t kRegExpParamOffset = + 2 * kWordSize; | |
Ivan Posva
2014/11/14 08:42:50
+ 2 is is unusual style.
zerny-google
2014/11/14 12:18:57
Done.
| |
1977 static const intptr_t kStringParamOffset = + 1 * kWordSize; | |
1978 // const Smi& start_index is located at (+ 0 * kWordSize). | |
Ivan Posva
2014/11/14 08:42:50
Code in comments?
zerny-google
2014/11/14 12:18:57
Done.
| |
1979 | |
1980 // Register assignments are as follows: | |
1981 // R0: The appropriate specialized matcher function. | |
Ivan Posva
2014/11/14 08:42:50
These register assignments are not valid at this p
zerny-google
2014/11/14 12:18:57
Done.
| |
1982 // R2: The regexp object. | |
1983 // R5: Temp. | |
1984 // R1: Temp, Pointer to the function's code which we then tail-call. | |
1985 | |
1986 __ ldr(R2, Address(SP, kRegExpParamOffset)); | |
1987 __ ldr(R1, Address(SP, kStringParamOffset)); | |
1988 | |
1989 // Load the specialized function pointer into R0. Leverage the fact the | |
1990 // string CIDs as well as stored function pointers are in sequence. | |
1991 | |
1992 __ LoadClassId(R1, R1); | |
1993 __ AddImmediate(R1, R1, -kOneByteStringCid); | |
1994 __ add(R1, R2, Operand(R1, LSL, kWordSizeLog2)); | |
1995 __ ldr(R0, FieldAddress(R1, JSRegExp::function_offset(kOneByteStringCid))); | |
1996 | |
1997 // Registers have been set up for the lazy compile stub at this point. | |
1998 // It expects the function in R0, the argument descriptor in R4, and | |
1999 // IC-Data in R5. Explicitly null out IC-Data to ensure its validity. | |
Ivan Posva
2014/11/14 08:42:50
It is not clear to me from this comment why the IC
zerny-google
2014/11/14 12:18:57
I think maybe some previous version of the stub us
| |
2000 | |
2001 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; | |
2002 __ LoadObject(R4, Array::Handle(ArgumentsDescriptor::New(arg_count))); | |
2003 __ eor(R5, R5, Operand(R5)); | |
2004 | |
2005 // Tail-call the function. | |
2006 __ ldr(R1, FieldAddress(R0, Function::instructions_offset())); | |
2007 __ AddImmediate(R1, Instructions::HeaderSize() - kHeapObjectTag); | |
2008 __ bx(R1); | |
2009 } | |
2010 | |
2011 | |
1973 // On stack: user tag (+0). | 2012 // On stack: user tag (+0). |
1974 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { | 2013 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
1975 // R1: Isolate. | 2014 // R1: Isolate. |
1976 Isolate* isolate = Isolate::Current(); | 2015 Isolate* isolate = Isolate::Current(); |
1977 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); | 2016 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); |
1978 // R0: Current user tag. | 2017 // R0: Current user tag. |
1979 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 2018 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
1980 // R2: UserTag. | 2019 // R2: UserTag. |
1981 __ ldr(R2, Address(SP, + 0 * kWordSize)); | 2020 __ ldr(R2, Address(SP, + 0 * kWordSize)); |
1982 // Set Isolate::current_tag_. | 2021 // Set Isolate::current_tag_. |
(...skipping 21 matching lines...) Expand all Loading... | |
2004 Isolate* isolate = Isolate::Current(); | 2043 Isolate* isolate = Isolate::Current(); |
2005 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); | 2044 __ LoadImmediate(R1, reinterpret_cast<uword>(isolate)); |
2006 // Set return value to Isolate::current_tag_. | 2045 // Set return value to Isolate::current_tag_. |
2007 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); | 2046 __ ldr(R0, Address(R1, Isolate::current_tag_offset())); |
2008 __ Ret(); | 2047 __ Ret(); |
2009 } | 2048 } |
2010 | 2049 |
2011 } // namespace dart | 2050 } // namespace dart |
2012 | 2051 |
2013 #endif // defined TARGET_ARCH_ARM | 2052 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |