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

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

Issue 11428067: Merge the Merlin heap tracing to top-of-trunk. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address review comments Created 8 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
« no previous file with comments | « runtime/vm/object_set.h ('k') | runtime/vm/raw_object.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/pages.h" 5 #include "vm/pages.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/compiler_stats.h" 8 #include "vm/compiler_stats.h"
9 #include "vm/gc_marker.h" 9 #include "vm/gc_marker.h"
10 #include "vm/gc_sweeper.h" 10 #include "vm/gc_sweeper.h"
11 #include "vm/heap_trace.h"
11 #include "vm/object.h" 12 #include "vm/object.h"
12 #include "vm/virtual_memory.h" 13 #include "vm/virtual_memory.h"
13 14
14 namespace dart { 15 namespace dart {
15 16
16 DEFINE_FLAG(int, heap_growth_space_ratio, 10, 17 DEFINE_FLAG(int, heap_growth_space_ratio, 10,
17 "The desired maximum percentage of free space after GC"); 18 "The desired maximum percentage of free space after GC");
18 DEFINE_FLAG(int, heap_growth_time_ratio, 3, 19 DEFINE_FLAG(int, heap_growth_time_ratio, 3,
19 "The desired maximum percentage of time spent in GC"); 20 "The desired maximum percentage of time spent in GC");
20 DEFINE_FLAG(int, heap_growth_rate, 4, 21 DEFINE_FLAG(int, heap_growth_rate, 4,
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 } 400 }
400 401
401 402
402 void PageSpace::MarkSweep(bool invoke_api_callbacks, const char* gc_reason) { 403 void PageSpace::MarkSweep(bool invoke_api_callbacks, const char* gc_reason) {
403 // MarkSweep is not reentrant. Make sure that is the case. 404 // MarkSweep is not reentrant. Make sure that is the case.
404 ASSERT(!sweeping_); 405 ASSERT(!sweeping_);
405 sweeping_ = true; 406 sweeping_ = true;
406 Isolate* isolate = Isolate::Current(); 407 Isolate* isolate = Isolate::Current();
407 NoHandleScope no_handles(isolate); 408 NoHandleScope no_handles(isolate);
408 409
410 if (HeapTrace::is_enabled()) {
411 isolate->heap()->trace()->TraceMarkSweepStart();
412 }
413
409 if (FLAG_print_free_list_before_gc) { 414 if (FLAG_print_free_list_before_gc) {
410 OS::Print("Data Freelist (before GC):\n"); 415 OS::Print("Data Freelist (before GC):\n");
411 freelist_[HeapPage::kData].Print(); 416 freelist_[HeapPage::kData].Print();
412 OS::Print("Executable Freelist (before GC):\n"); 417 OS::Print("Executable Freelist (before GC):\n");
413 freelist_[HeapPage::kExecutable].Print(); 418 freelist_[HeapPage::kExecutable].Print();
414 } 419 }
415 420
416 if (FLAG_verify_before_gc) { 421 if (FLAG_verify_before_gc) {
417 OS::PrintErr("Verifying before MarkSweep..."); 422 OS::PrintErr("Verifying before MarkSweep...");
418 heap_->Verify(); 423 heap_->Verify();
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 OS::Print("Executable Freelist (after GC):\n"); 499 OS::Print("Executable Freelist (after GC):\n");
495 freelist_[HeapPage::kExecutable].Print(); 500 freelist_[HeapPage::kExecutable].Print();
496 } 501 }
497 502
498 if (FLAG_verify_after_gc) { 503 if (FLAG_verify_after_gc) {
499 OS::PrintErr("Verifying after MarkSweep..."); 504 OS::PrintErr("Verifying after MarkSweep...");
500 heap_->Verify(); 505 heap_->Verify();
501 OS::PrintErr(" done.\n"); 506 OS::PrintErr(" done.\n");
502 } 507 }
503 508
509 if (HeapTrace::is_enabled()) {
510 isolate->heap()->trace()->TraceMarkSweepFinish();
511 }
512
504 count_++; 513 count_++;
505 // Done, reset the marker. 514 // Done, reset the marker.
506 ASSERT(sweeping_); 515 ASSERT(sweeping_);
507 sweeping_ = false; 516 sweeping_ = false;
508 } 517 }
509 518
510 519
511 PageSpaceController::PageSpaceController(int heap_growth_ratio, 520 PageSpaceController::PageSpaceController(int heap_growth_ratio,
512 int heap_growth_rate, 521 int heap_growth_rate,
513 int garbage_collection_time_ratio) 522 int garbage_collection_time_ratio)
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 return 0; 635 return 0;
627 } else { 636 } else {
628 ASSERT(total_time >= gc_time); 637 ASSERT(total_time >= gc_time);
629 int result= static_cast<int>((static_cast<double>(gc_time) / 638 int result= static_cast<int>((static_cast<double>(gc_time) /
630 static_cast<double>(total_time)) * 100); 639 static_cast<double>(total_time)) * 100);
631 return result; 640 return result;
632 } 641 }
633 } 642 }
634 643
635 } // namespace dart 644 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object_set.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698