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/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/heap/spaces.h" | 9 #include "src/heap/spaces.h" |
10 | 10 |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 inline void AddCandidate(JSFunction* function); | 272 inline void AddCandidate(JSFunction* function); |
273 | 273 |
274 void EvictCandidate(SharedFunctionInfo* shared_info); | 274 void EvictCandidate(SharedFunctionInfo* shared_info); |
275 void EvictCandidate(JSFunction* function); | 275 void EvictCandidate(JSFunction* function); |
276 | 276 |
277 void ProcessCandidates() { | 277 void ProcessCandidates() { |
278 ProcessSharedFunctionInfoCandidates(); | 278 ProcessSharedFunctionInfoCandidates(); |
279 ProcessJSFunctionCandidates(); | 279 ProcessJSFunctionCandidates(); |
280 } | 280 } |
281 | 281 |
282 void EvictAllCandidates() { | |
283 EvictJSFunctionCandidates(); | |
284 EvictSharedFunctionInfoCandidates(); | |
285 } | |
286 | |
287 void IteratePointersToFromSpace(ObjectVisitor* v); | 282 void IteratePointersToFromSpace(ObjectVisitor* v); |
288 | 283 |
289 private: | 284 private: |
290 void ProcessJSFunctionCandidates(); | 285 void ProcessJSFunctionCandidates(); |
291 void ProcessSharedFunctionInfoCandidates(); | 286 void ProcessSharedFunctionInfoCandidates(); |
292 void EvictJSFunctionCandidates(); | |
293 void EvictSharedFunctionInfoCandidates(); | |
294 | 287 |
295 static inline JSFunction** GetNextCandidateSlot(JSFunction* candidate); | 288 static inline JSFunction** GetNextCandidateSlot(JSFunction* candidate); |
296 static inline JSFunction* GetNextCandidate(JSFunction* candidate); | 289 static inline JSFunction* GetNextCandidate(JSFunction* candidate); |
297 static inline void SetNextCandidate(JSFunction* candidate, | 290 static inline void SetNextCandidate(JSFunction* candidate, |
298 JSFunction* next_candidate); | 291 JSFunction* next_candidate); |
299 static inline void ClearNextCandidate(JSFunction* candidate, | 292 static inline void ClearNextCandidate(JSFunction* candidate, |
300 Object* undefined); | 293 Object* undefined); |
301 | 294 |
302 static inline SharedFunctionInfo* GetNextCandidate( | 295 static inline SharedFunctionInfo* GetNextCandidate( |
303 SharedFunctionInfo* candidate); | 296 SharedFunctionInfo* candidate); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 static const uint32_t kMultiFreeEncoding = 1; | 357 static const uint32_t kMultiFreeEncoding = 1; |
365 | 358 |
366 static inline bool IsMarked(Object* obj); | 359 static inline bool IsMarked(Object* obj); |
367 static bool IsUnmarkedHeapObjectWithHeap(Heap* heap, Object** p); | 360 static bool IsUnmarkedHeapObjectWithHeap(Heap* heap, Object** p); |
368 | 361 |
369 inline Heap* heap() const { return heap_; } | 362 inline Heap* heap() const { return heap_; } |
370 inline Isolate* isolate() const; | 363 inline Isolate* isolate() const; |
371 | 364 |
372 CodeFlusher* code_flusher() { return code_flusher_; } | 365 CodeFlusher* code_flusher() { return code_flusher_; } |
373 inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; } | 366 inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; } |
374 void EnableCodeFlushing(bool enable); | |
375 | 367 |
376 enum SweeperType { | 368 enum SweeperType { |
377 CONCURRENT_SWEEPING, | 369 CONCURRENT_SWEEPING, |
378 SEQUENTIAL_SWEEPING | 370 SEQUENTIAL_SWEEPING |
379 }; | 371 }; |
380 | 372 |
381 enum SweepingParallelism { SWEEP_ON_MAIN_THREAD, SWEEP_IN_PARALLEL }; | 373 enum SweepingParallelism { SWEEP_ON_MAIN_THREAD, SWEEP_IN_PARALLEL }; |
382 | 374 |
383 #ifdef VERIFY_HEAP | 375 #ifdef VERIFY_HEAP |
384 void VerifyValidStoreAndSlotsBufferEntries(); | 376 void VerifyValidStoreAndSlotsBufferEntries(); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 | 502 |
511 private: | 503 private: |
512 class CompactionTask; | 504 class CompactionTask; |
513 class EvacuateNewSpaceVisitor; | 505 class EvacuateNewSpaceVisitor; |
514 class EvacuateOldSpaceVisitor; | 506 class EvacuateOldSpaceVisitor; |
515 class EvacuateVisitorBase; | 507 class EvacuateVisitorBase; |
516 class HeapObjectVisitor; | 508 class HeapObjectVisitor; |
517 class SweeperTask; | 509 class SweeperTask; |
518 | 510 |
519 explicit MarkCompactCollector(Heap* heap); | 511 explicit MarkCompactCollector(Heap* heap); |
520 ~MarkCompactCollector(); | |
521 | 512 |
522 bool WillBeDeoptimized(Code* code); | 513 bool WillBeDeoptimized(Code* code); |
523 void EvictPopularEvacuationCandidate(Page* page); | 514 void EvictPopularEvacuationCandidate(Page* page); |
524 void ClearInvalidStoreAndSlotsBufferEntries(); | 515 void ClearInvalidStoreAndSlotsBufferEntries(); |
525 | 516 |
526 void StartSweeperThreads(); | 517 void StartSweeperThreads(); |
527 | 518 |
528 void ComputeEvacuationHeuristics(int area_size, | 519 void ComputeEvacuationHeuristics(int area_size, |
529 int* target_fragmentation_percent, | 520 int* target_fragmentation_percent, |
530 int* max_evacuated_bytes); | 521 int* max_evacuated_bytes); |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 private: | 856 private: |
866 MarkCompactCollector* collector_; | 857 MarkCompactCollector* collector_; |
867 }; | 858 }; |
868 | 859 |
869 | 860 |
870 const char* AllocationSpaceName(AllocationSpace space); | 861 const char* AllocationSpaceName(AllocationSpace space); |
871 } // namespace internal | 862 } // namespace internal |
872 } // namespace v8 | 863 } // namespace v8 |
873 | 864 |
874 #endif // V8_HEAP_MARK_COMPACT_H_ | 865 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |