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 void Zap(Object* value) { | |
Michael Starzinger
2013/10/04 11:33:40
nit: Maybe add a short one-liner comment explainin
ulan
2013/10/04 11:37:18
Done.
| |
4005 int capacity = Capacity(); | |
4006 for (int i = 0; i < capacity; i++) { | |
4007 set(EntryToIndex(i), value); | |
4008 set(EntryToValueIndex(i), value); | |
4009 } | |
4010 } | |
4011 | |
4004 private: | 4012 private: |
4005 friend class MarkCompactCollector; | 4013 friend class MarkCompactCollector; |
4006 | 4014 |
4007 void AddEntry(int entry, Object* key, Object* value); | 4015 void AddEntry(int entry, Object* key, Object* value); |
4008 | 4016 |
4009 // Returns the index to the value of an entry. | 4017 // Returns the index to the value of an entry. |
4010 static inline int EntryToValueIndex(int entry) { | 4018 static inline int EntryToValueIndex(int entry) { |
4011 return EntryToIndex(entry) + 1; | 4019 return EntryToIndex(entry) + 1; |
4012 } | 4020 } |
4013 }; | 4021 }; |
(...skipping 6271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10285 } else { | 10293 } else { |
10286 value &= ~(1 << bit_position); | 10294 value &= ~(1 << bit_position); |
10287 } | 10295 } |
10288 return value; | 10296 return value; |
10289 } | 10297 } |
10290 }; | 10298 }; |
10291 | 10299 |
10292 } } // namespace v8::internal | 10300 } } // namespace v8::internal |
10293 | 10301 |
10294 #endif // V8_OBJECTS_H_ | 10302 #endif // V8_OBJECTS_H_ |
OLD | NEW |