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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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 #define __ assembler-> | 20 #define __ assembler-> |
23 | 21 |
24 | 22 |
25 intptr_t Intrinsifier::ParameterSlotFromSp() { return -1; } | 23 intptr_t Intrinsifier::ParameterSlotFromSp() { return -1; } |
(...skipping 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2061 | 2059 |
2062 void Intrinsifier::OneByteString_equality(Assembler* assembler) { | 2060 void Intrinsifier::OneByteString_equality(Assembler* assembler) { |
2063 StringEquality(assembler, kOneByteStringCid); | 2061 StringEquality(assembler, kOneByteStringCid); |
2064 } | 2062 } |
2065 | 2063 |
2066 | 2064 |
2067 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 2065 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
2068 StringEquality(assembler, kTwoByteStringCid); | 2066 StringEquality(assembler, kTwoByteStringCid); |
2069 } | 2067 } |
2070 | 2068 |
2071 | |
2072 void Intrinsifier::JSRegExp_ExecuteMatch(Assembler* assembler) { | |
2073 if (FLAG_use_jscre) { | |
2074 return; | |
2075 } | |
2076 static const intptr_t kRegExpParamOffset = 2 * kWordSize; | |
2077 static const intptr_t kStringParamOffset = 1 * kWordSize; | |
2078 // start_index smi is located at 0. | |
2079 | |
2080 // Incoming registers: | |
2081 // T0: Function. (Will be reloaded with the specialized matcher function.) | |
2082 // S4: Arguments descriptor. (Will be preserved.) | |
2083 // S5: IC-Data. (Will be preserved.) | |
2084 | |
2085 // Load the specialized function pointer into T0. Leverage the fact the | |
2086 // string CIDs as well as stored function pointers are in sequence. | |
2087 __ lw(T1, Address(SP, kRegExpParamOffset)); | |
2088 __ lw(T3, Address(SP, kStringParamOffset)); | |
2089 __ LoadClassId(T2, T3); | |
2090 __ AddImmediate(T2, -kOneByteStringCid); | |
2091 __ sll(T2, T2, kWordSizeLog2); | |
2092 __ addu(T2, T2, T1); | |
2093 __ lw(T0, FieldAddress(T2, JSRegExp::function_offset(kOneByteStringCid))); | |
2094 | |
2095 // Registers are now set up for the lazy compile stub. It expects the function | |
2096 // in T0, the argument descriptor in S4, and IC-Data in S5. | |
2097 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; | |
2098 __ LoadObject(S4, Array::Handle(ArgumentsDescriptor::New(arg_count))); | |
2099 | |
2100 // Tail-call the function. | |
2101 __ lw(T3, FieldAddress(T0, Function::instructions_offset())); | |
2102 __ AddImmediate(T3, Instructions::HeaderSize() - kHeapObjectTag); | |
2103 __ jr(T3); | |
2104 } | |
2105 | |
2106 | |
2107 // On stack: user tag (+0). | 2069 // On stack: user tag (+0). |
2108 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { | 2070 void Intrinsifier::UserTag_makeCurrent(Assembler* assembler) { |
2109 // T1: Isolate. | 2071 // T1: Isolate. |
2110 Isolate* isolate = Isolate::Current(); | 2072 Isolate* isolate = Isolate::Current(); |
2111 __ LoadImmediate(T1, reinterpret_cast<uword>(isolate)); | 2073 __ LoadImmediate(T1, reinterpret_cast<uword>(isolate)); |
2112 // V0: Current user tag. | 2074 // V0: Current user tag. |
2113 __ lw(V0, Address(T1, Isolate::current_tag_offset())); | 2075 __ lw(V0, Address(T1, Isolate::current_tag_offset())); |
2114 // T2: UserTag. | 2076 // T2: UserTag. |
2115 __ lw(T2, Address(SP, + 0 * kWordSize)); | 2077 __ lw(T2, Address(SP, + 0 * kWordSize)); |
2116 // Set Isolate::current_tag_. | 2078 // Set Isolate::current_tag_. |
(...skipping 22 matching lines...) Expand all Loading... |
2139 Isolate* isolate = Isolate::Current(); | 2101 Isolate* isolate = Isolate::Current(); |
2140 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); | 2102 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); |
2141 // Set return value. | 2103 // Set return value. |
2142 __ Ret(); | 2104 __ Ret(); |
2143 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); | 2105 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); |
2144 } | 2106 } |
2145 | 2107 |
2146 } // namespace dart | 2108 } // namespace dart |
2147 | 2109 |
2148 #endif // defined TARGET_ARCH_MIPS | 2110 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |