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

Unified Diff: runtime/lib/regexp_patch.dart

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/regexp.cc ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/regexp_patch.dart
diff --git a/runtime/lib/regexp_patch.dart b/runtime/lib/regexp_patch.dart
index a9ccd55527ec503550ee2969c974b6a4d04c68fc..0c9320452470020883d21daa3fb73dcd1c878300 100644
--- a/runtime/lib/regexp_patch.dart
+++ b/runtime/lib/regexp_patch.dart
@@ -160,11 +160,8 @@ class _RegExp implements RegExp {
if (start < 0 || start > string.length) {
throw new RangeError.range(start, 0, string.length);
}
- // Inefficient check that searches for a later match too.
- // Change this when possible.
- List<int> list = _ExecuteMatch(string, start);
+ List<int> list = _ExecuteMatchSticky(string, start);
if (list == null) return null;
- if (list[0] != start) return null;
return new _RegExpMatch(this, string, list);
}
@@ -238,6 +235,9 @@ class _RegExp implements RegExp {
List _ExecuteMatch(String str, int start_index)
native "RegExp_ExecuteMatch";
+
+ List _ExecuteMatchSticky(String str, int start_index)
+ native "RegExp_ExecuteMatchSticky";
}
class _AllMatchesIterable extends IterableBase<Match> {
« no previous file with comments | « runtime/lib/regexp.cc ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698