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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/heap/incremental-marking.h" | 7 #include "src/heap/incremental-marking.h" |
8 | 8 |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
11 #include "src/conversions.h" | 11 #include "src/conversions.h" |
12 #include "src/heap/objects-visiting.h" | 12 #include "src/heap/objects-visiting.h" |
13 #include "src/heap/objects-visiting-inl.h" | 13 #include "src/heap/objects-visiting-inl.h" |
14 | 14 |
15 namespace v8 { | 15 namespace v8 { |
16 namespace internal { | 16 namespace internal { |
17 | 17 |
18 | 18 |
19 IncrementalMarking::StepActions IncrementalMarking::NoForcedStepActions() { | |
20 return StepActions(IncrementalMarking::NO_GC_VIA_STACK_GUARD, | |
21 IncrementalMarking::DO_NOT_FORCE_MARKING, | |
22 IncrementalMarking::DO_NOT_FORCE_COMPLETION); | |
23 } | |
24 | |
25 | |
19 IncrementalMarking::IncrementalMarking(Heap* heap) | 26 IncrementalMarking::IncrementalMarking(Heap* heap) |
20 : heap_(heap), | 27 : heap_(heap), |
21 state_(STOPPED), | 28 state_(STOPPED), |
22 steps_count_(0), | 29 steps_count_(0), |
23 old_generation_space_available_at_start_of_incremental_(0), | 30 old_generation_space_available_at_start_of_incremental_(0), |
24 old_generation_space_used_at_start_of_incremental_(0), | 31 old_generation_space_used_at_start_of_incremental_(0), |
25 should_hurry_(false), | 32 should_hurry_(false), |
26 marking_speed_(0), | 33 marking_speed_(0), |
27 allocated_(0), | 34 allocated_(0), |
28 idle_marking_delay_counter_(0), | 35 idle_marking_delay_counter_(0), |
(...skipping 434 matching lines...) Loading... | |
463 Object* e = stubs->ValueAt(i); | 470 Object* e = stubs->ValueAt(i); |
464 if (e->IsCode()) { | 471 if (e->IsCode()) { |
465 RecordWriteStub::Patch(Code::cast(e), mode); | 472 RecordWriteStub::Patch(Code::cast(e), mode); |
466 } | 473 } |
467 } | 474 } |
468 } | 475 } |
469 } | 476 } |
470 } | 477 } |
471 | 478 |
472 | 479 |
473 void IncrementalMarking::Start(int mark_compact_flags) { | 480 void IncrementalMarking::Start(int mark_compact_flags, |
481 const GCCallbackFlags gc_callback_flags, | |
482 const char* reason) { | |
474 if (FLAG_trace_incremental_marking) { | 483 if (FLAG_trace_incremental_marking) { |
475 PrintF("[IncrementalMarking] Start\n"); | 484 PrintF("[IncrementalMarking] Start (%s)\n", |
485 (reason == nullptr) ? "unknown reason" : reason); | |
Hannes Payer (out of office)
2015/08/04 15:05:59
can we always have a reason?
Michael Lippautz
2015/08/04 15:53:06
Done.
| |
476 } | 486 } |
477 DCHECK(FLAG_incremental_marking); | 487 DCHECK(FLAG_incremental_marking); |
478 DCHECK(FLAG_incremental_marking_steps); | 488 DCHECK(FLAG_incremental_marking_steps); |
479 DCHECK(state_ == STOPPED); | 489 DCHECK(state_ == STOPPED); |
480 DCHECK(heap_->gc_state() == Heap::NOT_IN_GC); | 490 DCHECK(heap_->gc_state() == Heap::NOT_IN_GC); |
481 DCHECK(!heap_->isolate()->serializer_enabled()); | 491 DCHECK(!heap_->isolate()->serializer_enabled()); |
482 | 492 |
483 ResetStepCounters(); | 493 ResetStepCounters(); |
484 | 494 |
495 gc_callback_flags_ = gc_callback_flags; | |
485 was_activated_ = true; | 496 was_activated_ = true; |
486 | 497 |
487 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { | 498 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { |
488 heap_->mark_compact_collector()->SetFlags(mark_compact_flags); | 499 heap_->mark_compact_collector()->SetFlags(mark_compact_flags); |
489 StartMarking(); | 500 StartMarking(); |
490 heap_->mark_compact_collector()->SetFlags(Heap::kNoGCFlags); | 501 heap_->mark_compact_collector()->SetFlags(Heap::kNoGCFlags); |
491 } else { | 502 } else { |
492 if (FLAG_trace_incremental_marking) { | 503 if (FLAG_trace_incremental_marking) { |
493 PrintF("[IncrementalMarking] Start sweeping.\n"); | 504 PrintF("[IncrementalMarking] Start sweeping.\n"); |
494 } | 505 } |
(...skipping 526 matching lines...) Loading... | |
1021 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1032 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
1022 idle_marking_delay_counter_++; | 1033 idle_marking_delay_counter_++; |
1023 } | 1034 } |
1024 | 1035 |
1025 | 1036 |
1026 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1037 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1027 idle_marking_delay_counter_ = 0; | 1038 idle_marking_delay_counter_ = 0; |
1028 } | 1039 } |
1029 } // namespace internal | 1040 } // namespace internal |
1030 } // namespace v8 | 1041 } // namespace v8 |
OLD | NEW |