| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 ApiCallbacks api_callbacks, | 215 ApiCallbacks api_callbacks, |
| 216 GCReason reason) { | 216 GCReason reason) { |
| 217 TIMERSCOPE(isolate(), time_gc); | 217 TIMERSCOPE(isolate(), time_gc); |
| 218 bool invoke_api_callbacks = (api_callbacks == kInvokeApiCallbacks); | 218 bool invoke_api_callbacks = (api_callbacks == kInvokeApiCallbacks); |
| 219 switch (space) { | 219 switch (space) { |
| 220 case kNew: { | 220 case kNew: { |
| 221 VMTagScope tagScope(isolate(), VMTag::kGCNewSpaceTagId); | 221 VMTagScope tagScope(isolate(), VMTag::kGCNewSpaceTagId); |
| 222 RecordBeforeGC(kNew, reason); | 222 RecordBeforeGC(kNew, reason); |
| 223 UpdateClassHeapStatsBeforeGC(kNew); | 223 UpdateClassHeapStatsBeforeGC(kNew); |
| 224 new_space_->Scavenge(invoke_api_callbacks); | 224 new_space_->Scavenge(invoke_api_callbacks); |
| 225 isolate()->class_table()->UpdatePromoted(); |
| 225 RecordAfterGC(); | 226 RecordAfterGC(); |
| 226 PrintStats(); | 227 PrintStats(); |
| 227 if (old_space_->NeedsGarbageCollection()) { | 228 if (old_space_->NeedsGarbageCollection()) { |
| 228 // Old collections should call the API callbacks. | 229 // Old collections should call the API callbacks. |
| 229 CollectGarbage(kOld, kInvokeApiCallbacks, kPromotion); | 230 CollectGarbage(kOld, kInvokeApiCallbacks, kPromotion); |
| 230 } | 231 } |
| 231 break; | 232 break; |
| 232 } | 233 } |
| 233 case kOld: | 234 case kOld: |
| 234 case kCode: { | 235 case kCode: { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } | 267 } |
| 267 | 268 |
| 268 | 269 |
| 269 void Heap::CollectAllGarbage() { | 270 void Heap::CollectAllGarbage() { |
| 270 TIMERSCOPE(isolate(), time_gc); | 271 TIMERSCOPE(isolate(), time_gc); |
| 271 { | 272 { |
| 272 VMTagScope tagScope(isolate(), VMTag::kGCNewSpaceTagId); | 273 VMTagScope tagScope(isolate(), VMTag::kGCNewSpaceTagId); |
| 273 RecordBeforeGC(kNew, kFull); | 274 RecordBeforeGC(kNew, kFull); |
| 274 UpdateClassHeapStatsBeforeGC(kNew); | 275 UpdateClassHeapStatsBeforeGC(kNew); |
| 275 new_space_->Scavenge(kInvokeApiCallbacks); | 276 new_space_->Scavenge(kInvokeApiCallbacks); |
| 277 isolate()->class_table()->UpdatePromoted(); |
| 276 RecordAfterGC(); | 278 RecordAfterGC(); |
| 277 PrintStats(); | 279 PrintStats(); |
| 278 } | 280 } |
| 279 { | 281 { |
| 280 VMTagScope tagScope(isolate(), VMTag::kGCOldSpaceTagId); | 282 VMTagScope tagScope(isolate(), VMTag::kGCOldSpaceTagId); |
| 281 RecordBeforeGC(kOld, kFull); | 283 RecordBeforeGC(kOld, kFull); |
| 282 UpdateClassHeapStatsBeforeGC(kOld); | 284 UpdateClassHeapStatsBeforeGC(kOld); |
| 283 old_space_->MarkSweep(kInvokeApiCallbacks); | 285 old_space_->MarkSweep(kInvokeApiCallbacks); |
| 284 RecordAfterGC(); | 286 RecordAfterGC(); |
| 285 PrintStats(); | 287 PrintStats(); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 heap->DisableGrowthControl(); | 601 heap->DisableGrowthControl(); |
| 600 } | 602 } |
| 601 | 603 |
| 602 | 604 |
| 603 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { | 605 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { |
| 604 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); | 606 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); |
| 605 heap->SetGrowthControlState(current_growth_controller_state_); | 607 heap->SetGrowthControlState(current_growth_controller_state_); |
| 606 } | 608 } |
| 607 | 609 |
| 608 } // namespace dart | 610 } // namespace dart |
| OLD | NEW |