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