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 4182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4193 return reinterpret_cast<ObjectHashTable*>(obj); | 4193 return reinterpret_cast<ObjectHashTable*>(obj); |
4194 } | 4194 } |
4195 | 4195 |
4196 // Attempt to shrink hash table after removal of key. | 4196 // Attempt to shrink hash table after removal of key. |
4197 MUST_USE_RESULT static inline Handle<ObjectHashTable> Shrink( | 4197 MUST_USE_RESULT static inline Handle<ObjectHashTable> Shrink( |
4198 Handle<ObjectHashTable> table, | 4198 Handle<ObjectHashTable> table, |
4199 Handle<Object> key); | 4199 Handle<Object> key); |
4200 | 4200 |
4201 // Looks up the value associated with the given key. The hole value is | 4201 // Looks up the value associated with the given key. The hole value is |
4202 // returned in case the key is not present. | 4202 // returned in case the key is not present. |
4203 Object* Lookup(Object* key); | 4203 Object* Lookup(Handle<Object> key); |
4204 | 4204 |
4205 int FindEntry(Handle<Object> key); | 4205 int FindEntry(Handle<Object> key); |
4206 // TODO(ishell): Remove this when all the callers are handlified. | 4206 // TODO(ishell): Remove this when all the callers are handlified. |
4207 int FindEntry(Object* key); | 4207 int FindEntry(Object* key); |
4208 | 4208 |
4209 // Adds (or overwrites) the value associated with the given key. Mapping a | 4209 // Adds (or overwrites) the value associated with the given key. Mapping a |
4210 // key to the hole value causes removal of the whole entry. | 4210 // key to the hole value causes removal of the whole entry. |
4211 static Handle<ObjectHashTable> Put(Handle<ObjectHashTable> table, | 4211 static Handle<ObjectHashTable> Put(Handle<ObjectHashTable> table, |
4212 Handle<Object> key, | 4212 Handle<Object> key, |
4213 Handle<Object> value); | 4213 Handle<Object> value); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4381 | 4381 |
4382 | 4382 |
4383 class OrderedHashMap:public OrderedHashTable< | 4383 class OrderedHashMap:public OrderedHashTable< |
4384 OrderedHashMap, JSMapIterator, 2> { | 4384 OrderedHashMap, JSMapIterator, 2> { |
4385 public: | 4385 public: |
4386 static OrderedHashMap* cast(Object* obj) { | 4386 static OrderedHashMap* cast(Object* obj) { |
4387 ASSERT(obj->IsOrderedHashTable()); | 4387 ASSERT(obj->IsOrderedHashTable()); |
4388 return reinterpret_cast<OrderedHashMap*>(obj); | 4388 return reinterpret_cast<OrderedHashMap*>(obj); |
4389 } | 4389 } |
4390 | 4390 |
4391 Object* Lookup(Object* key); | 4391 Object* Lookup(Handle<Object> key); |
4392 static Handle<OrderedHashMap> Put( | 4392 static Handle<OrderedHashMap> Put( |
4393 Handle<OrderedHashMap> table, | 4393 Handle<OrderedHashMap> table, |
4394 Handle<Object> key, | 4394 Handle<Object> key, |
4395 Handle<Object> value); | 4395 Handle<Object> value); |
4396 | 4396 |
4397 private: | 4397 private: |
4398 Object* ValueAt(int entry) { | 4398 Object* ValueAt(int entry) { |
4399 return get(EntryToIndex(entry) + kValueOffset); | 4399 return get(EntryToIndex(entry) + kValueOffset); |
4400 } | 4400 } |
4401 | 4401 |
(...skipping 6776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11178 } else { | 11178 } else { |
11179 value &= ~(1 << bit_position); | 11179 value &= ~(1 << bit_position); |
11180 } | 11180 } |
11181 return value; | 11181 return value; |
11182 } | 11182 } |
11183 }; | 11183 }; |
11184 | 11184 |
11185 } } // namespace v8::internal | 11185 } } // namespace v8::internal |
11186 | 11186 |
11187 #endif // V8_OBJECTS_H_ | 11187 #endif // V8_OBJECTS_H_ |
OLD | NEW |