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

Side by Side Diff: runtime/vm/intrinsifier_arm.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.cc ('k') | runtime/vm/intrinsifier_arm64.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) 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"
(...skipping 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after
2211 void Intrinsifier::OneByteString_equality(Assembler* assembler) { 2211 void Intrinsifier::OneByteString_equality(Assembler* assembler) {
2212 StringEquality(assembler, kOneByteStringCid); 2212 StringEquality(assembler, kOneByteStringCid);
2213 } 2213 }
2214 2214
2215 2215
2216 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { 2216 void Intrinsifier::TwoByteString_equality(Assembler* assembler) {
2217 StringEquality(assembler, kTwoByteStringCid); 2217 StringEquality(assembler, kTwoByteStringCid);
2218 } 2218 }
2219 2219
2220 2220
2221 void Intrinsifier::RegExp_ExecuteMatch(Assembler* assembler) { 2221 void Intrinsifier::IntrinsifyRegExpExecuteMatch(Assembler* assembler,
2222 bool sticky) {
2222 if (FLAG_interpret_irregexp) return; 2223 if (FLAG_interpret_irregexp) return;
2223 2224
2224 static const intptr_t kRegExpParamOffset = 2 * kWordSize; 2225 static const intptr_t kRegExpParamOffset = 2 * kWordSize;
2225 static const intptr_t kStringParamOffset = 1 * kWordSize; 2226 static const intptr_t kStringParamOffset = 1 * kWordSize;
2226 // start_index smi is located at offset 0. 2227 // start_index smi is located at offset 0.
2227 2228
2228 // Incoming registers: 2229 // Incoming registers:
2229 // R0: Function. (Will be reloaded with the specialized matcher function.) 2230 // R0: Function. (Will be reloaded with the specialized matcher function.)
2230 // R4: Arguments descriptor. (Will be preserved.) 2231 // R4: Arguments descriptor. (Will be preserved.)
2231 // R9: Unknown. (Must be GC safe on tail call.) 2232 // R9: Unknown. (Must be GC safe on tail call.)
2232 2233
2233 // Load the specialized function pointer into R0. Leverage the fact the 2234 // Load the specialized function pointer into R0. Leverage the fact the
2234 // string CIDs as well as stored function pointers are in sequence. 2235 // string CIDs as well as stored function pointers are in sequence.
2235 __ ldr(R2, Address(SP, kRegExpParamOffset)); 2236 __ ldr(R2, Address(SP, kRegExpParamOffset));
2236 __ ldr(R1, Address(SP, kStringParamOffset)); 2237 __ ldr(R1, Address(SP, kStringParamOffset));
2237 __ LoadClassId(R1, R1); 2238 __ LoadClassId(R1, R1);
2238 __ AddImmediate(R1, R1, -kOneByteStringCid); 2239 __ AddImmediate(R1, R1, -kOneByteStringCid);
2239 __ add(R1, R2, Operand(R1, LSL, kWordSizeLog2)); 2240 __ add(R1, R2, Operand(R1, LSL, kWordSizeLog2));
2240 __ ldr(R0, FieldAddress(R1, RegExp::function_offset(kOneByteStringCid))); 2241 __ ldr(R0,
2242 FieldAddress(R1, RegExp::function_offset(kOneByteStringCid, sticky)));
2241 2243
2242 // Registers are now set up for the lazy compile stub. It expects the function 2244 // Registers are now set up for the lazy compile stub. It expects the function
2243 // in R0, the argument descriptor in R4, and IC-Data in R9. 2245 // in R0, the argument descriptor in R4, and IC-Data in R9.
2244 __ eor(R9, R9, Operand(R9)); 2246 __ eor(R9, R9, Operand(R9));
2245 2247
2246 // Tail-call the function. 2248 // Tail-call the function.
2247 __ ldr(CODE_REG, FieldAddress(R0, Function::code_offset())); 2249 __ ldr(CODE_REG, FieldAddress(R0, Function::code_offset()));
2248 __ ldr(R1, FieldAddress(R0, Function::entry_point_offset())); 2250 __ ldr(R1, FieldAddress(R0, Function::entry_point_offset()));
2249 __ bx(R1); 2251 __ bx(R1);
2250 } 2252 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2294 __ ldr(R0, Address(R0, TimelineStream::enabled_offset())); 2296 __ ldr(R0, Address(R0, TimelineStream::enabled_offset()));
2295 __ cmp(R0, Operand(0)); 2297 __ cmp(R0, Operand(0));
2296 __ LoadObject(R0, Bool::True(), NE); 2298 __ LoadObject(R0, Bool::True(), NE);
2297 __ LoadObject(R0, Bool::False(), EQ); 2299 __ LoadObject(R0, Bool::False(), EQ);
2298 __ Ret(); 2300 __ Ret();
2299 } 2301 }
2300 2302
2301 } // namespace dart 2303 } // namespace dart
2302 2304
2303 #endif // defined TARGET_ARCH_ARM 2305 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier.cc ('k') | runtime/vm/intrinsifier_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698