| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 | 367 |
| 368 static bool AddTo(SlotsBufferAllocator* allocator, | 368 static bool AddTo(SlotsBufferAllocator* allocator, |
| 369 SlotsBuffer** buffer_address, | 369 SlotsBuffer** buffer_address, |
| 370 SlotType type, | 370 SlotType type, |
| 371 Address addr, | 371 Address addr, |
| 372 AdditionMode mode); | 372 AdditionMode mode); |
| 373 | 373 |
| 374 static const int kNumberOfElements = 1021; | 374 static const int kNumberOfElements = 1021; |
| 375 | 375 |
| 376 private: | 376 private: |
| 377 static const int kChainLengthThreshold = 6; | 377 static const int kChainLengthThreshold = 15; |
| 378 | 378 |
| 379 intptr_t idx_; | 379 intptr_t idx_; |
| 380 intptr_t chain_length_; | 380 intptr_t chain_length_; |
| 381 SlotsBuffer* next_; | 381 SlotsBuffer* next_; |
| 382 ObjectSlot slots_[kNumberOfElements]; | 382 ObjectSlot slots_[kNumberOfElements]; |
| 383 }; | 383 }; |
| 384 | 384 |
| 385 | 385 |
| 386 // Defined in isolate.h. | 386 // Defined in isolate.h. |
| 387 class ThreadLocalTop; | 387 class ThreadLocalTop; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 | 434 |
| 435 void AddEvacuationCandidate(Page* p); | 435 void AddEvacuationCandidate(Page* p); |
| 436 | 436 |
| 437 // Prepares for GC by resetting relocation info in old and map spaces and | 437 // Prepares for GC by resetting relocation info in old and map spaces and |
| 438 // choosing spaces to compact. | 438 // choosing spaces to compact. |
| 439 void Prepare(GCTracer* tracer); | 439 void Prepare(GCTracer* tracer); |
| 440 | 440 |
| 441 // Performs a global garbage collection. | 441 // Performs a global garbage collection. |
| 442 void CollectGarbage(); | 442 void CollectGarbage(); |
| 443 | 443 |
| 444 bool StartCompaction(); | 444 enum CompactionMode { |
| 445 INCREMENTAL_COMPACTION, |
| 446 NON_INCREMENTAL_COMPACTION |
| 447 }; |
| 448 |
| 449 bool StartCompaction(CompactionMode mode); |
| 445 | 450 |
| 446 void AbortCompaction(); | 451 void AbortCompaction(); |
| 447 | 452 |
| 448 // During a full GC, there is a stack-allocated GCTracer that is used for | 453 // During a full GC, there is a stack-allocated GCTracer that is used for |
| 449 // bookkeeping information. Return a pointer to that tracer. | 454 // bookkeeping information. Return a pointer to that tracer. |
| 450 GCTracer* tracer() { return tracer_; } | 455 GCTracer* tracer() { return tracer_; } |
| 451 | 456 |
| 452 #ifdef DEBUG | 457 #ifdef DEBUG |
| 453 // Checks whether performing mark-compact collection. | 458 // Checks whether performing mark-compact collection. |
| 454 bool in_use() { return state_ > PREPARE_GC; } | 459 bool in_use() { return state_ > PREPARE_GC; } |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 }; | 570 }; |
| 566 | 571 |
| 567 // The current stage of the collector. | 572 // The current stage of the collector. |
| 568 CollectorState state_; | 573 CollectorState state_; |
| 569 #endif | 574 #endif |
| 570 | 575 |
| 571 // Global flag that forces sweeping to be precise, so we can traverse the | 576 // Global flag that forces sweeping to be precise, so we can traverse the |
| 572 // heap. | 577 // heap. |
| 573 bool sweep_precisely_; | 578 bool sweep_precisely_; |
| 574 | 579 |
| 580 bool reduce_memory_footprint_; |
| 581 |
| 575 // True if we are collecting slots to perform evacuation from evacuation | 582 // True if we are collecting slots to perform evacuation from evacuation |
| 576 // candidates. | 583 // candidates. |
| 577 bool compacting_; | 584 bool compacting_; |
| 578 | 585 |
| 579 bool was_marked_incrementally_; | 586 bool was_marked_incrementally_; |
| 580 | 587 |
| 581 bool collect_maps_; | 588 bool collect_maps_; |
| 582 | 589 |
| 583 bool flush_monomorphic_ics_; | 590 bool flush_monomorphic_ics_; |
| 584 | 591 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 | 766 |
| 760 friend class Heap; | 767 friend class Heap; |
| 761 }; | 768 }; |
| 762 | 769 |
| 763 | 770 |
| 764 const char* AllocationSpaceName(AllocationSpace space); | 771 const char* AllocationSpaceName(AllocationSpace space); |
| 765 | 772 |
| 766 } } // namespace v8::internal | 773 } } // namespace v8::internal |
| 767 | 774 |
| 768 #endif // V8_MARK_COMPACT_H_ | 775 #endif // V8_MARK_COMPACT_H_ |
| OLD | NEW |