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 4506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4517 ASSERT(obj->IsHashTable()); | 4517 ASSERT(obj->IsHashTable()); |
4518 return reinterpret_cast<WeakHashTable*>(obj); | 4518 return reinterpret_cast<WeakHashTable*>(obj); |
4519 } | 4519 } |
4520 | 4520 |
4521 // Looks up the value associated with the given key. The hole value is | 4521 // Looks up the value associated with the given key. The hole value is |
4522 // returned in case the key is not present. | 4522 // returned in case the key is not present. |
4523 Object* Lookup(Object* key); | 4523 Object* Lookup(Object* key); |
4524 | 4524 |
4525 // Adds (or overwrites) the value associated with the given key. Mapping a | 4525 // Adds (or overwrites) the value associated with the given key. Mapping a |
4526 // key to the hole value causes removal of the whole entry. | 4526 // key to the hole value causes removal of the whole entry. |
4527 MUST_USE_RESULT MaybeObject* Put(Object* key, Object* value); | 4527 MUST_USE_RESULT static Handle<WeakHashTable> Put(Handle<WeakHashTable> table, |
4528 Handle<Object> key, | |
Yang
2014/04/25 07:32:27
please align arguments
Igor Sheludko
2014/04/25 08:10:34
Done.
| |
4529 Handle<Object> value); | |
4528 | 4530 |
4529 // This function is called when heap verification is turned on. | 4531 // This function is called when heap verification is turned on. |
4530 void Zap(Object* value) { | 4532 void Zap(Object* value) { |
4531 int capacity = Capacity(); | 4533 int capacity = Capacity(); |
4532 for (int i = 0; i < capacity; i++) { | 4534 for (int i = 0; i < capacity; i++) { |
4533 set(EntryToIndex(i), value); | 4535 set(EntryToIndex(i), value); |
4534 set(EntryToValueIndex(i), value); | 4536 set(EntryToValueIndex(i), value); |
4535 } | 4537 } |
4536 } | 4538 } |
4537 | 4539 |
4538 private: | 4540 private: |
4539 friend class MarkCompactCollector; | 4541 friend class MarkCompactCollector; |
4540 | 4542 |
4541 void AddEntry(int entry, Object* key, Object* value); | 4543 void AddEntry(int entry, Handle<Object> key, Handle<Object> value); |
4542 | 4544 |
4543 // Returns the index to the value of an entry. | 4545 // Returns the index to the value of an entry. |
4544 static inline int EntryToValueIndex(int entry) { | 4546 static inline int EntryToValueIndex(int entry) { |
4545 return EntryToIndex(entry) + 1; | 4547 return EntryToIndex(entry) + 1; |
4546 } | 4548 } |
4547 }; | 4549 }; |
4548 | 4550 |
4549 | 4551 |
4550 // JSFunctionResultCache caches results of some JSFunction invocation. | 4552 // JSFunctionResultCache caches results of some JSFunction invocation. |
4551 // It is a fixed array with fixed structure: | 4553 // It is a fixed array with fixed structure: |
(...skipping 6729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11281 } else { | 11283 } else { |
11282 value &= ~(1 << bit_position); | 11284 value &= ~(1 << bit_position); |
11283 } | 11285 } |
11284 return value; | 11286 return value; |
11285 } | 11287 } |
11286 }; | 11288 }; |
11287 | 11289 |
11288 } } // namespace v8::internal | 11290 } } // namespace v8::internal |
11289 | 11291 |
11290 #endif // V8_OBJECTS_H_ | 11292 #endif // V8_OBJECTS_H_ |
OLD | NEW |