| 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/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
| (...skipping 2667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2678 heap()->MoveBlock(dst->address(), src->address(), size); | 2678 heap()->MoveBlock(dst->address(), src->address(), size); |
| 2679 Address base_pointer_slot = | 2679 Address base_pointer_slot = |
| 2680 dst->address() + FixedTypedArrayBase::kBasePointerOffset; | 2680 dst->address() + FixedTypedArrayBase::kBasePointerOffset; |
| 2681 RecordMigratedSlot(Memory::Object_at(base_pointer_slot), base_pointer_slot); | 2681 RecordMigratedSlot(Memory::Object_at(base_pointer_slot), base_pointer_slot); |
| 2682 } else if (src->IsBytecodeArray()) { | 2682 } else if (src->IsBytecodeArray()) { |
| 2683 heap()->MoveBlock(dst->address(), src->address(), size); | 2683 heap()->MoveBlock(dst->address(), src->address(), size); |
| 2684 Address constant_pool_slot = | 2684 Address constant_pool_slot = |
| 2685 dst->address() + BytecodeArray::kConstantPoolOffset; | 2685 dst->address() + BytecodeArray::kConstantPoolOffset; |
| 2686 RecordMigratedSlot(Memory::Object_at(constant_pool_slot), | 2686 RecordMigratedSlot(Memory::Object_at(constant_pool_slot), |
| 2687 constant_pool_slot); | 2687 constant_pool_slot); |
| 2688 } else if (src->IsJSArrayBuffer()) { |
| 2689 heap()->MoveBlock(dst->address(), src->address(), size); |
| 2690 |
| 2691 // Visit inherited JSObject properties and byte length of ArrayBuffer |
| 2692 Address regular_slot = |
| 2693 dst->address() + JSArrayBuffer::BodyDescriptor::kStartOffset; |
| 2694 Address regular_slots_end = |
| 2695 dst->address() + JSArrayBuffer::kByteLengthOffset + kPointerSize; |
| 2696 while (regular_slot < regular_slots_end) { |
| 2697 RecordMigratedSlot(Memory::Object_at(regular_slot), regular_slot); |
| 2698 regular_slot += kPointerSize; |
| 2699 } |
| 2700 |
| 2701 // Skip backing store and visit just internal fields |
| 2702 Address internal_field_slot = dst->address() + JSArrayBuffer::kSize; |
| 2703 Address internal_fields_end = |
| 2704 dst->address() + JSArrayBuffer::kSizeWithInternalFields; |
| 2705 while (internal_field_slot < internal_fields_end) { |
| 2706 RecordMigratedSlot(Memory::Object_at(internal_field_slot), |
| 2707 internal_field_slot); |
| 2708 internal_field_slot += kPointerSize; |
| 2709 } |
| 2688 } else if (FLAG_unbox_double_fields) { | 2710 } else if (FLAG_unbox_double_fields) { |
| 2689 Address dst_addr = dst->address(); | 2711 Address dst_addr = dst->address(); |
| 2690 Address src_addr = src->address(); | 2712 Address src_addr = src->address(); |
| 2691 Address src_slot = src_addr; | 2713 Address src_slot = src_addr; |
| 2692 Address dst_slot = dst_addr; | 2714 Address dst_slot = dst_addr; |
| 2693 | 2715 |
| 2694 LayoutDescriptorHelper helper(src->map()); | 2716 LayoutDescriptorHelper helper(src->map()); |
| 2695 DCHECK(!helper.all_fields_tagged()); | 2717 DCHECK(!helper.all_fields_tagged()); |
| 2696 for (int remaining = size / kPointerSize; remaining > 0; remaining--) { | 2718 for (int remaining = size / kPointerSize; remaining > 0; remaining--) { |
| 2697 Object* value = Memory::Object_at(src_slot); | 2719 Object* value = Memory::Object_at(src_slot); |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3104 return false; | 3126 return false; |
| 3105 } | 3127 } |
| 3106 | 3128 |
| 3107 case HeapObjectContents::kMixedValues: { | 3129 case HeapObjectContents::kMixedValues: { |
| 3108 if (object->IsFixedTypedArrayBase()) { | 3130 if (object->IsFixedTypedArrayBase()) { |
| 3109 return static_cast<int>(slot - object->address()) == | 3131 return static_cast<int>(slot - object->address()) == |
| 3110 FixedTypedArrayBase::kBasePointerOffset; | 3132 FixedTypedArrayBase::kBasePointerOffset; |
| 3111 } else if (object->IsBytecodeArray()) { | 3133 } else if (object->IsBytecodeArray()) { |
| 3112 return static_cast<int>(slot - object->address()) == | 3134 return static_cast<int>(slot - object->address()) == |
| 3113 BytecodeArray::kConstantPoolOffset; | 3135 BytecodeArray::kConstantPoolOffset; |
| 3136 } else if (object->IsJSArrayBuffer()) { |
| 3137 int off = static_cast<int>(slot - object->address()); |
| 3138 return (off >= JSArrayBuffer::BodyDescriptor::kStartOffset && |
| 3139 off <= JSArrayBuffer::kByteLengthOffset) || |
| 3140 (off >= JSArrayBuffer::kSize && |
| 3141 off < JSArrayBuffer::kSizeWithInternalFields); |
| 3114 } else if (FLAG_unbox_double_fields) { | 3142 } else if (FLAG_unbox_double_fields) { |
| 3115 // Filter out slots that happen to point to unboxed double fields. | 3143 // Filter out slots that happen to point to unboxed double fields. |
| 3116 LayoutDescriptorHelper helper(object->map()); | 3144 LayoutDescriptorHelper helper(object->map()); |
| 3117 DCHECK(!helper.all_fields_tagged()); | 3145 DCHECK(!helper.all_fields_tagged()); |
| 3118 return helper.IsTagged(static_cast<int>(slot - object->address())); | 3146 return helper.IsTagged(static_cast<int>(slot - object->address())); |
| 3119 } | 3147 } |
| 3120 break; | 3148 break; |
| 3121 } | 3149 } |
| 3122 } | 3150 } |
| 3123 UNREACHABLE(); | 3151 UNREACHABLE(); |
| (...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4666 SlotsBuffer* buffer = *buffer_address; | 4694 SlotsBuffer* buffer = *buffer_address; |
| 4667 while (buffer != NULL) { | 4695 while (buffer != NULL) { |
| 4668 SlotsBuffer* next_buffer = buffer->next(); | 4696 SlotsBuffer* next_buffer = buffer->next(); |
| 4669 DeallocateBuffer(buffer); | 4697 DeallocateBuffer(buffer); |
| 4670 buffer = next_buffer; | 4698 buffer = next_buffer; |
| 4671 } | 4699 } |
| 4672 *buffer_address = NULL; | 4700 *buffer_address = NULL; |
| 4673 } | 4701 } |
| 4674 } // namespace internal | 4702 } // namespace internal |
| 4675 } // namespace v8 | 4703 } // namespace v8 |
| OLD | NEW |