| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 Isolate* isolate = Isolate::Current(); | 207 Isolate* isolate = Isolate::Current(); |
| 208 bool invoke_api_callbacks = (api_callbacks == kInvokeApiCallbacks); | 208 bool invoke_api_callbacks = (api_callbacks == kInvokeApiCallbacks); |
| 209 switch (space) { | 209 switch (space) { |
| 210 case kNew: { | 210 case kNew: { |
| 211 VMTagScope tagScope(isolate, VMTag::kGCNewSpaceTagId); | 211 VMTagScope tagScope(isolate, VMTag::kGCNewSpaceTagId); |
| 212 RecordBeforeGC(kNew, kNewSpace); | 212 RecordBeforeGC(kNew, kNewSpace); |
| 213 UpdateClassHeapStatsBeforeGC(kNew); | 213 UpdateClassHeapStatsBeforeGC(kNew); |
| 214 new_space_->Scavenge(invoke_api_callbacks); | 214 new_space_->Scavenge(invoke_api_callbacks); |
| 215 RecordAfterGC(); | 215 RecordAfterGC(); |
| 216 PrintStats(); | 216 PrintStats(); |
| 217 if (new_space_->HadPromotionFailure()) { | 217 if (new_space_->HadPromotionFailure() || old_space_->NeedExternalGC()) { |
| 218 // Old collections should call the API callbacks. | 218 // Old collections should call the API callbacks. |
| 219 CollectGarbage(kOld, kInvokeApiCallbacks); | 219 CollectGarbage(kOld, kInvokeApiCallbacks); |
| 220 } | 220 } |
| 221 break; | 221 break; |
| 222 } | 222 } |
| 223 case kOld: | 223 case kOld: |
| 224 case kCode: { | 224 case kCode: { |
| 225 VMTagScope tagScope(isolate, VMTag::kGCOldSpaceTagId); | 225 VMTagScope tagScope(isolate, VMTag::kGCOldSpaceTagId); |
| 226 bool promotion_failure = new_space_->HadPromotionFailure(); | 226 bool promotion_failure = new_space_->HadPromotionFailure(); |
| 227 RecordBeforeGC(kOld, promotion_failure ? kPromotionFailure : kOldSpace); | 227 RecordBeforeGC(kOld, promotion_failure ? kPromotionFailure : kOldSpace); |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 heap->DisableGrowthControl(); | 579 heap->DisableGrowthControl(); |
| 580 } | 580 } |
| 581 | 581 |
| 582 | 582 |
| 583 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { | 583 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { |
| 584 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); | 584 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); |
| 585 heap->SetGrowthControlState(current_growth_controller_state_); | 585 heap->SetGrowthControlState(current_growth_controller_state_); |
| 586 } | 586 } |
| 587 | 587 |
| 588 } // namespace dart | 588 } // namespace dart |
| OLD | NEW |