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::IntrinsifyRegExpExecuteMatch(Assembler* assembler, |
| 2196 bool sticky) { |
2196 if (FLAG_interpret_irregexp) return; | 2197 if (FLAG_interpret_irregexp) return; |
2197 | 2198 |
2198 static const intptr_t kRegExpParamOffset = 3 * kWordSize; | 2199 static const intptr_t kRegExpParamOffset = 3 * kWordSize; |
2199 static const intptr_t kStringParamOffset = 2 * kWordSize; | 2200 static const intptr_t kStringParamOffset = 2 * kWordSize; |
2200 // start_index smi is located at offset 1. | 2201 // start_index smi is located at offset 1. |
2201 | 2202 |
2202 // Incoming registers: | 2203 // Incoming registers: |
2203 // RAX: Function. (Will be loaded with the specialized matcher function.) | 2204 // RAX: Function. (Will be loaded with the specialized matcher function.) |
2204 // RCX: Unknown. (Must be GC safe on tail call.) | 2205 // RCX: Unknown. (Must be GC safe on tail call.) |
2205 // R10: Arguments descriptor. (Will be preserved.) | 2206 // R10: Arguments descriptor. (Will be preserved.) |
2206 | 2207 |
2207 // Load the specialized function pointer into RAX. Leverage the fact the | 2208 // Load the specialized function pointer into RAX. Leverage the fact the |
2208 // string CIDs as well as stored function pointers are in sequence. | 2209 // string CIDs as well as stored function pointers are in sequence. |
2209 __ movq(RBX, Address(RSP, kRegExpParamOffset)); | 2210 __ movq(RBX, Address(RSP, kRegExpParamOffset)); |
2210 __ movq(RDI, Address(RSP, kStringParamOffset)); | 2211 __ movq(RDI, Address(RSP, kStringParamOffset)); |
2211 __ LoadClassId(RDI, RDI); | 2212 __ LoadClassId(RDI, RDI); |
2212 __ SubImmediate(RDI, Immediate(kOneByteStringCid)); | 2213 __ SubImmediate(RDI, Immediate(kOneByteStringCid)); |
2213 __ movq(RAX, FieldAddress(RBX, RDI, TIMES_8, | 2214 __ movq(RAX, FieldAddress(RBX, RDI, TIMES_8, RegExp::function_offset( |
2214 RegExp::function_offset(kOneByteStringCid))); | 2215 kOneByteStringCid, sticky))); |
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. |
2218 __ xorq(RCX, RCX); | 2219 __ xorq(RCX, RCX); |
2219 | 2220 |
2220 // Tail-call the function. | 2221 // Tail-call the function. |
2221 __ movq(CODE_REG, FieldAddress(RAX, Function::code_offset())); | 2222 __ movq(CODE_REG, FieldAddress(RAX, Function::code_offset())); |
2222 __ movq(RDI, FieldAddress(RAX, Function::entry_point_offset())); | 2223 __ movq(RDI, FieldAddress(RAX, Function::entry_point_offset())); |
2223 __ jmp(RDI); | 2224 __ jmp(RDI); |
2224 } | 2225 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2276 __ Bind(&true_label); | 2277 __ Bind(&true_label); |
2277 __ LoadObject(RAX, Bool::True()); | 2278 __ LoadObject(RAX, Bool::True()); |
2278 __ ret(); | 2279 __ ret(); |
2279 } | 2280 } |
2280 | 2281 |
2281 #undef __ | 2282 #undef __ |
2282 | 2283 |
2283 } // namespace dart | 2284 } // namespace dart |
2284 | 2285 |
2285 #endif // defined TARGET_ARCH_X64 | 2286 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |