| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 2170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2181 // added. The return value is the symbol table which might have | 2181 // added. The return value is the symbol table which might have |
| 2182 // been enlarged. If the return value is not a failure, the symbol | 2182 // been enlarged. If the return value is not a failure, the symbol |
| 2183 // pointer *s is set to the symbol found. | 2183 // pointer *s is set to the symbol found. |
| 2184 Object* LookupSymbol(Vector<const char> str, Object** s); | 2184 Object* LookupSymbol(Vector<const char> str, Object** s); |
| 2185 Object* LookupString(String* key, Object** s); | 2185 Object* LookupString(String* key, Object** s); |
| 2186 | 2186 |
| 2187 // Looks up a symbol that is equal to the given string and returns | 2187 // Looks up a symbol that is equal to the given string and returns |
| 2188 // true if it is found, assigning the symbol to the given output | 2188 // true if it is found, assigning the symbol to the given output |
| 2189 // parameter. | 2189 // parameter. |
| 2190 bool LookupSymbolIfExists(String* str, String** symbol); | 2190 bool LookupSymbolIfExists(String* str, String** symbol); |
| 2191 bool LookupTwoCharsIfExists(uint32_t c1, uint32_t c2, String** symbol); |
| 2191 | 2192 |
| 2192 // Casting. | 2193 // Casting. |
| 2193 static inline SymbolTable* cast(Object* obj); | 2194 static inline SymbolTable* cast(Object* obj); |
| 2194 | 2195 |
| 2195 private: | 2196 private: |
| 2196 Object* LookupKey(HashTableKey* key, Object** s); | 2197 Object* LookupKey(HashTableKey* key, Object** s); |
| 2197 | 2198 |
| 2198 DISALLOW_IMPLICIT_CONSTRUCTORS(SymbolTable); | 2199 DISALLOW_IMPLICIT_CONSTRUCTORS(SymbolTable); |
| 2199 }; | 2200 }; |
| 2200 | 2201 |
| (...skipping 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3839 } | 3840 } |
| 3840 | 3841 |
| 3841 inline uint32_t GetHash(); | 3842 inline uint32_t GetHash(); |
| 3842 | 3843 |
| 3843 int length_; | 3844 int length_; |
| 3844 uint32_t raw_running_hash_; | 3845 uint32_t raw_running_hash_; |
| 3845 uint32_t array_index_; | 3846 uint32_t array_index_; |
| 3846 bool is_array_index_; | 3847 bool is_array_index_; |
| 3847 bool is_first_char_; | 3848 bool is_first_char_; |
| 3848 bool is_valid_; | 3849 bool is_valid_; |
| 3850 friend class TwoCharHashTableKey; |
| 3849 }; | 3851 }; |
| 3850 | 3852 |
| 3851 | 3853 |
| 3852 // The characteristics of a string are stored in its map. Retrieving these | 3854 // The characteristics of a string are stored in its map. Retrieving these |
| 3853 // few bits of information is moderately expensive, involving two memory | 3855 // few bits of information is moderately expensive, involving two memory |
| 3854 // loads where the second is dependent on the first. To improve efficiency | 3856 // loads where the second is dependent on the first. To improve efficiency |
| 3855 // the shape of the string is given its own class so that it can be retrieved | 3857 // the shape of the string is given its own class so that it can be retrieved |
| 3856 // once and used for several string operations. A StringShape is small enough | 3858 // once and used for several string operations. A StringShape is small enough |
| 3857 // to be passed by value and is immutable, but be aware that flattening a | 3859 // to be passed by value and is immutable, but be aware that flattening a |
| 3858 // string can potentially alter its shape. Also be aware that a GC caused by | 3860 // string can potentially alter its shape. Also be aware that a GC caused by |
| (...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5051 } else { | 5053 } else { |
| 5052 value &= ~(1 << bit_position); | 5054 value &= ~(1 << bit_position); |
| 5053 } | 5055 } |
| 5054 return value; | 5056 return value; |
| 5055 } | 5057 } |
| 5056 }; | 5058 }; |
| 5057 | 5059 |
| 5058 } } // namespace v8::internal | 5060 } } // namespace v8::internal |
| 5059 | 5061 |
| 5060 #endif // V8_OBJECTS_H_ | 5062 #endif // V8_OBJECTS_H_ |
| OLD | NEW |