| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // next live object in the same page. For spaces using a different | 67 // next live object in the same page. For spaces using a different |
| 68 // encoding (ie, contiguous spaces), the offset parameter is ignored. | 68 // encoding (ie, contiguous spaces), the offset parameter is ignored. |
| 69 typedef void (*EncodingFunction)(HeapObject* old_object, | 69 typedef void (*EncodingFunction)(HeapObject* old_object, |
| 70 int object_size, | 70 int object_size, |
| 71 Object* new_object, | 71 Object* new_object, |
| 72 int* offset); | 72 int* offset); |
| 73 | 73 |
| 74 // Type of functions to process non-live objects. | 74 // Type of functions to process non-live objects. |
| 75 typedef void (*ProcessNonLiveFunction)(HeapObject* object); | 75 typedef void (*ProcessNonLiveFunction)(HeapObject* object); |
| 76 | 76 |
| 77 // Prepares for GC by resetting relocation info in old and map spaces and |
| 78 // choosing spaces to compact. |
| 79 static void Prepare(GCTracer* tracer); |
| 80 |
| 77 // Performs a global garbage collection. | 81 // Performs a global garbage collection. |
| 78 static void CollectGarbage(GCTracer* tracer); | 82 static void CollectGarbage(); |
| 79 | 83 |
| 80 // True if the last full GC performed heap compaction. | 84 // True if the last full GC performed heap compaction. |
| 81 static bool HasCompacted() { return compacting_collection_; } | 85 static bool HasCompacted() { return compacting_collection_; } |
| 82 | 86 |
| 83 // True after the Prepare phase if the compaction is taking place. | 87 // True after the Prepare phase if the compaction is taking place. |
| 84 static bool IsCompacting() { return compacting_collection_; } | 88 static bool IsCompacting() { return compacting_collection_; } |
| 85 | 89 |
| 86 // The count of the number of objects left marked at the end of the last | 90 // The count of the number of objects left marked at the end of the last |
| 87 // completed full GC (expected to be zero). | 91 // completed full GC (expected to be zero). |
| 88 static int previous_marked_count() { return previous_marked_count_; } | 92 static int previous_marked_count() { return previous_marked_count_; } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 116 static bool compacting_collection_; | 120 static bool compacting_collection_; |
| 117 | 121 |
| 118 // The number of objects left marked at the end of the last completed full | 122 // The number of objects left marked at the end of the last completed full |
| 119 // GC (expected to be zero). | 123 // GC (expected to be zero). |
| 120 static int previous_marked_count_; | 124 static int previous_marked_count_; |
| 121 | 125 |
| 122 // A pointer to the current stack-allocated GC tracer object during a full | 126 // A pointer to the current stack-allocated GC tracer object during a full |
| 123 // collection (NULL before and after). | 127 // collection (NULL before and after). |
| 124 static GCTracer* tracer_; | 128 static GCTracer* tracer_; |
| 125 | 129 |
| 126 // Prepares for GC by resetting relocation info in old and map spaces and | |
| 127 // choosing spaces to compact. | |
| 128 static void Prepare(); | |
| 129 | |
| 130 // Finishes GC, performs heap verification if enabled. | 130 // Finishes GC, performs heap verification if enabled. |
| 131 static void Finish(); | 131 static void Finish(); |
| 132 | 132 |
| 133 // ----------------------------------------------------------------------- | 133 // ----------------------------------------------------------------------- |
| 134 // Phase 1: Marking live objects. | 134 // Phase 1: Marking live objects. |
| 135 // | 135 // |
| 136 // Before: The heap has been prepared for garbage collection by | 136 // Before: The heap has been prepared for garbage collection by |
| 137 // MarkCompactCollector::Prepare() and is otherwise in its | 137 // MarkCompactCollector::Prepare() and is otherwise in its |
| 138 // normal state. | 138 // normal state. |
| 139 // | 139 // |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 | 398 |
| 399 friend class UnmarkObjectVisitor; | 399 friend class UnmarkObjectVisitor; |
| 400 static void UnmarkObject(HeapObject* obj); | 400 static void UnmarkObject(HeapObject* obj); |
| 401 #endif | 401 #endif |
| 402 }; | 402 }; |
| 403 | 403 |
| 404 | 404 |
| 405 } } // namespace v8::internal | 405 } } // namespace v8::internal |
| 406 | 406 |
| 407 #endif // V8_MARK_COMPACT_H_ | 407 #endif // V8_MARK_COMPACT_H_ |
| OLD | NEW |