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 2880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2891 if (dest == OLD_POINTER_SPACE) { | 2891 if (dest == OLD_POINTER_SPACE) { |
2892 Address src_slot = src_addr; | 2892 Address src_slot = src_addr; |
2893 Address dst_slot = dst_addr; | 2893 Address dst_slot = dst_addr; |
2894 DCHECK(IsAligned(size, kPointerSize)); | 2894 DCHECK(IsAligned(size, kPointerSize)); |
2895 | 2895 |
2896 for (int remaining = size / kPointerSize; remaining > 0; remaining--) { | 2896 for (int remaining = size / kPointerSize; remaining > 0; remaining--) { |
2897 Object* value = Memory::Object_at(src_slot); | 2897 Object* value = Memory::Object_at(src_slot); |
2898 | 2898 |
2899 Memory::Object_at(dst_slot) = value; | 2899 Memory::Object_at(dst_slot) = value; |
2900 | 2900 |
2901 // We special case ConstantPoolArrays below since they could contain | 2901 if (!src->MayContainRawValues()) { |
2902 // integers value entries which look like tagged pointers. | |
2903 // TODO(mstarzinger): restructure this code to avoid this special-casing. | |
2904 if (!src->IsConstantPoolArray()) { | |
2905 RecordMigratedSlot(value, dst_slot); | 2902 RecordMigratedSlot(value, dst_slot); |
2906 } | 2903 } |
2907 | 2904 |
2908 src_slot += kPointerSize; | 2905 src_slot += kPointerSize; |
2909 dst_slot += kPointerSize; | 2906 dst_slot += kPointerSize; |
2910 } | 2907 } |
2911 | 2908 |
2912 if (compacting_ && dst->IsJSFunction()) { | 2909 if (compacting_ && dst->IsJSFunction()) { |
2913 Address code_entry_slot = dst_addr + JSFunction::kCodeEntryOffset; | 2910 Address code_entry_slot = dst_addr + JSFunction::kCodeEntryOffset; |
2914 Address code_entry = Memory::Address_at(code_entry_slot); | 2911 Address code_entry = Memory::Address_at(code_entry_slot); |
2915 | 2912 |
2916 if (Page::FromAddress(code_entry)->IsEvacuationCandidate()) { | 2913 if (Page::FromAddress(code_entry)->IsEvacuationCandidate()) { |
2917 SlotsBuffer::AddTo(&slots_buffer_allocator_, &migration_slots_buffer_, | 2914 SlotsBuffer::AddTo(&slots_buffer_allocator_, &migration_slots_buffer_, |
2918 SlotsBuffer::CODE_ENTRY_SLOT, code_entry_slot, | 2915 SlotsBuffer::CODE_ENTRY_SLOT, code_entry_slot, |
2919 SlotsBuffer::IGNORE_OVERFLOW); | 2916 SlotsBuffer::IGNORE_OVERFLOW); |
2920 } | 2917 } |
2921 } else if (dst->IsConstantPoolArray()) { | 2918 } else if (dst->IsConstantPoolArray()) { |
| 2919 // We special case ConstantPoolArrays since they could contain integers |
| 2920 // value entries which look like tagged pointers. |
| 2921 // TODO(mstarzinger): restructure this code to avoid this special-casing. |
2922 ConstantPoolArray* array = ConstantPoolArray::cast(dst); | 2922 ConstantPoolArray* array = ConstantPoolArray::cast(dst); |
2923 ConstantPoolArray::Iterator code_iter(array, ConstantPoolArray::CODE_PTR); | 2923 ConstantPoolArray::Iterator code_iter(array, ConstantPoolArray::CODE_PTR); |
2924 while (!code_iter.is_finished()) { | 2924 while (!code_iter.is_finished()) { |
2925 Address code_entry_slot = | 2925 Address code_entry_slot = |
2926 dst_addr + array->OffsetOfElementAt(code_iter.next_index()); | 2926 dst_addr + array->OffsetOfElementAt(code_iter.next_index()); |
2927 Address code_entry = Memory::Address_at(code_entry_slot); | 2927 Address code_entry = Memory::Address_at(code_entry_slot); |
2928 | 2928 |
2929 if (Page::FromAddress(code_entry)->IsEvacuationCandidate()) { | 2929 if (Page::FromAddress(code_entry)->IsEvacuationCandidate()) { |
2930 SlotsBuffer::AddTo(&slots_buffer_allocator_, &migration_slots_buffer_, | 2930 SlotsBuffer::AddTo(&slots_buffer_allocator_, &migration_slots_buffer_, |
2931 SlotsBuffer::CODE_ENTRY_SLOT, code_entry_slot, | 2931 SlotsBuffer::CODE_ENTRY_SLOT, code_entry_slot, |
(...skipping 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4553 SlotsBuffer* buffer = *buffer_address; | 4553 SlotsBuffer* buffer = *buffer_address; |
4554 while (buffer != NULL) { | 4554 while (buffer != NULL) { |
4555 SlotsBuffer* next_buffer = buffer->next(); | 4555 SlotsBuffer* next_buffer = buffer->next(); |
4556 DeallocateBuffer(buffer); | 4556 DeallocateBuffer(buffer); |
4557 buffer = next_buffer; | 4557 buffer = next_buffer; |
4558 } | 4558 } |
4559 *buffer_address = NULL; | 4559 *buffer_address = NULL; |
4560 } | 4560 } |
4561 } | 4561 } |
4562 } // namespace v8::internal | 4562 } // namespace v8::internal |
OLD | NEW |