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

Side by Side Diff: runtime/vm/intrinsifier_ia32.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_arm64.cc ('k') | runtime/vm/intrinsifier_mips.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 // The intrinsic code below is executed before a method has built its frame. 5 // The intrinsic code below is executed before a method has built its frame.
6 // The return address is on the stack and the arguments below it. 6 // The return address is on the stack and the arguments below it.
7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved.
8 // Each intrinsification method returns true if the corresponding 8 // Each intrinsification method returns true if the corresponding
9 // Dart method was intrinsified. 9 // Dart method was intrinsified.
10 10
(...skipping 2212 matching lines...) Expand 10 before | Expand all | Expand 10 after
2223 void Intrinsifier::OneByteString_equality(Assembler* assembler) { 2223 void Intrinsifier::OneByteString_equality(Assembler* assembler) {
2224 StringEquality(assembler, kOneByteStringCid); 2224 StringEquality(assembler, kOneByteStringCid);
2225 } 2225 }
2226 2226
2227 2227
2228 void Intrinsifier::TwoByteString_equality(Assembler* assembler) { 2228 void Intrinsifier::TwoByteString_equality(Assembler* assembler) {
2229 StringEquality(assembler, kTwoByteStringCid); 2229 StringEquality(assembler, kTwoByteStringCid);
2230 } 2230 }
2231 2231
2232 2232
2233 void Intrinsifier::RegExp_ExecuteMatch(Assembler* assembler) { 2233 void Intrinsifier::IntrinsifyRegExpExecuteMatch(Assembler* assembler,
2234 bool sticky) {
2234 if (FLAG_interpret_irregexp) return; 2235 if (FLAG_interpret_irregexp) return;
2235 2236
2236 static const intptr_t kRegExpParamOffset = 3 * kWordSize; 2237 static const intptr_t kRegExpParamOffset = 3 * kWordSize;
2237 static const intptr_t kStringParamOffset = 2 * kWordSize; 2238 static const intptr_t kStringParamOffset = 2 * kWordSize;
2238 // start_index smi is located at offset 1. 2239 // start_index smi is located at offset 1.
2239 2240
2240 // Incoming registers: 2241 // Incoming registers:
2241 // EAX: Function. (Will be loaded with the specialized matcher function.) 2242 // EAX: Function. (Will be loaded with the specialized matcher function.)
2242 // ECX: Unknown. (Must be GC safe on tail call.) 2243 // ECX: Unknown. (Must be GC safe on tail call.)
2243 // EDX: Arguments descriptor. (Will be preserved.) 2244 // EDX: Arguments descriptor. (Will be preserved.)
2244 2245
2245 // Load the specialized function pointer into EAX. Leverage the fact the 2246 // Load the specialized function pointer into EAX. Leverage the fact the
2246 // string CIDs as well as stored function pointers are in sequence. 2247 // string CIDs as well as stored function pointers are in sequence.
2247 __ movl(EBX, Address(ESP, kRegExpParamOffset)); 2248 __ movl(EBX, Address(ESP, kRegExpParamOffset));
2248 __ movl(EDI, Address(ESP, kStringParamOffset)); 2249 __ movl(EDI, Address(ESP, kStringParamOffset));
2249 __ LoadClassId(EDI, EDI); 2250 __ LoadClassId(EDI, EDI);
2250 __ SubImmediate(EDI, Immediate(kOneByteStringCid)); 2251 __ SubImmediate(EDI, Immediate(kOneByteStringCid));
2251 __ movl(EAX, FieldAddress(EBX, EDI, TIMES_4, 2252 __ movl(EAX, FieldAddress(EBX, EDI, TIMES_4, RegExp::function_offset(
2252 RegExp::function_offset(kOneByteStringCid))); 2253 kOneByteStringCid, sticky)));
2253 2254
2254 // Registers are now set up for the lazy compile stub. It expects the function 2255 // Registers are now set up for the lazy compile stub. It expects the function
2255 // in EAX, the argument descriptor in EDX, and IC-Data in ECX. 2256 // in EAX, the argument descriptor in EDX, and IC-Data in ECX.
2256 __ xorl(ECX, ECX); 2257 __ xorl(ECX, ECX);
2257 2258
2258 // Tail-call the function. 2259 // Tail-call the function.
2259 __ movl(EDI, FieldAddress(EAX, Function::entry_point_offset())); 2260 __ movl(EDI, FieldAddress(EAX, Function::entry_point_offset()));
2260 __ jmp(EDI); 2261 __ jmp(EDI);
2261 } 2262 }
2262 2263
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2313 __ Bind(&true_label); 2314 __ Bind(&true_label);
2314 __ LoadObject(EAX, Bool::True()); 2315 __ LoadObject(EAX, Bool::True());
2315 __ ret(); 2316 __ ret();
2316 } 2317 }
2317 2318
2318 #undef __ 2319 #undef __
2319 2320
2320 } // namespace dart 2321 } // namespace dart
2321 2322
2322 #endif // defined TARGET_ARCH_IA32 2323 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_arm64.cc ('k') | runtime/vm/intrinsifier_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698