| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 244 |
| 245 INLINE(static int IterateBody(Map* map, HeapObject* obj)) { | 245 INLINE(static int IterateBody(Map* map, HeapObject* obj)) { |
| 246 return table_.GetVisitor(map)(map, obj); | 246 return table_.GetVisitor(map)(map, obj); |
| 247 } | 247 } |
| 248 | 248 |
| 249 INLINE(static void VisitPointers(Heap* heap, HeapObject* object, | 249 INLINE(static void VisitPointers(Heap* heap, HeapObject* object, |
| 250 Object** start, Object** end)) { | 250 Object** start, Object** end)) { |
| 251 for (Object** p = start; p < end; p++) StaticVisitor::VisitPointer(heap, p); | 251 for (Object** p = start; p < end; p++) StaticVisitor::VisitPointer(heap, p); |
| 252 } | 252 } |
| 253 | 253 |
| 254 private: | 254 // Although we are using the JSFunction body descriptor which does not |
| 255 INLINE(static int VisitJSFunction(Map* map, HeapObject* object)) { | 255 // visit the code entry, compiler wants it to be accessible. |
| 256 Heap* heap = map->GetHeap(); | 256 // See JSFunction::BodyDescriptorImpl. |
| 257 VisitPointers(heap, object, | 257 INLINE(static void VisitCodeEntry(Heap* heap, HeapObject* object, |
| 258 HeapObject::RawField(object, JSFunction::kPropertiesOffset), | 258 Address entry_address)) { |
| 259 HeapObject::RawField(object, JSFunction::kCodeEntryOffset)); | 259 UNREACHABLE(); |
| 260 | |
| 261 // Don't visit code entry. We are using this visitor only during scavenges. | |
| 262 | |
| 263 VisitPointers( | |
| 264 heap, object, HeapObject::RawField( | |
| 265 object, JSFunction::kCodeEntryOffset + kPointerSize), | |
| 266 HeapObject::RawField(object, JSFunction::kNonWeakFieldsEndOffset)); | |
| 267 return JSFunction::kSize; | |
| 268 } | 260 } |
| 269 | 261 |
| 262 private: |
| 270 INLINE(static int VisitByteArray(Map* map, HeapObject* object)) { | 263 INLINE(static int VisitByteArray(Map* map, HeapObject* object)) { |
| 271 return reinterpret_cast<ByteArray*>(object)->ByteArraySize(); | 264 return reinterpret_cast<ByteArray*>(object)->ByteArraySize(); |
| 272 } | 265 } |
| 273 | 266 |
| 274 INLINE(static int VisitFixedDoubleArray(Map* map, HeapObject* object)) { | 267 INLINE(static int VisitFixedDoubleArray(Map* map, HeapObject* object)) { |
| 275 int length = reinterpret_cast<FixedDoubleArray*>(object)->length(); | 268 int length = reinterpret_cast<FixedDoubleArray*>(object)->length(); |
| 276 return FixedDoubleArray::SizeFor(length); | 269 return FixedDoubleArray::SizeFor(length); |
| 277 } | 270 } |
| 278 | 271 |
| 279 INLINE(static int VisitFixedTypedArray(Map* map, HeapObject* object)) { | 272 INLINE(static int VisitFixedTypedArray(Map* map, HeapObject* object)) { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 static void MarkOptimizedCodeMap(Heap* heap, FixedArray* code_map); | 391 static void MarkOptimizedCodeMap(Heap* heap, FixedArray* code_map); |
| 399 | 392 |
| 400 // Code flushing support. | 393 // Code flushing support. |
| 401 INLINE(static bool IsFlushable(Heap* heap, JSFunction* function)); | 394 INLINE(static bool IsFlushable(Heap* heap, JSFunction* function)); |
| 402 INLINE(static bool IsFlushable(Heap* heap, SharedFunctionInfo* shared_info)); | 395 INLINE(static bool IsFlushable(Heap* heap, SharedFunctionInfo* shared_info)); |
| 403 | 396 |
| 404 // Helpers used by code flushing support that visit pointer fields and treat | 397 // Helpers used by code flushing support that visit pointer fields and treat |
| 405 // references to code objects either strongly or weakly. | 398 // references to code objects either strongly or weakly. |
| 406 static void VisitSharedFunctionInfoStrongCode(Heap* heap, HeapObject* object); | 399 static void VisitSharedFunctionInfoStrongCode(Heap* heap, HeapObject* object); |
| 407 static void VisitSharedFunctionInfoWeakCode(Heap* heap, HeapObject* object); | 400 static void VisitSharedFunctionInfoWeakCode(Heap* heap, HeapObject* object); |
| 408 static void VisitJSFunctionStrongCode(Heap* heap, HeapObject* object); | 401 static void VisitJSFunctionStrongCode(Map* map, HeapObject* object); |
| 409 static void VisitJSFunctionWeakCode(Heap* heap, HeapObject* object); | 402 static void VisitJSFunctionWeakCode(Map* map, HeapObject* object); |
| 410 | 403 |
| 411 class DataObjectVisitor { | 404 class DataObjectVisitor { |
| 412 public: | 405 public: |
| 413 template <int size> | 406 template <int size> |
| 414 static inline void VisitSpecialized(Map* map, HeapObject* object) {} | 407 static inline void VisitSpecialized(Map* map, HeapObject* object) {} |
| 415 | 408 |
| 416 INLINE(static void Visit(Map* map, HeapObject* object)) {} | 409 INLINE(static void Visit(Map* map, HeapObject* object)) {} |
| 417 }; | 410 }; |
| 418 | 411 |
| 419 typedef FlexibleBodyVisitor<StaticVisitor, FixedArray::BodyDescriptor, void> | 412 typedef FlexibleBodyVisitor<StaticVisitor, FixedArray::BodyDescriptor, void> |
| (...skipping 23 matching lines...) Expand all Loading... |
| 443 // the next element. Given the head of the list, this function removes dead | 436 // the next element. Given the head of the list, this function removes dead |
| 444 // elements from the list and if requested records slots for next-element | 437 // elements from the list and if requested records slots for next-element |
| 445 // pointers. The template parameter T is a WeakListVisitor that defines how to | 438 // pointers. The template parameter T is a WeakListVisitor that defines how to |
| 446 // access the next-element pointers. | 439 // access the next-element pointers. |
| 447 template <class T> | 440 template <class T> |
| 448 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); | 441 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); |
| 449 } // namespace internal | 442 } // namespace internal |
| 450 } // namespace v8 | 443 } // namespace v8 |
| 451 | 444 |
| 452 #endif // V8_OBJECTS_VISITING_H_ | 445 #endif // V8_OBJECTS_VISITING_H_ |
| OLD | NEW |