OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/heap/heap.h" | 5 #include "src/heap/heap.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/ast/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 | 813 |
814 GCTracer::Scope gc_scope(tracer(), GCTracer::Scope::MC_INCREMENTAL_FINALIZE); | 814 GCTracer::Scope gc_scope(tracer(), GCTracer::Scope::MC_INCREMENTAL_FINALIZE); |
815 HistogramTimerScope incremental_marking_scope( | 815 HistogramTimerScope incremental_marking_scope( |
816 isolate()->counters()->gc_incremental_marking_finalize()); | 816 isolate()->counters()->gc_incremental_marking_finalize()); |
817 TRACE_EVENT0("v8", "V8.GCIncrementalMarkingFinalize"); | 817 TRACE_EVENT0("v8", "V8.GCIncrementalMarkingFinalize"); |
818 | 818 |
819 { | 819 { |
820 GCCallbacksScope scope(this); | 820 GCCallbacksScope scope(this); |
821 if (scope.CheckReenter()) { | 821 if (scope.CheckReenter()) { |
822 AllowHeapAllocation allow_allocation; | 822 AllowHeapAllocation allow_allocation; |
823 GCTracer::Scope scope(tracer(), GCTracer::Scope::EXTERNAL); | 823 GCTracer::Scope scope(tracer(), |
| 824 GCTracer::Scope::MC_INCREMENTAL_EXTERNAL_PROLOGUE); |
824 VMState<EXTERNAL> state(isolate_); | 825 VMState<EXTERNAL> state(isolate_); |
825 HandleScope handle_scope(isolate_); | 826 HandleScope handle_scope(isolate_); |
826 CallGCPrologueCallbacks(kGCTypeIncrementalMarking, kNoGCCallbackFlags); | 827 CallGCPrologueCallbacks(kGCTypeIncrementalMarking, kNoGCCallbackFlags); |
827 } | 828 } |
828 } | 829 } |
829 incremental_marking()->FinalizeIncrementally(); | 830 incremental_marking()->FinalizeIncrementally(); |
830 { | 831 { |
831 GCCallbacksScope scope(this); | 832 GCCallbacksScope scope(this); |
832 if (scope.CheckReenter()) { | 833 if (scope.CheckReenter()) { |
833 AllowHeapAllocation allow_allocation; | 834 AllowHeapAllocation allow_allocation; |
834 GCTracer::Scope scope(tracer(), GCTracer::Scope::EXTERNAL); | 835 GCTracer::Scope scope(tracer(), |
| 836 GCTracer::Scope::MC_INCREMENTAL_EXTERNAL_PROLOGUE); |
835 VMState<EXTERNAL> state(isolate_); | 837 VMState<EXTERNAL> state(isolate_); |
836 HandleScope handle_scope(isolate_); | 838 HandleScope handle_scope(isolate_); |
837 CallGCEpilogueCallbacks(kGCTypeIncrementalMarking, kNoGCCallbackFlags); | 839 CallGCEpilogueCallbacks(kGCTypeIncrementalMarking, kNoGCCallbackFlags); |
838 } | 840 } |
839 } | 841 } |
840 } | 842 } |
841 | 843 |
842 | 844 |
843 HistogramTimer* Heap::GCTypeTimer(GarbageCollector collector) { | 845 HistogramTimer* Heap::GCTypeTimer(GarbageCollector collector) { |
844 if (collector == SCAVENGER) { | 846 if (collector == SCAVENGER) { |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 } | 1273 } |
1272 #endif | 1274 #endif |
1273 | 1275 |
1274 GCType gc_type = | 1276 GCType gc_type = |
1275 collector == MARK_COMPACTOR ? kGCTypeMarkSweepCompact : kGCTypeScavenge; | 1277 collector == MARK_COMPACTOR ? kGCTypeMarkSweepCompact : kGCTypeScavenge; |
1276 | 1278 |
1277 { | 1279 { |
1278 GCCallbacksScope scope(this); | 1280 GCCallbacksScope scope(this); |
1279 if (scope.CheckReenter()) { | 1281 if (scope.CheckReenter()) { |
1280 AllowHeapAllocation allow_allocation; | 1282 AllowHeapAllocation allow_allocation; |
1281 GCTracer::Scope scope(tracer(), GCTracer::Scope::EXTERNAL); | 1283 GCTracer::Scope scope(tracer(), |
| 1284 collector == MARK_COMPACTOR |
| 1285 ? GCTracer::Scope::MC_EXTERNAL_PROLOGUE |
| 1286 : GCTracer::Scope::SCAVENGER_EXTERNAL_PROLOGUE); |
1282 VMState<EXTERNAL> state(isolate_); | 1287 VMState<EXTERNAL> state(isolate_); |
1283 HandleScope handle_scope(isolate_); | 1288 HandleScope handle_scope(isolate_); |
1284 CallGCPrologueCallbacks(gc_type, kNoGCCallbackFlags); | 1289 CallGCPrologueCallbacks(gc_type, kNoGCCallbackFlags); |
1285 } | 1290 } |
1286 } | 1291 } |
1287 | 1292 |
1288 EnsureFromSpaceIsCommitted(); | 1293 EnsureFromSpaceIsCommitted(); |
1289 | 1294 |
1290 int start_new_space_size = Heap::new_space()->SizeAsInt(); | 1295 int start_new_space_size = Heap::new_space()->SizeAsInt(); |
1291 | 1296 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1330 // We finished a marking cycle. We can uncommit the marking deque until | 1335 // We finished a marking cycle. We can uncommit the marking deque until |
1331 // we start marking again. | 1336 // we start marking again. |
1332 mark_compact_collector()->marking_deque()->Uninitialize(); | 1337 mark_compact_collector()->marking_deque()->Uninitialize(); |
1333 mark_compact_collector()->EnsureMarkingDequeIsCommitted( | 1338 mark_compact_collector()->EnsureMarkingDequeIsCommitted( |
1334 MarkCompactCollector::kMinMarkingDequeSize); | 1339 MarkCompactCollector::kMinMarkingDequeSize); |
1335 } | 1340 } |
1336 | 1341 |
1337 gc_post_processing_depth_++; | 1342 gc_post_processing_depth_++; |
1338 { | 1343 { |
1339 AllowHeapAllocation allow_allocation; | 1344 AllowHeapAllocation allow_allocation; |
1340 GCTracer::Scope scope(tracer(), GCTracer::Scope::EXTERNAL); | 1345 GCTracer::Scope scope(tracer(), |
| 1346 GCTracer::Scope::EXTERNAL_WEAK_GLOBAL_HANDLES); |
1341 freed_global_handles = | 1347 freed_global_handles = |
1342 isolate_->global_handles()->PostGarbageCollectionProcessing( | 1348 isolate_->global_handles()->PostGarbageCollectionProcessing( |
1343 collector, gc_callback_flags); | 1349 collector, gc_callback_flags); |
1344 } | 1350 } |
1345 gc_post_processing_depth_--; | 1351 gc_post_processing_depth_--; |
1346 | 1352 |
1347 isolate_->eternal_handles()->PostGarbageCollectionProcessing(this); | 1353 isolate_->eternal_handles()->PostGarbageCollectionProcessing(this); |
1348 | 1354 |
1349 // Update relocatables. | 1355 // Update relocatables. |
1350 Relocatable::PostGarbageCollectionProcessing(isolate_); | 1356 Relocatable::PostGarbageCollectionProcessing(isolate_); |
(...skipping 10 matching lines...) Expand all Loading... |
1361 SetOldGenerationAllocationLimit(old_gen_size, gc_speed, mutator_speed); | 1367 SetOldGenerationAllocationLimit(old_gen_size, gc_speed, mutator_speed); |
1362 } else if (HasLowYoungGenerationAllocationRate() && | 1368 } else if (HasLowYoungGenerationAllocationRate() && |
1363 old_generation_size_configured_) { | 1369 old_generation_size_configured_) { |
1364 DampenOldGenerationAllocationLimit(old_gen_size, gc_speed, mutator_speed); | 1370 DampenOldGenerationAllocationLimit(old_gen_size, gc_speed, mutator_speed); |
1365 } | 1371 } |
1366 | 1372 |
1367 { | 1373 { |
1368 GCCallbacksScope scope(this); | 1374 GCCallbacksScope scope(this); |
1369 if (scope.CheckReenter()) { | 1375 if (scope.CheckReenter()) { |
1370 AllowHeapAllocation allow_allocation; | 1376 AllowHeapAllocation allow_allocation; |
1371 GCTracer::Scope scope(tracer(), GCTracer::Scope::EXTERNAL); | 1377 GCTracer::Scope scope(tracer(), |
| 1378 collector == MARK_COMPACTOR |
| 1379 ? GCTracer::Scope::MC_EXTERNAL_EPILOGUE |
| 1380 : GCTracer::Scope::SCAVENGER_EXTERNAL_EPILOGUE); |
1372 VMState<EXTERNAL> state(isolate_); | 1381 VMState<EXTERNAL> state(isolate_); |
1373 HandleScope handle_scope(isolate_); | 1382 HandleScope handle_scope(isolate_); |
1374 CallGCEpilogueCallbacks(gc_type, gc_callback_flags); | 1383 CallGCEpilogueCallbacks(gc_type, gc_callback_flags); |
1375 } | 1384 } |
1376 } | 1385 } |
1377 | 1386 |
1378 #ifdef VERIFY_HEAP | 1387 #ifdef VERIFY_HEAP |
1379 if (FLAG_verify_heap) { | 1388 if (FLAG_verify_heap) { |
1380 VerifyStringTable(this); | 1389 VerifyStringTable(this); |
1381 } | 1390 } |
(...skipping 5024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6406 } | 6415 } |
6407 | 6416 |
6408 | 6417 |
6409 // static | 6418 // static |
6410 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6419 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6411 return StaticVisitorBase::GetVisitorId(map); | 6420 return StaticVisitorBase::GetVisitorId(map); |
6412 } | 6421 } |
6413 | 6422 |
6414 } // namespace internal | 6423 } // namespace internal |
6415 } // namespace v8 | 6424 } // namespace v8 |
OLD | NEW |