OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 void VisitPointers(Object** start, Object** end) { | 230 void VisitPointers(Object** start, Object** end) { |
231 // Copy all HeapObject pointers in [start, end). | 231 // Copy all HeapObject pointers in [start, end). |
232 for (Object** p = start; p < end; p++) UpdatePointer(p); | 232 for (Object** p = start; p < end; p++) UpdatePointer(p); |
233 } | 233 } |
234 | 234 |
235 private: | 235 private: |
236 // Based on Heap::ScavengeObject() but only does forwarding of pointers | 236 // Based on Heap::ScavengeObject() but only does forwarding of pointers |
237 // to live new space objects, and not actually keep them alive. | 237 // to live new space objects, and not actually keep them alive. |
238 void UpdatePointer(Object** p) { | 238 void UpdatePointer(Object** p) { |
239 Object* object = *p; | 239 Object* object = *p; |
240 if (!Heap::InNewSpace(object)) return; | 240 if (!HEAP->InNewSpace(object)) return; |
241 | 241 |
242 HeapObject* heap_obj = HeapObject::cast(object); | 242 HeapObject* heap_obj = HeapObject::cast(object); |
243 ASSERT(Heap::InFromSpace(heap_obj)); | 243 ASSERT(HEAP->InFromSpace(heap_obj)); |
244 | 244 |
245 // We use the first word (where the map pointer usually is) of a heap | 245 // We use the first word (where the map pointer usually is) of a heap |
246 // object to record the forwarding pointer. A forwarding pointer can | 246 // object to record the forwarding pointer. A forwarding pointer can |
247 // point to an old space, the code space, or the to space of the new | 247 // point to an old space, the code space, or the to space of the new |
248 // generation. | 248 // generation. |
249 MapWord first_word = heap_obj->map_word(); | 249 MapWord first_word = heap_obj->map_word(); |
250 | 250 |
251 // If the first word is a forwarding address, the object has already been | 251 // If the first word is a forwarding address, the object has already been |
252 // copied. | 252 // copied. |
253 if (first_word.IsForwardingAddress()) { | 253 if (first_word.IsForwardingAddress()) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 inline static Object* PrintObj(int obj_id) { return HEAP->undefined_value(); } | 313 inline static Object* PrintObj(int obj_id) { return HEAP->undefined_value(); } |
314 }; | 314 }; |
315 | 315 |
316 | 316 |
317 #endif // LIVE_OBJECT_LIST | 317 #endif // LIVE_OBJECT_LIST |
318 | 318 |
319 } } // namespace v8::internal | 319 } } // namespace v8::internal |
320 | 320 |
321 #endif // V8_LIVEOBJECTLIST_H_ | 321 #endif // V8_LIVEOBJECTLIST_H_ |
322 | 322 |
OLD | NEW |