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

Unified Diff: src/objects.h

Issue 8104: Regexp caching (Closed)
Patch Set: Created 12 years, 2 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
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index c490831df880ca53dd9f5ed0ffac53fec9c337bb..60b451a8742bdd0804b5c648ba691d68995da16d 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -1859,7 +1859,9 @@ class CompilationCacheTable: public HashTable<0, 2> {
public:
// Find cached value for a string key, otherwise return null.
Object* Lookup(String* src);
+ Object* LookupRegExp(String* source, int flags);
Kasper Lund 2008/10/24 06:42:50 source -> src for consistency... or change src ->
Object* Put(String* src, Object* value);
+ Object* PutRegExp(String* src, int flags, FixedArray* value);
static inline CompilationCacheTable* cast(Object* obj);
@@ -2910,14 +2912,14 @@ class JSValue: public JSObject {
// Regular expressions
class JSRegExp: public JSObject {
public:
- enum Type { JSCRE, ATOM };
+ enum Type { NOT_COMPILED, JSCRE, ATOM };
+ enum Flag { NONE = 0, GLOBAL = 1, IGNORE_CASE = 2, MULTILINE = 4 };
- inline Type type_tag();
- inline void set_type_tag(Type value);
-
- DECL_ACCESSORS(type, Object)
DECL_ACCESSORS(data, Object)
+ inline Type TypeTag();
+ inline Object* DataAt(int index);
+
static inline JSRegExp* cast(Object* obj);
// Dispatched behavior.
@@ -2926,9 +2928,17 @@ class JSRegExp: public JSObject {
void JSRegExpVerify();
#endif
- static const int kTypeOffset = JSObject::kHeaderSize;
- static const int kDataOffset = kTypeOffset + kIntSize;
+ static const int kDataOffset = JSObject::kHeaderSize;
static const int kSize = kDataOffset + kIntSize;
+
+ static const int kTagIndex = 0;
+ static const int kSourceIndex = kTagIndex + 1;
+ static const int kFlagsIndex = kSourceIndex + 1;
+ // These two are the same since the same entry is shared for
+ // different purposes in different types of regexps.
+ static const int kAtomPatternIndex = kFlagsIndex + 1;
+ static const int kJscreDataIndex = kFlagsIndex + 1;
+ static const int kDataSize = kAtomPatternIndex + 1;
};

Powered by Google App Engine
This is Rietveld 408576698