| 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 private: | 376 private: |
| 377 static const int kChainLengthThreshold = 6; | 377 static const int kChainLengthThreshold = 6; |
| 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. |
| 387 class ThreadLocalTop; |
| 388 |
| 389 |
| 386 // ------------------------------------------------------------------------- | 390 // ------------------------------------------------------------------------- |
| 387 // Mark-Compact collector | 391 // Mark-Compact collector |
| 388 class MarkCompactCollector { | 392 class MarkCompactCollector { |
| 389 public: | 393 public: |
| 390 // Type of functions to compute forwarding addresses of objects in | 394 // Type of functions to compute forwarding addresses of objects in |
| 391 // compacted spaces. Given an object and its size, return a (non-failure) | 395 // compacted spaces. Given an object and its size, return a (non-failure) |
| 392 // Object* that will be the object after forwarding. There is a separate | 396 // Object* that will be the object after forwarding. There is a separate |
| 393 // allocation function for each (compactable) space based on the location | 397 // allocation function for each (compactable) space based on the location |
| 394 // of the object before compaction. | 398 // of the object before compaction. |
| 395 typedef MaybeObject* (*AllocationFunction)(Heap* heap, | 399 typedef MaybeObject* (*AllocationFunction)(Heap* heap, |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 // | 600 // |
| 597 // After: Live objects are marked and non-live objects are unmarked. | 601 // After: Live objects are marked and non-live objects are unmarked. |
| 598 | 602 |
| 599 | 603 |
| 600 friend class RootMarkingVisitor; | 604 friend class RootMarkingVisitor; |
| 601 friend class MarkingVisitor; | 605 friend class MarkingVisitor; |
| 602 friend class StaticMarkingVisitor; | 606 friend class StaticMarkingVisitor; |
| 603 friend class CodeMarkingVisitor; | 607 friend class CodeMarkingVisitor; |
| 604 friend class SharedFunctionInfoMarkingVisitor; | 608 friend class SharedFunctionInfoMarkingVisitor; |
| 605 | 609 |
| 610 // Mark non-optimize code for functions inlined into the given optimized |
| 611 // code. This will prevent it from being flushed. |
| 612 void MarkInlinedFunctionsCode(Code* code); |
| 613 |
| 614 // Mark code objects that are active on the stack to prevent them |
| 615 // from being flushed. |
| 616 void PrepareThreadForCodeFlushing(Isolate* isolate, ThreadLocalTop* top); |
| 617 |
| 606 void PrepareForCodeFlushing(); | 618 void PrepareForCodeFlushing(); |
| 607 | 619 |
| 608 // Marking operations for objects reachable from roots. | 620 // Marking operations for objects reachable from roots. |
| 609 void MarkLiveObjects(); | 621 void MarkLiveObjects(); |
| 610 | 622 |
| 611 void AfterMarking(); | 623 void AfterMarking(); |
| 612 | 624 |
| 613 INLINE(void MarkObject(HeapObject* obj, MarkBit mark_bit)); | 625 INLINE(void MarkObject(HeapObject* obj, MarkBit mark_bit)); |
| 614 | 626 |
| 615 INLINE(void SetMark(HeapObject* obj, MarkBit mark_bit)); | 627 INLINE(void SetMark(HeapObject* obj, MarkBit mark_bit)); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 | 745 |
| 734 friend class Heap; | 746 friend class Heap; |
| 735 }; | 747 }; |
| 736 | 748 |
| 737 | 749 |
| 738 const char* AllocationSpaceName(AllocationSpace space); | 750 const char* AllocationSpaceName(AllocationSpace space); |
| 739 | 751 |
| 740 } } // namespace v8::internal | 752 } } // namespace v8::internal |
| 741 | 753 |
| 742 #endif // V8_MARK_COMPACT_H_ | 754 #endif // V8_MARK_COMPACT_H_ |
| OLD | NEW |