| 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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 | 529 |
| 530 | 530 |
| 531 // Defined in isolate.h. | 531 // Defined in isolate.h. |
| 532 class ThreadLocalTop; | 532 class ThreadLocalTop; |
| 533 | 533 |
| 534 | 534 |
| 535 // ------------------------------------------------------------------------- | 535 // ------------------------------------------------------------------------- |
| 536 // Mark-Compact collector | 536 // Mark-Compact collector |
| 537 class MarkCompactCollector { | 537 class MarkCompactCollector { |
| 538 public: | 538 public: |
| 539 // Type of functions to compute forwarding addresses of objects in | |
| 540 // compacted spaces. Given an object and its size, return a (non-failure) | |
| 541 // Object* that will be the object after forwarding. There is a separate | |
| 542 // allocation function for each (compactable) space based on the location | |
| 543 // of the object before compaction. | |
| 544 typedef MaybeObject* (*AllocationFunction)(Heap* heap, | |
| 545 HeapObject* object, | |
| 546 int object_size); | |
| 547 | |
| 548 // Type of functions to encode the forwarding address for an object. | |
| 549 // Given the object, its size, and the new (non-failure) object it will be | |
| 550 // forwarded to, encode the forwarding address. For paged spaces, the | |
| 551 // 'offset' input/output parameter contains the offset of the forwarded | |
| 552 // object from the forwarding address of the previous live object in the | |
| 553 // page as input, and is updated to contain the offset to be used for the | |
| 554 // next live object in the same page. For spaces using a different | |
| 555 // encoding (i.e., contiguous spaces), the offset parameter is ignored. | |
| 556 typedef void (*EncodingFunction)(Heap* heap, | |
| 557 HeapObject* old_object, | |
| 558 int object_size, | |
| 559 Object* new_object, | |
| 560 int* offset); | |
| 561 | |
| 562 // Type of functions to process non-live objects. | |
| 563 typedef void (*ProcessNonLiveFunction)(HeapObject* object, Isolate* isolate); | |
| 564 | |
| 565 // Pointer to member function, used in IterateLiveObjects. | |
| 566 typedef int (MarkCompactCollector::*LiveObjectCallback)(HeapObject* obj); | |
| 567 | |
| 568 // Set the global flags, it must be called before Prepare to take effect. | 539 // Set the global flags, it must be called before Prepare to take effect. |
| 569 inline void SetFlags(int flags); | 540 inline void SetFlags(int flags); |
| 570 | 541 |
| 571 static void Initialize(); | 542 static void Initialize(); |
| 572 | 543 |
| 573 void SetUp(); | 544 void SetUp(); |
| 574 | 545 |
| 575 void TearDown(); | 546 void TearDown(); |
| 576 | 547 |
| 577 void CollectEvacuationCandidates(PagedSpace* space); | 548 void CollectEvacuationCandidates(PagedSpace* space); |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 private: | 1006 private: |
| 1036 MarkCompactCollector* collector_; | 1007 MarkCompactCollector* collector_; |
| 1037 }; | 1008 }; |
| 1038 | 1009 |
| 1039 | 1010 |
| 1040 const char* AllocationSpaceName(AllocationSpace space); | 1011 const char* AllocationSpaceName(AllocationSpace space); |
| 1041 | 1012 |
| 1042 } } // namespace v8::internal | 1013 } } // namespace v8::internal |
| 1043 | 1014 |
| 1044 #endif // V8_MARK_COMPACT_H_ | 1015 #endif // V8_MARK_COMPACT_H_ |
| OLD | NEW |