| 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 "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
| (...skipping 4589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4600 return SlotsBuffer::NUMBER_OF_SLOT_TYPES; | 4600 return SlotsBuffer::NUMBER_OF_SLOT_TYPES; |
| 4601 } | 4601 } |
| 4602 | 4602 |
| 4603 | 4603 |
| 4604 void MarkCompactCollector::RecordRelocSlot(RelocInfo* rinfo, Object* target) { | 4604 void MarkCompactCollector::RecordRelocSlot(RelocInfo* rinfo, Object* target) { |
| 4605 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); | 4605 Page* target_page = Page::FromAddress(reinterpret_cast<Address>(target)); |
| 4606 RelocInfo::Mode rmode = rinfo->rmode(); | 4606 RelocInfo::Mode rmode = rinfo->rmode(); |
| 4607 if (target_page->IsEvacuationCandidate() && | 4607 if (target_page->IsEvacuationCandidate() && |
| 4608 (rinfo->host() == NULL || | 4608 (rinfo->host() == NULL || |
| 4609 !ShouldSkipEvacuationSlotRecording(rinfo->host()))) { | 4609 !ShouldSkipEvacuationSlotRecording(rinfo->host()))) { |
| 4610 bool success; | 4610 bool success = SlotsBuffer::AddTo( |
| 4611 if (RelocInfo::IsEmbeddedObject(rmode) && rinfo->IsInConstantPool()) { | 4611 &slots_buffer_allocator_, target_page->slots_buffer_address(), |
| 4612 // This doesn't need to be typed since it is just a normal heap pointer. | 4612 SlotTypeForRMode(rmode), rinfo->pc(), SlotsBuffer::FAIL_ON_OVERFLOW); |
| 4613 Object** target_pointer = | |
| 4614 reinterpret_cast<Object**>(rinfo->constant_pool_entry_address()); | |
| 4615 success = SlotsBuffer::AddTo( | |
| 4616 &slots_buffer_allocator_, target_page->slots_buffer_address(), | |
| 4617 target_pointer, SlotsBuffer::FAIL_ON_OVERFLOW); | |
| 4618 } else if (RelocInfo::IsCodeTarget(rmode) && rinfo->IsInConstantPool()) { | |
| 4619 success = SlotsBuffer::AddTo( | |
| 4620 &slots_buffer_allocator_, target_page->slots_buffer_address(), | |
| 4621 SlotsBuffer::CODE_ENTRY_SLOT, rinfo->constant_pool_entry_address(), | |
| 4622 SlotsBuffer::FAIL_ON_OVERFLOW); | |
| 4623 } else { | |
| 4624 success = SlotsBuffer::AddTo( | |
| 4625 &slots_buffer_allocator_, target_page->slots_buffer_address(), | |
| 4626 SlotTypeForRMode(rmode), rinfo->pc(), SlotsBuffer::FAIL_ON_OVERFLOW); | |
| 4627 } | |
| 4628 if (!success) { | 4613 if (!success) { |
| 4629 EvictPopularEvacuationCandidate(target_page); | 4614 EvictPopularEvacuationCandidate(target_page); |
| 4630 } | 4615 } |
| 4631 } | 4616 } |
| 4632 } | 4617 } |
| 4633 | 4618 |
| 4634 | 4619 |
| 4635 void MarkCompactCollector::EvictPopularEvacuationCandidate(Page* page) { | 4620 void MarkCompactCollector::EvictPopularEvacuationCandidate(Page* page) { |
| 4636 if (FLAG_trace_fragmentation) { | 4621 if (FLAG_trace_fragmentation) { |
| 4637 PrintF("Page %p is too popular. Disabling evacuation.\n", | 4622 PrintF("Page %p is too popular. Disabling evacuation.\n", |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4743 SlotsBuffer* buffer = *buffer_address; | 4728 SlotsBuffer* buffer = *buffer_address; |
| 4744 while (buffer != NULL) { | 4729 while (buffer != NULL) { |
| 4745 SlotsBuffer* next_buffer = buffer->next(); | 4730 SlotsBuffer* next_buffer = buffer->next(); |
| 4746 DeallocateBuffer(buffer); | 4731 DeallocateBuffer(buffer); |
| 4747 buffer = next_buffer; | 4732 buffer = next_buffer; |
| 4748 } | 4733 } |
| 4749 *buffer_address = NULL; | 4734 *buffer_address = NULL; |
| 4750 } | 4735 } |
| 4751 } | 4736 } |
| 4752 } // namespace v8::internal | 4737 } // namespace v8::internal |
| OLD | NEW |