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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
406 class_table->ResetCountersOld(); | 406 class_table->ResetCountersOld(); |
407 } | 407 } |
408 } | 408 } |
409 #endif | 409 #endif |
410 | 410 |
411 void Heap::EvacuateNewSpace(Thread* thread, GCReason reason) { | 411 void Heap::EvacuateNewSpace(Thread* thread, GCReason reason) { |
412 ASSERT(reason == kFull); | 412 ASSERT(reason == kFull); |
413 if (BeginNewSpaceGC(thread)) { | 413 if (BeginNewSpaceGC(thread)) { |
414 RecordBeforeGC(kNew, kFull); | 414 RecordBeforeGC(kNew, kFull); |
415 VMTagScope tagScope(thread, VMTag::kGCNewSpaceTagId); | 415 VMTagScope tagScope(thread, VMTag::kGCNewSpaceTagId); |
416 TIMELINE_FUNCTION_GC_DURATION(thread, "EvacuateNewGeneration"); | 416 TIMELINE_FUNCTION_GC_DURATION(thread, "EvacuateNewGeneration"); |
danunez
2017/08/22 17:01:26
I think you'll need to do the same for the Evacuat
rmacnak
2017/08/22 17:10:51
There's no trailing old-space GC here to exclude.
| |
417 NOT_IN_PRODUCT(UpdateClassHeapStatsBeforeGC(kNew)); | 417 NOT_IN_PRODUCT(UpdateClassHeapStatsBeforeGC(kNew)); |
418 new_space_.Evacuate(); | 418 new_space_.Evacuate(); |
419 NOT_IN_PRODUCT(isolate()->class_table()->UpdatePromoted()); | 419 NOT_IN_PRODUCT(isolate()->class_table()->UpdatePromoted()); |
420 RecordAfterGC(kNew); | 420 RecordAfterGC(kNew); |
421 PrintStats(); | 421 PrintStats(); |
422 NOT_IN_PRODUCT(PrintStatsToTimeline(&tds)); | 422 NOT_IN_PRODUCT(PrintStatsToTimeline(&tds)); |
423 EndNewSpaceGC(); | 423 EndNewSpaceGC(); |
424 } | 424 } |
425 } | 425 } |
426 | 426 |
427 void Heap::CollectNewSpaceGarbage(Thread* thread, | 427 void Heap::CollectNewSpaceGarbage(Thread* thread, |
428 ApiCallbacks api_callbacks, | 428 ApiCallbacks api_callbacks, |
429 GCReason reason) { | 429 GCReason reason) { |
430 ASSERT((reason == kNewSpace) || (reason == kFull)); | 430 ASSERT((reason == kNewSpace) || (reason == kFull)); |
431 if (BeginNewSpaceGC(thread)) { | 431 if (BeginNewSpaceGC(thread)) { |
432 bool invoke_api_callbacks = (api_callbacks == kInvokeApiCallbacks); | 432 bool invoke_api_callbacks = (api_callbacks == kInvokeApiCallbacks); |
433 RecordBeforeGC(kNew, reason); | 433 RecordBeforeGC(kNew, reason); |
434 VMTagScope tagScope(thread, VMTag::kGCNewSpaceTagId); | 434 { |
435 TIMELINE_FUNCTION_GC_DURATION(thread, "CollectNewGeneration"); | 435 VMTagScope tagScope(thread, VMTag::kGCNewSpaceTagId); |
436 NOT_IN_PRODUCT(UpdateClassHeapStatsBeforeGC(kNew)); | 436 TIMELINE_FUNCTION_GC_DURATION(thread, "CollectNewGeneration"); |
437 new_space_.Scavenge(invoke_api_callbacks); | 437 NOT_IN_PRODUCT(UpdateClassHeapStatsBeforeGC(kNew)); |
438 NOT_IN_PRODUCT(isolate()->class_table()->UpdatePromoted()); | 438 new_space_.Scavenge(invoke_api_callbacks); |
439 RecordAfterGC(kNew); | 439 NOT_IN_PRODUCT(isolate()->class_table()->UpdatePromoted()); |
440 PrintStats(); | 440 RecordAfterGC(kNew); |
441 NOT_IN_PRODUCT(PrintStatsToTimeline(&tds)); | 441 PrintStats(); |
442 EndNewSpaceGC(); | 442 NOT_IN_PRODUCT(PrintStatsToTimeline(&tds)); |
443 EndNewSpaceGC(); | |
444 } | |
443 if ((reason == kNewSpace) && old_space_.NeedsGarbageCollection()) { | 445 if ((reason == kNewSpace) && old_space_.NeedsGarbageCollection()) { |
444 // Old collections should call the API callbacks. | 446 // Old collections should call the API callbacks. |
445 CollectOldSpaceGarbage(thread, kInvokeApiCallbacks, kPromotion); | 447 CollectOldSpaceGarbage(thread, kInvokeApiCallbacks, kPromotion); |
446 } | 448 } |
447 } | 449 } |
448 } | 450 } |
449 | 451 |
450 void Heap::CollectOldSpaceGarbage(Thread* thread, | 452 void Heap::CollectOldSpaceGarbage(Thread* thread, |
451 ApiCallbacks api_callbacks, | 453 ApiCallbacks api_callbacks, |
452 GCReason reason) { | 454 GCReason reason) { |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
899 : StackResource(thread) { | 901 : StackResource(thread) { |
900 Dart::vm_isolate()->heap()->WriteProtect(false); | 902 Dart::vm_isolate()->heap()->WriteProtect(false); |
901 } | 903 } |
902 | 904 |
903 WritableVMIsolateScope::~WritableVMIsolateScope() { | 905 WritableVMIsolateScope::~WritableVMIsolateScope() { |
904 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); | 906 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); |
905 Dart::vm_isolate()->heap()->WriteProtect(true); | 907 Dart::vm_isolate()->heap()->WriteProtect(true); |
906 } | 908 } |
907 | 909 |
908 } // namespace dart | 910 } // namespace dart |
OLD | NEW |