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 // Review notes: | 5 // Review notes: |
6 // | 6 // |
7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
10 // | 10 // |
(...skipping 2811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2822 | 2822 |
2823 WriteBarrierMode HeapObject::GetWriteBarrierMode( | 2823 WriteBarrierMode HeapObject::GetWriteBarrierMode( |
2824 const DisallowHeapAllocation& promise) { | 2824 const DisallowHeapAllocation& promise) { |
2825 Heap* heap = GetHeap(); | 2825 Heap* heap = GetHeap(); |
2826 if (heap->incremental_marking()->IsMarking()) return UPDATE_WRITE_BARRIER; | 2826 if (heap->incremental_marking()->IsMarking()) return UPDATE_WRITE_BARRIER; |
2827 if (heap->InNewSpace(this)) return SKIP_WRITE_BARRIER; | 2827 if (heap->InNewSpace(this)) return SKIP_WRITE_BARRIER; |
2828 return UPDATE_WRITE_BARRIER; | 2828 return UPDATE_WRITE_BARRIER; |
2829 } | 2829 } |
2830 | 2830 |
2831 | 2831 |
2832 bool HeapObject::NeedsToEnsureDoubleAlignment() { | 2832 AllocationAlignment HeapObject::RequiredAlignment() { |
2833 #ifdef V8_HOST_ARCH_32_BIT | 2833 #ifdef V8_HOST_ARCH_32_BIT |
2834 return (IsFixedFloat64Array() || IsFixedDoubleArray() || | 2834 if ((IsFixedFloat64Array() || IsFixedDoubleArray() || |
2835 IsConstantPoolArray()) && | 2835 IsConstantPoolArray()) && |
2836 FixedArrayBase::cast(this)->length() != 0; | 2836 FixedArrayBase::cast(this)->length() != 0) { |
2837 #else | 2837 return kDoubleAligned; |
2838 return false; | 2838 } |
| 2839 if (IsHeapNumber()) return kDoubleUnaligned; |
2839 #endif // V8_HOST_ARCH_32_BIT | 2840 #endif // V8_HOST_ARCH_32_BIT |
| 2841 return kWordAligned; |
2840 } | 2842 } |
2841 | 2843 |
2842 | 2844 |
2843 bool HeapObject::NeedsToEnsureDoubleUnalignment() { | |
2844 #ifdef V8_HOST_ARCH_32_BIT | |
2845 return IsHeapNumber(); | |
2846 #else | |
2847 return false; | |
2848 #endif // V8_HOST_ARCH_32_BIT | |
2849 } | |
2850 | |
2851 | |
2852 void FixedArray::set(int index, | 2845 void FixedArray::set(int index, |
2853 Object* value, | 2846 Object* value, |
2854 WriteBarrierMode mode) { | 2847 WriteBarrierMode mode) { |
2855 DCHECK(map() != GetHeap()->fixed_cow_array_map()); | 2848 DCHECK(map() != GetHeap()->fixed_cow_array_map()); |
2856 DCHECK(index >= 0 && index < this->length()); | 2849 DCHECK(index >= 0 && index < this->length()); |
2857 int offset = kHeaderSize + index * kPointerSize; | 2850 int offset = kHeaderSize + index * kPointerSize; |
2858 WRITE_FIELD(this, offset, value); | 2851 WRITE_FIELD(this, offset, value); |
2859 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); | 2852 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); |
2860 } | 2853 } |
2861 | 2854 |
(...skipping 4770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7632 #undef READ_SHORT_FIELD | 7625 #undef READ_SHORT_FIELD |
7633 #undef WRITE_SHORT_FIELD | 7626 #undef WRITE_SHORT_FIELD |
7634 #undef READ_BYTE_FIELD | 7627 #undef READ_BYTE_FIELD |
7635 #undef WRITE_BYTE_FIELD | 7628 #undef WRITE_BYTE_FIELD |
7636 #undef NOBARRIER_READ_BYTE_FIELD | 7629 #undef NOBARRIER_READ_BYTE_FIELD |
7637 #undef NOBARRIER_WRITE_BYTE_FIELD | 7630 #undef NOBARRIER_WRITE_BYTE_FIELD |
7638 | 7631 |
7639 } } // namespace v8::internal | 7632 } } // namespace v8::internal |
7640 | 7633 |
7641 #endif // V8_OBJECTS_INL_H_ | 7634 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |