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

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

Issue 304223002: Special case ConstantPoolArray in MarkCompactCollector::MigrateObject. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/mark-compact.h ('k') | no next file » | 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 "v8.h" 5 #include "v8.h"
6 6
7 #include "code-stubs.h" 7 #include "code-stubs.h"
8 #include "compilation-cache.h" 8 #include "compilation-cache.h"
9 #include "cpu-profiler.h" 9 #include "cpu-profiler.h"
10 #include "deoptimizer.h" 10 #include "deoptimizer.h"
(...skipping 2804 matching lines...) Expand 10 before | Expand all | Expand 10 after
2815 table->RemoveEntry(i); 2815 table->RemoveEntry(i);
2816 } 2816 }
2817 } 2817 }
2818 weak_collection_obj = weak_collection->next(); 2818 weak_collection_obj = weak_collection->next();
2819 weak_collection->set_next(Smi::FromInt(0)); 2819 weak_collection->set_next(Smi::FromInt(0));
2820 } 2820 }
2821 set_encountered_weak_collections(Smi::FromInt(0)); 2821 set_encountered_weak_collections(Smi::FromInt(0));
2822 } 2822 }
2823 2823
2824 2824
2825 void MarkCompactCollector::RecordMigratedSlot(Object* value, Address slot) {
2826 if (heap_->InNewSpace(value)) {
2827 heap_->store_buffer()->Mark(slot);
2828 } else if (value->IsHeapObject() && IsOnEvacuationCandidate(value)) {
2829 SlotsBuffer::AddTo(&slots_buffer_allocator_,
2830 &migration_slots_buffer_,
2831 reinterpret_cast<Object**>(slot),
2832 SlotsBuffer::IGNORE_OVERFLOW);
2833 }
2834 }
2835
2836
2837
2825 // We scavange new space simultaneously with sweeping. This is done in two 2838 // We scavange new space simultaneously with sweeping. This is done in two
2826 // passes. 2839 // passes.
2827 // 2840 //
2828 // The first pass migrates all alive objects from one semispace to another or 2841 // The first pass migrates all alive objects from one semispace to another or
2829 // promotes them to old space. Forwarding address is written directly into 2842 // promotes them to old space. Forwarding address is written directly into
2830 // first word of object without any encoding. If object is dead we write 2843 // first word of object without any encoding. If object is dead we write
2831 // NULL as a forwarding address. 2844 // NULL as a forwarding address.
2832 // 2845 //
2833 // The second pass updates pointers to new space in all spaces. It is possible 2846 // The second pass updates pointers to new space in all spaces. It is possible
2834 // to encounter pointers to dead new space objects during traversal of pointers 2847 // to encounter pointers to dead new space objects during traversal of pointers
(...skipping 16 matching lines...) Expand all
2851 if (dest == OLD_POINTER_SPACE) { 2864 if (dest == OLD_POINTER_SPACE) {
2852 Address src_slot = src_addr; 2865 Address src_slot = src_addr;
2853 Address dst_slot = dst_addr; 2866 Address dst_slot = dst_addr;
2854 ASSERT(IsAligned(size, kPointerSize)); 2867 ASSERT(IsAligned(size, kPointerSize));
2855 2868
2856 for (int remaining = size / kPointerSize; remaining > 0; remaining--) { 2869 for (int remaining = size / kPointerSize; remaining > 0; remaining--) {
2857 Object* value = Memory::Object_at(src_slot); 2870 Object* value = Memory::Object_at(src_slot);
2858 2871
2859 Memory::Object_at(dst_slot) = value; 2872 Memory::Object_at(dst_slot) = value;
2860 2873
2861 if (heap_->InNewSpace(value)) { 2874 // We special case ConstantPoolArrays below since they could contain
Hannes Payer (out of office) 2014/06/04 07:25:04 contain contain => contain
rmcilroy 2014/06/04 10:19:26 Done.
2862 heap_->store_buffer()->Mark(dst_slot); 2875 // contain integers value entries which look like tagged pointers.
2863 } else if (value->IsHeapObject() && IsOnEvacuationCandidate(value)) { 2876 if (!(compacting_ && dst->IsConstantPoolArray())) {
Michael Starzinger 2014/06/03 22:57:11 OMG, this is a giant hack. Please leave a TODO(mst
Hannes Payer (out of office) 2014/06/04 07:25:04 The problem is that constant pools do not belong t
Hannes Payer (out of office) 2014/06/04 07:25:04 if (!(compacting_ && dst->IsConstantPoolArray()))
rmcilroy 2014/06/04 10:15:56 ConstantPoolArrays are pre-tenured, so they should
rmcilroy 2014/06/04 10:15:56 Done.
Hannes Payer (out of office) 2014/06/04 10:54:16 I was worried about creating store buffer entries
2864 SlotsBuffer::AddTo(&slots_buffer_allocator_, 2877 RecordMigratedSlot(value, dst_slot);
2865 &migration_slots_buffer_,
2866 reinterpret_cast<Object**>(dst_slot),
2867 SlotsBuffer::IGNORE_OVERFLOW);
2868 } 2878 }
2869 2879
2870 src_slot += kPointerSize; 2880 src_slot += kPointerSize;
2871 dst_slot += kPointerSize; 2881 dst_slot += kPointerSize;
2872 } 2882 }
2873 2883
2874 if (compacting_ && dst->IsJSFunction()) { 2884 if (compacting_ && dst->IsJSFunction()) {
2875 Address code_entry_slot = dst_addr + JSFunction::kCodeEntryOffset; 2885 Address code_entry_slot = dst_addr + JSFunction::kCodeEntryOffset;
2876 Address code_entry = Memory::Address_at(code_entry_slot); 2886 Address code_entry = Memory::Address_at(code_entry_slot);
2877 2887
(...skipping 13 matching lines...) Expand all
2891 Address code_entry = Memory::Address_at(code_entry_slot); 2901 Address code_entry = Memory::Address_at(code_entry_slot);
2892 2902
2893 if (Page::FromAddress(code_entry)->IsEvacuationCandidate()) { 2903 if (Page::FromAddress(code_entry)->IsEvacuationCandidate()) {
2894 SlotsBuffer::AddTo(&slots_buffer_allocator_, 2904 SlotsBuffer::AddTo(&slots_buffer_allocator_,
2895 &migration_slots_buffer_, 2905 &migration_slots_buffer_,
2896 SlotsBuffer::CODE_ENTRY_SLOT, 2906 SlotsBuffer::CODE_ENTRY_SLOT,
2897 code_entry_slot, 2907 code_entry_slot,
2898 SlotsBuffer::IGNORE_OVERFLOW); 2908 SlotsBuffer::IGNORE_OVERFLOW);
2899 } 2909 }
2900 } 2910 }
2911 ConstantPoolArray::Iterator heap_iter(array, ConstantPoolArray::HEAP_PTR);
2912 while (!heap_iter.is_finished()) {
2913 Address heap_slot =
2914 dst_addr + array->OffsetOfElementAt(heap_iter.next_index());
2915 Object* value = Memory::Object_at(heap_slot);
2916 RecordMigratedSlot(value, heap_slot);
2917 }
2901 } 2918 }
2902 } else if (dest == CODE_SPACE) { 2919 } else if (dest == CODE_SPACE) {
2903 PROFILE(isolate(), CodeMoveEvent(src_addr, dst_addr)); 2920 PROFILE(isolate(), CodeMoveEvent(src_addr, dst_addr));
2904 heap()->MoveBlock(dst_addr, src_addr, size); 2921 heap()->MoveBlock(dst_addr, src_addr, size);
2905 SlotsBuffer::AddTo(&slots_buffer_allocator_, 2922 SlotsBuffer::AddTo(&slots_buffer_allocator_,
2906 &migration_slots_buffer_, 2923 &migration_slots_buffer_,
2907 SlotsBuffer::RELOCATED_CODE_OBJECT, 2924 SlotsBuffer::RELOCATED_CODE_OBJECT,
2908 dst_addr, 2925 dst_addr,
2909 SlotsBuffer::IGNORE_OVERFLOW); 2926 SlotsBuffer::IGNORE_OVERFLOW);
2910 Code::cast(dst)->Relocate(dst_addr - src_addr); 2927 Code::cast(dst)->Relocate(dst_addr - src_addr);
(...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after
4502 while (buffer != NULL) { 4519 while (buffer != NULL) {
4503 SlotsBuffer* next_buffer = buffer->next(); 4520 SlotsBuffer* next_buffer = buffer->next();
4504 DeallocateBuffer(buffer); 4521 DeallocateBuffer(buffer);
4505 buffer = next_buffer; 4522 buffer = next_buffer;
4506 } 4523 }
4507 *buffer_address = NULL; 4524 *buffer_address = NULL;
4508 } 4525 }
4509 4526
4510 4527
4511 } } // namespace v8::internal 4528 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mark-compact.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698