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

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

Issue 325553002: --verify-predictable mode added for ensuring that GC behaves deterministically. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing review comments 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/heap-inl.h ('k') | src/objects-printer.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/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compilation-cache.h" 9 #include "src/compilation-cache.h"
10 #include "src/cpu-profiler.h" 10 #include "src/cpu-profiler.h"
(...skipping 2788 matching lines...) Expand 10 before | Expand all | Expand 10 after
2799 // to new space. We should clear them to avoid encountering them during next 2799 // to new space. We should clear them to avoid encountering them during next
2800 // pointer iteration. This is an issue if the store buffer overflows and we 2800 // pointer iteration. This is an issue if the store buffer overflows and we
2801 // have to scan the entire old space, including dead objects, looking for 2801 // have to scan the entire old space, including dead objects, looking for
2802 // pointers to new space. 2802 // pointers to new space.
2803 void MarkCompactCollector::MigrateObject(HeapObject* dst, 2803 void MarkCompactCollector::MigrateObject(HeapObject* dst,
2804 HeapObject* src, 2804 HeapObject* src,
2805 int size, 2805 int size,
2806 AllocationSpace dest) { 2806 AllocationSpace dest) {
2807 Address dst_addr = dst->address(); 2807 Address dst_addr = dst->address();
2808 Address src_addr = src->address(); 2808 Address src_addr = src->address();
2809 HeapProfiler* heap_profiler = heap()->isolate()->heap_profiler();
2810 if (heap_profiler->is_tracking_object_moves()) {
2811 heap_profiler->ObjectMoveEvent(src_addr, dst_addr, size);
2812 }
2813 ASSERT(heap()->AllowedToBeMigrated(src, dest)); 2809 ASSERT(heap()->AllowedToBeMigrated(src, dest));
2814 ASSERT(dest != LO_SPACE && size <= Page::kMaxRegularHeapObjectSize); 2810 ASSERT(dest != LO_SPACE && size <= Page::kMaxRegularHeapObjectSize);
2815 if (dest == OLD_POINTER_SPACE) { 2811 if (dest == OLD_POINTER_SPACE) {
2816 Address src_slot = src_addr; 2812 Address src_slot = src_addr;
2817 Address dst_slot = dst_addr; 2813 Address dst_slot = dst_addr;
2818 ASSERT(IsAligned(size, kPointerSize)); 2814 ASSERT(IsAligned(size, kPointerSize));
2819 2815
2820 for (int remaining = size / kPointerSize; remaining > 0; remaining--) { 2816 for (int remaining = size / kPointerSize; remaining > 0; remaining--) {
2821 Object* value = Memory::Object_at(src_slot); 2817 Object* value = Memory::Object_at(src_slot);
2822 2818
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2869 SlotsBuffer::AddTo(&slots_buffer_allocator_, 2865 SlotsBuffer::AddTo(&slots_buffer_allocator_,
2870 &migration_slots_buffer_, 2866 &migration_slots_buffer_,
2871 SlotsBuffer::RELOCATED_CODE_OBJECT, 2867 SlotsBuffer::RELOCATED_CODE_OBJECT,
2872 dst_addr, 2868 dst_addr,
2873 SlotsBuffer::IGNORE_OVERFLOW); 2869 SlotsBuffer::IGNORE_OVERFLOW);
2874 Code::cast(dst)->Relocate(dst_addr - src_addr); 2870 Code::cast(dst)->Relocate(dst_addr - src_addr);
2875 } else { 2871 } else {
2876 ASSERT(dest == OLD_DATA_SPACE || dest == NEW_SPACE); 2872 ASSERT(dest == OLD_DATA_SPACE || dest == NEW_SPACE);
2877 heap()->MoveBlock(dst_addr, src_addr, size); 2873 heap()->MoveBlock(dst_addr, src_addr, size);
2878 } 2874 }
2875 heap()->OnMoveEvent(dst, src, size);
2879 Memory::Address_at(src_addr) = dst_addr; 2876 Memory::Address_at(src_addr) = dst_addr;
2880 } 2877 }
2881 2878
2882 2879
2883 // Visitor for updating pointers from live objects in old spaces to new space. 2880 // Visitor for updating pointers from live objects in old spaces to new space.
2884 // It does not expect to encounter pointers to dead objects. 2881 // It does not expect to encounter pointers to dead objects.
2885 class PointersUpdatingVisitor: public ObjectVisitor { 2882 class PointersUpdatingVisitor: public ObjectVisitor {
2886 public: 2883 public:
2887 explicit PointersUpdatingVisitor(Heap* heap) : heap_(heap) { } 2884 explicit PointersUpdatingVisitor(Heap* heap) : heap_(heap) { }
2888 2885
(...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after
4465 while (buffer != NULL) { 4462 while (buffer != NULL) {
4466 SlotsBuffer* next_buffer = buffer->next(); 4463 SlotsBuffer* next_buffer = buffer->next();
4467 DeallocateBuffer(buffer); 4464 DeallocateBuffer(buffer);
4468 buffer = next_buffer; 4465 buffer = next_buffer;
4469 } 4466 }
4470 *buffer_address = NULL; 4467 *buffer_address = NULL;
4471 } 4468 }
4472 4469
4473 4470
4474 } } // namespace v8::internal 4471 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-inl.h ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698