| 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 3304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3315 | 3315 |
| 3316 // ObjectHashTable maps keys that are arbitrary objects to object values by | 3316 // ObjectHashTable maps keys that are arbitrary objects to object values by |
| 3317 // using the identity hash of the key for hashing purposes. | 3317 // using the identity hash of the key for hashing purposes. |
| 3318 class ObjectHashTable: public HashTable<ObjectHashTableShape<2>, Object*> { | 3318 class ObjectHashTable: public HashTable<ObjectHashTableShape<2>, Object*> { |
| 3319 public: | 3319 public: |
| 3320 static inline ObjectHashTable* cast(Object* obj) { | 3320 static inline ObjectHashTable* cast(Object* obj) { |
| 3321 ASSERT(obj->IsHashTable()); | 3321 ASSERT(obj->IsHashTable()); |
| 3322 return reinterpret_cast<ObjectHashTable*>(obj); | 3322 return reinterpret_cast<ObjectHashTable*>(obj); |
| 3323 } | 3323 } |
| 3324 | 3324 |
| 3325 // Looks up the value associated with the given key. The undefined value is | 3325 // Looks up the value associated with the given key. The hole value is |
| 3326 // returned in case the key is not present. | 3326 // returned in case the key is not present. |
| 3327 Object* Lookup(Object* key); | 3327 Object* Lookup(Object* key); |
| 3328 | 3328 |
| 3329 // Adds (or overwrites) the value associated with the given key. Mapping a | 3329 // Adds (or overwrites) the value associated with the given key. Mapping a |
| 3330 // key to the undefined value causes removal of the whole entry. | 3330 // key to the hole value causes removal of the whole entry. |
| 3331 MUST_USE_RESULT MaybeObject* Put(Object* key, Object* value); | 3331 MUST_USE_RESULT MaybeObject* Put(Object* key, Object* value); |
| 3332 | 3332 |
| 3333 private: | 3333 private: |
| 3334 friend class MarkCompactCollector; | 3334 friend class MarkCompactCollector; |
| 3335 | 3335 |
| 3336 void AddEntry(int entry, Object* key, Object* value); | 3336 void AddEntry(int entry, Object* key, Object* value); |
| 3337 void RemoveEntry(int entry); | 3337 void RemoveEntry(int entry); |
| 3338 | 3338 |
| 3339 // Returns the index to the value of an entry. | 3339 // Returns the index to the value of an entry. |
| 3340 static inline int EntryToValueIndex(int entry) { | 3340 static inline int EntryToValueIndex(int entry) { |
| (...skipping 5452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8793 } else { | 8793 } else { |
| 8794 value &= ~(1 << bit_position); | 8794 value &= ~(1 << bit_position); |
| 8795 } | 8795 } |
| 8796 return value; | 8796 return value; |
| 8797 } | 8797 } |
| 8798 }; | 8798 }; |
| 8799 | 8799 |
| 8800 } } // namespace v8::internal | 8800 } } // namespace v8::internal |
| 8801 | 8801 |
| 8802 #endif // V8_OBJECTS_H_ | 8802 #endif // V8_OBJECTS_H_ |
| OLD | NEW |