Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/heap/mark-compact.cc

Issue 1176263004: Introduce a base pointer field in FixedTypedArrayBase and teach GC about it (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/store-buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2761 matching lines...) Expand 10 before | Expand all | Expand 10 after
2772 Memory::Object_at(dst_slot) = value; 2772 Memory::Object_at(dst_slot) = value;
2773 RecordMigratedSlot(value, dst_slot); 2773 RecordMigratedSlot(value, dst_slot);
2774 src_slot += kPointerSize; 2774 src_slot += kPointerSize;
2775 dst_slot += kPointerSize; 2775 dst_slot += kPointerSize;
2776 } 2776 }
2777 } 2777 }
2778 2778
2779 2779
2780 void MarkCompactCollector::MigrateObjectMixed(HeapObject* dst, HeapObject* src, 2780 void MarkCompactCollector::MigrateObjectMixed(HeapObject* dst, HeapObject* src,
2781 int size) { 2781 int size) {
2782 if (FLAG_unbox_double_fields) { 2782 if (src->IsFixedTypedArrayBase()) {
2783 heap()->MoveBlock(dst->address(), src->address(), size);
2784 Address base_pointer_slot =
2785 dst->address() + FixedTypedArrayBase::kBasePointerOffset;
2786 RecordMigratedSlot(Memory::Object_at(base_pointer_slot), base_pointer_slot);
2787 } else if (FLAG_unbox_double_fields) {
2783 Address dst_addr = dst->address(); 2788 Address dst_addr = dst->address();
2784 Address src_addr = src->address(); 2789 Address src_addr = src->address();
2785 Address src_slot = src_addr; 2790 Address src_slot = src_addr;
2786 Address dst_slot = dst_addr; 2791 Address dst_slot = dst_addr;
2787 2792
2788 LayoutDescriptorHelper helper(src->map()); 2793 LayoutDescriptorHelper helper(src->map());
2789 DCHECK(!helper.all_fields_tagged()); 2794 DCHECK(!helper.all_fields_tagged());
2790 for (int remaining = size / kPointerSize; remaining > 0; remaining--) { 2795 for (int remaining = size / kPointerSize; remaining > 0; remaining--) {
2791 Object* value = Memory::Object_at(src_slot); 2796 Object* value = Memory::Object_at(src_slot);
2792 2797
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
3191 InstanceType type = object->map()->instance_type(); 3196 InstanceType type = object->map()->instance_type();
3192 // Slots in maps and code can't be invalid because they are never 3197 // Slots in maps and code can't be invalid because they are never
3193 // shrunk. 3198 // shrunk.
3194 if (type == MAP_TYPE || type == CODE_TYPE) return true; 3199 if (type == MAP_TYPE || type == CODE_TYPE) return true;
3195 3200
3196 // Consider slots in objects that contain ONLY raw data as invalid. 3201 // Consider slots in objects that contain ONLY raw data as invalid.
3197 return false; 3202 return false;
3198 } 3203 }
3199 3204
3200 case HeapObjectContents::kMixedValues: { 3205 case HeapObjectContents::kMixedValues: {
3201 if (FLAG_unbox_double_fields) { 3206 if (object->IsFixedTypedArrayBase()) {
3207 return static_cast<int>(slot - object->address()) ==
3208 FixedTypedArrayBase::kBasePointerOffset;
3209 } else if (FLAG_unbox_double_fields) {
3202 // Filter out slots that happen to point to unboxed double fields. 3210 // Filter out slots that happen to point to unboxed double fields.
3203 LayoutDescriptorHelper helper(object->map()); 3211 LayoutDescriptorHelper helper(object->map());
3204 DCHECK(!helper.all_fields_tagged()); 3212 DCHECK(!helper.all_fields_tagged());
3205 return helper.IsTagged(static_cast<int>(slot - object->address())); 3213 return helper.IsTagged(static_cast<int>(slot - object->address()));
3206 } 3214 }
3207 break; 3215 break;
3208 } 3216 }
3209 } 3217 }
3210 UNREACHABLE(); 3218 UNREACHABLE();
3211 } 3219 }
(...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after
4728 SlotsBuffer* buffer = *buffer_address; 4736 SlotsBuffer* buffer = *buffer_address;
4729 while (buffer != NULL) { 4737 while (buffer != NULL) {
4730 SlotsBuffer* next_buffer = buffer->next(); 4738 SlotsBuffer* next_buffer = buffer->next();
4731 DeallocateBuffer(buffer); 4739 DeallocateBuffer(buffer);
4732 buffer = next_buffer; 4740 buffer = next_buffer;
4733 } 4741 }
4734 *buffer_address = NULL; 4742 *buffer_address = NULL;
4735 } 4743 }
4736 } // namespace internal 4744 } // namespace internal
4737 } // namespace v8 4745 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/store-buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698