| 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_HEAP_MARK_COMPACT_H_ | 5 #ifndef V8_HEAP_MARK_COMPACT_H_ | 
| 6 #define V8_HEAP_MARK_COMPACT_H_ | 6 #define V8_HEAP_MARK_COMPACT_H_ | 
| 7 | 7 | 
| 8 #include "src/heap/spaces.h" | 8 #include "src/heap/spaces.h" | 
| 9 | 9 | 
| 10 namespace v8 { | 10 namespace v8 { | 
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 537   static inline bool IsMarked(Object* obj); | 537   static inline bool IsMarked(Object* obj); | 
| 538 | 538 | 
| 539   inline Heap* heap() const { return heap_; } | 539   inline Heap* heap() const { return heap_; } | 
| 540   inline Isolate* isolate() const; | 540   inline Isolate* isolate() const; | 
| 541 | 541 | 
| 542   CodeFlusher* code_flusher() { return code_flusher_; } | 542   CodeFlusher* code_flusher() { return code_flusher_; } | 
| 543   inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; } | 543   inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; } | 
| 544   void EnableCodeFlushing(bool enable); | 544   void EnableCodeFlushing(bool enable); | 
| 545 | 545 | 
| 546   enum SweeperType { | 546   enum SweeperType { | 
| 547     PARALLEL_CONSERVATIVE, | 547     PARALLEL_SWEEPING, | 
| 548     CONCURRENT_CONSERVATIVE, | 548     CONCURRENT_SWEEPING, | 
| 549     PARALLEL_PRECISE, | 549     SEQUENTIAL_SWEEPING | 
| 550     CONCURRENT_PRECISE, |  | 
| 551     PRECISE |  | 
| 552   }; | 550   }; | 
| 553 | 551 | 
| 554   enum SweepingParallelism { SWEEP_ON_MAIN_THREAD, SWEEP_IN_PARALLEL }; | 552   enum SweepingParallelism { SWEEP_ON_MAIN_THREAD, SWEEP_IN_PARALLEL }; | 
| 555 | 553 | 
| 556 #ifdef VERIFY_HEAP | 554 #ifdef VERIFY_HEAP | 
| 557   void VerifyMarkbitsAreClean(); | 555   void VerifyMarkbitsAreClean(); | 
| 558   static void VerifyMarkbitsAreClean(PagedSpace* space); | 556   static void VerifyMarkbitsAreClean(PagedSpace* space); | 
| 559   static void VerifyMarkbitsAreClean(NewSpace* space); | 557   static void VerifyMarkbitsAreClean(NewSpace* space); | 
| 560   void VerifyWeakEmbeddedObjectsInCode(); | 558   void VerifyWeakEmbeddedObjectsInCode(); | 
| 561   void VerifyOmittedMapChecks(); | 559   void VerifyOmittedMapChecks(); | 
| 562 #endif | 560 #endif | 
| 563 | 561 | 
| 564   // Sweep a single page from the given space conservatively. |  | 
| 565   // Returns the size of the biggest continuous freed memory chunk in bytes. |  | 
| 566   template <SweepingParallelism type> |  | 
| 567   static int SweepConservatively(PagedSpace* space, FreeList* free_list, |  | 
| 568                                  Page* p); |  | 
| 569 |  | 
| 570   INLINE(static bool ShouldSkipEvacuationSlotRecording(Object** anchor)) { | 562   INLINE(static bool ShouldSkipEvacuationSlotRecording(Object** anchor)) { | 
| 571     return Page::FromAddress(reinterpret_cast<Address>(anchor)) | 563     return Page::FromAddress(reinterpret_cast<Address>(anchor)) | 
| 572         ->ShouldSkipEvacuationSlotRecording(); | 564         ->ShouldSkipEvacuationSlotRecording(); | 
| 573   } | 565   } | 
| 574 | 566 | 
| 575   INLINE(static bool ShouldSkipEvacuationSlotRecording(Object* host)) { | 567   INLINE(static bool ShouldSkipEvacuationSlotRecording(Object* host)) { | 
| 576     return Page::FromAddress(reinterpret_cast<Address>(host)) | 568     return Page::FromAddress(reinterpret_cast<Address>(host)) | 
| 577         ->ShouldSkipEvacuationSlotRecording(); | 569         ->ShouldSkipEvacuationSlotRecording(); | 
| 578   } | 570   } | 
| 579 | 571 | 
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 686     SWEEP_SPACES, | 678     SWEEP_SPACES, | 
| 687     ENCODE_FORWARDING_ADDRESSES, | 679     ENCODE_FORWARDING_ADDRESSES, | 
| 688     UPDATE_POINTERS, | 680     UPDATE_POINTERS, | 
| 689     RELOCATE_OBJECTS | 681     RELOCATE_OBJECTS | 
| 690   }; | 682   }; | 
| 691 | 683 | 
| 692   // The current stage of the collector. | 684   // The current stage of the collector. | 
| 693   CollectorState state_; | 685   CollectorState state_; | 
| 694 #endif | 686 #endif | 
| 695 | 687 | 
| 696   // Global flag that forces sweeping to be precise, so we can traverse the |  | 
| 697   // heap. |  | 
| 698   bool sweep_precisely_; |  | 
| 699 |  | 
| 700   bool reduce_memory_footprint_; | 688   bool reduce_memory_footprint_; | 
| 701 | 689 | 
| 702   bool abort_incremental_marking_; | 690   bool abort_incremental_marking_; | 
| 703 | 691 | 
| 704   MarkingParity marking_parity_; | 692   MarkingParity marking_parity_; | 
| 705 | 693 | 
| 706   // True if we are collecting slots to perform evacuation from evacuation | 694   // True if we are collecting slots to perform evacuation from evacuation | 
| 707   // candidates. | 695   // candidates. | 
| 708   bool compacting_; | 696   bool compacting_; | 
| 709 | 697 | 
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 956  private: | 944  private: | 
| 957   MarkCompactCollector* collector_; | 945   MarkCompactCollector* collector_; | 
| 958 }; | 946 }; | 
| 959 | 947 | 
| 960 | 948 | 
| 961 const char* AllocationSpaceName(AllocationSpace space); | 949 const char* AllocationSpaceName(AllocationSpace space); | 
| 962 } | 950 } | 
| 963 }  // namespace v8::internal | 951 }  // namespace v8::internal | 
| 964 | 952 | 
| 965 #endif  // V8_HEAP_MARK_COMPACT_H_ | 953 #endif  // V8_HEAP_MARK_COMPACT_H_ | 
| OLD | NEW | 
|---|