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

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

Issue 23060018: Fix migration checks and extend them to the Scavenger. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address nit. Created 7 years, 4 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') | 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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2725 matching lines...) Expand 10 before | Expand all | Expand 10 after
2736 // to encounter pointers to dead new space objects during traversal of pointers 2736 // to encounter pointers to dead new space objects during traversal of pointers
2737 // to new space. We should clear them to avoid encountering them during next 2737 // to new space. We should clear them to avoid encountering them during next
2738 // pointer iteration. This is an issue if the store buffer overflows and we 2738 // pointer iteration. This is an issue if the store buffer overflows and we
2739 // have to scan the entire old space, including dead objects, looking for 2739 // have to scan the entire old space, including dead objects, looking for
2740 // pointers to new space. 2740 // pointers to new space.
2741 void MarkCompactCollector::MigrateObject(Address dst, 2741 void MarkCompactCollector::MigrateObject(Address dst,
2742 Address src, 2742 Address src,
2743 int size, 2743 int size,
2744 AllocationSpace dest) { 2744 AllocationSpace dest) {
2745 HEAP_PROFILE(heap(), ObjectMoveEvent(src, dst)); 2745 HEAP_PROFILE(heap(), ObjectMoveEvent(src, dst));
2746 // TODO(hpayer): Replace that check with an assert. 2746 // TODO(hpayer): Replace these checks with asserts.
2747 CHECK(heap()->AllowedToBeMigrated(HeapObject::FromAddress(src), dest));
2747 CHECK(dest != LO_SPACE && size <= Page::kMaxNonCodeHeapObjectSize); 2748 CHECK(dest != LO_SPACE && size <= Page::kMaxNonCodeHeapObjectSize);
2748 if (dest == OLD_POINTER_SPACE) { 2749 if (dest == OLD_POINTER_SPACE) {
2749 // TODO(hpayer): Replace this check with an assert.
2750 HeapObject* heap_object = HeapObject::FromAddress(src);
2751 CHECK(heap_->TargetSpace(heap_object) == heap_->old_pointer_space());
2752 Address src_slot = src; 2750 Address src_slot = src;
2753 Address dst_slot = dst; 2751 Address dst_slot = dst;
2754 ASSERT(IsAligned(size, kPointerSize)); 2752 ASSERT(IsAligned(size, kPointerSize));
2755 2753
2756 for (int remaining = size / kPointerSize; remaining > 0; remaining--) { 2754 for (int remaining = size / kPointerSize; remaining > 0; remaining--) {
2757 Object* value = Memory::Object_at(src_slot); 2755 Object* value = Memory::Object_at(src_slot);
2758 2756
2759 Memory::Object_at(dst_slot) = value; 2757 Memory::Object_at(dst_slot) = value;
2760 2758
2761 if (heap_->InNewSpace(value)) { 2759 if (heap_->InNewSpace(value)) {
(...skipping 25 matching lines...) Expand all
2787 PROFILE(isolate(), CodeMoveEvent(src, dst)); 2785 PROFILE(isolate(), CodeMoveEvent(src, dst));
2788 heap()->MoveBlock(dst, src, size); 2786 heap()->MoveBlock(dst, src, size);
2789 SlotsBuffer::AddTo(&slots_buffer_allocator_, 2787 SlotsBuffer::AddTo(&slots_buffer_allocator_,
2790 &migration_slots_buffer_, 2788 &migration_slots_buffer_,
2791 SlotsBuffer::RELOCATED_CODE_OBJECT, 2789 SlotsBuffer::RELOCATED_CODE_OBJECT,
2792 dst, 2790 dst,
2793 SlotsBuffer::IGNORE_OVERFLOW); 2791 SlotsBuffer::IGNORE_OVERFLOW);
2794 Code::cast(HeapObject::FromAddress(dst))->Relocate(dst - src); 2792 Code::cast(HeapObject::FromAddress(dst))->Relocate(dst - src);
2795 } else { 2793 } else {
2796 ASSERT(dest == OLD_DATA_SPACE || dest == NEW_SPACE); 2794 ASSERT(dest == OLD_DATA_SPACE || dest == NEW_SPACE);
2797 // Objects in old data space can just be moved by compaction to a different
2798 // page in old data space.
2799 // TODO(hpayer): Replace the following check with an assert.
2800 CHECK(!heap_->old_data_space()->Contains(src) ||
2801 (heap_->old_data_space()->Contains(dst) &&
2802 heap_->TargetSpace(HeapObject::FromAddress(src)) ==
2803 heap_->old_data_space()));
2804 heap()->MoveBlock(dst, src, size); 2795 heap()->MoveBlock(dst, src, size);
2805 } 2796 }
2806 Memory::Address_at(src) = dst; 2797 Memory::Address_at(src) = dst;
2807 } 2798 }
2808 2799
2809 2800
2810 // Visitor for updating pointers from live objects in old spaces to new space. 2801 // Visitor for updating pointers from live objects in old spaces to new space.
2811 // It does not expect to encounter pointers to dead objects. 2802 // It does not expect to encounter pointers to dead objects.
2812 class PointersUpdatingVisitor: public ObjectVisitor { 2803 class PointersUpdatingVisitor: public ObjectVisitor {
2813 public: 2804 public:
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after
4342 while (buffer != NULL) { 4333 while (buffer != NULL) {
4343 SlotsBuffer* next_buffer = buffer->next(); 4334 SlotsBuffer* next_buffer = buffer->next();
4344 DeallocateBuffer(buffer); 4335 DeallocateBuffer(buffer);
4345 buffer = next_buffer; 4336 buffer = next_buffer;
4346 } 4337 }
4347 *buffer_address = NULL; 4338 *buffer_address = NULL;
4348 } 4339 }
4349 4340
4350 4341
4351 } } // namespace v8::internal 4342 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698