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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 HeapObject* obj = array[current]; | 510 HeapObject* obj = array[current]; |
511 ASSERT(obj->IsHeapObject()); | 511 ASSERT(obj->IsHeapObject()); |
512 current = ((current + 1) & mask); | 512 current = ((current + 1) & mask); |
513 if (heap_->InNewSpace(obj)) { | 513 if (heap_->InNewSpace(obj)) { |
514 MapWord map_word = obj->map_word(); | 514 MapWord map_word = obj->map_word(); |
515 if (map_word.IsForwardingAddress()) { | 515 if (map_word.IsForwardingAddress()) { |
516 HeapObject* dest = map_word.ToForwardingAddress(); | 516 HeapObject* dest = map_word.ToForwardingAddress(); |
517 array[new_top] = dest; | 517 array[new_top] = dest; |
518 new_top = ((new_top + 1) & mask); | 518 new_top = ((new_top + 1) & mask); |
519 ASSERT(new_top != marking_deque_.bottom()); | 519 ASSERT(new_top != marking_deque_.bottom()); |
520 ASSERT(Marking::IsGrey(Marking::MarkBitFrom(obj))); | 520 #ifdef DEBUG |
| 521 MarkBit mark_bit = Marking::MarkBitFrom(obj); |
| 522 ASSERT(Marking::IsGrey(mark_bit) || |
| 523 (obj->IsFiller() && Marking::IsWhite(mark_bit))); |
| 524 #endif |
521 } | 525 } |
522 } else if (obj->map() != filler_map) { | 526 } else if (obj->map() != filler_map) { |
523 // Skip one word filler objects that appear on the | 527 // Skip one word filler objects that appear on the |
524 // stack when we perform in place array shift. | 528 // stack when we perform in place array shift. |
525 array[new_top] = obj; | 529 array[new_top] = obj; |
526 new_top = ((new_top + 1) & mask); | 530 new_top = ((new_top + 1) & mask); |
527 ASSERT(new_top != marking_deque_.bottom()); | 531 ASSERT(new_top != marking_deque_.bottom()); |
528 ASSERT(Marking::IsGrey(Marking::MarkBitFrom(obj))); | 532 #ifdef DEBUG |
| 533 MarkBit mark_bit = Marking::MarkBitFrom(obj); |
| 534 ASSERT(Marking::IsGrey(mark_bit) || |
| 535 (obj->IsFiller() && Marking::IsWhite(mark_bit))); |
| 536 #endif |
529 } | 537 } |
530 } | 538 } |
531 marking_deque_.set_top(new_top); | 539 marking_deque_.set_top(new_top); |
532 | 540 |
533 steps_took_since_last_gc_ = 0; | 541 steps_took_since_last_gc_ = 0; |
534 steps_count_since_last_gc_ = 0; | 542 steps_count_since_last_gc_ = 0; |
535 longest_step_ = 0.0; | 543 longest_step_ = 0.0; |
536 } | 544 } |
537 | 545 |
538 | 546 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 Map* global_context_map = heap_->global_context_map(); | 711 Map* global_context_map = heap_->global_context_map(); |
704 IncrementalMarkingMarkingVisitor marking_visitor(heap_, this); | 712 IncrementalMarkingMarkingVisitor marking_visitor(heap_, this); |
705 while (!marking_deque_.IsEmpty() && bytes_to_process > 0) { | 713 while (!marking_deque_.IsEmpty() && bytes_to_process > 0) { |
706 HeapObject* obj = marking_deque_.Pop(); | 714 HeapObject* obj = marking_deque_.Pop(); |
707 | 715 |
708 // Explicitly skip one word fillers. Incremental markbit patterns are | 716 // Explicitly skip one word fillers. Incremental markbit patterns are |
709 // correct only for objects that occupy at least two words. | 717 // correct only for objects that occupy at least two words. |
710 Map* map = obj->map(); | 718 Map* map = obj->map(); |
711 if (map == filler_map) continue; | 719 if (map == filler_map) continue; |
712 | 720 |
713 ASSERT(Marking::IsGrey(Marking::MarkBitFrom(obj))); | |
714 int size = obj->SizeFromMap(map); | 721 int size = obj->SizeFromMap(map); |
715 bytes_to_process -= size; | 722 bytes_to_process -= size; |
716 MarkBit map_mark_bit = Marking::MarkBitFrom(map); | 723 MarkBit map_mark_bit = Marking::MarkBitFrom(map); |
717 if (Marking::IsWhite(map_mark_bit)) { | 724 if (Marking::IsWhite(map_mark_bit)) { |
718 WhiteToGreyAndPush(map, map_mark_bit); | 725 WhiteToGreyAndPush(map, map_mark_bit); |
719 } | 726 } |
720 | 727 |
721 // TODO(gc) switch to static visitor instead of normal visitor. | 728 // TODO(gc) switch to static visitor instead of normal visitor. |
722 if (map == global_context_map) { | 729 if (map == global_context_map) { |
723 // Global contexts have weak fields. | 730 // Global contexts have weak fields. |
724 Context* ctx = Context::cast(obj); | 731 Context* ctx = Context::cast(obj); |
725 | 732 |
726 // We will mark cache black with a separate pass | 733 // We will mark cache black with a separate pass |
727 // when we finish marking. | 734 // when we finish marking. |
728 MarkObjectGreyDoNotEnqueue(ctx->normalized_map_cache()); | 735 MarkObjectGreyDoNotEnqueue(ctx->normalized_map_cache()); |
729 | 736 |
730 VisitGlobalContext(ctx, &marking_visitor); | 737 VisitGlobalContext(ctx, &marking_visitor); |
731 } else { | 738 } else { |
732 obj->IterateBody(map->instance_type(), size, &marking_visitor); | 739 obj->IterateBody(map->instance_type(), size, &marking_visitor); |
733 } | 740 } |
734 | 741 |
735 MarkBit obj_mark_bit = Marking::MarkBitFrom(obj); | 742 MarkBit obj_mark_bit = Marking::MarkBitFrom(obj); |
736 ASSERT(!Marking::IsBlack(obj_mark_bit)); | 743 ASSERT(Marking::IsGrey(obj_mark_bit) || |
| 744 (obj->IsFiller() && Marking::IsWhite(obj_mark_bit))); |
737 Marking::MarkBlack(obj_mark_bit); | 745 Marking::MarkBlack(obj_mark_bit); |
738 MemoryChunk::IncrementLiveBytes(obj->address(), size); | 746 MemoryChunk::IncrementLiveBytes(obj->address(), size); |
739 } | 747 } |
740 if (marking_deque_.IsEmpty()) MarkingComplete(); | 748 if (marking_deque_.IsEmpty()) MarkingComplete(); |
741 } | 749 } |
742 | 750 |
743 allocated_ = 0; | 751 allocated_ = 0; |
744 | 752 |
745 steps_count_++; | 753 steps_count_++; |
746 steps_count_since_last_gc_++; | 754 steps_count_since_last_gc_++; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 bytes_rescanned_ = 0; | 810 bytes_rescanned_ = 0; |
803 allocation_marking_factor_ = kInitialAllocationMarkingFactor; | 811 allocation_marking_factor_ = kInitialAllocationMarkingFactor; |
804 } | 812 } |
805 | 813 |
806 | 814 |
807 int64_t IncrementalMarking::SpaceLeftInOldSpace() { | 815 int64_t IncrementalMarking::SpaceLeftInOldSpace() { |
808 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSize(); | 816 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSize(); |
809 } | 817 } |
810 | 818 |
811 } } // namespace v8::internal | 819 } } // namespace v8::internal |
OLD | NEW |