| 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 2903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2914 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); | 2914 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); |
| 2915 }; | 2915 }; |
| 2916 | 2916 |
| 2917 // Regular expressions | 2917 // Regular expressions |
| 2918 class JSRegExp: public JSObject { | 2918 class JSRegExp: public JSObject { |
| 2919 public: | 2919 public: |
| 2920 // Meaning of Type: | 2920 // Meaning of Type: |
| 2921 // NOT_COMPILED: Initial value. No data has been stored in the JSRegExp yet. | 2921 // NOT_COMPILED: Initial value. No data has been stored in the JSRegExp yet. |
| 2922 // JSCRE: A complex RegExp for JSCRE | 2922 // JSCRE: A complex RegExp for JSCRE |
| 2923 // ATOM: A simple string to match against using an indexOf operation. | 2923 // ATOM: A simple string to match against using an indexOf operation. |
| 2924 // RE2K: Compiled with RegExp2000. | 2924 // IRREGEXP: Compiled with Irregexp. |
| 2925 // RE2K_NATIVE: Compiled to native code with RegExp2000. | 2925 // IRREGEXP_NATIVE: Compiled to native code with Irregexp. |
| 2926 enum Type { NOT_COMPILED, JSCRE, ATOM, RE2K, RE2K_NATIVE }; | 2926 enum Type { NOT_COMPILED, JSCRE, ATOM, IRREGEXP, IRREGEXP_NATIVE }; |
| 2927 enum Flag { NONE = 0, GLOBAL = 1, IGNORE_CASE = 2, MULTILINE = 4 }; | 2927 enum Flag { NONE = 0, GLOBAL = 1, IGNORE_CASE = 2, MULTILINE = 4 }; |
| 2928 | 2928 |
| 2929 class Flags { | 2929 class Flags { |
| 2930 public: | 2930 public: |
| 2931 explicit Flags(uint32_t value) : value_(value) { } | 2931 explicit Flags(uint32_t value) : value_(value) { } |
| 2932 bool is_global() { return (value_ & GLOBAL) != 0; } | 2932 bool is_global() { return (value_ & GLOBAL) != 0; } |
| 2933 bool is_ignore_case() { return (value_ & IGNORE_CASE) != 0; } | 2933 bool is_ignore_case() { return (value_ & IGNORE_CASE) != 0; } |
| 2934 bool is_multiline() { return (value_ & MULTILINE) != 0; } | 2934 bool is_multiline() { return (value_ & MULTILINE) != 0; } |
| 2935 uint32_t value() { return value_; } | 2935 uint32_t value() { return value_; } |
| 2936 private: | 2936 private: |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2955 static const int kDataOffset = JSObject::kHeaderSize; | 2955 static const int kDataOffset = JSObject::kHeaderSize; |
| 2956 static const int kSize = kDataOffset + kIntSize; | 2956 static const int kSize = kDataOffset + kIntSize; |
| 2957 | 2957 |
| 2958 static const int kTagIndex = 0; | 2958 static const int kTagIndex = 0; |
| 2959 static const int kSourceIndex = kTagIndex + 1; | 2959 static const int kSourceIndex = kTagIndex + 1; |
| 2960 static const int kFlagsIndex = kSourceIndex + 1; | 2960 static const int kFlagsIndex = kSourceIndex + 1; |
| 2961 // These three are the same since the same entry is shared for | 2961 // These three are the same since the same entry is shared for |
| 2962 // different purposes in different types of regexps. | 2962 // different purposes in different types of regexps. |
| 2963 static const int kAtomPatternIndex = kFlagsIndex + 1; | 2963 static const int kAtomPatternIndex = kFlagsIndex + 1; |
| 2964 static const int kJscreDataIndex = kFlagsIndex + 1; | 2964 static const int kJscreDataIndex = kFlagsIndex + 1; |
| 2965 static const int kRe2kDataIndex = kFlagsIndex + 1; | 2965 static const int kIrregexpDataIndex = kFlagsIndex + 1; |
| 2966 static const int kDataSize = kAtomPatternIndex + 1; | 2966 static const int kDataSize = kAtomPatternIndex + 1; |
| 2967 }; | 2967 }; |
| 2968 | 2968 |
| 2969 | 2969 |
| 2970 class CompilationCacheTable: public HashTable<0, 2> { | 2970 class CompilationCacheTable: public HashTable<0, 2> { |
| 2971 public: | 2971 public: |
| 2972 // Find cached value for a string key, otherwise return null. | 2972 // Find cached value for a string key, otherwise return null. |
| 2973 Object* Lookup(String* src); | 2973 Object* Lookup(String* src); |
| 2974 Object* LookupRegExp(String* source, JSRegExp::Flags flags); | 2974 Object* LookupRegExp(String* source, JSRegExp::Flags flags); |
| 2975 Object* Put(String* src, Object* value); | 2975 Object* Put(String* src, Object* value); |
| (...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4201 } else { | 4201 } else { |
| 4202 value &= ~(1 << bit_position); | 4202 value &= ~(1 << bit_position); |
| 4203 } | 4203 } |
| 4204 return value; | 4204 return value; |
| 4205 } | 4205 } |
| 4206 }; | 4206 }; |
| 4207 | 4207 |
| 4208 } } // namespace v8::internal | 4208 } } // namespace v8::internal |
| 4209 | 4209 |
| 4210 #endif // V8_OBJECTS_H_ | 4210 #endif // V8_OBJECTS_H_ |
| OLD | NEW |