OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include "allocation.h" | 8 #include "allocation.h" |
9 #include "assert-scope.h" | 9 #include "assert-scope.h" |
10 #include "builtins.h" | 10 #include "builtins.h" |
(...skipping 4185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4196 | 4196 |
4197 // Attempt to shrink hash table after removal of key. | 4197 // Attempt to shrink hash table after removal of key. |
4198 MUST_USE_RESULT static inline Handle<ObjectHashTable> Shrink( | 4198 MUST_USE_RESULT static inline Handle<ObjectHashTable> Shrink( |
4199 Handle<ObjectHashTable> table, | 4199 Handle<ObjectHashTable> table, |
4200 Handle<Object> key); | 4200 Handle<Object> key); |
4201 | 4201 |
4202 // Looks up the value associated with the given key. The hole value is | 4202 // Looks up the value associated with the given key. The hole value is |
4203 // returned in case the key is not present. | 4203 // returned in case the key is not present. |
4204 Object* Lookup(Handle<Object> key); | 4204 Object* Lookup(Handle<Object> key); |
4205 | 4205 |
4206 int FindEntry(Handle<Object> key); | |
4207 // TODO(ishell): Remove this when all the callers are handlified. | |
4208 int FindEntry(Object* key); | |
4209 | |
4210 // Adds (or overwrites) the value associated with the given key. Mapping a | 4206 // Adds (or overwrites) the value associated with the given key. Mapping a |
4211 // key to the hole value causes removal of the whole entry. | 4207 // key to the hole value causes removal of the whole entry. |
4212 static Handle<ObjectHashTable> Put(Handle<ObjectHashTable> table, | 4208 static Handle<ObjectHashTable> Put(Handle<ObjectHashTable> table, |
4213 Handle<Object> key, | 4209 Handle<Object> key, |
4214 Handle<Object> value); | 4210 Handle<Object> value); |
4215 | 4211 |
4216 private: | 4212 private: |
4217 friend class MarkCompactCollector; | 4213 friend class MarkCompactCollector; |
4218 | 4214 |
4219 void AddEntry(int entry, Object* key, Object* value); | 4215 void AddEntry(int entry, Object* key, Object* value); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4425 typedef HashTable< | 4421 typedef HashTable< |
4426 WeakHashTable, WeakHashTableShape<2>, Handle<Object> > DerivedHashTable; | 4422 WeakHashTable, WeakHashTableShape<2>, Handle<Object> > DerivedHashTable; |
4427 public: | 4423 public: |
4428 static inline WeakHashTable* cast(Object* obj) { | 4424 static inline WeakHashTable* cast(Object* obj) { |
4429 ASSERT(obj->IsHashTable()); | 4425 ASSERT(obj->IsHashTable()); |
4430 return reinterpret_cast<WeakHashTable*>(obj); | 4426 return reinterpret_cast<WeakHashTable*>(obj); |
4431 } | 4427 } |
4432 | 4428 |
4433 // Looks up the value associated with the given key. The hole value is | 4429 // Looks up the value associated with the given key. The hole value is |
4434 // returned in case the key is not present. | 4430 // returned in case the key is not present. |
4435 Object* Lookup(Object* key); | 4431 Object* Lookup(Handle<Object> key); |
4436 | |
4437 int FindEntry(Handle<Object> key); | |
4438 // TODO(ishell): Remove this when all the callers are handlified. | |
4439 int FindEntry(Object* key); | |
4440 | 4432 |
4441 // Adds (or overwrites) the value associated with the given key. Mapping a | 4433 // Adds (or overwrites) the value associated with the given key. Mapping a |
4442 // key to the hole value causes removal of the whole entry. | 4434 // key to the hole value causes removal of the whole entry. |
4443 MUST_USE_RESULT static Handle<WeakHashTable> Put(Handle<WeakHashTable> table, | 4435 MUST_USE_RESULT static Handle<WeakHashTable> Put(Handle<WeakHashTable> table, |
4444 Handle<Object> key, | 4436 Handle<Object> key, |
4445 Handle<Object> value); | 4437 Handle<Object> value); |
4446 | 4438 |
4447 // This function is called when heap verification is turned on. | 4439 // This function is called when heap verification is turned on. |
4448 void Zap(Object* value) { | 4440 void Zap(Object* value) { |
4449 int capacity = Capacity(); | 4441 int capacity = Capacity(); |
(...skipping 6742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11192 } else { | 11184 } else { |
11193 value &= ~(1 << bit_position); | 11185 value &= ~(1 << bit_position); |
11194 } | 11186 } |
11195 return value; | 11187 return value; |
11196 } | 11188 } |
11197 }; | 11189 }; |
11198 | 11190 |
11199 } } // namespace v8::internal | 11191 } } // namespace v8::internal |
11200 | 11192 |
11201 #endif // V8_OBJECTS_H_ | 11193 #endif // V8_OBJECTS_H_ |
OLD | NEW |