| 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 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1738 enum NewSpaceAllocationMode { | 1738 enum NewSpaceAllocationMode { |
| 1739 kNonstickyBailoutOldSpace, | 1739 kNonstickyBailoutOldSpace, |
| 1740 kStickyBailoutOldSpace, | 1740 kStickyBailoutOldSpace, |
| 1741 }; | 1741 }; |
| 1742 | 1742 |
| 1743 inline AllocationSpace AllocateTargetObject(HeapObject* old_object, | 1743 inline AllocationSpace AllocateTargetObject(HeapObject* old_object, |
| 1744 HeapObject** target_object) { | 1744 HeapObject** target_object) { |
| 1745 const int size = old_object->Size(); | 1745 const int size = old_object->Size(); |
| 1746 AllocationAlignment alignment = old_object->RequiredAlignment(); | 1746 AllocationAlignment alignment = old_object->RequiredAlignment(); |
| 1747 AllocationResult allocation; | 1747 AllocationResult allocation; |
| 1748 AllocationSpace space_allocated_in = space_to_allocate_; |
| 1748 if (space_to_allocate_ == NEW_SPACE) { | 1749 if (space_to_allocate_ == NEW_SPACE) { |
| 1749 if (size > kMaxLabObjectSize) { | 1750 if (size > kMaxLabObjectSize) { |
| 1750 allocation = | 1751 allocation = |
| 1751 AllocateInNewSpace(size, alignment, kNonstickyBailoutOldSpace); | 1752 AllocateInNewSpace(size, alignment, kNonstickyBailoutOldSpace); |
| 1752 } else { | 1753 } else { |
| 1753 allocation = AllocateInLab(size, alignment); | 1754 allocation = AllocateInLab(size, alignment); |
| 1754 } | 1755 } |
| 1755 } | 1756 } |
| 1756 if (allocation.IsRetry() || (space_to_allocate_ == OLD_SPACE)) { | 1757 if (allocation.IsRetry() || (space_to_allocate_ == OLD_SPACE)) { |
| 1757 allocation = AllocateInOldSpace(size, alignment); | 1758 allocation = AllocateInOldSpace(size, alignment); |
| 1759 space_allocated_in = OLD_SPACE; |
| 1758 } | 1760 } |
| 1759 bool ok = allocation.To(target_object); | 1761 bool ok = allocation.To(target_object); |
| 1760 DCHECK(ok); | 1762 DCHECK(ok); |
| 1761 USE(ok); | 1763 USE(ok); |
| 1762 return space_to_allocate_; | 1764 return space_allocated_in; |
| 1763 } | 1765 } |
| 1764 | 1766 |
| 1765 inline bool NewLocalAllocationBuffer() { | 1767 inline bool NewLocalAllocationBuffer() { |
| 1766 AllocationResult result = | 1768 AllocationResult result = |
| 1767 AllocateInNewSpace(kLabSize, kWordAligned, kStickyBailoutOldSpace); | 1769 AllocateInNewSpace(kLabSize, kWordAligned, kStickyBailoutOldSpace); |
| 1768 LocalAllocationBuffer saved_old_buffer = buffer_; | 1770 LocalAllocationBuffer saved_old_buffer = buffer_; |
| 1769 buffer_ = LocalAllocationBuffer::FromResult(heap_, result, kLabSize); | 1771 buffer_ = LocalAllocationBuffer::FromResult(heap_, result, kLabSize); |
| 1770 if (buffer_.IsValid()) { | 1772 if (buffer_.IsValid()) { |
| 1771 buffer_.TryMerge(&saved_old_buffer); | 1773 buffer_.TryMerge(&saved_old_buffer); |
| 1772 return true; | 1774 return true; |
| (...skipping 2260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4033 // The target is always in old space, we don't have to record the slot in | 4035 // The target is always in old space, we don't have to record the slot in |
| 4034 // the old-to-new remembered set. | 4036 // the old-to-new remembered set. |
| 4035 DCHECK(!heap()->InNewSpace(target)); | 4037 DCHECK(!heap()->InNewSpace(target)); |
| 4036 RecordRelocSlot(host, &rinfo, target); | 4038 RecordRelocSlot(host, &rinfo, target); |
| 4037 } | 4039 } |
| 4038 } | 4040 } |
| 4039 } | 4041 } |
| 4040 | 4042 |
| 4041 } // namespace internal | 4043 } // namespace internal |
| 4042 } // namespace v8 | 4044 } // namespace v8 |
| OLD | NEW |