OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 } | 396 } |
397 state_ = SWEEPING; | 397 state_ = SWEEPING; |
398 } | 398 } |
399 | 399 |
400 heap_->new_space()->LowerInlineAllocationLimit(kAllocatedThreshold); | 400 heap_->new_space()->LowerInlineAllocationLimit(kAllocatedThreshold); |
401 } | 401 } |
402 | 402 |
403 | 403 |
404 static void MarkObjectGreyDoNotEnqueue(Object* obj) { | 404 static void MarkObjectGreyDoNotEnqueue(Object* obj) { |
405 if (obj->IsHeapObject()) { | 405 if (obj->IsHeapObject()) { |
| 406 HeapObject* heap_obj = HeapObject::cast(obj); |
406 MarkBit mark_bit = Marking::MarkBitFrom(HeapObject::cast(obj)); | 407 MarkBit mark_bit = Marking::MarkBitFrom(HeapObject::cast(obj)); |
| 408 if (Marking::IsBlack(mark_bit)) { |
| 409 MemoryChunk::IncrementLiveBytes(heap_obj->address(), |
| 410 -heap_obj->Size()); |
| 411 } |
407 Marking::AnyToGrey(mark_bit); | 412 Marking::AnyToGrey(mark_bit); |
408 } | 413 } |
409 } | 414 } |
410 | 415 |
411 | 416 |
412 void IncrementalMarking::StartMarking() { | 417 void IncrementalMarking::StartMarking() { |
413 if (FLAG_trace_incremental_marking) { | 418 if (FLAG_trace_incremental_marking) { |
414 PrintF("[IncrementalMarking] Start marking\n"); | 419 PrintF("[IncrementalMarking] Start marking\n"); |
415 } | 420 } |
416 | 421 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 } | 567 } |
563 state_ = COMPLETE; | 568 state_ = COMPLETE; |
564 if (FLAG_trace_incremental_marking) { | 569 if (FLAG_trace_incremental_marking) { |
565 double end = OS::TimeCurrentMillis(); | 570 double end = OS::TimeCurrentMillis(); |
566 PrintF("[IncrementalMarking] Complete (hurry), spent %d ms.\n", | 571 PrintF("[IncrementalMarking] Complete (hurry), spent %d ms.\n", |
567 static_cast<int>(end - start)); | 572 static_cast<int>(end - start)); |
568 } | 573 } |
569 } | 574 } |
570 | 575 |
571 if (FLAG_cleanup_code_caches_at_gc) { | 576 if (FLAG_cleanup_code_caches_at_gc) { |
572 Marking::GreyToBlack(Marking::MarkBitFrom(heap_->polymorphic_code_cache())); | 577 PolymorphicCodeCache* poly_cache = heap_->polymorphic_code_cache(); |
| 578 Marking::GreyToBlack(Marking::MarkBitFrom(poly_cache)); |
| 579 MemoryChunk::IncrementLiveBytes(poly_cache->address(), |
| 580 PolymorphicCodeCache::kSize); |
573 } | 581 } |
574 | 582 |
575 Object* context = heap_->global_contexts_list(); | 583 Object* context = heap_->global_contexts_list(); |
576 while (!context->IsUndefined()) { | 584 while (!context->IsUndefined()) { |
577 NormalizedMapCache* cache = Context::cast(context)->normalized_map_cache(); | 585 NormalizedMapCache* cache = Context::cast(context)->normalized_map_cache(); |
578 MarkBit mark_bit = Marking::MarkBitFrom(cache); | 586 MarkBit mark_bit = Marking::MarkBitFrom(cache); |
579 if (Marking::IsGrey(mark_bit)) Marking::GreyToBlack(mark_bit); | 587 if (Marking::IsGrey(mark_bit)) { |
| 588 Marking::GreyToBlack(mark_bit); |
| 589 MemoryChunk::IncrementLiveBytes(cache->address(), cache->Size()); |
| 590 } |
580 context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK); | 591 context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK); |
581 } | 592 } |
582 } | 593 } |
583 | 594 |
584 | 595 |
585 void IncrementalMarking::Abort() { | 596 void IncrementalMarking::Abort() { |
586 if (IsStopped()) return; | 597 if (IsStopped()) return; |
587 if (FLAG_trace_incremental_marking) { | 598 if (FLAG_trace_incremental_marking) { |
588 PrintF("[IncrementalMarking] Aborting.\n"); | 599 PrintF("[IncrementalMarking] Aborting.\n"); |
589 } | 600 } |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 bytes_rescanned_ = 0; | 771 bytes_rescanned_ = 0; |
761 allocation_marking_factor_ = kInitialAllocationMarkingFactor; | 772 allocation_marking_factor_ = kInitialAllocationMarkingFactor; |
762 } | 773 } |
763 | 774 |
764 | 775 |
765 int64_t IncrementalMarking::SpaceLeftInOldSpace() { | 776 int64_t IncrementalMarking::SpaceLeftInOldSpace() { |
766 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSize(); | 777 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSize(); |
767 } | 778 } |
768 | 779 |
769 } } // namespace v8::internal | 780 } } // namespace v8::internal |
OLD | NEW |