Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: runtime/vm/intrinsifier_arm64.cc

Issue 2510783002: VM: Optimize RegExp.matchAsPrefix(...) by generating a sticky RegExp specialization. (Closed)
Patch Set: Done Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/intrinsifier_arm.cc ('k') | runtime/vm/intrinsifier_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after
2277 void Intrinsifier::OneByteString_equality(Assembler* assembler) { 2277 void Intrinsifier::OneByteString_equality(Assembler* assembler) {
2278 StringEquality(assembler, kOneByteStringCid); 2278 StringEquality(assembler, kOneByteStringCid);
2279 } 2279 }
2280 2280
2281 2281
2282 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { 2282 void Intrinsifier::TwoByteString_equality(Assembler* assembler) {
2283 StringEquality(assembler, kTwoByteStringCid); 2283 StringEquality(assembler, kTwoByteStringCid);
2284 } 2284 }
2285 2285
2286 2286
2287 void Intrinsifier::RegExp_ExecuteMatch(Assembler* assembler) { 2287 void Intrinsifier::IntrinsifyRegExpExecuteMatch(Assembler* assembler,
2288 bool sticky) {
2288 if (FLAG_interpret_irregexp) return; 2289 if (FLAG_interpret_irregexp) return;
2289 2290
2290 static const intptr_t kRegExpParamOffset = 2 * kWordSize; 2291 static const intptr_t kRegExpParamOffset = 2 * kWordSize;
2291 static const intptr_t kStringParamOffset = 1 * kWordSize; 2292 static const intptr_t kStringParamOffset = 1 * kWordSize;
2292 // start_index smi is located at offset 0. 2293 // start_index smi is located at offset 0.
2293 2294
2294 // Incoming registers: 2295 // Incoming registers:
2295 // R0: Function. (Will be reloaded with the specialized matcher function.) 2296 // R0: Function. (Will be reloaded with the specialized matcher function.)
2296 // R4: Arguments descriptor. (Will be preserved.) 2297 // R4: Arguments descriptor. (Will be preserved.)
2297 // R5: Unknown. (Must be GC safe on tail call.) 2298 // R5: Unknown. (Must be GC safe on tail call.)
2298 2299
2299 // Load the specialized function pointer into R0. Leverage the fact the 2300 // Load the specialized function pointer into R0. Leverage the fact the
2300 // string CIDs as well as stored function pointers are in sequence. 2301 // string CIDs as well as stored function pointers are in sequence.
2301 __ ldr(R2, Address(SP, kRegExpParamOffset)); 2302 __ ldr(R2, Address(SP, kRegExpParamOffset));
2302 __ ldr(R1, Address(SP, kStringParamOffset)); 2303 __ ldr(R1, Address(SP, kStringParamOffset));
2303 __ LoadClassId(R1, R1); 2304 __ LoadClassId(R1, R1);
2304 __ AddImmediate(R1, R1, -kOneByteStringCid); 2305 __ AddImmediate(R1, R1, -kOneByteStringCid);
2305 __ add(R1, R2, Operand(R1, LSL, kWordSizeLog2)); 2306 __ add(R1, R2, Operand(R1, LSL, kWordSizeLog2));
2306 __ ldr(R0, FieldAddress(R1, RegExp::function_offset(kOneByteStringCid))); 2307 __ ldr(R0,
2308 FieldAddress(R1, RegExp::function_offset(kOneByteStringCid, sticky)));
2307 2309
2308 // Registers are now set up for the lazy compile stub. It expects the function 2310 // Registers are now set up for the lazy compile stub. It expects the function
2309 // in R0, the argument descriptor in R4, and IC-Data in R5. 2311 // in R0, the argument descriptor in R4, and IC-Data in R5.
2310 __ eor(R5, R5, Operand(R5)); 2312 __ eor(R5, R5, Operand(R5));
2311 2313
2312 // Tail-call the function. 2314 // Tail-call the function.
2313 __ ldr(CODE_REG, FieldAddress(R0, Function::code_offset())); 2315 __ ldr(CODE_REG, FieldAddress(R0, Function::code_offset()));
2314 __ ldr(R1, FieldAddress(R0, Function::entry_point_offset())); 2316 __ ldr(R1, FieldAddress(R0, Function::entry_point_offset()));
2315 __ br(R1); 2317 __ br(R1);
2316 } 2318 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2361 __ cmp(R0, Operand(0)); 2363 __ cmp(R0, Operand(0));
2362 __ LoadObject(R0, Bool::False()); 2364 __ LoadObject(R0, Bool::False());
2363 __ LoadObject(TMP, Bool::True()); 2365 __ LoadObject(TMP, Bool::True());
2364 __ csel(R0, TMP, R0, NE); 2366 __ csel(R0, TMP, R0, NE);
2365 __ ret(); 2367 __ ret();
2366 } 2368 }
2367 2369
2368 } // namespace dart 2370 } // namespace dart
2369 2371
2370 #endif // defined TARGET_ARCH_ARM64 2372 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_arm.cc ('k') | runtime/vm/intrinsifier_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698