| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 RELOCATED_CODE_OBJECT, | 317 RELOCATED_CODE_OBJECT, |
| 318 CODE_TARGET_SLOT, | 318 CODE_TARGET_SLOT, |
| 319 CODE_ENTRY_SLOT, | 319 CODE_ENTRY_SLOT, |
| 320 DEBUG_TARGET_SLOT, | 320 DEBUG_TARGET_SLOT, |
| 321 JS_RETURN_SLOT, | 321 JS_RETURN_SLOT, |
| 322 NUMBER_OF_SLOT_TYPES | 322 NUMBER_OF_SLOT_TYPES |
| 323 }; | 323 }; |
| 324 | 324 |
| 325 void UpdateSlots(Heap* heap); | 325 void UpdateSlots(Heap* heap); |
| 326 | 326 |
| 327 void UpdateSlotsWithFilter(Heap* heap); |
| 328 |
| 327 SlotsBuffer* next() { return next_; } | 329 SlotsBuffer* next() { return next_; } |
| 328 | 330 |
| 329 static int SizeOfChain(SlotsBuffer* buffer) { | 331 static int SizeOfChain(SlotsBuffer* buffer) { |
| 330 if (buffer == NULL) return 0; | 332 if (buffer == NULL) return 0; |
| 331 return static_cast<int>(buffer->idx_ + | 333 return static_cast<int>(buffer->idx_ + |
| 332 (buffer->chain_length_ - 1) * kNumberOfElements); | 334 (buffer->chain_length_ - 1) * kNumberOfElements); |
| 333 } | 335 } |
| 334 | 336 |
| 335 inline bool IsFull() { | 337 inline bool IsFull() { |
| 336 return idx_ == kNumberOfElements; | 338 return idx_ == kNumberOfElements; |
| 337 } | 339 } |
| 338 | 340 |
| 339 inline bool HasSpaceForTypedSlot() { | 341 inline bool HasSpaceForTypedSlot() { |
| 340 return idx_ < kNumberOfElements - 1; | 342 return idx_ < kNumberOfElements - 1; |
| 341 } | 343 } |
| 342 | 344 |
| 343 static void UpdateSlotsRecordedIn(Heap* heap, SlotsBuffer* buffer) { | 345 static void UpdateSlotsRecordedIn(Heap* heap, |
| 346 SlotsBuffer* buffer, |
| 347 bool code_slots_filtering_required) { |
| 344 while (buffer != NULL) { | 348 while (buffer != NULL) { |
| 345 buffer->UpdateSlots(heap); | 349 if (code_slots_filtering_required) { |
| 350 buffer->UpdateSlotsWithFilter(heap); |
| 351 } else { |
| 352 buffer->UpdateSlots(heap); |
| 353 } |
| 346 buffer = buffer->next(); | 354 buffer = buffer->next(); |
| 347 } | 355 } |
| 348 } | 356 } |
| 349 | 357 |
| 350 enum AdditionMode { | 358 enum AdditionMode { |
| 351 FAIL_ON_OVERFLOW, | 359 FAIL_ON_OVERFLOW, |
| 352 IGNORE_OVERFLOW | 360 IGNORE_OVERFLOW |
| 353 }; | 361 }; |
| 354 | 362 |
| 355 static bool ChainLengthThresholdReached(SlotsBuffer* buffer) { | 363 static bool ChainLengthThresholdReached(SlotsBuffer* buffer) { |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 int size, | 547 int size, |
| 540 AllocationSpace to_old_space); | 548 AllocationSpace to_old_space); |
| 541 | 549 |
| 542 bool TryPromoteObject(HeapObject* object, int object_size); | 550 bool TryPromoteObject(HeapObject* object, int object_size); |
| 543 | 551 |
| 544 inline Object* encountered_weak_maps() { return encountered_weak_maps_; } | 552 inline Object* encountered_weak_maps() { return encountered_weak_maps_; } |
| 545 inline void set_encountered_weak_maps(Object* weak_map) { | 553 inline void set_encountered_weak_maps(Object* weak_map) { |
| 546 encountered_weak_maps_ = weak_map; | 554 encountered_weak_maps_ = weak_map; |
| 547 } | 555 } |
| 548 | 556 |
| 557 void InvalidateCode(Code* code); |
| 558 |
| 549 private: | 559 private: |
| 550 MarkCompactCollector(); | 560 MarkCompactCollector(); |
| 551 ~MarkCompactCollector(); | 561 ~MarkCompactCollector(); |
| 552 | 562 |
| 563 bool MarkInvalidatedCode(); |
| 564 void RemoveDeadInvalidatedCode(); |
| 565 void ProcessInvalidatedCode(ObjectVisitor* visitor); |
| 566 |
| 567 |
| 553 #ifdef DEBUG | 568 #ifdef DEBUG |
| 554 enum CollectorState { | 569 enum CollectorState { |
| 555 IDLE, | 570 IDLE, |
| 556 PREPARE_GC, | 571 PREPARE_GC, |
| 557 MARK_LIVE_OBJECTS, | 572 MARK_LIVE_OBJECTS, |
| 558 SWEEP_SPACES, | 573 SWEEP_SPACES, |
| 559 ENCODE_FORWARDING_ADDRESSES, | 574 ENCODE_FORWARDING_ADDRESSES, |
| 560 UPDATE_POINTERS, | 575 UPDATE_POINTERS, |
| 561 RELOCATE_OBJECTS | 576 RELOCATE_OBJECTS |
| 562 }; | 577 }; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 friend class UnmarkObjectVisitor; | 770 friend class UnmarkObjectVisitor; |
| 756 static void UnmarkObject(HeapObject* obj); | 771 static void UnmarkObject(HeapObject* obj); |
| 757 #endif | 772 #endif |
| 758 | 773 |
| 759 Heap* heap_; | 774 Heap* heap_; |
| 760 MarkingDeque marking_deque_; | 775 MarkingDeque marking_deque_; |
| 761 CodeFlusher* code_flusher_; | 776 CodeFlusher* code_flusher_; |
| 762 Object* encountered_weak_maps_; | 777 Object* encountered_weak_maps_; |
| 763 | 778 |
| 764 List<Page*> evacuation_candidates_; | 779 List<Page*> evacuation_candidates_; |
| 780 List<Code*> invalidated_code_; |
| 765 | 781 |
| 766 friend class Heap; | 782 friend class Heap; |
| 767 }; | 783 }; |
| 768 | 784 |
| 769 | 785 |
| 770 const char* AllocationSpaceName(AllocationSpace space); | 786 const char* AllocationSpaceName(AllocationSpace space); |
| 771 | 787 |
| 772 } } // namespace v8::internal | 788 } } // namespace v8::internal |
| 773 | 789 |
| 774 #endif // V8_MARK_COMPACT_H_ | 790 #endif // V8_MARK_COMPACT_H_ |
| OLD | NEW |