| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 V(Oddball) \ | 73 V(Oddball) \ |
| 74 V(Code) \ | 74 V(Code) \ |
| 75 V(Map) \ | 75 V(Map) \ |
| 76 V(Cell) \ | 76 V(Cell) \ |
| 77 V(PropertyCell) \ | 77 V(PropertyCell) \ |
| 78 V(WeakCell) \ | 78 V(WeakCell) \ |
| 79 V(SharedFunctionInfo) \ | 79 V(SharedFunctionInfo) \ |
| 80 V(JSFunction) \ | 80 V(JSFunction) \ |
| 81 V(JSWeakCollection) \ | 81 V(JSWeakCollection) \ |
| 82 V(JSArrayBuffer) \ | 82 V(JSArrayBuffer) \ |
| 83 V(JSTypedArray) \ | |
| 84 V(JSDataView) \ | |
| 85 V(JSRegExp) | 83 V(JSRegExp) |
| 86 | 84 |
| 87 // For data objects, JS objects and structs along with generic visitor which | 85 // For data objects, JS objects and structs along with generic visitor which |
| 88 // can visit object of any size we provide visitors specialized by | 86 // can visit object of any size we provide visitors specialized by |
| 89 // object size in words. | 87 // object size in words. |
| 90 // Ids of specialized visitors are declared in a linear order (without | 88 // Ids of specialized visitors are declared in a linear order (without |
| 91 // holes) starting from the id of visitor specialized for 2 words objects | 89 // holes) starting from the id of visitor specialized for 2 words objects |
| 92 // (base visitor id) and ending with the id of generic visitor. | 90 // (base visitor id) and ending with the id of generic visitor. |
| 93 // Method GetVisitorIdForSize depends on this ordering to calculate visitor | 91 // Method GetVisitorIdForSize depends on this ordering to calculate visitor |
| 94 // id of specialized visitor from given instance size, base visitor id and | 92 // id of specialized visitor from given instance size, base visitor id and |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 INLINE(static int VisitSeqTwoByteString(Map* map, HeapObject* object)) { | 284 INLINE(static int VisitSeqTwoByteString(Map* map, HeapObject* object)) { |
| 287 return SeqTwoByteString::cast(object) | 285 return SeqTwoByteString::cast(object) |
| 288 ->SeqTwoByteStringSize(map->instance_type()); | 286 ->SeqTwoByteStringSize(map->instance_type()); |
| 289 } | 287 } |
| 290 | 288 |
| 291 INLINE(static int VisitFreeSpace(Map* map, HeapObject* object)) { | 289 INLINE(static int VisitFreeSpace(Map* map, HeapObject* object)) { |
| 292 return FreeSpace::cast(object)->size(); | 290 return FreeSpace::cast(object)->size(); |
| 293 } | 291 } |
| 294 | 292 |
| 295 INLINE(static int VisitJSArrayBuffer(Map* map, HeapObject* object)); | 293 INLINE(static int VisitJSArrayBuffer(Map* map, HeapObject* object)); |
| 296 INLINE(static int VisitJSTypedArray(Map* map, HeapObject* object)); | |
| 297 INLINE(static int VisitJSDataView(Map* map, HeapObject* object)); | |
| 298 INLINE(static int VisitBytecodeArray(Map* map, HeapObject* object)); | 294 INLINE(static int VisitBytecodeArray(Map* map, HeapObject* object)); |
| 299 | 295 |
| 300 class DataObjectVisitor { | 296 class DataObjectVisitor { |
| 301 public: | 297 public: |
| 302 template <int object_size> | 298 template <int object_size> |
| 303 static inline int VisitSpecialized(Map* map, HeapObject* object) { | 299 static inline int VisitSpecialized(Map* map, HeapObject* object) { |
| 304 return object_size; | 300 return object_size; |
| 305 } | 301 } |
| 306 | 302 |
| 307 INLINE(static int Visit(Map* map, HeapObject* object)) { | 303 INLINE(static int Visit(Map* map, HeapObject* object)) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 | 362 |
| 367 protected: | 363 protected: |
| 368 INLINE(static void VisitMap(Map* map, HeapObject* object)); | 364 INLINE(static void VisitMap(Map* map, HeapObject* object)); |
| 369 INLINE(static void VisitCode(Map* map, HeapObject* object)); | 365 INLINE(static void VisitCode(Map* map, HeapObject* object)); |
| 370 INLINE(static void VisitSharedFunctionInfo(Map* map, HeapObject* object)); | 366 INLINE(static void VisitSharedFunctionInfo(Map* map, HeapObject* object)); |
| 371 INLINE(static void VisitAllocationSite(Map* map, HeapObject* object)); | 367 INLINE(static void VisitAllocationSite(Map* map, HeapObject* object)); |
| 372 INLINE(static void VisitWeakCollection(Map* map, HeapObject* object)); | 368 INLINE(static void VisitWeakCollection(Map* map, HeapObject* object)); |
| 373 INLINE(static void VisitJSFunction(Map* map, HeapObject* object)); | 369 INLINE(static void VisitJSFunction(Map* map, HeapObject* object)); |
| 374 INLINE(static void VisitJSRegExp(Map* map, HeapObject* object)); | 370 INLINE(static void VisitJSRegExp(Map* map, HeapObject* object)); |
| 375 INLINE(static void VisitJSArrayBuffer(Map* map, HeapObject* object)); | 371 INLINE(static void VisitJSArrayBuffer(Map* map, HeapObject* object)); |
| 376 INLINE(static void VisitJSTypedArray(Map* map, HeapObject* object)); | |
| 377 INLINE(static void VisitJSDataView(Map* map, HeapObject* object)); | |
| 378 INLINE(static void VisitNativeContext(Map* map, HeapObject* object)); | 372 INLINE(static void VisitNativeContext(Map* map, HeapObject* object)); |
| 379 INLINE(static void VisitBytecodeArray(Map* map, HeapObject* object)); | 373 INLINE(static void VisitBytecodeArray(Map* map, HeapObject* object)); |
| 380 | 374 |
| 381 // Mark pointers in a Map and its TransitionArray together, possibly | 375 // Mark pointers in a Map and its TransitionArray together, possibly |
| 382 // treating transitions or back pointers weak. | 376 // treating transitions or back pointers weak. |
| 383 static void MarkMapContents(Heap* heap, Map* map); | 377 static void MarkMapContents(Heap* heap, Map* map); |
| 384 static void MarkTransitionArray(Heap* heap, TransitionArray* transitions); | 378 static void MarkTransitionArray(Heap* heap, TransitionArray* transitions); |
| 385 | 379 |
| 386 // Mark pointers in the optimized code map that should act as strong | 380 // Mark pointers in the optimized code map that should act as strong |
| 387 // references, possibly treating some entries weak. | 381 // references, possibly treating some entries weak. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 // the next element. Given the head of the list, this function removes dead | 431 // the next element. Given the head of the list, this function removes dead |
| 438 // elements from the list and if requested records slots for next-element | 432 // elements from the list and if requested records slots for next-element |
| 439 // pointers. The template parameter T is a WeakListVisitor that defines how to | 433 // pointers. The template parameter T is a WeakListVisitor that defines how to |
| 440 // access the next-element pointers. | 434 // access the next-element pointers. |
| 441 template <class T> | 435 template <class T> |
| 442 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); | 436 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); |
| 443 } // namespace internal | 437 } // namespace internal |
| 444 } // namespace v8 | 438 } // namespace v8 |
| 445 | 439 |
| 446 #endif // V8_OBJECTS_VISITING_H_ | 440 #endif // V8_OBJECTS_VISITING_H_ |
| OLD | NEW |