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

Side by Side Diff: src/heap.cc

Issue 7302003: Support slots recording for compaction during incremental marking. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Created 9 years, 5 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 4286 matching lines...) Expand 10 before | Expand all | Expand 10 after
4297 Address end, 4297 Address end,
4298 ObjectSlotCallback callback) { 4298 ObjectSlotCallback callback) {
4299 Address slot_address = start; 4299 Address slot_address = start;
4300 while (slot_address < end) { 4300 while (slot_address < end) {
4301 Object** slot = reinterpret_cast<Object**>(slot_address); 4301 Object** slot = reinterpret_cast<Object**>(slot_address);
4302 Object* object = *slot; 4302 Object* object = *slot;
4303 // If the store buffer becomes overfull we mark pages as being exempt from 4303 // If the store buffer becomes overfull we mark pages as being exempt from
4304 // the store buffer. These pages are scanned to find pointers that point 4304 // the store buffer. These pages are scanned to find pointers that point
4305 // to the new space. In that case we may hit newly promoted objects and 4305 // to the new space. In that case we may hit newly promoted objects and
4306 // fix the pointers before the promotion queue gets to them. Thus the 'if'. 4306 // fix the pointers before the promotion queue gets to them. Thus the 'if'.
4307 if (Heap::InFromSpace(object)) { 4307 if (object->IsHeapObject()) {
4308 callback(reinterpret_cast<HeapObject**>(slot), HeapObject::cast(object)); 4308 if (Heap::InFromSpace(object)) {
4309 if (InNewSpace(*slot)) { 4309 callback(reinterpret_cast<HeapObject**>(slot),
4310 ASSERT(Heap::InToSpace(*slot)); 4310 HeapObject::cast(object));
4311 ASSERT((*slot)->IsHeapObject()); 4311 Object* new_object = *slot;
4312 store_buffer_.EnterDirectlyIntoStoreBuffer( 4312 if (InNewSpace(new_object)) {
4313 reinterpret_cast<Address>(slot)); 4313 ASSERT(Heap::InToSpace(new_object));
4314 ASSERT(new_object->IsHeapObject());
4315 store_buffer_.EnterDirectlyIntoStoreBuffer(
4316 reinterpret_cast<Address>(slot));
4317 }
4318 ASSERT(!MarkCompactCollector::IsOnEvacuationCandidate(new_object));
4319 } else if (MarkCompactCollector::IsOnEvacuationCandidate(object)) {
4320 mark_compact_collector()->RecordSlot(slot, slot, object);
Erik Corry 2011/07/04 11:04:11 Does this happen? The pointer can't suddenly star
Vyacheslav Egorov (Chromium) 2011/08/05 12:50:28 This else if belongs to the first if. So yes this
4314 } 4321 }
4315 } 4322 }
4316 slot_address += kPointerSize; 4323 slot_address += kPointerSize;
4317 } 4324 }
4318 } 4325 }
4319 4326
4320 4327
4321 #ifdef DEBUG 4328 #ifdef DEBUG
4322 typedef bool (*CheckStoreBufferFilter)(Object** addr); 4329 typedef bool (*CheckStoreBufferFilter)(Object** addr);
4323 4330
(...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after
5847 } 5854 }
5848 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); 5855 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED);
5849 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { 5856 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) {
5850 next = chunk->next_chunk(); 5857 next = chunk->next_chunk();
5851 isolate_->memory_allocator()->Free(chunk); 5858 isolate_->memory_allocator()->Free(chunk);
5852 } 5859 }
5853 chunks_queued_for_free_ = NULL; 5860 chunks_queued_for_free_ = NULL;
5854 } 5861 }
5855 5862
5856 } } // namespace v8::internal 5863 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/assembler.cc ('k') | src/ia32/assembler-ia32-inl.h » ('j') | src/ia32/assembler-ia32-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698