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

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

Issue 1811713002: Perform a full GC by default when requesting a heap snapshot. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « runtime/vm/object_graph.h ('k') | runtime/vm/service.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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/object_graph.h" 5 #include "vm/object_graph.h"
6 6
7 #include "vm/dart.h" 7 #include "vm/dart.h"
8 #include "vm/growable_array.h" 8 #include "vm/growable_array.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 504
505 intptr_t count() const { return count_; } 505 intptr_t count() const { return count_; }
506 506
507 private: 507 private:
508 WriteStream* stream_; 508 WriteStream* stream_;
509 WritePointerVisitor ptr_writer_; 509 WritePointerVisitor ptr_writer_;
510 intptr_t count_; 510 intptr_t count_;
511 }; 511 };
512 512
513 513
514 intptr_t ObjectGraph::Serialize(WriteStream* stream) { 514 intptr_t ObjectGraph::Serialize(WriteStream* stream, bool collect_garbage) {
515 if (collect_garbage) {
516 isolate()->heap()->CollectAllGarbage();
517 }
515 // Current encoding assumes objects do not move, so promote everything to old. 518 // Current encoding assumes objects do not move, so promote everything to old.
516 isolate()->heap()->new_space()->Evacuate(); 519 isolate()->heap()->new_space()->Evacuate();
Ivan Posva 2016/03/18 23:38:58 You could also run a scavenge followed by the call
520
517 WriteGraphVisitor visitor(isolate(), stream); 521 WriteGraphVisitor visitor(isolate(), stream);
518 stream->WriteUnsigned(kObjectAlignment); 522 stream->WriteUnsigned(kObjectAlignment);
519 stream->WriteUnsigned(0); 523 stream->WriteUnsigned(0);
520 stream->WriteUnsigned(0); 524 stream->WriteUnsigned(0);
521 stream->WriteUnsigned(0); 525 stream->WriteUnsigned(0);
522 { 526 {
523 WritePointerVisitor ptr_writer(isolate(), stream); 527 WritePointerVisitor ptr_writer(isolate(), stream);
524 isolate()->IterateObjectPointers(&ptr_writer, false); 528 isolate()->IterateObjectPointers(&ptr_writer, false);
525 } 529 }
526 stream->WriteUnsigned(0); 530 stream->WriteUnsigned(0);
527 IterateObjects(&visitor); 531 IterateObjects(&visitor);
528 return visitor.count() + 1; // + root 532 return visitor.count() + 1; // + root
529 } 533 }
530 534
531 } // namespace dart 535 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object_graph.h ('k') | runtime/vm/service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698