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

Side by Side Diff: src/objects.h

Issue 8104: Regexp caching (Closed)
Patch Set: Created 12 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 unified diff | Download patch
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after
1852 Object* LookupKey(HashTableKey* key, Object** s); 1852 Object* LookupKey(HashTableKey* key, Object** s);
1853 1853
1854 DISALLOW_IMPLICIT_CONSTRUCTORS(SymbolTable); 1854 DISALLOW_IMPLICIT_CONSTRUCTORS(SymbolTable);
1855 }; 1855 };
1856 1856
1857 1857
1858 class CompilationCacheTable: public HashTable<0, 2> { 1858 class CompilationCacheTable: public HashTable<0, 2> {
1859 public: 1859 public:
1860 // Find cached value for a string key, otherwise return null. 1860 // Find cached value for a string key, otherwise return null.
1861 Object* Lookup(String* src); 1861 Object* Lookup(String* src);
1862 Object* LookupRegExp(String* source, int flags);
Kasper Lund 2008/10/24 06:42:50 source -> src for consistency... or change src ->
1862 Object* Put(String* src, Object* value); 1863 Object* Put(String* src, Object* value);
1864 Object* PutRegExp(String* src, int flags, FixedArray* value);
1863 1865
1864 static inline CompilationCacheTable* cast(Object* obj); 1866 static inline CompilationCacheTable* cast(Object* obj);
1865 1867
1866 private: 1868 private:
1867 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable); 1869 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable);
1868 }; 1870 };
1869 1871
1870 1872
1871 // MapCache. 1873 // MapCache.
1872 // 1874 //
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after
2903 static const int kSize = kValueOffset + kPointerSize; 2905 static const int kSize = kValueOffset + kPointerSize;
2904 2906
2905 private: 2907 private:
2906 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); 2908 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue);
2907 }; 2909 };
2908 2910
2909 2911
2910 // Regular expressions 2912 // Regular expressions
2911 class JSRegExp: public JSObject { 2913 class JSRegExp: public JSObject {
2912 public: 2914 public:
2913 enum Type { JSCRE, ATOM }; 2915 enum Type { NOT_COMPILED, JSCRE, ATOM };
2916 enum Flag { NONE = 0, GLOBAL = 1, IGNORE_CASE = 2, MULTILINE = 4 };
2914 2917
2915 inline Type type_tag(); 2918 DECL_ACCESSORS(data, Object)
2916 inline void set_type_tag(Type value);
2917 2919
2918 DECL_ACCESSORS(type, Object) 2920 inline Type TypeTag();
2919 DECL_ACCESSORS(data, Object) 2921 inline Object* DataAt(int index);
2920 2922
2921 static inline JSRegExp* cast(Object* obj); 2923 static inline JSRegExp* cast(Object* obj);
2922 2924
2923 // Dispatched behavior. 2925 // Dispatched behavior.
2924 #ifdef DEBUG 2926 #ifdef DEBUG
2925 void JSRegExpPrint(); 2927 void JSRegExpPrint();
2926 void JSRegExpVerify(); 2928 void JSRegExpVerify();
2927 #endif 2929 #endif
2928 2930
2929 static const int kTypeOffset = JSObject::kHeaderSize; 2931 static const int kDataOffset = JSObject::kHeaderSize;
2930 static const int kDataOffset = kTypeOffset + kIntSize;
2931 static const int kSize = kDataOffset + kIntSize; 2932 static const int kSize = kDataOffset + kIntSize;
2933
2934 static const int kTagIndex = 0;
2935 static const int kSourceIndex = kTagIndex + 1;
2936 static const int kFlagsIndex = kSourceIndex + 1;
2937 // These two are the same since the same entry is shared for
2938 // different purposes in different types of regexps.
2939 static const int kAtomPatternIndex = kFlagsIndex + 1;
2940 static const int kJscreDataIndex = kFlagsIndex + 1;
2941 static const int kDataSize = kAtomPatternIndex + 1;
2932 }; 2942 };
2933 2943
2934 2944
2935 enum AllowNullsFlag {ALLOW_NULLS, DISALLOW_NULLS}; 2945 enum AllowNullsFlag {ALLOW_NULLS, DISALLOW_NULLS};
2936 enum RobustnessFlag {ROBUST_STRING_TRAVERSAL, FAST_STRING_TRAVERSAL}; 2946 enum RobustnessFlag {ROBUST_STRING_TRAVERSAL, FAST_STRING_TRAVERSAL};
2937 2947
2938 2948
2939 class StringHasher { 2949 class StringHasher {
2940 public: 2950 public:
2941 inline StringHasher(int length); 2951 inline StringHasher(int length);
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
4094 } else { 4104 } else {
4095 value &= ~(1 << bit_position); 4105 value &= ~(1 << bit_position);
4096 } 4106 }
4097 return value; 4107 return value;
4098 } 4108 }
4099 }; 4109 };
4100 4110
4101 } } // namespace v8::internal 4111 } } // namespace v8::internal
4102 4112
4103 #endif // V8_OBJECTS_H_ 4113 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698