OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 4134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4145 static Handle<NameDictionary> AddNameEntry(Handle<NameDictionary> dict, | 4145 static Handle<NameDictionary> AddNameEntry(Handle<NameDictionary> dict, |
4146 Handle<Name> name, | 4146 Handle<Name> name, |
4147 Handle<Object> value, | 4147 Handle<Object> value, |
4148 PropertyDetails details); | 4148 PropertyDetails details); |
4149 }; | 4149 }; |
4150 | 4150 |
4151 | 4151 |
4152 class NumberDictionaryShape : public BaseShape<uint32_t> { | 4152 class NumberDictionaryShape : public BaseShape<uint32_t> { |
4153 public: | 4153 public: |
4154 static inline bool IsMatch(uint32_t key, Object* other); | 4154 static inline bool IsMatch(uint32_t key, Object* other); |
| 4155 // TODO(ishell): This should be eventually replaced with AsHandle(). |
4155 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap, | 4156 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap, |
4156 uint32_t key); | 4157 uint32_t key); |
| 4158 static inline Handle<Object> AsHandle(Isolate* isolate, uint32_t key); |
4157 static const int kEntrySize = 3; | 4159 static const int kEntrySize = 3; |
4158 static const bool kIsEnumerable = false; | 4160 static const bool kIsEnumerable = false; |
4159 }; | 4161 }; |
4160 | 4162 |
4161 | 4163 |
4162 class SeededNumberDictionaryShape : public NumberDictionaryShape { | 4164 class SeededNumberDictionaryShape : public NumberDictionaryShape { |
4163 public: | 4165 public: |
4164 static const bool UsesSeed = true; | 4166 static const bool UsesSeed = true; |
4165 static const int kPrefixSize = 2; | 4167 static const int kPrefixSize = 2; |
4166 | 4168 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4198 Handle<Object> value, | 4200 Handle<Object> value, |
4199 PropertyDetails details); | 4201 PropertyDetails details); |
4200 MUST_USE_RESULT MaybeObject* AddNumberEntry(uint32_t key, | 4202 MUST_USE_RESULT MaybeObject* AddNumberEntry(uint32_t key, |
4201 Object* value, | 4203 Object* value, |
4202 PropertyDetails details); | 4204 PropertyDetails details); |
4203 | 4205 |
4204 // Set an existing entry or add a new one if needed. | 4206 // Set an existing entry or add a new one if needed. |
4205 // Return the updated dictionary. | 4207 // Return the updated dictionary. |
4206 MUST_USE_RESULT static Handle<SeededNumberDictionary> Set( | 4208 MUST_USE_RESULT static Handle<SeededNumberDictionary> Set( |
4207 Handle<SeededNumberDictionary> dictionary, | 4209 Handle<SeededNumberDictionary> dictionary, |
4208 uint32_t index, | 4210 uint32_t key, |
4209 Handle<Object> value, | 4211 Handle<Object> value, |
4210 PropertyDetails details); | 4212 PropertyDetails details); |
4211 | 4213 |
4212 MUST_USE_RESULT MaybeObject* Set(uint32_t key, | 4214 MUST_USE_RESULT MaybeObject* Set(uint32_t key, |
4213 Object* value, | 4215 Object* value, |
4214 PropertyDetails details); | 4216 PropertyDetails details); |
4215 | 4217 |
4216 void UpdateMaxNumberKey(uint32_t key); | 4218 void UpdateMaxNumberKey(uint32_t key); |
4217 | 4219 |
4218 // If slow elements are required we will never go back to fast-case | 4220 // If slow elements are required we will never go back to fast-case |
(...skipping 22 matching lines...) Expand all Loading... |
4241 uint32_t> { | 4243 uint32_t> { |
4242 public: | 4244 public: |
4243 static UnseededNumberDictionary* cast(Object* obj) { | 4245 static UnseededNumberDictionary* cast(Object* obj) { |
4244 ASSERT(obj->IsDictionary()); | 4246 ASSERT(obj->IsDictionary()); |
4245 return reinterpret_cast<UnseededNumberDictionary*>(obj); | 4247 return reinterpret_cast<UnseededNumberDictionary*>(obj); |
4246 } | 4248 } |
4247 | 4249 |
4248 // Type specific at put (default NONE attributes is used when adding). | 4250 // Type specific at put (default NONE attributes is used when adding). |
4249 MUST_USE_RESULT MaybeObject* AtNumberPut(uint32_t key, Object* value); | 4251 MUST_USE_RESULT MaybeObject* AtNumberPut(uint32_t key, Object* value); |
4250 MUST_USE_RESULT MaybeObject* AddNumberEntry(uint32_t key, Object* value); | 4252 MUST_USE_RESULT MaybeObject* AddNumberEntry(uint32_t key, Object* value); |
| 4253 MUST_USE_RESULT static Handle<UnseededNumberDictionary> AddNumberEntry( |
| 4254 Handle<UnseededNumberDictionary> dictionary, |
| 4255 uint32_t key, |
| 4256 Handle<Object> value); |
4251 | 4257 |
4252 // Set an existing entry or add a new one if needed. | 4258 // Set an existing entry or add a new one if needed. |
4253 // Return the updated dictionary. | 4259 // Return the updated dictionary. |
4254 MUST_USE_RESULT static Handle<UnseededNumberDictionary> Set( | 4260 MUST_USE_RESULT static Handle<UnseededNumberDictionary> Set( |
4255 Handle<UnseededNumberDictionary> dictionary, | 4261 Handle<UnseededNumberDictionary> dictionary, |
4256 uint32_t index, | 4262 uint32_t key, |
4257 Handle<Object> value); | 4263 Handle<Object> value); |
4258 | |
4259 MUST_USE_RESULT MaybeObject* Set(uint32_t key, Object* value); | |
4260 }; | 4264 }; |
4261 | 4265 |
4262 | 4266 |
4263 class ObjectHashTableShape : public BaseShape<Object*> { | 4267 class ObjectHashTableShape : public BaseShape<Object*> { |
4264 public: | 4268 public: |
4265 static inline bool IsMatch(Object* key, Object* other); | 4269 static inline bool IsMatch(Object* key, Object* other); |
4266 static inline uint32_t Hash(Object* key); | 4270 static inline uint32_t Hash(Object* key); |
4267 static inline uint32_t HashForObject(Object* key, Object* object); | 4271 static inline uint32_t HashForObject(Object* key, Object* object); |
4268 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap, | 4272 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap, |
4269 Object* key); | 4273 Object* key); |
(...skipping 7007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11277 } else { | 11281 } else { |
11278 value &= ~(1 << bit_position); | 11282 value &= ~(1 << bit_position); |
11279 } | 11283 } |
11280 return value; | 11284 return value; |
11281 } | 11285 } |
11282 }; | 11286 }; |
11283 | 11287 |
11284 } } // namespace v8::internal | 11288 } } // namespace v8::internal |
11285 | 11289 |
11286 #endif // V8_OBJECTS_H_ | 11290 #endif // V8_OBJECTS_H_ |
OLD | NEW |