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/heap/mark-compact.h" | 5 #include "src/heap/mark-compact.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/base/sys-info.h" | 9 #include "src/base/sys-info.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1791 matching lines...) Loading... |
1802 | 1802 |
1803 void MarkCompactCollector::ProcessTopOptimizedFrame(ObjectVisitor* visitor) { | 1803 void MarkCompactCollector::ProcessTopOptimizedFrame(ObjectVisitor* visitor) { |
1804 for (StackFrameIterator it(isolate(), isolate()->thread_local_top()); | 1804 for (StackFrameIterator it(isolate(), isolate()->thread_local_top()); |
1805 !it.done(); it.Advance()) { | 1805 !it.done(); it.Advance()) { |
1806 if (it.frame()->type() == StackFrame::JAVA_SCRIPT) { | 1806 if (it.frame()->type() == StackFrame::JAVA_SCRIPT) { |
1807 return; | 1807 return; |
1808 } | 1808 } |
1809 if (it.frame()->type() == StackFrame::OPTIMIZED) { | 1809 if (it.frame()->type() == StackFrame::OPTIMIZED) { |
1810 Code* code = it.frame()->LookupCode(); | 1810 Code* code = it.frame()->LookupCode(); |
1811 if (!code->CanDeoptAt(it.frame()->pc())) { | 1811 if (!code->CanDeoptAt(it.frame()->pc())) { |
1812 code->CodeIterateBody(visitor); | 1812 Code::BodyDescriptor::IterateBody(code, visitor); |
1813 } | 1813 } |
1814 ProcessMarkingDeque(); | 1814 ProcessMarkingDeque(); |
1815 return; | 1815 return; |
1816 } | 1816 } |
1817 } | 1817 } |
1818 } | 1818 } |
1819 | 1819 |
1820 | 1820 |
1821 void MarkCompactCollector::RetainMaps() { | 1821 void MarkCompactCollector::RetainMaps() { |
1822 if (heap()->ShouldReduceMemory() || heap()->ShouldAbortIncrementalMarking() || | 1822 if (heap()->ShouldReduceMemory() || heap()->ShouldAbortIncrementalMarking() || |
(...skipping 888 matching lines...) Loading... |
2711 } else if (src->IsBytecodeArray()) { | 2711 } else if (src->IsBytecodeArray()) { |
2712 heap()->MoveBlock(dst->address(), src->address(), size); | 2712 heap()->MoveBlock(dst->address(), src->address(), size); |
2713 Address constant_pool_slot = | 2713 Address constant_pool_slot = |
2714 dst->address() + BytecodeArray::kConstantPoolOffset; | 2714 dst->address() + BytecodeArray::kConstantPoolOffset; |
2715 RecordMigratedSlot(Memory::Object_at(constant_pool_slot), | 2715 RecordMigratedSlot(Memory::Object_at(constant_pool_slot), |
2716 constant_pool_slot, evacuation_slots_buffer); | 2716 constant_pool_slot, evacuation_slots_buffer); |
2717 } else if (src->IsJSArrayBuffer()) { | 2717 } else if (src->IsJSArrayBuffer()) { |
2718 heap()->MoveBlock(dst->address(), src->address(), size); | 2718 heap()->MoveBlock(dst->address(), src->address(), size); |
2719 | 2719 |
2720 // Visit inherited JSObject properties and byte length of ArrayBuffer | 2720 // Visit inherited JSObject properties and byte length of ArrayBuffer |
2721 Address regular_slot = | 2721 Address regular_slot = dst->address() + JSArrayBuffer::kPropertiesOffset; |
2722 dst->address() + JSArrayBuffer::BodyDescriptor::kStartOffset; | |
2723 Address regular_slots_end = | 2722 Address regular_slots_end = |
2724 dst->address() + JSArrayBuffer::kByteLengthOffset + kPointerSize; | 2723 dst->address() + JSArrayBuffer::kByteLengthOffset + kPointerSize; |
2725 while (regular_slot < regular_slots_end) { | 2724 while (regular_slot < regular_slots_end) { |
2726 RecordMigratedSlot(Memory::Object_at(regular_slot), regular_slot, | 2725 RecordMigratedSlot(Memory::Object_at(regular_slot), regular_slot, |
2727 evacuation_slots_buffer); | 2726 evacuation_slots_buffer); |
2728 regular_slot += kPointerSize; | 2727 regular_slot += kPointerSize; |
2729 } | 2728 } |
2730 | 2729 |
2731 // Skip backing store and visit just internal fields | 2730 // Skip backing store and visit just internal fields |
2732 Address internal_field_slot = dst->address() + JSArrayBuffer::kSize; | 2731 Address internal_field_slot = dst->address() + JSArrayBuffer::kSize; |
(...skipping 48 matching lines...) Loading... |
2781 RelocInfo rinfo(addr, RelocInfo::CELL, 0, NULL); | 2780 RelocInfo rinfo(addr, RelocInfo::CELL, 0, NULL); |
2782 rinfo.Visit(isolate, v); | 2781 rinfo.Visit(isolate, v); |
2783 break; | 2782 break; |
2784 } | 2783 } |
2785 case SlotsBuffer::CODE_ENTRY_SLOT: { | 2784 case SlotsBuffer::CODE_ENTRY_SLOT: { |
2786 v->VisitCodeEntry(addr); | 2785 v->VisitCodeEntry(addr); |
2787 break; | 2786 break; |
2788 } | 2787 } |
2789 case SlotsBuffer::RELOCATED_CODE_OBJECT: { | 2788 case SlotsBuffer::RELOCATED_CODE_OBJECT: { |
2790 HeapObject* obj = HeapObject::FromAddress(addr); | 2789 HeapObject* obj = HeapObject::FromAddress(addr); |
2791 Code::cast(obj)->CodeIterateBody(v); | 2790 Code::BodyDescriptor::IterateBody(obj, v); |
2792 break; | 2791 break; |
2793 } | 2792 } |
2794 case SlotsBuffer::DEBUG_TARGET_SLOT: { | 2793 case SlotsBuffer::DEBUG_TARGET_SLOT: { |
2795 RelocInfo rinfo(addr, RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION, 0, NULL); | 2794 RelocInfo rinfo(addr, RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION, 0, NULL); |
2796 if (rinfo.IsPatchedDebugBreakSlotSequence()) rinfo.Visit(isolate, v); | 2795 if (rinfo.IsPatchedDebugBreakSlotSequence()) rinfo.Visit(isolate, v); |
2797 break; | 2796 break; |
2798 } | 2797 } |
2799 case SlotsBuffer::EMBEDDED_OBJECT_SLOT: { | 2798 case SlotsBuffer::EMBEDDED_OBJECT_SLOT: { |
2800 RelocInfo rinfo(addr, RelocInfo::EMBEDDED_OBJECT, 0, NULL); | 2799 RelocInfo rinfo(addr, RelocInfo::EMBEDDED_OBJECT, 0, NULL); |
2801 rinfo.Visit(isolate, v); | 2800 rinfo.Visit(isolate, v); |
(...skipping 326 matching lines...) Loading... |
3128 | 3127 |
3129 case HeapObjectContents::kMixedValues: { | 3128 case HeapObjectContents::kMixedValues: { |
3130 if (object->IsFixedTypedArrayBase()) { | 3129 if (object->IsFixedTypedArrayBase()) { |
3131 return static_cast<int>(slot - object->address()) == | 3130 return static_cast<int>(slot - object->address()) == |
3132 FixedTypedArrayBase::kBasePointerOffset; | 3131 FixedTypedArrayBase::kBasePointerOffset; |
3133 } else if (object->IsBytecodeArray()) { | 3132 } else if (object->IsBytecodeArray()) { |
3134 return static_cast<int>(slot - object->address()) == | 3133 return static_cast<int>(slot - object->address()) == |
3135 BytecodeArray::kConstantPoolOffset; | 3134 BytecodeArray::kConstantPoolOffset; |
3136 } else if (object->IsJSArrayBuffer()) { | 3135 } else if (object->IsJSArrayBuffer()) { |
3137 int off = static_cast<int>(slot - object->address()); | 3136 int off = static_cast<int>(slot - object->address()); |
3138 return (off >= JSArrayBuffer::BodyDescriptor::kStartOffset && | 3137 return (off >= JSArrayBuffer::kPropertiesOffset && |
3139 off <= JSArrayBuffer::kByteLengthOffset) || | 3138 off <= JSArrayBuffer::kByteLengthOffset) || |
3140 (off >= JSArrayBuffer::kSize && | 3139 (off >= JSArrayBuffer::kSize && |
3141 off < JSArrayBuffer::kSizeWithInternalFields); | 3140 off < JSArrayBuffer::kSizeWithInternalFields); |
3142 } else if (FLAG_unbox_double_fields) { | 3141 } else if (FLAG_unbox_double_fields) { |
3143 // Filter out slots that happen to point to unboxed double fields. | 3142 // Filter out slots that happen to point to unboxed double fields. |
3144 LayoutDescriptorHelper helper(object->map()); | 3143 LayoutDescriptorHelper helper(object->map()); |
3145 DCHECK(!helper.all_fields_tagged()); | 3144 DCHECK(!helper.all_fields_tagged()); |
3146 return helper.IsTagged(static_cast<int>(slot - object->address())); | 3145 return helper.IsTagged(static_cast<int>(slot - object->address())); |
3147 } | 3146 } |
3148 break; | 3147 break; |
(...skipping 1426 matching lines...) Loading... |
4575 MarkBit mark_bit = Marking::MarkBitFrom(host); | 4574 MarkBit mark_bit = Marking::MarkBitFrom(host); |
4576 if (Marking::IsBlack(mark_bit)) { | 4575 if (Marking::IsBlack(mark_bit)) { |
4577 RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, 0, host); | 4576 RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, 0, host); |
4578 RecordRelocSlot(&rinfo, target); | 4577 RecordRelocSlot(&rinfo, target); |
4579 } | 4578 } |
4580 } | 4579 } |
4581 } | 4580 } |
4582 | 4581 |
4583 } // namespace internal | 4582 } // namespace internal |
4584 } // namespace v8 | 4583 } // namespace v8 |
OLD | NEW |