| 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/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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 } | 439 } |
| 440 | 440 |
| 441 | 441 |
| 442 void Heap::CollectAllGarbage() { | 442 void Heap::CollectAllGarbage() { |
| 443 Thread* thread = Thread::Current(); | 443 Thread* thread = Thread::Current(); |
| 444 CollectNewSpaceGarbage(thread, kInvokeApiCallbacks, kFull); | 444 CollectNewSpaceGarbage(thread, kInvokeApiCallbacks, kFull); |
| 445 CollectOldSpaceGarbage(thread, kInvokeApiCallbacks, kFull); | 445 CollectOldSpaceGarbage(thread, kInvokeApiCallbacks, kFull); |
| 446 } | 446 } |
| 447 | 447 |
| 448 | 448 |
| 449 #if defined(DEBUG) |
| 450 void Heap::WaitForSweeperTasks() { |
| 451 Thread* thread = Thread::Current(); |
| 452 { |
| 453 MonitorLocker ml(old_space_.tasks_lock()); |
| 454 while (old_space_.tasks() > 0) { |
| 455 ml.WaitWithSafepointCheck(thread); |
| 456 } |
| 457 } |
| 458 } |
| 459 #endif |
| 460 |
| 461 |
| 449 bool Heap::ShouldPretenure(intptr_t class_id) const { | 462 bool Heap::ShouldPretenure(intptr_t class_id) const { |
| 450 if (class_id == kOneByteStringCid) { | 463 if (class_id == kOneByteStringCid) { |
| 451 return pretenure_policy_ > 0; | 464 return pretenure_policy_ > 0; |
| 452 } else { | 465 } else { |
| 453 return false; | 466 return false; |
| 454 } | 467 } |
| 455 } | 468 } |
| 456 | 469 |
| 457 | 470 |
| 458 void Heap::UpdatePretenurePolicy() { | 471 void Heap::UpdatePretenurePolicy() { |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 Dart::vm_isolate()->heap()->WriteProtect(false, include_code_pages_); | 854 Dart::vm_isolate()->heap()->WriteProtect(false, include_code_pages_); |
| 842 } | 855 } |
| 843 | 856 |
| 844 | 857 |
| 845 WritableVMIsolateScope::~WritableVMIsolateScope() { | 858 WritableVMIsolateScope::~WritableVMIsolateScope() { |
| 846 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); | 859 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); |
| 847 Dart::vm_isolate()->heap()->WriteProtect(true, include_code_pages_); | 860 Dart::vm_isolate()->heap()->WriteProtect(true, include_code_pages_); |
| 848 } | 861 } |
| 849 | 862 |
| 850 } // namespace dart | 863 } // namespace dart |
| OLD | NEW |