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