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

Unified Diff: src/jsregexp.cc

Issue 719403005: One instead of two runtime calls when initializing regexp. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comments Created 6 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 | « src/jsregexp.h ('k') | src/regexp.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/jsregexp.cc
diff --git a/src/jsregexp.cc b/src/jsregexp.cc
index d078d07d5e6af408bd42d48e1faab8bc77619379..a9fdc570822df13c8d272cbbf4f2dd2fa306bdfa 100644
--- a/src/jsregexp.cc
+++ b/src/jsregexp.cc
@@ -58,28 +58,6 @@ MaybeHandle<Object> RegExpImpl::CreateRegExpLiteral(
}
-static JSRegExp::Flags RegExpFlagsFromString(Handle<String> str) {
- int flags = JSRegExp::NONE;
- for (int i = 0; i < str->length(); i++) {
- switch (str->Get(i)) {
- case 'i':
- flags |= JSRegExp::IGNORE_CASE;
- break;
- case 'g':
- flags |= JSRegExp::GLOBAL;
- break;
- case 'm':
- flags |= JSRegExp::MULTILINE;
- break;
- case 'y':
- if (FLAG_harmony_regexps) flags |= JSRegExp::STICKY;
- break;
- }
- }
- return JSRegExp::Flags(flags);
-}
-
-
MUST_USE_RESULT
static inline MaybeHandle<Object> ThrowRegExpException(
Handle<JSRegExp> re,
@@ -156,10 +134,9 @@ static bool HasFewDifferentCharacters(Handle<String> pattern) {
MaybeHandle<Object> RegExpImpl::Compile(Handle<JSRegExp> re,
Handle<String> pattern,
- Handle<String> flag_str) {
+ JSRegExp::Flags flags) {
Isolate* isolate = re->GetIsolate();
Zone zone(isolate);
- JSRegExp::Flags flags = RegExpFlagsFromString(flag_str);
CompilationCache* compilation_cache = isolate->compilation_cache();
MaybeHandle<FixedArray> maybe_cached =
compilation_cache->LookupRegExp(pattern, flags);
« no previous file with comments | « src/jsregexp.h ('k') | src/regexp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698