| OLD | NEW |
| 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 2923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2934 | 2934 |
| 2935 private: | 2935 private: |
| 2936 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); | 2936 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); |
| 2937 }; | 2937 }; |
| 2938 | 2938 |
| 2939 // Regular expressions | 2939 // Regular expressions |
| 2940 class JSRegExp: public JSObject { | 2940 class JSRegExp: public JSObject { |
| 2941 public: | 2941 public: |
| 2942 // Meaning of Type: | 2942 // Meaning of Type: |
| 2943 // NOT_COMPILED: Initial value. No data has been stored in the JSRegExp yet. | 2943 // NOT_COMPILED: Initial value. No data has been stored in the JSRegExp yet. |
| 2944 // JSCRE: A complex RegExp for JSCRE | |
| 2945 // ATOM: A simple string to match against using an indexOf operation. | 2944 // ATOM: A simple string to match against using an indexOf operation. |
| 2946 // IRREGEXP: Compiled with Irregexp. | 2945 // IRREGEXP: Compiled with Irregexp. |
| 2947 // IRREGEXP_NATIVE: Compiled to native code with Irregexp. | 2946 // IRREGEXP_NATIVE: Compiled to native code with Irregexp. |
| 2948 enum Type { NOT_COMPILED, JSCRE, ATOM, IRREGEXP }; | 2947 enum Type { NOT_COMPILED, ATOM, IRREGEXP }; |
| 2949 enum Flag { NONE = 0, GLOBAL = 1, IGNORE_CASE = 2, MULTILINE = 4 }; | 2948 enum Flag { NONE = 0, GLOBAL = 1, IGNORE_CASE = 2, MULTILINE = 4 }; |
| 2950 | 2949 |
| 2951 class Flags { | 2950 class Flags { |
| 2952 public: | 2951 public: |
| 2953 explicit Flags(uint32_t value) : value_(value) { } | 2952 explicit Flags(uint32_t value) : value_(value) { } |
| 2954 bool is_global() { return (value_ & GLOBAL) != 0; } | 2953 bool is_global() { return (value_ & GLOBAL) != 0; } |
| 2955 bool is_ignore_case() { return (value_ & IGNORE_CASE) != 0; } | 2954 bool is_ignore_case() { return (value_ & IGNORE_CASE) != 0; } |
| 2956 bool is_multiline() { return (value_ & MULTILINE) != 0; } | 2955 bool is_multiline() { return (value_ & MULTILINE) != 0; } |
| 2957 uint32_t value() { return value_; } | 2956 uint32_t value() { return value_; } |
| 2958 private: | 2957 private: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2972 #ifdef DEBUG | 2971 #ifdef DEBUG |
| 2973 void JSRegExpVerify(); | 2972 void JSRegExpVerify(); |
| 2974 #endif | 2973 #endif |
| 2975 | 2974 |
| 2976 static const int kDataOffset = JSObject::kHeaderSize; | 2975 static const int kDataOffset = JSObject::kHeaderSize; |
| 2977 static const int kSize = kDataOffset + kIntSize; | 2976 static const int kSize = kDataOffset + kIntSize; |
| 2978 | 2977 |
| 2979 static const int kTagIndex = 0; | 2978 static const int kTagIndex = 0; |
| 2980 static const int kSourceIndex = kTagIndex + 1; | 2979 static const int kSourceIndex = kTagIndex + 1; |
| 2981 static const int kFlagsIndex = kSourceIndex + 1; | 2980 static const int kFlagsIndex = kSourceIndex + 1; |
| 2982 // These three are the same since the same entry is shared for | 2981 // These two are the same since the same entry is shared for |
| 2983 // different purposes in different types of regexps. | 2982 // different purposes in different types of regexps. |
| 2984 static const int kAtomPatternIndex = kFlagsIndex + 1; | 2983 static const int kAtomPatternIndex = kFlagsIndex + 1; |
| 2985 static const int kJscreDataIndex = kFlagsIndex + 1; | |
| 2986 static const int kIrregexpDataIndex = kFlagsIndex + 1; | 2984 static const int kIrregexpDataIndex = kFlagsIndex + 1; |
| 2987 static const int kDataSize = kAtomPatternIndex + 1; | 2985 static const int kDataSize = kAtomPatternIndex + 1; |
| 2988 }; | 2986 }; |
| 2989 | 2987 |
| 2990 | 2988 |
| 2991 class CompilationCacheTable: public HashTable<0, 2> { | 2989 class CompilationCacheTable: public HashTable<0, 2> { |
| 2992 public: | 2990 public: |
| 2993 // Find cached value for a string key, otherwise return null. | 2991 // Find cached value for a string key, otherwise return null. |
| 2994 Object* Lookup(String* src); | 2992 Object* Lookup(String* src); |
| 2993 Object* LookupEval(String* src, Context* context); |
| 2995 Object* LookupRegExp(String* source, JSRegExp::Flags flags); | 2994 Object* LookupRegExp(String* source, JSRegExp::Flags flags); |
| 2996 Object* Put(String* src, Object* value); | 2995 Object* Put(String* src, Object* value); |
| 2996 Object* PutEval(String* src, Context* context, Object* value); |
| 2997 Object* PutRegExp(String* src, JSRegExp::Flags flags, FixedArray* value); | 2997 Object* PutRegExp(String* src, JSRegExp::Flags flags, FixedArray* value); |
| 2998 | 2998 |
| 2999 static inline CompilationCacheTable* cast(Object* obj); | 2999 static inline CompilationCacheTable* cast(Object* obj); |
| 3000 | 3000 |
| 3001 private: | 3001 private: |
| 3002 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable); | 3002 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable); |
| 3003 }; | 3003 }; |
| 3004 | 3004 |
| 3005 | 3005 |
| 3006 enum AllowNullsFlag {ALLOW_NULLS, DISALLOW_NULLS}; | 3006 enum AllowNullsFlag {ALLOW_NULLS, DISALLOW_NULLS}; |
| (...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4236 } else { | 4236 } else { |
| 4237 value &= ~(1 << bit_position); | 4237 value &= ~(1 << bit_position); |
| 4238 } | 4238 } |
| 4239 return value; | 4239 return value; |
| 4240 } | 4240 } |
| 4241 }; | 4241 }; |
| 4242 | 4242 |
| 4243 } } // namespace v8::internal | 4243 } } // namespace v8::internal |
| 4244 | 4244 |
| 4245 #endif // V8_OBJECTS_H_ | 4245 #endif // V8_OBJECTS_H_ |
| OLD | NEW |