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 "allocation.h" | 8 #include "allocation.h" |
9 | 9 |
10 // This file provides base classes and auxiliary methods for defining | 10 // This file provides base classes and auxiliary methods for defining |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 V(ConsString) \ | 66 V(ConsString) \ |
67 V(SlicedString) \ | 67 V(SlicedString) \ |
68 V(Symbol) \ | 68 V(Symbol) \ |
69 V(Oddball) \ | 69 V(Oddball) \ |
70 V(Code) \ | 70 V(Code) \ |
71 V(Map) \ | 71 V(Map) \ |
72 V(Cell) \ | 72 V(Cell) \ |
73 V(PropertyCell) \ | 73 V(PropertyCell) \ |
74 V(SharedFunctionInfo) \ | 74 V(SharedFunctionInfo) \ |
75 V(JSFunction) \ | 75 V(JSFunction) \ |
76 V(JSWeakMap) \ | 76 V(JSWeakCollection) \ |
77 V(JSWeakSet) \ | |
78 V(JSArrayBuffer) \ | 77 V(JSArrayBuffer) \ |
79 V(JSTypedArray) \ | 78 V(JSTypedArray) \ |
80 V(JSDataView) \ | 79 V(JSDataView) \ |
81 V(JSRegExp) | 80 V(JSRegExp) |
82 | 81 |
83 // For data objects, JS objects and structs along with generic visitor which | 82 // For data objects, JS objects and structs along with generic visitor which |
84 // can visit object of any size we provide visitors specialized by | 83 // can visit object of any size we provide visitors specialized by |
85 // object size in words. | 84 // object size in words. |
86 // Ids of specialized visitors are declared in a linear order (without | 85 // Ids of specialized visitors are declared in a linear order (without |
87 // holes) starting from the id of visitor specialized for 2 words objects | 86 // holes) starting from the id of visitor specialized for 2 words objects |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 template<typename StaticVisitor> | 374 template<typename StaticVisitor> |
376 class StaticMarkingVisitor : public StaticVisitorBase { | 375 class StaticMarkingVisitor : public StaticVisitorBase { |
377 public: | 376 public: |
378 static void Initialize(); | 377 static void Initialize(); |
379 | 378 |
380 INLINE(static void IterateBody(Map* map, HeapObject* obj)) { | 379 INLINE(static void IterateBody(Map* map, HeapObject* obj)) { |
381 table_.GetVisitor(map)(map, obj); | 380 table_.GetVisitor(map)(map, obj); |
382 } | 381 } |
383 | 382 |
384 INLINE(static void VisitPropertyCell(Map* map, HeapObject* object)); | 383 INLINE(static void VisitPropertyCell(Map* map, HeapObject* object)); |
385 INLINE(static void VisitAllocationSite(Map* map, HeapObject* object)); | |
386 INLINE(static void VisitCodeEntry(Heap* heap, Address entry_address)); | 384 INLINE(static void VisitCodeEntry(Heap* heap, Address entry_address)); |
387 INLINE(static void VisitEmbeddedPointer(Heap* heap, RelocInfo* rinfo)); | 385 INLINE(static void VisitEmbeddedPointer(Heap* heap, RelocInfo* rinfo)); |
388 INLINE(static void VisitCell(Heap* heap, RelocInfo* rinfo)); | 386 INLINE(static void VisitCell(Heap* heap, RelocInfo* rinfo)); |
389 INLINE(static void VisitDebugTarget(Heap* heap, RelocInfo* rinfo)); | 387 INLINE(static void VisitDebugTarget(Heap* heap, RelocInfo* rinfo)); |
390 INLINE(static void VisitCodeTarget(Heap* heap, RelocInfo* rinfo)); | 388 INLINE(static void VisitCodeTarget(Heap* heap, RelocInfo* rinfo)); |
391 INLINE(static void VisitCodeAgeSequence(Heap* heap, RelocInfo* rinfo)); | 389 INLINE(static void VisitCodeAgeSequence(Heap* heap, RelocInfo* rinfo)); |
392 INLINE(static void VisitExternalReference(RelocInfo* rinfo)) { } | 390 INLINE(static void VisitExternalReference(RelocInfo* rinfo)) { } |
393 INLINE(static void VisitRuntimeEntry(RelocInfo* rinfo)) { } | 391 INLINE(static void VisitRuntimeEntry(RelocInfo* rinfo)) { } |
394 // Skip the weak next code link in a code object. | 392 // Skip the weak next code link in a code object. |
395 INLINE(static void VisitNextCodeLink(Heap* heap, Object** slot)) { } | 393 INLINE(static void VisitNextCodeLink(Heap* heap, Object** slot)) { } |
396 | 394 |
397 // TODO(mstarzinger): This should be made protected once refactoring is done. | 395 // TODO(mstarzinger): This should be made protected once refactoring is done. |
398 // Mark non-optimize code for functions inlined into the given optimized | 396 // Mark non-optimize code for functions inlined into the given optimized |
399 // code. This will prevent it from being flushed. | 397 // code. This will prevent it from being flushed. |
400 static void MarkInlinedFunctionsCode(Heap* heap, Code* code); | 398 static void MarkInlinedFunctionsCode(Heap* heap, Code* code); |
401 | 399 |
402 protected: | 400 protected: |
403 INLINE(static void VisitMap(Map* map, HeapObject* object)); | 401 INLINE(static void VisitMap(Map* map, HeapObject* object)); |
404 INLINE(static void VisitCode(Map* map, HeapObject* object)); | 402 INLINE(static void VisitCode(Map* map, HeapObject* object)); |
405 INLINE(static void VisitSharedFunctionInfo(Map* map, HeapObject* object)); | 403 INLINE(static void VisitSharedFunctionInfo(Map* map, HeapObject* object)); |
406 INLINE(static void VisitConstantPoolArray(Map* map, HeapObject* object)); | 404 INLINE(static void VisitConstantPoolArray(Map* map, HeapObject* object)); |
| 405 INLINE(static void VisitAllocationSite(Map* map, HeapObject* object)); |
| 406 INLINE(static void VisitWeakCollection(Map* map, HeapObject* object)); |
407 INLINE(static void VisitJSFunction(Map* map, HeapObject* object)); | 407 INLINE(static void VisitJSFunction(Map* map, HeapObject* object)); |
408 INLINE(static void VisitJSRegExp(Map* map, HeapObject* object)); | 408 INLINE(static void VisitJSRegExp(Map* map, HeapObject* object)); |
409 INLINE(static void VisitJSArrayBuffer(Map* map, HeapObject* object)); | 409 INLINE(static void VisitJSArrayBuffer(Map* map, HeapObject* object)); |
410 INLINE(static void VisitJSTypedArray(Map* map, HeapObject* object)); | 410 INLINE(static void VisitJSTypedArray(Map* map, HeapObject* object)); |
411 INLINE(static void VisitJSDataView(Map* map, HeapObject* object)); | 411 INLINE(static void VisitJSDataView(Map* map, HeapObject* object)); |
412 INLINE(static void VisitNativeContext(Map* map, HeapObject* object)); | 412 INLINE(static void VisitNativeContext(Map* map, HeapObject* object)); |
413 | 413 |
414 // Mark pointers in a Map and its TransitionArray together, possibly | 414 // Mark pointers in a Map and its TransitionArray together, possibly |
415 // treating transitions or back pointers weak. | 415 // treating transitions or back pointers weak. |
416 static void MarkMapContents(Heap* heap, Map* map); | 416 static void MarkMapContents(Heap* heap, Map* map); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 // the next element. Given the head of the list, this function removes dead | 467 // the next element. Given the head of the list, this function removes dead |
468 // elements from the list and if requested records slots for next-element | 468 // elements from the list and if requested records slots for next-element |
469 // pointers. The template parameter T is a WeakListVisitor that defines how to | 469 // pointers. The template parameter T is a WeakListVisitor that defines how to |
470 // access the next-element pointers. | 470 // access the next-element pointers. |
471 template <class T> | 471 template <class T> |
472 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); | 472 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); |
473 | 473 |
474 } } // namespace v8::internal | 474 } } // namespace v8::internal |
475 | 475 |
476 #endif // V8_OBJECTS_VISITING_H_ | 476 #endif // V8_OBJECTS_VISITING_H_ |
OLD | NEW |