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 "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "incremental-marking.h" | 7 #include "incremental-marking.h" |
8 | 8 |
9 #include "code-stubs.h" | 9 #include "code-stubs.h" |
10 #include "compilation-cache.h" | 10 #include "compilation-cache.h" |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 // TODO(gc) consider setting this to some low level so that some | 452 // TODO(gc) consider setting this to some low level so that some |
453 // debug tests run with incremental marking and some without. | 453 // debug tests run with incremental marking and some without. |
454 static const intptr_t kActivationThreshold = 0; | 454 static const intptr_t kActivationThreshold = 0; |
455 #endif | 455 #endif |
456 // Only start incremental marking in a safe state: 1) when incremental | 456 // Only start incremental marking in a safe state: 1) when incremental |
457 // marking is turned on, 2) when we are currently not in a GC, and | 457 // marking is turned on, 2) when we are currently not in a GC, and |
458 // 3) when we are currently not serializing or deserializing the heap. | 458 // 3) when we are currently not serializing or deserializing the heap. |
459 return FLAG_incremental_marking && | 459 return FLAG_incremental_marking && |
460 FLAG_incremental_marking_steps && | 460 FLAG_incremental_marking_steps && |
461 heap_->gc_state() == Heap::NOT_IN_GC && | 461 heap_->gc_state() == Heap::NOT_IN_GC && |
462 !Serializer::enabled() && | 462 !Serializer::enabled(heap_->isolate()) && |
463 heap_->isolate()->IsInitialized() && | 463 heap_->isolate()->IsInitialized() && |
464 heap_->PromotedSpaceSizeOfObjects() > kActivationThreshold; | 464 heap_->PromotedSpaceSizeOfObjects() > kActivationThreshold; |
465 } | 465 } |
466 | 466 |
467 | 467 |
468 void IncrementalMarking::ActivateGeneratedStub(Code* stub) { | 468 void IncrementalMarking::ActivateGeneratedStub(Code* stub) { |
469 ASSERT(RecordWriteStub::GetMode(stub) == | 469 ASSERT(RecordWriteStub::GetMode(stub) == |
470 RecordWriteStub::STORE_BUFFER_ONLY); | 470 RecordWriteStub::STORE_BUFFER_ONLY); |
471 | 471 |
472 if (!IsMarking()) { | 472 if (!IsMarking()) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 | 530 |
531 | 531 |
532 void IncrementalMarking::Start(CompactionFlag flag) { | 532 void IncrementalMarking::Start(CompactionFlag flag) { |
533 if (FLAG_trace_incremental_marking) { | 533 if (FLAG_trace_incremental_marking) { |
534 PrintF("[IncrementalMarking] Start\n"); | 534 PrintF("[IncrementalMarking] Start\n"); |
535 } | 535 } |
536 ASSERT(FLAG_incremental_marking); | 536 ASSERT(FLAG_incremental_marking); |
537 ASSERT(FLAG_incremental_marking_steps); | 537 ASSERT(FLAG_incremental_marking_steps); |
538 ASSERT(state_ == STOPPED); | 538 ASSERT(state_ == STOPPED); |
539 ASSERT(heap_->gc_state() == Heap::NOT_IN_GC); | 539 ASSERT(heap_->gc_state() == Heap::NOT_IN_GC); |
540 ASSERT(!Serializer::enabled()); | 540 ASSERT(!Serializer::enabled(heap_->isolate())); |
541 ASSERT(heap_->isolate()->IsInitialized()); | 541 ASSERT(heap_->isolate()->IsInitialized()); |
542 | 542 |
543 ResetStepCounters(); | 543 ResetStepCounters(); |
544 | 544 |
545 if (!heap_->mark_compact_collector()->IsConcurrentSweepingInProgress()) { | 545 if (!heap_->mark_compact_collector()->IsConcurrentSweepingInProgress()) { |
546 StartMarking(flag); | 546 StartMarking(flag); |
547 } else { | 547 } else { |
548 if (FLAG_trace_incremental_marking) { | 548 if (FLAG_trace_incremental_marking) { |
549 PrintF("[IncrementalMarking] Start sweeping.\n"); | 549 PrintF("[IncrementalMarking] Start sweeping.\n"); |
550 } | 550 } |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 bytes_scanned_ = 0; | 992 bytes_scanned_ = 0; |
993 write_barriers_invoked_since_last_step_ = 0; | 993 write_barriers_invoked_since_last_step_ = 0; |
994 } | 994 } |
995 | 995 |
996 | 996 |
997 int64_t IncrementalMarking::SpaceLeftInOldSpace() { | 997 int64_t IncrementalMarking::SpaceLeftInOldSpace() { |
998 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); | 998 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); |
999 } | 999 } |
1000 | 1000 |
1001 } } // namespace v8::internal | 1001 } } // namespace v8::internal |
OLD | NEW |