Chromium Code Reviews| 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 395 if (BeginOldSpaceGC(thread)) { | 395 if (BeginOldSpaceGC(thread)) { |
| 396 bool invoke_api_callbacks = (api_callbacks == kInvokeApiCallbacks); | 396 bool invoke_api_callbacks = (api_callbacks == kInvokeApiCallbacks); |
| 397 RecordBeforeGC(kOld, reason); | 397 RecordBeforeGC(kOld, reason); |
| 398 VMTagScope tagScope(thread, VMTag::kGCOldSpaceTagId); | 398 VMTagScope tagScope(thread, VMTag::kGCOldSpaceTagId); |
| 399 TIMELINE_FUNCTION_GC_DURATION(thread, "CollectOldGeneration"); | 399 TIMELINE_FUNCTION_GC_DURATION(thread, "CollectOldGeneration"); |
| 400 NOT_IN_PRODUCT(UpdateClassHeapStatsBeforeGC(kOld)); | 400 NOT_IN_PRODUCT(UpdateClassHeapStatsBeforeGC(kOld)); |
| 401 old_space_.MarkSweep(invoke_api_callbacks); | 401 old_space_.MarkSweep(invoke_api_callbacks); |
| 402 RecordAfterGC(kOld); | 402 RecordAfterGC(kOld); |
| 403 PrintStats(); | 403 PrintStats(); |
| 404 NOT_IN_PRODUCT(PrintStatsToTimeline(&tds)); | 404 NOT_IN_PRODUCT(PrintStatsToTimeline(&tds)); |
| 405 // Some Code objects may have been collected so invalidate handler cache. | |
| 406 thread->isolate()->handler_info_cache.Clear(); | |
|
Florian Schneider
2017/02/08 21:34:05
Can we only invalidate if there was a code GC, and
Dmitry Olshansky
2017/02/09 17:54:34
Asked Slava and basically we can't know if there w
| |
| 405 EndOldSpaceGC(); | 407 EndOldSpaceGC(); |
| 406 } | 408 } |
| 407 } | 409 } |
| 408 | 410 |
| 409 | 411 |
| 410 void Heap::CollectGarbage(Space space, | 412 void Heap::CollectGarbage(Space space, |
| 411 ApiCallbacks api_callbacks, | 413 ApiCallbacks api_callbacks, |
| 412 GCReason reason) { | 414 GCReason reason) { |
| 413 Thread* thread = Thread::Current(); | 415 Thread* thread = Thread::Current(); |
| 414 switch (space) { | 416 switch (space) { |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 843 Dart::vm_isolate()->heap()->WriteProtect(false); | 845 Dart::vm_isolate()->heap()->WriteProtect(false); |
| 844 } | 846 } |
| 845 | 847 |
| 846 | 848 |
| 847 WritableVMIsolateScope::~WritableVMIsolateScope() { | 849 WritableVMIsolateScope::~WritableVMIsolateScope() { |
| 848 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); | 850 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); |
| 849 Dart::vm_isolate()->heap()->WriteProtect(true); | 851 Dart::vm_isolate()->heap()->WriteProtect(true); |
| 850 } | 852 } |
| 851 | 853 |
| 852 } // namespace dart | 854 } // namespace dart |
| OLD | NEW |