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

Unified Diff: src/jsregexp.h

Issue 42115: Faster string.replace with regexp pattern. (Closed)
Patch Set: Addressed review comments Created 11 years, 9 months 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 | « no previous file | src/jsregexp.cc » ('j') | src/runtime.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/jsregexp.h
diff --git a/src/jsregexp.h b/src/jsregexp.h
index bb28f06a98c17904987c3a57898cf2419556a665..145cb26f2e386b4e984bd10e20e0b34b08b7cb47 100644
--- a/src/jsregexp.h
+++ b/src/jsregexp.h
@@ -36,6 +36,13 @@ class RegExpMacroAssembler;
class RegExpImpl {
public:
+ static inline bool UseNativeRegexp() {
+#ifdef ARM
+ return false;
+#else
+ return FLAG_regexp_native;
+#endif
+ }
// Creates a regular expression literal in the old space.
// This function calls the garbage collector if necessary.
static Handle<Object> CreateRegExpLiteral(Handle<JSFunction> constructor,
@@ -117,6 +124,7 @@ class RegExpImpl {
static const int kFirstCapture = 1;
static const int kLastMatchOverhead = 3;
+ // Used to access the lastMatchInfo array.
static int GetCapture(FixedArray* array, int index) {
return Smi::cast(array->get(index + kFirstCapture))->value();
}
@@ -139,12 +147,11 @@ class RegExpImpl {
array->set(index + kFirstCapture, Smi::FromInt(to));
}
- private:
- static String* last_ascii_string_;
- static String* two_byte_cached_string_;
-
- static bool EnsureCompiledIrregexp(Handle<JSRegExp> re, bool is_ascii);
+ static int GetLastCaptureCount(FixedArray* array) {
+ return Smi::cast(array->get(kLastCaptureCount))->value();
+ }
+ // For acting on the JSRegExp data FixedArray.
static int IrregexpMaxRegisterCount(FixedArray* re);
static void SetIrregexpMaxRegisterCount(FixedArray* re, int value);
static int IrregexpNumberOfCaptures(FixedArray* re);
@@ -152,6 +159,13 @@ class RegExpImpl {
static ByteArray* IrregexpByteCode(FixedArray* re, bool is_ascii);
static Code* IrregexpNativeCode(FixedArray* re, bool is_ascii);
+ private:
+ static String* last_ascii_string_;
+ static String* two_byte_cached_string_;
+
+ static bool EnsureCompiledIrregexp(Handle<JSRegExp> re, bool is_ascii);
+
+
// On a successful match, the result is a JSArray containing
// captured positions. On a failure, the result is the null value.
// Returns an empty handle in case of an exception.
@@ -171,10 +185,6 @@ class RegExpImpl {
int character_position,
int utf8_position);
- // Used to access the lastMatchInfo array.
- static int GetLastCaptureCount(FixedArray* array) {
- return Smi::cast(array->get(kLastCaptureCount))->value();
- }
// A one element cache of the last utf8_subject string and its length. The
// subject JS String object is cached in the heap. We also cache a
// translation between position and utf8 position.
« no previous file with comments | « no previous file | src/jsregexp.cc » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698