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

Side by Side Diff: runtime/vm/heap.cc

Issue 251373012: Add Heap::isolate_ to simplify code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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
« no previous file with comments | « runtime/vm/heap.h ('k') | runtime/vm/pages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "vm/heap.h" 5 #include "vm/heap.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 14 matching lines...) Expand all
25 DEFINE_FLAG(bool, verbose_gc, false, "Enables verbose GC."); 25 DEFINE_FLAG(bool, verbose_gc, false, "Enables verbose GC.");
26 DEFINE_FLAG(int, verbose_gc_hdr, 40, "Print verbose GC header interval."); 26 DEFINE_FLAG(int, verbose_gc_hdr, 40, "Print verbose GC header interval.");
27 DEFINE_FLAG(bool, verify_before_gc, false, 27 DEFINE_FLAG(bool, verify_before_gc, false,
28 "Enables heap verification before GC."); 28 "Enables heap verification before GC.");
29 DEFINE_FLAG(bool, verify_after_gc, false, 29 DEFINE_FLAG(bool, verify_after_gc, false,
30 "Enables heap verification after GC."); 30 "Enables heap verification after GC.");
31 DEFINE_FLAG(bool, gc_at_alloc, false, "GC at every allocation."); 31 DEFINE_FLAG(bool, gc_at_alloc, false, "GC at every allocation.");
32 DEFINE_FLAG(int, new_gen_ext_limit, 64, 32 DEFINE_FLAG(int, new_gen_ext_limit, 64,
33 "maximum total external size (MB) in new gen before triggering GC"); 33 "maximum total external size (MB) in new gen before triggering GC");
34 34
35 Heap::Heap(intptr_t max_new_gen_words, 35 Heap::Heap(Isolate* isolate,
36 intptr_t max_new_gen_words,
36 intptr_t max_old_gen_words) 37 intptr_t max_old_gen_words)
37 : read_only_(false), gc_in_progress_(false) { 38 : isolate_(isolate), read_only_(false), gc_in_progress_(false) {
38 for (int sel = 0; 39 for (int sel = 0;
39 sel < kNumWeakSelectors; 40 sel < kNumWeakSelectors;
40 sel++) { 41 sel++) {
41 new_weak_tables_[sel] = new WeakTable(); 42 new_weak_tables_[sel] = new WeakTable();
42 old_weak_tables_[sel] = new WeakTable(); 43 old_weak_tables_[sel] = new WeakTable();
43 } 44 }
44 new_space_ = new Scavenger(this, 45 new_space_ = new Scavenger(this,
45 max_new_gen_words, 46 max_new_gen_words,
46 kNewObjectAlignmentOffset); 47 kNewObjectAlignmentOffset);
47 old_space_ = new PageSpace(this, max_old_gen_words); 48 old_space_ = new PageSpace(this, max_old_gen_words);
48 stats_.num_ = 0; 49 stats_.num_ = 0;
49 } 50 }
50 51
51 52
52 Heap::~Heap() { 53 Heap::~Heap() {
53 delete new_space_; 54 delete new_space_;
54 delete old_space_; 55 delete old_space_;
55 for (int sel = 0; 56 for (int sel = 0;
56 sel < kNumWeakSelectors; 57 sel < kNumWeakSelectors;
57 sel++) { 58 sel++) {
58 delete new_weak_tables_[sel]; 59 delete new_weak_tables_[sel];
59 delete old_weak_tables_[sel]; 60 delete old_weak_tables_[sel];
60 } 61 }
61 } 62 }
62 63
63 64
64 uword Heap::AllocateNew(intptr_t size) { 65 uword Heap::AllocateNew(intptr_t size) {
65 ASSERT(Isolate::Current()->no_gc_scope_depth() == 0); 66 ASSERT(isolate()->no_gc_scope_depth() == 0);
66 uword addr = new_space_->TryAllocate(size); 67 uword addr = new_space_->TryAllocate(size);
67 if (addr == 0) { 68 if (addr == 0) {
68 CollectGarbage(kNew); 69 CollectGarbage(kNew);
69 addr = new_space_->TryAllocate(size); 70 addr = new_space_->TryAllocate(size);
70 if (addr == 0) { 71 if (addr == 0) {
71 return AllocateOld(size, HeapPage::kData); 72 return AllocateOld(size, HeapPage::kData);
72 } 73 }
73 } 74 }
74 return addr; 75 return addr;
75 } 76 }
76 77
77 78
78 uword Heap::AllocateOld(intptr_t size, HeapPage::PageType type) { 79 uword Heap::AllocateOld(intptr_t size, HeapPage::PageType type) {
79 ASSERT(Isolate::Current()->no_gc_scope_depth() == 0); 80 ASSERT(isolate()->no_gc_scope_depth() == 0);
80 uword addr = old_space_->TryAllocate(size, type); 81 uword addr = old_space_->TryAllocate(size, type);
81 if (addr == 0) { 82 if (addr == 0) {
82 CollectAllGarbage(); 83 CollectAllGarbage();
83 addr = old_space_->TryAllocate(size, type, PageSpace::kForceGrowth); 84 addr = old_space_->TryAllocate(size, type, PageSpace::kForceGrowth);
84 if (addr == 0) { 85 if (addr == 0) {
85 OS::PrintErr("Exhausted heap space, trying to allocate %" Pd " bytes.\n", 86 OS::PrintErr("Exhausted heap space, trying to allocate %" Pd " bytes.\n",
86 size); 87 size);
87 return 0; 88 return 0;
88 } 89 }
89 } 90 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 bool Heap::OldContains(uword addr) const { 136 bool Heap::OldContains(uword addr) const {
136 return old_space_->Contains(addr); 137 return old_space_->Contains(addr);
137 } 138 }
138 139
139 140
140 bool Heap::CodeContains(uword addr) const { 141 bool Heap::CodeContains(uword addr) const {
141 return old_space_->Contains(addr, HeapPage::kExecutable); 142 return old_space_->Contains(addr, HeapPage::kExecutable);
142 } 143 }
143 144
144 145
145 void Heap::IterateObjects(ObjectVisitor* visitor) { 146 void Heap::IterateObjects(ObjectVisitor* visitor) const {
146 new_space_->VisitObjects(visitor); 147 new_space_->VisitObjects(visitor);
147 old_space_->VisitObjects(visitor); 148 old_space_->VisitObjects(visitor);
148 } 149 }
149 150
150 151
151 void Heap::IteratePointers(ObjectPointerVisitor* visitor) { 152 void Heap::IteratePointers(ObjectPointerVisitor* visitor) const {
152 new_space_->VisitObjectPointers(visitor); 153 new_space_->VisitObjectPointers(visitor);
153 old_space_->VisitObjectPointers(visitor); 154 old_space_->VisitObjectPointers(visitor);
154 } 155 }
155 156
156 157
157 void Heap::IterateNewPointers(ObjectPointerVisitor* visitor) { 158 void Heap::IterateNewPointers(ObjectPointerVisitor* visitor) const {
158 new_space_->VisitObjectPointers(visitor); 159 new_space_->VisitObjectPointers(visitor);
159 } 160 }
160 161
161 162
162 void Heap::IterateOldPointers(ObjectPointerVisitor* visitor) { 163 void Heap::IterateOldPointers(ObjectPointerVisitor* visitor) const {
163 old_space_->VisitObjectPointers(visitor); 164 old_space_->VisitObjectPointers(visitor);
164 } 165 }
165 166
166 167
167 void Heap::IterateNewObjects(ObjectVisitor* visitor) { 168 void Heap::IterateNewObjects(ObjectVisitor* visitor) const {
168 new_space_->VisitObjects(visitor); 169 new_space_->VisitObjects(visitor);
169 } 170 }
170 171
171 172
172 void Heap::IterateOldObjects(ObjectVisitor* visitor) { 173 void Heap::IterateOldObjects(ObjectVisitor* visitor) const {
173 old_space_->VisitObjects(visitor); 174 old_space_->VisitObjects(visitor);
174 } 175 }
175 176
176 177
177 RawInstructions* Heap::FindObjectInCodeSpace(FindObjectVisitor* visitor) const { 178 RawInstructions* Heap::FindObjectInCodeSpace(FindObjectVisitor* visitor) const {
178 // Only executable pages can have RawInstructions objects. 179 // Only executable pages can have RawInstructions objects.
179 RawObject* raw_obj = old_space_->FindObject(visitor, HeapPage::kExecutable); 180 RawObject* raw_obj = old_space_->FindObject(visitor, HeapPage::kExecutable);
180 ASSERT((raw_obj == Object::null()) || 181 ASSERT((raw_obj == Object::null()) ||
181 (raw_obj->GetClassId() == kInstructionsCid)); 182 (raw_obj->GetClassId() == kInstructionsCid));
182 return reinterpret_cast<RawInstructions*>(raw_obj); 183 return reinterpret_cast<RawInstructions*>(raw_obj);
183 } 184 }
184 185
185 186
186 RawObject* Heap::FindOldObject(FindObjectVisitor* visitor) const { 187 RawObject* Heap::FindOldObject(FindObjectVisitor* visitor) const {
187 return old_space_->FindObject(visitor, HeapPage::kData); 188 return old_space_->FindObject(visitor, HeapPage::kData);
188 } 189 }
189 190
190 191
191 RawObject* Heap::FindNewObject(FindObjectVisitor* visitor) const { 192 RawObject* Heap::FindNewObject(FindObjectVisitor* visitor) const {
192 return new_space_->FindObject(visitor); 193 return new_space_->FindObject(visitor);
193 } 194 }
194 195
195 196
196 RawObject* Heap::FindObject(FindObjectVisitor* visitor) const { 197 RawObject* Heap::FindObject(FindObjectVisitor* visitor) const {
197 ASSERT(Isolate::Current()->no_gc_scope_depth() != 0); 198 ASSERT(isolate()->no_gc_scope_depth() != 0);
198 RawObject* raw_obj = FindNewObject(visitor); 199 RawObject* raw_obj = FindNewObject(visitor);
199 if (raw_obj != Object::null()) { 200 if (raw_obj != Object::null()) {
200 return raw_obj; 201 return raw_obj;
201 } 202 }
202 raw_obj = FindOldObject(visitor); 203 raw_obj = FindOldObject(visitor);
203 if (raw_obj != Object::null()) { 204 if (raw_obj != Object::null()) {
204 return raw_obj; 205 return raw_obj;
205 } 206 }
206 raw_obj = FindObjectInCodeSpace(visitor); 207 raw_obj = FindObjectInCodeSpace(visitor);
207 return raw_obj; 208 return raw_obj;
208 } 209 }
209 210
210 211
211 void Heap::CollectGarbage(Space space, 212 void Heap::CollectGarbage(Space space,
212 ApiCallbacks api_callbacks, 213 ApiCallbacks api_callbacks,
213 GCReason reason) { 214 GCReason reason) {
214 Isolate* isolate = Isolate::Current(); 215 TIMERSCOPE(isolate(), time_gc);
215 TIMERSCOPE(isolate, time_gc);
216 bool invoke_api_callbacks = (api_callbacks == kInvokeApiCallbacks); 216 bool invoke_api_callbacks = (api_callbacks == kInvokeApiCallbacks);
217 switch (space) { 217 switch (space) {
218 case kNew: { 218 case kNew: {
219 VMTagScope tagScope(isolate, VMTag::kGCNewSpaceTagId); 219 VMTagScope tagScope(isolate(), VMTag::kGCNewSpaceTagId);
220 RecordBeforeGC(kNew, reason); 220 RecordBeforeGC(kNew, reason);
221 UpdateClassHeapStatsBeforeGC(kNew); 221 UpdateClassHeapStatsBeforeGC(kNew);
222 new_space_->Scavenge(invoke_api_callbacks); 222 new_space_->Scavenge(invoke_api_callbacks);
223 RecordAfterGC(); 223 RecordAfterGC();
224 PrintStats(); 224 PrintStats();
225 if (old_space_->NeedsGarbageCollection()) { 225 if (old_space_->NeedsGarbageCollection()) {
226 // Old collections should call the API callbacks. 226 // Old collections should call the API callbacks.
227 CollectGarbage(kOld, kInvokeApiCallbacks, kPromotion); 227 CollectGarbage(kOld, kInvokeApiCallbacks, kPromotion);
228 } 228 }
229 break; 229 break;
230 } 230 }
231 case kOld: 231 case kOld:
232 case kCode: { 232 case kCode: {
233 VMTagScope tagScope(isolate, VMTag::kGCOldSpaceTagId); 233 VMTagScope tagScope(isolate(), VMTag::kGCOldSpaceTagId);
234 RecordBeforeGC(kOld, reason); 234 RecordBeforeGC(kOld, reason);
235 UpdateClassHeapStatsBeforeGC(kOld); 235 UpdateClassHeapStatsBeforeGC(kOld);
236 old_space_->MarkSweep(invoke_api_callbacks); 236 old_space_->MarkSweep(invoke_api_callbacks);
237 RecordAfterGC(); 237 RecordAfterGC();
238 PrintStats(); 238 PrintStats();
239 break; 239 break;
240 } 240 }
241 default: 241 default:
242 UNREACHABLE(); 242 UNREACHABLE();
243 } 243 }
244 } 244 }
245 245
246 246
247 void Heap::UpdateClassHeapStatsBeforeGC(Heap::Space space) { 247 void Heap::UpdateClassHeapStatsBeforeGC(Heap::Space space) {
248 Isolate* isolate = Isolate::Current(); 248 ClassTable* class_table = isolate()->class_table();
249 ClassTable* class_table = isolate->class_table();
250 if (space == kNew) { 249 if (space == kNew) {
251 class_table->ResetCountersNew(); 250 class_table->ResetCountersNew();
252 } else { 251 } else {
253 class_table->ResetCountersOld(); 252 class_table->ResetCountersOld();
254 } 253 }
255 } 254 }
256 255
257 256
258 void Heap::CollectGarbage(Space space) { 257 void Heap::CollectGarbage(Space space) {
259 if (space == kOld) { 258 if (space == kOld) {
260 CollectGarbage(space, kInvokeApiCallbacks, kOldSpace); 259 CollectGarbage(space, kInvokeApiCallbacks, kOldSpace);
261 } else { 260 } else {
262 ASSERT(space == kNew); 261 ASSERT(space == kNew);
263 CollectGarbage(space, kInvokeApiCallbacks, kNewSpace); 262 CollectGarbage(space, kInvokeApiCallbacks, kNewSpace);
264 } 263 }
265 } 264 }
266 265
267 266
268 void Heap::CollectAllGarbage() { 267 void Heap::CollectAllGarbage() {
269 Isolate* isolate = Isolate::Current(); 268 TIMERSCOPE(isolate(), time_gc);
270 TIMERSCOPE(isolate, time_gc);
271 { 269 {
272 VMTagScope tagScope(isolate, VMTag::kGCNewSpaceTagId); 270 VMTagScope tagScope(isolate(), VMTag::kGCNewSpaceTagId);
273 RecordBeforeGC(kNew, kFull); 271 RecordBeforeGC(kNew, kFull);
274 UpdateClassHeapStatsBeforeGC(kNew); 272 UpdateClassHeapStatsBeforeGC(kNew);
275 new_space_->Scavenge(kInvokeApiCallbacks); 273 new_space_->Scavenge(kInvokeApiCallbacks);
276 RecordAfterGC(); 274 RecordAfterGC();
277 PrintStats(); 275 PrintStats();
278 } 276 }
279 { 277 {
280 VMTagScope tagScope(isolate, VMTag::kGCOldSpaceTagId); 278 VMTagScope tagScope(isolate(), VMTag::kGCOldSpaceTagId);
281 RecordBeforeGC(kOld, kFull); 279 RecordBeforeGC(kOld, kFull);
282 UpdateClassHeapStatsBeforeGC(kOld); 280 UpdateClassHeapStatsBeforeGC(kOld);
283 old_space_->MarkSweep(kInvokeApiCallbacks); 281 old_space_->MarkSweep(kInvokeApiCallbacks);
284 RecordAfterGC(); 282 RecordAfterGC();
285 PrintStats(); 283 PrintStats();
286 } 284 }
287 } 285 }
288 286
289 287
290 void Heap::SetGrowthControlState(bool state) { 288 void Heap::SetGrowthControlState(bool state) {
(...skipping 20 matching lines...) Expand all
311 309
312 uword Heap::EndAddress() { 310 uword Heap::EndAddress() {
313 return reinterpret_cast<uword>(new_space_->EndAddress()); 311 return reinterpret_cast<uword>(new_space_->EndAddress());
314 } 312 }
315 313
316 314
317 void Heap::Init(Isolate* isolate, 315 void Heap::Init(Isolate* isolate,
318 intptr_t max_new_gen_words, 316 intptr_t max_new_gen_words,
319 intptr_t max_old_gen_words) { 317 intptr_t max_old_gen_words) {
320 ASSERT(isolate->heap() == NULL); 318 ASSERT(isolate->heap() == NULL);
321 Heap* heap = new Heap(max_new_gen_words, max_old_gen_words); 319 Heap* heap = new Heap(isolate, max_new_gen_words, max_old_gen_words);
322 isolate->set_heap(heap); 320 isolate->set_heap(heap);
323 } 321 }
324 322
325 323
326 void Heap::GetMergedAddressRange(uword* start, uword* end) const { 324 void Heap::GetMergedAddressRange(uword* start, uword* end) const {
327 if (new_space_->CapacityInWords() != 0) { 325 if (new_space_->CapacityInWords() != 0) {
328 uword new_start; 326 uword new_start;
329 uword new_end; 327 uword new_end;
330 new_space_->StartEndAddress(&new_start, &new_end); 328 new_space_->StartEndAddress(&new_start, &new_end);
331 *start = Utils::Minimum(new_start, *start); 329 *start = Utils::Minimum(new_start, *start);
332 *end = Utils::Maximum(new_end, *end); 330 *end = Utils::Maximum(new_end, *end);
333 } 331 }
334 if (old_space_->CapacityInWords() != 0) { 332 if (old_space_->CapacityInWords() != 0) {
335 uword old_start; 333 uword old_start;
336 uword old_end; 334 uword old_end;
337 old_space_->StartEndAddress(&old_start, &old_end); 335 old_space_->StartEndAddress(&old_start, &old_end);
338 *start = Utils::Minimum(old_start, *start); 336 *start = Utils::Minimum(old_start, *start);
339 *end = Utils::Maximum(old_end, *end); 337 *end = Utils::Maximum(old_end, *end);
340 } 338 }
341 ASSERT(*start <= *end); 339 ASSERT(*start <= *end);
342 } 340 }
343 341
344 342
345 ObjectSet* Heap::CreateAllocatedObjectSet() const { 343 ObjectSet* Heap::CreateAllocatedObjectSet() const {
346 uword start = static_cast<uword>(-1); 344 uword start = static_cast<uword>(-1);
347 uword end = 0; 345 uword end = 0;
348 Isolate* vm_isolate = Dart::vm_isolate(); 346 Isolate* vm_isolate = Dart::vm_isolate();
349 vm_isolate->heap()->GetMergedAddressRange(&start, &end); 347 vm_isolate->heap()->GetMergedAddressRange(&start, &end);
350 Isolate* isolate = Isolate::Current(); 348 this->GetMergedAddressRange(&start, &end);
Ivan Posva 2014/04/25 16:55:57 Drop this->?
koda 2014/04/25 17:26:06 When there is another object of the same type arou
351 ASSERT(isolate->heap() == this);
352 isolate->heap()->GetMergedAddressRange(&start, &end);
353 349
354 ObjectSet* allocated_set = new ObjectSet(start, end); 350 ObjectSet* allocated_set = new ObjectSet(start, end);
355 351
356 VerifyObjectVisitor object_visitor(isolate, allocated_set); 352 VerifyObjectVisitor object_visitor(isolate(), allocated_set);
357 // TODO(koda): Consider adding a const visitor to enable using 'this'. 353 this->IterateObjects(&object_visitor);
358 isolate->heap()->IterateObjects(&object_visitor);
359 vm_isolate->heap()->IterateObjects(&object_visitor); 354 vm_isolate->heap()->IterateObjects(&object_visitor);
360 355
361 return allocated_set; 356 return allocated_set;
362 } 357 }
363 358
364 359
365 bool Heap::Verify() const { 360 bool Heap::Verify() const {
366 Isolate* isolate = Isolate::Current(); 361 ObjectSet* allocated_set = CreateAllocatedObjectSet();
367 ASSERT(isolate->heap() == this); 362 VerifyPointersVisitor visitor(isolate(), allocated_set);
368 ObjectSet* allocated_set = isolate->heap()->CreateAllocatedObjectSet(); 363 IteratePointers(&visitor);
369 VerifyPointersVisitor visitor(isolate, allocated_set);
370 // TODO(koda): Consider adding a const visitor to enable using 'this'.
371 isolate->heap()->IteratePointers(&visitor);
372 delete allocated_set; 364 delete allocated_set;
373 // Only returning a value so that Heap::Validate can be called from an ASSERT. 365 // Only returning a value so that Heap::Validate can be called from an ASSERT.
374 return true; 366 return true;
375 } 367 }
376 368
377 369
378 void Heap::PrintSizes() const { 370 void Heap::PrintSizes() const {
379 OS::PrintErr("New space (%" Pd "k of %" Pd "k) " 371 OS::PrintErr("New space (%" Pd "k of %" Pd "k) "
380 "Old space (%" Pd "k of %" Pd "k)\n", 372 "Old space (%" Pd "k of %" Pd "k)\n",
381 (UsedInWords(kNew) / KBInWords), 373 (UsedInWords(kNew) / KBInWords),
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 } 500 }
509 stats_.after_.new_ = new_space_->GetCurrentUsage(); 501 stats_.after_.new_ = new_space_->GetCurrentUsage();
510 stats_.after_.old_ = old_space_->GetCurrentUsage(); 502 stats_.after_.old_ = old_space_->GetCurrentUsage();
511 ASSERT(gc_in_progress_); 503 ASSERT(gc_in_progress_);
512 gc_in_progress_ = false; 504 gc_in_progress_ = false;
513 } 505 }
514 506
515 507
516 void Heap::PrintStats() { 508 void Heap::PrintStats() {
517 if (!FLAG_verbose_gc) return; 509 if (!FLAG_verbose_gc) return;
518 Isolate* isolate = Isolate::Current();
519 510
520 if ((FLAG_verbose_gc_hdr != 0) && 511 if ((FLAG_verbose_gc_hdr != 0) &&
521 (((stats_.num_ - 1) % FLAG_verbose_gc_hdr) == 0)) { 512 (((stats_.num_ - 1) % FLAG_verbose_gc_hdr) == 0)) {
522 OS::PrintErr("[ GC | space | count | start | gc time | " 513 OS::PrintErr("[ GC | space | count | start | gc time | "
523 "new gen (KB) | old gen (KB) | timers | data ]\n" 514 "new gen (KB) | old gen (KB) | timers | data ]\n"
524 "[ (isolate)| (reason)| | (s) | (ms) | " 515 "[ (isolate)| (reason)| | (s) | (ms) | "
525 "used,cap,ext | used,cap,ext | (ms) | ]\n"); 516 "used,cap,ext | used,cap,ext | (ms) | ]\n");
526 } 517 }
527 518
528 const char* space_str = stats_.space_ == kNew ? "Scavenge" : "Mark-Sweep"; 519 const char* space_str = stats_.space_ == kNew ? "Scavenge" : "Mark-Sweep";
529 OS::PrintErr( 520 OS::PrintErr(
530 "[ GC(%" Pd64 "): %s(%s), " // GC(isolate), space(reason) 521 "[ GC(%" Pd64 "): %s(%s), " // GC(isolate), space(reason)
531 "%" Pd ", " // count 522 "%" Pd ", " // count
532 "%.3f, " // start time 523 "%.3f, " // start time
533 "%.3f, " // total time 524 "%.3f, " // total time
534 "%" Pd ", %" Pd ", " // new gen: in use before/after 525 "%" Pd ", %" Pd ", " // new gen: in use before/after
535 "%" Pd ", %" Pd ", " // new gen: capacity before/after 526 "%" Pd ", %" Pd ", " // new gen: capacity before/after
536 "%" Pd ", %" Pd ", " // new gen: external before/after 527 "%" Pd ", %" Pd ", " // new gen: external before/after
537 "%" Pd ", %" Pd ", " // old gen: in use before/after 528 "%" Pd ", %" Pd ", " // old gen: in use before/after
538 "%" Pd ", %" Pd ", " // old gen: capacity before/after 529 "%" Pd ", %" Pd ", " // old gen: capacity before/after
539 "%" Pd ", %" Pd ", " // old gen: external before/after 530 "%" Pd ", %" Pd ", " // old gen: external before/after
540 "%.3f, %.3f, %.3f, %.3f, " // times 531 "%.3f, %.3f, %.3f, %.3f, " // times
541 "%" Pd ", %" Pd ", %" Pd ", %" Pd ", " // data 532 "%" Pd ", %" Pd ", %" Pd ", %" Pd ", " // data
542 "]\n", // End with a comma to make it easier to import in spreadsheets. 533 "]\n", // End with a comma to make it easier to import in spreadsheets.
543 isolate->main_port(), space_str, GCReasonToString(stats_.reason_), 534 isolate()->main_port(), space_str, GCReasonToString(stats_.reason_),
544 stats_.num_, 535 stats_.num_,
545 MicrosecondsToSeconds(stats_.before_.micros_ - isolate->start_time()), 536 MicrosecondsToSeconds(stats_.before_.micros_ - isolate()->start_time()),
546 MicrosecondsToMilliseconds(stats_.after_.micros_ - 537 MicrosecondsToMilliseconds(stats_.after_.micros_ -
547 stats_.before_.micros_), 538 stats_.before_.micros_),
548 RoundWordsToKB(stats_.before_.new_.used_in_words), 539 RoundWordsToKB(stats_.before_.new_.used_in_words),
549 RoundWordsToKB(stats_.after_.new_.used_in_words), 540 RoundWordsToKB(stats_.after_.new_.used_in_words),
550 RoundWordsToKB(stats_.before_.new_.capacity_in_words), 541 RoundWordsToKB(stats_.before_.new_.capacity_in_words),
551 RoundWordsToKB(stats_.after_.new_.capacity_in_words), 542 RoundWordsToKB(stats_.after_.new_.capacity_in_words),
552 RoundWordsToKB(stats_.before_.new_.external_in_words), 543 RoundWordsToKB(stats_.before_.new_.external_in_words),
553 RoundWordsToKB(stats_.after_.new_.external_in_words), 544 RoundWordsToKB(stats_.after_.new_.external_in_words),
554 RoundWordsToKB(stats_.before_.old_.used_in_words), 545 RoundWordsToKB(stats_.before_.old_.used_in_words),
555 RoundWordsToKB(stats_.after_.old_.used_in_words), 546 RoundWordsToKB(stats_.after_.old_.used_in_words),
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 heap->DisableGrowthControl(); 578 heap->DisableGrowthControl();
588 } 579 }
589 580
590 581
591 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { 582 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() {
592 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); 583 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap();
593 heap->SetGrowthControlState(current_growth_controller_state_); 584 heap->SetGrowthControlState(current_growth_controller_state_);
594 } 585 }
595 586
596 } // namespace dart 587 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/heap.h ('k') | runtime/vm/pages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698