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_VISITING_H_ | 5 #ifndef V8_OBJECTS_VISITING_H_ |
6 #define V8_OBJECTS_VISITING_H_ | 6 #define V8_OBJECTS_VISITING_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/heap/heap.h" | 9 #include "src/heap/heap.h" |
10 #include "src/heap/spaces.h" | 10 #include "src/heap/spaces.h" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 INLINE(static void VisitPointers(Heap* heap, HeapObject* object, | 260 INLINE(static void VisitPointers(Heap* heap, HeapObject* object, |
261 Object** start, Object** end)) { | 261 Object** start, Object** end)) { |
262 for (Object** p = start; p < end; p++) { | 262 for (Object** p = start; p < end; p++) { |
263 StaticVisitor::VisitPointer(heap, object, p); | 263 StaticVisitor::VisitPointer(heap, object, p); |
264 } | 264 } |
265 } | 265 } |
266 | 266 |
267 // Although we are using the JSFunction body descriptor which does not | 267 // Although we are using the JSFunction body descriptor which does not |
268 // visit the code entry, compiler wants it to be accessible. | 268 // visit the code entry, compiler wants it to be accessible. |
269 // See JSFunction::BodyDescriptorImpl. | 269 // See JSFunction::BodyDescriptorImpl. |
270 INLINE(static void VisitCodeEntry(Heap* heap, HeapObject* object, | 270 inline static void VisitCodeEntry(Heap* heap, HeapObject* object, |
271 Address entry_address)) { | 271 Address entry_address) { |
272 UNREACHABLE(); | 272 UNREACHABLE(); |
273 } | 273 } |
274 | 274 |
275 private: | 275 private: |
| 276 inline static int UnreachableVisitor(Map* map, HeapObject* object) { |
| 277 UNREACHABLE(); |
| 278 return 0; |
| 279 } |
| 280 |
276 INLINE(static int VisitByteArray(Map* map, HeapObject* object)) { | 281 INLINE(static int VisitByteArray(Map* map, HeapObject* object)) { |
277 return reinterpret_cast<ByteArray*>(object)->ByteArraySize(); | 282 return reinterpret_cast<ByteArray*>(object)->ByteArraySize(); |
278 } | 283 } |
279 | 284 |
280 INLINE(static int VisitFixedDoubleArray(Map* map, HeapObject* object)) { | 285 INLINE(static int VisitFixedDoubleArray(Map* map, HeapObject* object)) { |
281 int length = reinterpret_cast<FixedDoubleArray*>(object)->length(); | 286 int length = reinterpret_cast<FixedDoubleArray*>(object)->length(); |
282 return FixedDoubleArray::SizeFor(length); | 287 return FixedDoubleArray::SizeFor(length); |
283 } | 288 } |
284 | 289 |
285 INLINE(static int VisitJSObject(Map* map, HeapObject* object)) { | 290 INLINE(static int VisitJSObject(Map* map, HeapObject* object)) { |
286 return JSObjectVisitor::Visit(map, object); | 291 return JSObjectVisitor::Visit(map, object); |
287 } | 292 } |
288 | 293 |
289 INLINE(static int VisitSeqOneByteString(Map* map, HeapObject* object)) { | 294 INLINE(static int VisitSeqOneByteString(Map* map, HeapObject* object)) { |
290 return SeqOneByteString::cast(object) | 295 return SeqOneByteString::cast(object) |
291 ->SeqOneByteStringSize(map->instance_type()); | 296 ->SeqOneByteStringSize(map->instance_type()); |
292 } | 297 } |
293 | 298 |
294 INLINE(static int VisitSeqTwoByteString(Map* map, HeapObject* object)) { | 299 INLINE(static int VisitSeqTwoByteString(Map* map, HeapObject* object)) { |
295 return SeqTwoByteString::cast(object) | 300 return SeqTwoByteString::cast(object) |
296 ->SeqTwoByteStringSize(map->instance_type()); | 301 ->SeqTwoByteStringSize(map->instance_type()); |
297 } | 302 } |
298 | 303 |
299 INLINE(static int VisitFreeSpace(Map* map, HeapObject* object)) { | 304 INLINE(static int VisitFreeSpace(Map* map, HeapObject* object)) { |
300 return FreeSpace::cast(object)->size(); | 305 return FreeSpace::cast(object)->size(); |
301 } | 306 } |
302 | 307 |
303 INLINE(static int VisitBytecodeArray(Map* map, HeapObject* object)); | |
304 | |
305 class DataObjectVisitor { | 308 class DataObjectVisitor { |
306 public: | 309 public: |
307 template <int object_size> | 310 template <int object_size> |
308 static inline int VisitSpecialized(Map* map, HeapObject* object) { | 311 static inline int VisitSpecialized(Map* map, HeapObject* object) { |
309 return object_size; | 312 return object_size; |
310 } | 313 } |
311 | 314 |
312 INLINE(static int Visit(Map* map, HeapObject* object)) { | 315 INLINE(static int Visit(Map* map, HeapObject* object)) { |
313 return map->instance_size(); | 316 return map->instance_size(); |
314 } | 317 } |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 // the next element. Given the head of the list, this function removes dead | 451 // the next element. Given the head of the list, this function removes dead |
449 // elements from the list and if requested records slots for next-element | 452 // elements from the list and if requested records slots for next-element |
450 // pointers. The template parameter T is a WeakListVisitor that defines how to | 453 // pointers. The template parameter T is a WeakListVisitor that defines how to |
451 // access the next-element pointers. | 454 // access the next-element pointers. |
452 template <class T> | 455 template <class T> |
453 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); | 456 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); |
454 } // namespace internal | 457 } // namespace internal |
455 } // namespace v8 | 458 } // namespace v8 |
456 | 459 |
457 #endif // V8_OBJECTS_VISITING_H_ | 460 #endif // V8_OBJECTS_VISITING_H_ |
OLD | NEW |