| OLD | NEW |
| 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" |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 | 397 |
| 398 | 398 |
| 399 void PageSpace::MarkSweep(bool invoke_api_callbacks, const char* gc_reason) { | 399 void PageSpace::MarkSweep(bool invoke_api_callbacks, const char* gc_reason) { |
| 400 // MarkSweep is not reentrant. Make sure that is the case. | 400 // MarkSweep is not reentrant. Make sure that is the case. |
| 401 ASSERT(!sweeping_); | 401 ASSERT(!sweeping_); |
| 402 sweeping_ = true; | 402 sweeping_ = true; |
| 403 Isolate* isolate = Isolate::Current(); | 403 Isolate* isolate = Isolate::Current(); |
| 404 NoHandleScope no_handles(isolate); | 404 NoHandleScope no_handles(isolate); |
| 405 | 405 |
| 406 if (FLAG_print_free_list_before_gc) { | 406 if (FLAG_print_free_list_before_gc) { |
| 407 OS::Print("Data Freelist:\n"); | 407 OS::Print("Data Freelist (before GC):\n"); |
| 408 freelist_[HeapPage::kData].Print(); | 408 freelist_[HeapPage::kData].Print(); |
| 409 OS::Print("Executable Freelist:\n"); | 409 OS::Print("Executable Freelist (before GC):\n"); |
| 410 freelist_[HeapPage::kExecutable].Print(); | 410 freelist_[HeapPage::kExecutable].Print(); |
| 411 } | 411 } |
| 412 | 412 |
| 413 if (FLAG_verify_before_gc) { | 413 if (FLAG_verify_before_gc) { |
| 414 OS::PrintErr("Verifying before MarkSweep..."); | 414 OS::PrintErr("Verifying before MarkSweep..."); |
| 415 heap_->Verify(); | 415 heap_->Verify(); |
| 416 OS::PrintErr(" done.\n"); | 416 OS::PrintErr(" done.\n"); |
| 417 } | 417 } |
| 418 | 418 |
| 419 if (FLAG_verbose_gc) { | 419 if (FLAG_verbose_gc) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 const intptr_t KB2 = KB / 2; | 479 const intptr_t KB2 = KB / 2; |
| 480 OS::PrintErr("Mark-Sweep[%d]: %"Pd64"us (%"Pd"K -> %"Pd"K, %"Pd"K)\n", | 480 OS::PrintErr("Mark-Sweep[%d]: %"Pd64"us (%"Pd"K -> %"Pd"K, %"Pd"K)\n", |
| 481 count_, | 481 count_, |
| 482 timer.TotalElapsedTime(), | 482 timer.TotalElapsedTime(), |
| 483 (in_use_before + (KB2)) / KB, | 483 (in_use_before + (KB2)) / KB, |
| 484 (in_use + (KB2)) / KB, | 484 (in_use + (KB2)) / KB, |
| 485 (capacity_ + KB2) / KB); | 485 (capacity_ + KB2) / KB); |
| 486 } | 486 } |
| 487 | 487 |
| 488 if (FLAG_print_free_list_after_gc) { | 488 if (FLAG_print_free_list_after_gc) { |
| 489 OS::Print("Data Freelist:\n"); | 489 OS::Print("Data Freelist (after GC):\n"); |
| 490 freelist_[HeapPage::kData].Print(); | 490 freelist_[HeapPage::kData].Print(); |
| 491 OS::Print("Executable Freelist:\n"); | 491 OS::Print("Executable Freelist (after GC):\n"); |
| 492 freelist_[HeapPage::kExecutable].Print(); | 492 freelist_[HeapPage::kExecutable].Print(); |
| 493 } | 493 } |
| 494 | 494 |
| 495 if (FLAG_verify_after_gc) { | 495 if (FLAG_verify_after_gc) { |
| 496 OS::PrintErr("Verifying after MarkSweep..."); | 496 OS::PrintErr("Verifying after MarkSweep..."); |
| 497 heap_->Verify(); | 497 heap_->Verify(); |
| 498 OS::PrintErr(" done.\n"); | 498 OS::PrintErr(" done.\n"); |
| 499 } | 499 } |
| 500 | 500 |
| 501 count_++; | 501 count_++; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 return 0; | 623 return 0; |
| 624 } else { | 624 } else { |
| 625 ASSERT(total_time >= gc_time); | 625 ASSERT(total_time >= gc_time); |
| 626 int result= static_cast<int>((static_cast<double>(gc_time) / | 626 int result= static_cast<int>((static_cast<double>(gc_time) / |
| 627 static_cast<double>(total_time)) * 100); | 627 static_cast<double>(total_time)) * 100); |
| 628 return result; | 628 return result; |
| 629 } | 629 } |
| 630 } | 630 } |
| 631 | 631 |
| 632 } // namespace dart | 632 } // namespace dart |
| OLD | NEW |