Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1246)

Side by Side Diff: src/incremental-marking.h

Issue 6970004: Introduce lazy sweeping. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 24 matching lines...) Expand all
35 35
36 namespace v8 { 36 namespace v8 {
37 namespace internal { 37 namespace internal {
38 38
39 39
40 // TODO(gc) rename into IncrementalMarker after merge. 40 // TODO(gc) rename into IncrementalMarker after merge.
41 class IncrementalMarking : public AllStatic { 41 class IncrementalMarking : public AllStatic {
42 public: 42 public:
43 enum State { 43 enum State {
44 STOPPED, 44 STOPPED,
45 SWEEPING,
45 MARKING, 46 MARKING,
46 COMPLETE 47 COMPLETE
47 }; 48 };
48 49
49 explicit IncrementalMarking(Heap* heap); 50 explicit IncrementalMarking(Heap* heap);
50 51
51 State state() { 52 State state() {
52 ASSERT(state_ == STOPPED || FLAG_incremental_marking); 53 ASSERT(state_ == STOPPED || FLAG_incremental_marking);
53 return state_; 54 return state_;
54 } 55 }
55 56
56 bool should_hurry() { return should_hurry_; } 57 bool should_hurry() { return should_hurry_; }
57 58
58 inline bool IsStopped() { return state() == STOPPED; } 59 inline bool IsStopped() { return state() == STOPPED; }
59 60
60 inline bool IsMarking() { return state() == MARKING; } 61 inline bool IsMarking() { return state() >= MARKING; }
62
63 inline bool IsMarkingIncomplete() { return state() == MARKING; }
61 64
62 bool WorthActivating(); 65 bool WorthActivating();
63 66
64 void Start(); 67 void Start();
65 68
66 void Stop(); 69 void Stop();
67 70
68 void PrepareForScavenge(); 71 void PrepareForScavenge();
69 72
70 void UpdateMarkingDequeAfterScavenge(); 73 void UpdateMarkingDequeAfterScavenge();
71 74
72 void Hurry(); 75 void Hurry();
73 76
74 void Finalize(); 77 void Finalize();
75 78
79 void Abort();
80
76 void MarkingComplete(); 81 void MarkingComplete();
77 82
78 // It's hard to know how much work the incremental marker should do to make 83 // It's hard to know how much work the incremental marker should do to make
79 // progress in the face of the mutator creating new work for it. We start 84 // progress in the face of the mutator creating new work for it. We start
80 // of at a moderate rate of work and gradually increase the speed of the 85 // of at a moderate rate of work and gradually increase the speed of the
81 // incremental marker until it completes. 86 // incremental marker until it completes.
82 // Do some marking every time this much memory has been allocated. 87 // Do some marking every time this much memory has been allocated.
83 static const intptr_t kAllocatedThreshold = 8192; 88 static const intptr_t kAllocatedThreshold = 8192;
84 // Start off by marking this many times more memory than has been allocated. 89 // Start off by marking this many times more memory than has been allocated.
85 static const intptr_t kInitialAllocationMarkingFactor = 4; 90 static const intptr_t kInitialAllocationMarkingFactor = 4;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 void set_should_hurry(bool val) { 193 void set_should_hurry(bool val) {
189 should_hurry_ = val; 194 should_hurry_ = val;
190 } 195 }
191 196
192 void ResetStepCounters() { 197 void ResetStepCounters() {
193 steps_count_ = 0; 198 steps_count_ = 0;
194 steps_took_ = 0; 199 steps_took_ = 0;
195 allocation_marking_factor_ = kInitialAllocationMarkingFactor; 200 allocation_marking_factor_ = kInitialAllocationMarkingFactor;
196 } 201 }
197 202
203 static void ClearMarkbits(PagedSpace* space);
204 void ClearMarkbits();
205
206 #ifdef DEBUG
207 void VerifyMarkbitsAreClean();
208 static void VerifyMarkbitsAreClean(PagedSpace* space);
209 #endif
210
211 void StartMarking();
212
198 213
199 Heap* heap_; 214 Heap* heap_;
200 215
201 State state_; 216 State state_;
202 MarkingDeque marking_deque_; 217 MarkingDeque marking_deque_;
203 218
204 int steps_count_; 219 int steps_count_;
205 double steps_took_; 220 double steps_took_;
206 bool should_hurry_; 221 bool should_hurry_;
207 intptr_t allocation_marking_factor_; 222 intptr_t allocation_marking_factor_;
208 intptr_t allocated_; 223 intptr_t allocated_;
209 }; 224 };
210 225
211 } } // namespace v8::internal 226 } } // namespace v8::internal
212 227
213 #endif // V8_INCREMENTAL_MARKING_H_ 228 #endif // V8_INCREMENTAL_MARKING_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/incremental-marking.cc » ('j') | src/incremental-marking.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698