| 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" |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 #else | 432 #else |
| 433 // TODO(gc) consider setting this to some low level so that some | 433 // TODO(gc) consider setting this to some low level so that some |
| 434 // debug tests run with incremental marking and some without. | 434 // debug tests run with incremental marking and some without. |
| 435 static const intptr_t kActivationThreshold = 0; | 435 static const intptr_t kActivationThreshold = 0; |
| 436 #endif | 436 #endif |
| 437 // Only start incremental marking in a safe state: 1) when incremental | 437 // Only start incremental marking in a safe state: 1) when incremental |
| 438 // marking is turned on, 2) when we are currently not in a GC, and | 438 // marking is turned on, 2) when we are currently not in a GC, and |
| 439 // 3) when we are currently not serializing or deserializing the heap. | 439 // 3) when we are currently not serializing or deserializing the heap. |
| 440 return FLAG_incremental_marking && FLAG_incremental_marking_steps && | 440 return FLAG_incremental_marking && FLAG_incremental_marking_steps && |
| 441 heap_->gc_state() == Heap::NOT_IN_GC && | 441 heap_->gc_state() == Heap::NOT_IN_GC && |
| 442 heap_->deserialization_complete() && |
| 442 !heap_->isolate()->serializer_enabled() && | 443 !heap_->isolate()->serializer_enabled() && |
| 443 heap_->isolate()->IsInitialized() && | |
| 444 heap_->PromotedSpaceSizeOfObjects() > kActivationThreshold; | 444 heap_->PromotedSpaceSizeOfObjects() > kActivationThreshold; |
| 445 } | 445 } |
| 446 | 446 |
| 447 | 447 |
| 448 void IncrementalMarking::ActivateGeneratedStub(Code* stub) { | 448 void IncrementalMarking::ActivateGeneratedStub(Code* stub) { |
| 449 DCHECK(RecordWriteStub::GetMode(stub) == RecordWriteStub::STORE_BUFFER_ONLY); | 449 DCHECK(RecordWriteStub::GetMode(stub) == RecordWriteStub::STORE_BUFFER_ONLY); |
| 450 | 450 |
| 451 if (!IsMarking()) { | 451 if (!IsMarking()) { |
| 452 // Initially stub is generated in STORE_BUFFER_ONLY mode thus | 452 // Initially stub is generated in STORE_BUFFER_ONLY mode thus |
| 453 // we don't need to do anything if incremental marking is | 453 // we don't need to do anything if incremental marking is |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 | 509 |
| 510 void IncrementalMarking::Start(CompactionFlag flag) { | 510 void IncrementalMarking::Start(CompactionFlag flag) { |
| 511 if (FLAG_trace_incremental_marking) { | 511 if (FLAG_trace_incremental_marking) { |
| 512 PrintF("[IncrementalMarking] Start\n"); | 512 PrintF("[IncrementalMarking] Start\n"); |
| 513 } | 513 } |
| 514 DCHECK(FLAG_incremental_marking); | 514 DCHECK(FLAG_incremental_marking); |
| 515 DCHECK(FLAG_incremental_marking_steps); | 515 DCHECK(FLAG_incremental_marking_steps); |
| 516 DCHECK(state_ == STOPPED); | 516 DCHECK(state_ == STOPPED); |
| 517 DCHECK(heap_->gc_state() == Heap::NOT_IN_GC); | 517 DCHECK(heap_->gc_state() == Heap::NOT_IN_GC); |
| 518 DCHECK(!heap_->isolate()->serializer_enabled()); | 518 DCHECK(!heap_->isolate()->serializer_enabled()); |
| 519 DCHECK(heap_->isolate()->IsInitialized()); | |
| 520 | 519 |
| 521 ResetStepCounters(); | 520 ResetStepCounters(); |
| 522 | 521 |
| 523 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { | 522 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { |
| 524 StartMarking(flag); | 523 StartMarking(flag); |
| 525 } else { | 524 } else { |
| 526 if (FLAG_trace_incremental_marking) { | 525 if (FLAG_trace_incremental_marking) { |
| 527 PrintF("[IncrementalMarking] Start sweeping.\n"); | 526 PrintF("[IncrementalMarking] Start sweeping.\n"); |
| 528 } | 527 } |
| 529 state_ = SWEEPING; | 528 state_ = SWEEPING; |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 bytes_scanned_ = 0; | 972 bytes_scanned_ = 0; |
| 974 write_barriers_invoked_since_last_step_ = 0; | 973 write_barriers_invoked_since_last_step_ = 0; |
| 975 } | 974 } |
| 976 | 975 |
| 977 | 976 |
| 978 int64_t IncrementalMarking::SpaceLeftInOldSpace() { | 977 int64_t IncrementalMarking::SpaceLeftInOldSpace() { |
| 979 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); | 978 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); |
| 980 } | 979 } |
| 981 } | 980 } |
| 982 } // namespace v8::internal | 981 } // namespace v8::internal |
| OLD | NEW |