OLD | NEW |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 // Mark-sweep old-space. | 4 // Mark-sweep old-space. |
5 // * Uses worst-fit free-list allocation to get big chunks for fast bump | 5 // * Uses worst-fit free-list allocation to get big chunks for fast bump |
6 // allocation. | 6 // allocation. |
7 // * Non-moving for now. | 7 // * Non-moving for now. |
8 // * Has on-heap chained data structure keeping track of | 8 // * Has on-heap chained data structure keeping track of |
9 // promoted-and-not-yet-scanned areas. This is called PromotedTrack. | 9 // promoted-and-not-yet-scanned areas. This is called PromotedTrack. |
10 // * No remembered set yet. When scavenging we have to scan all of old space. | 10 // * No remembered set yet. When scavenging we have to scan all of old space. |
11 // We skip PromotedTrack areas because we know we will get to them later and | 11 // We skip PromotedTrack areas because we know we will get to them later and |
12 // they contain uninitialized memory. | 12 // they contain uninitialized memory. |
13 | 13 |
14 #include "src/vm/mark_sweep.h" | 14 #include "src/vm/mark_sweep.h" |
15 #include "src/vm/object_memory.h" | 15 #include "src/vm/object_memory.h" |
16 #include "src/vm/object.h" | 16 #include "src/vm/object.h" |
17 | 17 |
18 namespace fletch { | 18 namespace dartino { |
19 | 19 |
20 // In oldspace, the sentinel marks the end of each chunk, and never moves or is | 20 // In oldspace, the sentinel marks the end of each chunk, and never moves or is |
21 // overwritten. | 21 // overwritten. |
22 static Smi* chunk_end_sentinel() { return Smi::zero(); } | 22 static Smi* chunk_end_sentinel() { return Smi::zero(); } |
23 | 23 |
24 static bool HasSentinelAt(uword address) { | 24 static bool HasSentinelAt(uword address) { |
25 return *reinterpret_cast<Object**>(address) == chunk_end_sentinel(); | 25 return *reinterpret_cast<Object**>(address) == chunk_end_sentinel(); |
26 } | 26 } |
27 | 27 |
28 OldSpace::OldSpace(int maximum_initial_size) | 28 OldSpace::OldSpace(int maximum_initial_size) |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 } | 225 } |
226 | 226 |
227 void SemiSpace::StartScavenge() { | 227 void SemiSpace::StartScavenge() { |
228 Flush(); | 228 Flush(); |
229 | 229 |
230 for (Chunk* chunk = first(); chunk != NULL; chunk = chunk->next()) { | 230 for (Chunk* chunk = first(); chunk != NULL; chunk = chunk->next()) { |
231 chunk->set_scavenge_pointer(chunk->base()); | 231 chunk->set_scavenge_pointer(chunk->base()); |
232 } | 232 } |
233 } | 233 } |
234 | 234 |
235 } // namespace fletch | 235 } // namespace dartino |
OLD | NEW |