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

Side by Side Diff: src/heap.cc

Issue 7356005: Chang Heap::FreeQueuedChunks to prepare queued large chunks for StoreBuffer::Filter. (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
« no previous file with comments | « no previous file | 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 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 5957 matching lines...) Expand 10 before | Expand all | Expand 10 after
5968 } 5968 }
5969 5969
5970 5970
5971 void Heap::FreeQueuedChunks() { 5971 void Heap::FreeQueuedChunks() {
5972 if (chunks_queued_for_free_ == NULL) return; 5972 if (chunks_queued_for_free_ == NULL) return;
5973 MemoryChunk* next; 5973 MemoryChunk* next;
5974 MemoryChunk* chunk; 5974 MemoryChunk* chunk;
5975 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { 5975 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) {
5976 next = chunk->next_chunk(); 5976 next = chunk->next_chunk();
5977 chunk->SetFlag(MemoryChunk::ABOUT_TO_BE_FREED); 5977 chunk->SetFlag(MemoryChunk::ABOUT_TO_BE_FREED);
5978
5979 if (chunk->owner()->identity() == LO_SPACE) {
5980 // StoreBuffer::Filter relies on MemoryChunk::FromAnyPointerAddress.
5981 // If FromAnyPointerAddress encounters a slot that belongs to a large
5982 // chunk queued for deletion it will fail to find the chunk because
5983 // it try to perform a search in the list of pages owned by of the large
5984 // object space and queued chunks were detached from that list.
5985 // To work around this we split large chunk into normal kPageSize aligned
5986 // pieces and initialize owner field and flags of every piece.
5987 // If FromAnyPointerAddress encounteres a slot that belongs to one of
5988 // these smaller pieces it will treat it as a slot on a normal Page.
5989 MemoryChunk* inner = MemoryChunk::FromAddress(
5990 chunk->address() + Page::kPageSize);
5991 MemoryChunk* inner_last = MemoryChunk::FromAddress(
5992 chunk->address() + chunk->size() - 1);
5993 while (inner <= inner_last) {
Lasse Reichstein 2011/07/13 07:07:13 It's not obvious why this can't crash, if the end
5994 inner->set_owner(lo_space());
5995 inner->SetFlag(MemoryChunk::ABOUT_TO_BE_FREED);
5996 inner = MemoryChunk::FromAddress(
5997 inner->address() + Page::kPageSize);
5998 }
5999 }
5978 } 6000 }
5979 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); 6001 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED);
5980 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { 6002 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) {
5981 next = chunk->next_chunk(); 6003 next = chunk->next_chunk();
5982 isolate_->memory_allocator()->Free(chunk); 6004 isolate_->memory_allocator()->Free(chunk);
5983 } 6005 }
5984 chunks_queued_for_free_ = NULL; 6006 chunks_queued_for_free_ = NULL;
5985 } 6007 }
5986 6008
5987 } } // namespace v8::internal 6009 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698