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

Side by Side Diff: runtime/vm/regexp_assembler_ir.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/regexp_assembler_ir.h ('k') | tests/corelib/regexp/regexp_test.dart » ('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/regexp_assembler_ir.h" 5 #include "vm/regexp_assembler_ir.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 static const bool kEnableUnalignedAccesses = true; 310 static const bool kEnableUnalignedAccesses = true;
311 #endif 311 #endif
312 bool IRRegExpMacroAssembler::CanReadUnaligned() { 312 bool IRRegExpMacroAssembler::CanReadUnaligned() {
313 return kEnableUnalignedAccesses && !slow_safe(); 313 return kEnableUnalignedAccesses && !slow_safe();
314 } 314 }
315 315
316 316
317 RawArray* IRRegExpMacroAssembler::Execute(const RegExp& regexp, 317 RawArray* IRRegExpMacroAssembler::Execute(const RegExp& regexp,
318 const String& input, 318 const String& input,
319 const Smi& start_offset, 319 const Smi& start_offset,
320 bool sticky,
320 Zone* zone) { 321 Zone* zone) {
321 const intptr_t cid = input.GetClassId(); 322 const intptr_t cid = input.GetClassId();
322 const Function& fun = Function::Handle(regexp.function(cid)); 323 const Function& fun = Function::Handle(regexp.function(cid, sticky));
323 ASSERT(!fun.IsNull()); 324 ASSERT(!fun.IsNull());
324 // Create the argument list. 325 // Create the argument list.
325 const Array& args = 326 const Array& args =
326 Array::Handle(Array::New(RegExpMacroAssembler::kParamCount)); 327 Array::Handle(Array::New(RegExpMacroAssembler::kParamCount));
327 args.SetAt(RegExpMacroAssembler::kParamRegExpIndex, regexp); 328 args.SetAt(RegExpMacroAssembler::kParamRegExpIndex, regexp);
328 args.SetAt(RegExpMacroAssembler::kParamStringIndex, input); 329 args.SetAt(RegExpMacroAssembler::kParamStringIndex, input);
329 args.SetAt(RegExpMacroAssembler::kParamStartOffsetIndex, start_offset); 330 args.SetAt(RegExpMacroAssembler::kParamStartOffsetIndex, start_offset);
330 331
331 // And finally call the generated code. 332 // And finally call the generated code.
332 333
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1842 1843
1843 return Bind(new (Z) LoadCodeUnitsInstr(pattern_val, index_val, characters, 1844 return Bind(new (Z) LoadCodeUnitsInstr(pattern_val, index_val, characters,
1844 specialization_cid_, 1845 specialization_cid_,
1845 TokenPosition::kNoSource)); 1846 TokenPosition::kNoSource));
1846 } 1847 }
1847 1848
1848 1849
1849 #undef __ 1850 #undef __
1850 1851
1851 } // namespace dart 1852 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/regexp_assembler_ir.h ('k') | tests/corelib/regexp/regexp_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698