| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 new_space_->AllocateExternal(size); | 96 new_space_->AllocateExternal(size); |
| 97 if (new_space_->ExternalInWords() > (FLAG_new_gen_ext_limit * MBInWords)) { | 97 if (new_space_->ExternalInWords() > (FLAG_new_gen_ext_limit * MBInWords)) { |
| 98 // Attempt to free some external allocation by a scavenge. (If the total | 98 // Attempt to free some external allocation by a scavenge. (If the total |
| 99 // remains above the limit, next external alloc will trigger another.) | 99 // remains above the limit, next external alloc will trigger another.) |
| 100 CollectGarbage(kNew); | 100 CollectGarbage(kNew); |
| 101 } | 101 } |
| 102 } else { | 102 } else { |
| 103 ASSERT(space == kOld); | 103 ASSERT(space == kOld); |
| 104 old_space_->AllocateExternal(size); | 104 old_space_->AllocateExternal(size); |
| 105 if (old_space_->NeedsGarbageCollection()) { | 105 if (old_space_->NeedsGarbageCollection()) { |
| 106 CollectGarbage(kOld); | 106 CollectAllGarbage(); |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 | 110 |
| 111 void Heap::FreeExternal(intptr_t size, Space space) { | 111 void Heap::FreeExternal(intptr_t size, Space space) { |
| 112 if (space == kNew) { | 112 if (space == kNew) { |
| 113 new_space_->FreeExternal(size); | 113 new_space_->FreeExternal(size); |
| 114 } else { | 114 } else { |
| 115 ASSERT(space == kOld); | 115 ASSERT(space == kOld); |
| 116 old_space_->FreeExternal(size); | 116 old_space_->FreeExternal(size); |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 heap->DisableGrowthControl(); | 578 heap->DisableGrowthControl(); |
| 579 } | 579 } |
| 580 | 580 |
| 581 | 581 |
| 582 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { | 582 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { |
| 583 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); | 583 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); |
| 584 heap->SetGrowthControlState(current_growth_controller_state_); | 584 heap->SetGrowthControlState(current_growth_controller_state_); |
| 585 } | 585 } |
| 586 | 586 |
| 587 } // namespace dart | 587 } // namespace dart |
| OLD | NEW |