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 21 matching lines...) Expand all Loading... |
32 #include "ic-inl.h" | 32 #include "ic-inl.h" |
33 #include "mark-compact.h" | 33 #include "mark-compact.h" |
34 #include "stub-cache.h" | 34 #include "stub-cache.h" |
35 | 35 |
36 namespace v8 { | 36 namespace v8 { |
37 namespace internal { | 37 namespace internal { |
38 | 38 |
39 // ------------------------------------------------------------------------- | 39 // ------------------------------------------------------------------------- |
40 // MarkCompactCollector | 40 // MarkCompactCollector |
41 | 41 |
| 42 bool MarkCompactCollector::force_compaction_ = false; |
42 bool MarkCompactCollector::compacting_collection_ = false; | 43 bool MarkCompactCollector::compacting_collection_ = false; |
43 | 44 |
44 int MarkCompactCollector::previous_marked_count_ = 0; | 45 int MarkCompactCollector::previous_marked_count_ = 0; |
45 GCTracer* MarkCompactCollector::tracer_ = NULL; | 46 GCTracer* MarkCompactCollector::tracer_ = NULL; |
46 | 47 |
47 | 48 |
48 #ifdef DEBUG | 49 #ifdef DEBUG |
49 MarkCompactCollector::CollectorState MarkCompactCollector::state_ = IDLE; | 50 MarkCompactCollector::CollectorState MarkCompactCollector::state_ = IDLE; |
50 | 51 |
51 // Counters used for debugging the marking phase of mark-compact or mark-sweep | 52 // Counters used for debugging the marking phase of mark-compact or mark-sweep |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // variable. | 104 // variable. |
104 tracer_ = tracer; | 105 tracer_ = tracer; |
105 | 106 |
106 static const int kFragmentationLimit = 50; // Percent. | 107 static const int kFragmentationLimit = 50; // Percent. |
107 #ifdef DEBUG | 108 #ifdef DEBUG |
108 ASSERT(state_ == IDLE); | 109 ASSERT(state_ == IDLE); |
109 state_ = PREPARE_GC; | 110 state_ = PREPARE_GC; |
110 #endif | 111 #endif |
111 ASSERT(!FLAG_always_compact || !FLAG_never_compact); | 112 ASSERT(!FLAG_always_compact || !FLAG_never_compact); |
112 | 113 |
113 compacting_collection_ = FLAG_always_compact; | 114 compacting_collection_ = FLAG_always_compact || force_compaction_; |
114 | 115 |
115 // We compact the old generation if it gets too fragmented (ie, we could | 116 // We compact the old generation if it gets too fragmented (ie, we could |
116 // recover an expected amount of space by reclaiming the waste and free | 117 // recover an expected amount of space by reclaiming the waste and free |
117 // list blocks). We always compact when the flag --gc-global is true | 118 // list blocks). We always compact when the flag --gc-global is true |
118 // because objects do not get promoted out of new space on non-compacting | 119 // because objects do not get promoted out of new space on non-compacting |
119 // GCs. | 120 // GCs. |
120 if (!compacting_collection_) { | 121 if (!compacting_collection_) { |
121 int old_gen_recoverable = 0; | 122 int old_gen_recoverable = 0; |
122 int old_gen_used = 0; | 123 int old_gen_used = 0; |
123 | 124 |
(...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1833 | 1834 |
1834 void MarkCompactCollector::RebuildRSets() { | 1835 void MarkCompactCollector::RebuildRSets() { |
1835 #ifdef DEBUG | 1836 #ifdef DEBUG |
1836 ASSERT(state_ == RELOCATE_OBJECTS); | 1837 ASSERT(state_ == RELOCATE_OBJECTS); |
1837 state_ = REBUILD_RSETS; | 1838 state_ = REBUILD_RSETS; |
1838 #endif | 1839 #endif |
1839 Heap::RebuildRSets(); | 1840 Heap::RebuildRSets(); |
1840 } | 1841 } |
1841 | 1842 |
1842 } } // namespace v8::internal | 1843 } } // namespace v8::internal |
OLD | NEW |