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 3983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3994 } | 3994 } |
3995 | 3995 |
3996 // Looks up the value associated with the given key. The hole value is | 3996 // Looks up the value associated with the given key. The hole value is |
3997 // returned in case the key is not present. | 3997 // returned in case the key is not present. |
3998 Object* Lookup(Object* key); | 3998 Object* Lookup(Object* key); |
3999 | 3999 |
4000 // Adds (or overwrites) the value associated with the given key. Mapping a | 4000 // Adds (or overwrites) the value associated with the given key. Mapping a |
4001 // key to the hole value causes removal of the whole entry. | 4001 // key to the hole value causes removal of the whole entry. |
4002 MUST_USE_RESULT MaybeObject* Put(Object* key, Object* value); | 4002 MUST_USE_RESULT MaybeObject* Put(Object* key, Object* value); |
4003 | 4003 |
| 4004 // This function is called when heap verification is turned on. |
| 4005 void Zap(Object* value) { |
| 4006 int capacity = Capacity(); |
| 4007 for (int i = 0; i < capacity; i++) { |
| 4008 set(EntryToIndex(i), value); |
| 4009 set(EntryToValueIndex(i), value); |
| 4010 } |
| 4011 } |
| 4012 |
4004 private: | 4013 private: |
4005 friend class MarkCompactCollector; | 4014 friend class MarkCompactCollector; |
4006 | 4015 |
4007 void AddEntry(int entry, Object* key, Object* value); | 4016 void AddEntry(int entry, Object* key, Object* value); |
4008 | 4017 |
4009 // Returns the index to the value of an entry. | 4018 // Returns the index to the value of an entry. |
4010 static inline int EntryToValueIndex(int entry) { | 4019 static inline int EntryToValueIndex(int entry) { |
4011 return EntryToIndex(entry) + 1; | 4020 return EntryToIndex(entry) + 1; |
4012 } | 4021 } |
4013 }; | 4022 }; |
(...skipping 6271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10285 } else { | 10294 } else { |
10286 value &= ~(1 << bit_position); | 10295 value &= ~(1 << bit_position); |
10287 } | 10296 } |
10288 return value; | 10297 return value; |
10289 } | 10298 } |
10290 }; | 10299 }; |
10291 | 10300 |
10292 } } // namespace v8::internal | 10301 } } // namespace v8::internal |
10293 | 10302 |
10294 #endif // V8_OBJECTS_H_ | 10303 #endif // V8_OBJECTS_H_ |
OLD | NEW |