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

Side by Side Diff: runtime/vm/scavenger.h

Issue 773573005: vmservice: basic object graph serialization. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years 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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart 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 file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_SCAVENGER_H_ 5 #ifndef VM_SCAVENGER_H_
6 #define VM_SCAVENGER_H_ 6 #define VM_SCAVENGER_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "platform/utils.h" 9 #include "platform/utils.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 top_ += size; 153 top_ += size;
154 ASSERT(to_->Contains(top_) || (top_ == to_->end())); 154 ASSERT(to_->Contains(top_) || (top_ == to_->end()));
155 return result; 155 return result;
156 } 156 }
157 157
158 // Collect the garbage in this scavenger. 158 // Collect the garbage in this scavenger.
159 void Scavenge(); 159 void Scavenge();
160 void Scavenge(bool invoke_api_callbacks); 160 void Scavenge(bool invoke_api_callbacks);
161 161
162 // Promote all live objects.
163 void Evacuate() {
164 Scavenge();
165 Scavenge();
166 ASSERT(UsedInWords() == 0);
167 }
168
162 // Accessors to generate code for inlined allocation. 169 // Accessors to generate code for inlined allocation.
163 uword* TopAddress() { return &top_; } 170 uword* TopAddress() { return &top_; }
164 uword* EndAddress() { return &end_; } 171 uword* EndAddress() { return &end_; }
165 static intptr_t top_offset() { return OFFSET_OF(Scavenger, top_); } 172 static intptr_t top_offset() { return OFFSET_OF(Scavenger, top_); }
166 static intptr_t end_offset() { return OFFSET_OF(Scavenger, end_); } 173 static intptr_t end_offset() { return OFFSET_OF(Scavenger, end_); }
167 174
168 intptr_t UsedInWords() const { 175 intptr_t UsedInWords() const {
169 return (top_ - FirstObjectStart()) >> kWordSizeLog2; 176 return (top_ - FirstObjectStart()) >> kWordSizeLog2;
170 } 177 }
171 intptr_t CapacityInWords() const { 178 intptr_t CapacityInWords() const {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 317
311 friend class ScavengerVisitor; 318 friend class ScavengerVisitor;
312 friend class ScavengerWeakVisitor; 319 friend class ScavengerWeakVisitor;
313 320
314 DISALLOW_COPY_AND_ASSIGN(Scavenger); 321 DISALLOW_COPY_AND_ASSIGN(Scavenger);
315 }; 322 };
316 323
317 } // namespace dart 324 } // namespace dart
318 325
319 #endif // VM_SCAVENGER_H_ 326 #endif // VM_SCAVENGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698