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

Unified Diff: runtime/vm/raw_object_snapshot.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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/raw_object_snapshot.cc
diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
index aebda455c32d238e3cc9740d2de013af9e600db3..cc90d0b812e24b70c8a775c15a2f48ef67813ed4 100644
--- a/runtime/vm/raw_object_snapshot.cc
+++ b/runtime/vm/raw_object_snapshot.cc
@@ -2896,14 +2896,11 @@ RawRegExp* RegExp::ReadFrom(SnapshotReader* reader,
// TODO(18854): Need to implement a way of recreating the irrexp functions.
rmacnak 2016/11/17 00:49:52 Remove this todo.
Vyacheslav Egorov (Google) 2016/11/17 16:51:33 Done.
const Function& no_function = Function::Handle(reader->zone());
- regex.set_function(kOneByteStringCid, no_function);
- regex.set_function(kTwoByteStringCid, no_function);
- regex.set_function(kExternalOneByteStringCid, no_function);
- regex.set_function(kExternalTwoByteStringCid, no_function);
-
- const TypedData& no_bytecode = TypedData::Handle(reader->zone());
- regex.set_bytecode(true, no_bytecode);
- regex.set_bytecode(false, no_bytecode);
+ for (intptr_t cid = kOneByteStringCid; cid <= kExternalTwoByteStringCid;
erikcorry 2016/11/17 13:56:17 Here and elsewhere you put in a loop. Perhaps ther
Vyacheslav Egorov (Google) 2016/11/17 16:51:33 Yeah, that sounds like a nice improvement - but I
+ cid++) {
+ regex.set_function(cid, /*sticky=*/false, no_function);
+ regex.set_function(cid, /*sticky=*/true, no_function);
+ }
return regex.raw();
}

Powered by Google App Engine
This is Rietveld 408576698