Chromium Code Reviews| 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/layout-descriptor.h" | 9 #include "src/layout-descriptor.h" |
| 10 | 10 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 if (!FLAG_unbox_double_fields || object->map()->HasFastPointerLayout()) { | 208 if (!FLAG_unbox_double_fields || object->map()->HasFastPointerLayout()) { |
| 209 IterateRawPointers(heap, object, start_offset, end_offset); | 209 IterateRawPointers(heap, object, start_offset, end_offset); |
| 210 } else { | 210 } else { |
| 211 IterateBodyUsingLayoutDescriptor(heap, object, start_offset, end_offset); | 211 IterateBodyUsingLayoutDescriptor(heap, object, start_offset, end_offset); |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 | 214 |
| 215 private: | 215 private: |
| 216 INLINE(static void IterateRawPointers(Heap* heap, HeapObject* object, | 216 INLINE(static void IterateRawPointers(Heap* heap, HeapObject* object, |
| 217 int start_offset, int end_offset)) { | 217 int start_offset, int end_offset)) { |
| 218 StaticVisitor::VisitPointers(heap, | 218 StaticVisitor::VisitPointers(heap, object, |
| 219 HeapObject::RawField(object, start_offset), | 219 HeapObject::RawField(object, start_offset), |
| 220 HeapObject::RawField(object, end_offset)); | 220 HeapObject::RawField(object, end_offset)); |
| 221 } | 221 } |
| 222 | 222 |
| 223 static void IterateBodyUsingLayoutDescriptor(Heap* heap, HeapObject* object, | 223 static void IterateBodyUsingLayoutDescriptor(Heap* heap, HeapObject* object, |
| 224 int start_offset, | 224 int start_offset, |
| 225 int end_offset) { | 225 int end_offset) { |
| 226 DCHECK(FLAG_unbox_double_fields); | 226 DCHECK(FLAG_unbox_double_fields); |
| 227 DCHECK(IsAligned(start_offset, kPointerSize) && | 227 DCHECK(IsAligned(start_offset, kPointerSize) && |
| 228 IsAligned(end_offset, kPointerSize)); | 228 IsAligned(end_offset, kPointerSize)); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 290 // inlining and specialization of StaticVisitor::VisitPointers methods). | 290 // inlining and specialization of StaticVisitor::VisitPointers methods). |
| 291 template <typename StaticVisitor> | 291 template <typename StaticVisitor> |
| 292 class StaticNewSpaceVisitor : public StaticVisitorBase { | 292 class StaticNewSpaceVisitor : public StaticVisitorBase { |
| 293 public: | 293 public: |
| 294 static void Initialize(); | 294 static void Initialize(); |
| 295 | 295 |
| 296 INLINE(static int IterateBody(Map* map, HeapObject* obj)) { | 296 INLINE(static int IterateBody(Map* map, HeapObject* obj)) { |
| 297 return table_.GetVisitor(map)(map, obj); | 297 return table_.GetVisitor(map)(map, obj); |
| 298 } | 298 } |
| 299 | 299 |
| 300 INLINE(static void VisitPointers(Heap* heap, Object** start, Object** end)) { | 300 INLINE(static void VisitPointers(Heap* heap, HeapObject* object, |
|
Michael Starzinger
2015/08/04 15:20:13
Is this change for the StaticNewSpaceVisitor reall
Hannes Payer (out of office)
2015/08/04 16:16:21
Unfortunatly, BodyVisitorBase is used by both. We
| |
| 301 Object** start, Object** end)) { | |
| 301 for (Object** p = start; p < end; p++) StaticVisitor::VisitPointer(heap, p); | 302 for (Object** p = start; p < end; p++) StaticVisitor::VisitPointer(heap, p); |
| 302 } | 303 } |
| 303 | 304 |
| 304 private: | 305 private: |
| 305 INLINE(static int VisitJSFunction(Map* map, HeapObject* object)) { | 306 INLINE(static int VisitJSFunction(Map* map, HeapObject* object)) { |
| 306 Heap* heap = map->GetHeap(); | 307 Heap* heap = map->GetHeap(); |
| 307 VisitPointers(heap, | 308 VisitPointers(heap, object, |
| 308 HeapObject::RawField(object, JSFunction::kPropertiesOffset), | 309 HeapObject::RawField(object, JSFunction::kPropertiesOffset), |
| 309 HeapObject::RawField(object, JSFunction::kCodeEntryOffset)); | 310 HeapObject::RawField(object, JSFunction::kCodeEntryOffset)); |
| 310 | 311 |
| 311 // Don't visit code entry. We are using this visitor only during scavenges. | 312 // Don't visit code entry. We are using this visitor only during scavenges. |
| 312 | 313 |
| 313 VisitPointers( | 314 VisitPointers( |
| 314 heap, HeapObject::RawField(object, | 315 heap, object, HeapObject::RawField( |
| 315 JSFunction::kCodeEntryOffset + kPointerSize), | 316 object, JSFunction::kCodeEntryOffset + kPointerSize), |
| 316 HeapObject::RawField(object, JSFunction::kNonWeakFieldsEndOffset)); | 317 HeapObject::RawField(object, JSFunction::kNonWeakFieldsEndOffset)); |
| 317 return JSFunction::kSize; | 318 return JSFunction::kSize; |
| 318 } | 319 } |
| 319 | 320 |
| 320 INLINE(static int VisitByteArray(Map* map, HeapObject* object)) { | 321 INLINE(static int VisitByteArray(Map* map, HeapObject* object)) { |
| 321 return reinterpret_cast<ByteArray*>(object)->ByteArraySize(); | 322 return reinterpret_cast<ByteArray*>(object)->ByteArraySize(); |
| 322 } | 323 } |
| 323 | 324 |
| 324 INLINE(static int VisitBytecodeArray(Map* map, HeapObject* object)) { | 325 INLINE(static int VisitBytecodeArray(Map* map, HeapObject* object)) { |
| 325 return reinterpret_cast<BytecodeArray*>(object)->BytecodeArraySize(); | 326 return reinterpret_cast<BytecodeArray*>(object)->BytecodeArraySize(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 403 class StaticMarkingVisitor : public StaticVisitorBase { | 404 class StaticMarkingVisitor : public StaticVisitorBase { |
| 404 public: | 405 public: |
| 405 static void Initialize(); | 406 static void Initialize(); |
| 406 | 407 |
| 407 INLINE(static void IterateBody(Map* map, HeapObject* obj)) { | 408 INLINE(static void IterateBody(Map* map, HeapObject* obj)) { |
| 408 table_.GetVisitor(map)(map, obj); | 409 table_.GetVisitor(map)(map, obj); |
| 409 } | 410 } |
| 410 | 411 |
| 411 INLINE(static void VisitPropertyCell(Map* map, HeapObject* object)); | 412 INLINE(static void VisitPropertyCell(Map* map, HeapObject* object)); |
| 412 INLINE(static void VisitWeakCell(Map* map, HeapObject* object)); | 413 INLINE(static void VisitWeakCell(Map* map, HeapObject* object)); |
| 413 INLINE(static void VisitCodeEntry(Heap* heap, Address entry_address)); | 414 INLINE(static void VisitCodeEntry(Heap* heap, HeapObject* object, |
| 415 Address entry_address)); | |
| 414 INLINE(static void VisitEmbeddedPointer(Heap* heap, RelocInfo* rinfo)); | 416 INLINE(static void VisitEmbeddedPointer(Heap* heap, RelocInfo* rinfo)); |
| 415 INLINE(static void VisitCell(Heap* heap, RelocInfo* rinfo)); | 417 INLINE(static void VisitCell(Heap* heap, RelocInfo* rinfo)); |
| 416 INLINE(static void VisitDebugTarget(Heap* heap, RelocInfo* rinfo)); | 418 INLINE(static void VisitDebugTarget(Heap* heap, RelocInfo* rinfo)); |
| 417 INLINE(static void VisitCodeTarget(Heap* heap, RelocInfo* rinfo)); | 419 INLINE(static void VisitCodeTarget(Heap* heap, RelocInfo* rinfo)); |
| 418 INLINE(static void VisitCodeAgeSequence(Heap* heap, RelocInfo* rinfo)); | 420 INLINE(static void VisitCodeAgeSequence(Heap* heap, RelocInfo* rinfo)); |
| 419 INLINE(static void VisitExternalReference(RelocInfo* rinfo)) {} | 421 INLINE(static void VisitExternalReference(RelocInfo* rinfo)) {} |
| 420 INLINE(static void VisitInternalReference(RelocInfo* rinfo)) {} | 422 INLINE(static void VisitInternalReference(RelocInfo* rinfo)) {} |
| 421 INLINE(static void VisitRuntimeEntry(RelocInfo* rinfo)) {} | 423 INLINE(static void VisitRuntimeEntry(RelocInfo* rinfo)) {} |
| 422 // Skip the weak next code link in a code object. | 424 // Skip the weak next code link in a code object. |
| 423 INLINE(static void VisitNextCodeLink(Heap* heap, Object** slot)) {} | 425 INLINE(static void VisitNextCodeLink(Heap* heap, Object** slot)) {} |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 494 // the next element. Given the head of the list, this function removes dead | 496 // the next element. Given the head of the list, this function removes dead |
| 495 // elements from the list and if requested records slots for next-element | 497 // elements from the list and if requested records slots for next-element |
| 496 // pointers. The template parameter T is a WeakListVisitor that defines how to | 498 // pointers. The template parameter T is a WeakListVisitor that defines how to |
| 497 // access the next-element pointers. | 499 // access the next-element pointers. |
| 498 template <class T> | 500 template <class T> |
| 499 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); | 501 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); |
| 500 } | 502 } |
| 501 } // namespace v8::internal | 503 } // namespace v8::internal |
| 502 | 504 |
| 503 #endif // V8_OBJECTS_VISITING_H_ | 505 #endif // V8_OBJECTS_VISITING_H_ |
| OLD | NEW |