| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 // mark-compact collector. | 793 // mark-compact collector. |
| 794 ASSERT(!Page::IsRSetSet(reinterpret_cast<Address>(p), 0)); | 794 ASSERT(!Page::IsRSetSet(reinterpret_cast<Address>(p), 0)); |
| 795 if (Heap::InNewSpace(*p)) { | 795 if (Heap::InNewSpace(*p)) { |
| 796 Page::SetRSet(reinterpret_cast<Address>(p), 0); | 796 Page::SetRSet(reinterpret_cast<Address>(p), 0); |
| 797 } | 797 } |
| 798 } | 798 } |
| 799 }; | 799 }; |
| 800 | 800 |
| 801 | 801 |
| 802 int Heap::UpdateRSet(HeapObject* obj) { | 802 int Heap::UpdateRSet(HeapObject* obj) { |
| 803 #ifndef V8_HOST_ARCH_64_BIT |
| 804 // TODO(X64) Reenable RSet when we have a working 64-bit layout of Page. |
| 803 ASSERT(!InNewSpace(obj)); | 805 ASSERT(!InNewSpace(obj)); |
| 804 // Special handling of fixed arrays to iterate the body based on the start | 806 // Special handling of fixed arrays to iterate the body based on the start |
| 805 // address and offset. Just iterating the pointers as in UpdateRSetVisitor | 807 // address and offset. Just iterating the pointers as in UpdateRSetVisitor |
| 806 // will not work because Page::SetRSet needs to have the start of the | 808 // will not work because Page::SetRSet needs to have the start of the |
| 807 // object. | 809 // object. |
| 808 if (obj->IsFixedArray()) { | 810 if (obj->IsFixedArray()) { |
| 809 FixedArray* array = FixedArray::cast(obj); | 811 FixedArray* array = FixedArray::cast(obj); |
| 810 int length = array->length(); | 812 int length = array->length(); |
| 811 for (int i = 0; i < length; i++) { | 813 for (int i = 0; i < length; i++) { |
| 812 int offset = FixedArray::kHeaderSize + i * kPointerSize; | 814 int offset = FixedArray::kHeaderSize + i * kPointerSize; |
| 813 ASSERT(!Page::IsRSetSet(obj->address(), offset)); | 815 ASSERT(!Page::IsRSetSet(obj->address(), offset)); |
| 814 if (Heap::InNewSpace(array->get(i))) { | 816 if (Heap::InNewSpace(array->get(i))) { |
| 815 Page::SetRSet(obj->address(), offset); | 817 Page::SetRSet(obj->address(), offset); |
| 816 } | 818 } |
| 817 } | 819 } |
| 818 } else if (!obj->IsCode()) { | 820 } else if (!obj->IsCode()) { |
| 819 // Skip code object, we know it does not contain inter-generational | 821 // Skip code object, we know it does not contain inter-generational |
| 820 // pointers. | 822 // pointers. |
| 821 UpdateRSetVisitor v; | 823 UpdateRSetVisitor v; |
| 822 obj->Iterate(&v); | 824 obj->Iterate(&v); |
| 823 } | 825 } |
| 826 #endif // V8_HOST_ARCH_64_BIT |
| 824 return obj->Size(); | 827 return obj->Size(); |
| 825 } | 828 } |
| 826 | 829 |
| 827 | 830 |
| 828 void Heap::RebuildRSets() { | 831 void Heap::RebuildRSets() { |
| 829 // By definition, we do not care about remembered set bits in code or data | 832 // By definition, we do not care about remembered set bits in code or data |
| 830 // spaces. | 833 // spaces. |
| 831 map_space_->ClearRSet(); | 834 map_space_->ClearRSet(); |
| 832 RebuildRSets(map_space_); | 835 RebuildRSets(map_space_); |
| 833 | 836 |
| (...skipping 2622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3456 #ifdef DEBUG | 3459 #ifdef DEBUG |
| 3457 bool Heap::GarbageCollectionGreedyCheck() { | 3460 bool Heap::GarbageCollectionGreedyCheck() { |
| 3458 ASSERT(FLAG_gc_greedy); | 3461 ASSERT(FLAG_gc_greedy); |
| 3459 if (Bootstrapper::IsActive()) return true; | 3462 if (Bootstrapper::IsActive()) return true; |
| 3460 if (disallow_allocation_failure()) return true; | 3463 if (disallow_allocation_failure()) return true; |
| 3461 return CollectGarbage(0, NEW_SPACE); | 3464 return CollectGarbage(0, NEW_SPACE); |
| 3462 } | 3465 } |
| 3463 #endif | 3466 #endif |
| 3464 | 3467 |
| 3465 } } // namespace v8::internal | 3468 } } // namespace v8::internal |
| OLD | NEW |