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/incremental-marking.h" | 5 #include "src/heap/incremental-marking.h" |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/compilation-cache.h" | 8 #include "src/compilation-cache.h" |
9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/heap/gc-idle-time-handler.h" | 10 #include "src/heap/gc-idle-time-handler.h" |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 RecordWriteStub::Patch(Code::cast(e), mode); | 480 RecordWriteStub::Patch(Code::cast(e), mode); |
481 } | 481 } |
482 } | 482 } |
483 } | 483 } |
484 } | 484 } |
485 } | 485 } |
486 | 486 |
487 | 487 |
488 void IncrementalMarking::Start(const char* reason) { | 488 void IncrementalMarking::Start(const char* reason) { |
489 if (FLAG_trace_incremental_marking) { | 489 if (FLAG_trace_incremental_marking) { |
| 490 int old_generation_size_mb = |
| 491 static_cast<int>(heap()->PromotedSpaceSizeOfObjects() / MB); |
| 492 int old_generation_limit_mb = |
| 493 static_cast<int>(heap()->old_generation_allocation_limit() / MB); |
490 heap()->isolate()->PrintWithTimestamp( | 494 heap()->isolate()->PrintWithTimestamp( |
491 "[IncrementalMarking] Start (%s)\n", | 495 "[IncrementalMarking] Start (%s): old generation %dMB, limit %dMB, " |
492 (reason == nullptr) ? "unknown reason" : reason); | 496 "slack %dMB\n", |
| 497 (reason == nullptr) ? "unknown reason" : reason, old_generation_size_mb, |
| 498 old_generation_limit_mb, |
| 499 Max(0, old_generation_limit_mb - old_generation_size_mb)); |
493 } | 500 } |
494 DCHECK(FLAG_incremental_marking); | 501 DCHECK(FLAG_incremental_marking); |
495 DCHECK(state_ == STOPPED); | 502 DCHECK(state_ == STOPPED); |
496 DCHECK(heap_->gc_state() == Heap::NOT_IN_GC); | 503 DCHECK(heap_->gc_state() == Heap::NOT_IN_GC); |
497 DCHECK(!heap_->isolate()->serializer_enabled()); | 504 DCHECK(!heap_->isolate()->serializer_enabled()); |
498 | 505 |
499 HistogramTimerScope incremental_marking_scope( | 506 HistogramTimerScope incremental_marking_scope( |
500 heap_->isolate()->counters()->gc_incremental_marking_start()); | 507 heap_->isolate()->counters()->gc_incremental_marking_start()); |
501 TRACE_EVENT0("v8", "V8.GCIncrementalMarkingStart"); | 508 TRACE_EVENT0("v8", "V8.GCIncrementalMarkingStart"); |
502 ResetStepCounters(); | 509 ResetStepCounters(); |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 } | 959 } |
953 } | 960 } |
954 context = Context::cast(context)->next_context_link(); | 961 context = Context::cast(context)->next_context_link(); |
955 } | 962 } |
956 } | 963 } |
957 | 964 |
958 | 965 |
959 void IncrementalMarking::Stop() { | 966 void IncrementalMarking::Stop() { |
960 if (IsStopped()) return; | 967 if (IsStopped()) return; |
961 if (FLAG_trace_incremental_marking) { | 968 if (FLAG_trace_incremental_marking) { |
962 heap()->isolate()->PrintWithTimestamp("[IncrementalMarking] Stopping.\n"); | 969 int old_generation_size_mb = |
| 970 static_cast<int>(heap()->PromotedSpaceSizeOfObjects() / MB); |
| 971 int old_generation_limit_mb = |
| 972 static_cast<int>(heap()->old_generation_allocation_limit() / MB); |
| 973 heap()->isolate()->PrintWithTimestamp( |
| 974 "[IncrementalMarking] Stopping: old generation %dMB, limit %dMB, " |
| 975 "overshoot %dMB\n", |
| 976 old_generation_size_mb, old_generation_limit_mb, |
| 977 Max(0, old_generation_size_mb - old_generation_limit_mb)); |
963 } | 978 } |
964 | 979 |
965 heap_->new_space()->RemoveAllocationObserver(&observer_); | 980 heap_->new_space()->RemoveAllocationObserver(&observer_); |
966 IncrementalMarking::set_should_hurry(false); | 981 IncrementalMarking::set_should_hurry(false); |
967 ResetStepCounters(); | 982 ResetStepCounters(); |
968 if (IsMarking()) { | 983 if (IsMarking()) { |
969 PatchIncrementalMarkingRecordWriteStubs(heap_, | 984 PatchIncrementalMarkingRecordWriteStubs(heap_, |
970 RecordWriteStub::STORE_BUFFER_ONLY); | 985 RecordWriteStub::STORE_BUFFER_ONLY); |
971 DeactivateIncrementalWriteBarrier(); | 986 DeactivateIncrementalWriteBarrier(); |
972 } | 987 } |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 idle_marking_delay_counter_++; | 1212 idle_marking_delay_counter_++; |
1198 } | 1213 } |
1199 | 1214 |
1200 | 1215 |
1201 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1216 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1202 idle_marking_delay_counter_ = 0; | 1217 idle_marking_delay_counter_ = 0; |
1203 } | 1218 } |
1204 | 1219 |
1205 } // namespace internal | 1220 } // namespace internal |
1206 } // namespace v8 | 1221 } // namespace v8 |
OLD | NEW |