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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/intrinsifier.h" | 8 #include "vm/intrinsifier.h" |
9 | 9 |
10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
(...skipping 2174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2185 void Intrinsifier::OneByteString_equality(Assembler* assembler) { | 2185 void Intrinsifier::OneByteString_equality(Assembler* assembler) { |
2186 StringEquality(assembler, kOneByteStringCid); | 2186 StringEquality(assembler, kOneByteStringCid); |
2187 } | 2187 } |
2188 | 2188 |
2189 | 2189 |
2190 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { | 2190 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { |
2191 StringEquality(assembler, kTwoByteStringCid); | 2191 StringEquality(assembler, kTwoByteStringCid); |
2192 } | 2192 } |
2193 | 2193 |
2194 | 2194 |
2195 void Intrinsifier::RegExp_ExecuteMatch(Assembler* assembler) { | 2195 void Intrinsifier::RegExp_ExecuteMatch(Assembler* assembler) { |
erikcorry
2016/11/17 13:56:17
Can't RegExp_ExecuteMatch and RegExp_ExecuteMatchS
Vyacheslav Egorov (Google)
2016/11/17 16:51:33
In this case code below would have to check for bo
| |
2196 if (FLAG_interpret_irregexp) return; | 2196 if (FLAG_interpret_irregexp || FLAG_precompiled_runtime) return; |
rmacnak
2016/11/17 00:49:52
Why add this? FLAG_interpret_irregexp should alrea
Vyacheslav Egorov (Google)
2016/11/17 16:51:33
There was a code somewhere that checked both so I
| |
2197 | 2197 |
2198 static const intptr_t kRegExpParamOffset = 3 * kWordSize; | 2198 static const intptr_t kRegExpParamOffset = 3 * kWordSize; |
2199 static const intptr_t kStringParamOffset = 2 * kWordSize; | 2199 static const intptr_t kStringParamOffset = 2 * kWordSize; |
2200 // start_index smi is located at offset 1. | 2200 // start_index smi is located at offset 1. |
2201 | 2201 |
2202 // Incoming registers: | 2202 // Incoming registers: |
2203 // RAX: Function. (Will be loaded with the specialized matcher function.) | 2203 // RAX: Function. (Will be loaded with the specialized matcher function.) |
2204 // RCX: Unknown. (Must be GC safe on tail call.) | 2204 // RCX: Unknown. (Must be GC safe on tail call.) |
2205 // R10: Arguments descriptor. (Will be preserved.) | 2205 // R10: Arguments descriptor. (Will be preserved.) |
2206 | 2206 |
2207 // Load the specialized function pointer into RAX. Leverage the fact the | 2207 // Load the specialized function pointer into RAX. Leverage the fact the |
2208 // string CIDs as well as stored function pointers are in sequence. | 2208 // string CIDs as well as stored function pointers are in sequence. |
2209 __ movq(RBX, Address(RSP, kRegExpParamOffset)); | 2209 __ movq(RBX, Address(RSP, kRegExpParamOffset)); |
2210 __ movq(RDI, Address(RSP, kStringParamOffset)); | 2210 __ movq(RDI, Address(RSP, kStringParamOffset)); |
2211 __ LoadClassId(RDI, RDI); | 2211 __ LoadClassId(RDI, RDI); |
2212 __ SubImmediate(RDI, Immediate(kOneByteStringCid)); | 2212 __ SubImmediate(RDI, Immediate(kOneByteStringCid)); |
2213 __ movq(RAX, FieldAddress(RBX, RDI, TIMES_8, | 2213 __ movq(RAX, FieldAddress(RBX, RDI, TIMES_8, |
2214 RegExp::function_offset(kOneByteStringCid))); | 2214 RegExp::function_offset(kOneByteStringCid, |
2215 /*sticky=*/false))); | |
2215 | 2216 |
2216 // Registers are now set up for the lazy compile stub. It expects the function | 2217 // Registers are now set up for the lazy compile stub. It expects the function |
2217 // in RAX, the argument descriptor in R10, and IC-Data in RCX. | 2218 // in RAX, the argument descriptor in R10, and IC-Data in RCX. |
2219 __ xorq(RCX, RCX); | |
2220 | |
2221 // Tail-call the function. | |
2222 __ movq(CODE_REG, FieldAddress(RAX, Function::code_offset())); | |
2223 __ movq(RDI, FieldAddress(RAX, Function::entry_point_offset())); | |
2224 __ jmp(RDI); | |
2225 } | |
2226 | |
2227 | |
2228 void Intrinsifier::RegExp_ExecuteMatchSticky(Assembler* assembler) { | |
2229 if (FLAG_interpret_irregexp || FLAG_precompiled_runtime) return; | |
2230 | |
2231 static const intptr_t kRegExpParamOffset = 3 * kWordSize; | |
2232 static const intptr_t kStringParamOffset = 2 * kWordSize; | |
2233 // start_index smi is located at offset 1. | |
2234 | |
2235 // Incoming registers: | |
2236 // RAX: Function. (Will be loaded with the specialized matcher function.) | |
2237 // RCX: Unknown. (Must be GC safe on tail call.) | |
2238 // R10: Arguments descriptor. (Will be preserved.) | |
2239 | |
2240 // Load the specialized function pointer into RAX. Leverage the fact the | |
2241 // string CIDs as well as stored function pointers are in sequence. | |
2242 __ movq(RBX, Address(RSP, kRegExpParamOffset)); | |
2243 __ movq(RDI, Address(RSP, kStringParamOffset)); | |
2244 __ LoadClassId(RDI, RDI); | |
2245 __ SubImmediate(RDI, Immediate(kOneByteStringCid)); | |
2246 __ movq(RAX, FieldAddress(RBX, RDI, TIMES_8, | |
2247 RegExp::function_offset(kOneByteStringCid, | |
2248 /*sticky=*/true))); | |
2249 | |
2250 // Registers are now set up for the lazy compile stub. It expects the function | |
2251 // in RAX, the argument descriptor in R10, and IC-Data in RCX. | |
2218 __ xorq(RCX, RCX); | 2252 __ xorq(RCX, RCX); |
2219 | 2253 |
2220 // Tail-call the function. | 2254 // Tail-call the function. |
2221 __ movq(CODE_REG, FieldAddress(RAX, Function::code_offset())); | 2255 __ movq(CODE_REG, FieldAddress(RAX, Function::code_offset())); |
2222 __ movq(RDI, FieldAddress(RAX, Function::entry_point_offset())); | 2256 __ movq(RDI, FieldAddress(RAX, Function::entry_point_offset())); |
2223 __ jmp(RDI); | 2257 __ jmp(RDI); |
2224 } | 2258 } |
2225 | 2259 |
2226 | 2260 |
2227 // On stack: user tag (+1), return-address (+0). | 2261 // On stack: user tag (+1), return-address (+0). |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2276 __ Bind(&true_label); | 2310 __ Bind(&true_label); |
2277 __ LoadObject(RAX, Bool::True()); | 2311 __ LoadObject(RAX, Bool::True()); |
2278 __ ret(); | 2312 __ ret(); |
2279 } | 2313 } |
2280 | 2314 |
2281 #undef __ | 2315 #undef __ |
2282 | 2316 |
2283 } // namespace dart | 2317 } // namespace dart |
2284 | 2318 |
2285 #endif // defined TARGET_ARCH_X64 | 2319 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |