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

Side by Side Diff: src/heap.cc

Issue 9597026: Merge r10927 from the bleeding_edge to the 3.7 branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/3.7/
Patch Set: Created 8 years, 9 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 | src/spaces.h » ('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 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 6485 matching lines...) Expand 10 before | Expand all | Expand 10 after
6496 if (chunk->owner()->identity() == LO_SPACE) { 6496 if (chunk->owner()->identity() == LO_SPACE) {
6497 // StoreBuffer::Filter relies on MemoryChunk::FromAnyPointerAddress. 6497 // StoreBuffer::Filter relies on MemoryChunk::FromAnyPointerAddress.
6498 // If FromAnyPointerAddress encounters a slot that belongs to a large 6498 // If FromAnyPointerAddress encounters a slot that belongs to a large
6499 // chunk queued for deletion it will fail to find the chunk because 6499 // chunk queued for deletion it will fail to find the chunk because
6500 // it try to perform a search in the list of pages owned by of the large 6500 // it try to perform a search in the list of pages owned by of the large
6501 // object space and queued chunks were detached from that list. 6501 // object space and queued chunks were detached from that list.
6502 // To work around this we split large chunk into normal kPageSize aligned 6502 // To work around this we split large chunk into normal kPageSize aligned
6503 // pieces and initialize size, owner and flags field of every piece. 6503 // pieces and initialize size, owner and flags field of every piece.
6504 // If FromAnyPointerAddress encounters a slot that belongs to one of 6504 // If FromAnyPointerAddress encounters a slot that belongs to one of
6505 // these smaller pieces it will treat it as a slot on a normal Page. 6505 // these smaller pieces it will treat it as a slot on a normal Page.
6506 Address chunk_end = chunk->address() + chunk->size();
6506 MemoryChunk* inner = MemoryChunk::FromAddress( 6507 MemoryChunk* inner = MemoryChunk::FromAddress(
6507 chunk->address() + Page::kPageSize); 6508 chunk->address() + Page::kPageSize);
6508 MemoryChunk* inner_last = MemoryChunk::FromAddress( 6509 MemoryChunk* inner_last = MemoryChunk::FromAddress(chunk_end - 1);
6509 chunk->address() + chunk->size() - 1);
6510 while (inner <= inner_last) { 6510 while (inner <= inner_last) {
6511 // Size of a large chunk is always a multiple of 6511 // Size of a large chunk is always a multiple of
6512 // OS::AllocateAlignment() so there is always 6512 // OS::AllocateAlignment() so there is always
6513 // enough space for a fake MemoryChunk header. 6513 // enough space for a fake MemoryChunk header.
6514 Address area_end = Min(inner->address() + Page::kPageSize, chunk_end);
6515 // Guard against overflow.
6516 if (area_end < inner->address()) area_end = chunk_end;
6517 inner->SetArea(inner->address(), area_end);
6514 inner->set_size(Page::kPageSize); 6518 inner->set_size(Page::kPageSize);
6515 inner->set_owner(lo_space()); 6519 inner->set_owner(lo_space());
6516 inner->SetFlag(MemoryChunk::ABOUT_TO_BE_FREED); 6520 inner->SetFlag(MemoryChunk::ABOUT_TO_BE_FREED);
6517 inner = MemoryChunk::FromAddress( 6521 inner = MemoryChunk::FromAddress(
6518 inner->address() + Page::kPageSize); 6522 inner->address() + Page::kPageSize);
6519 } 6523 }
6520 } 6524 }
6521 } 6525 }
6522 isolate_->heap()->store_buffer()->Compact(); 6526 isolate_->heap()->store_buffer()->Compact();
6523 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); 6527 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED);
6524 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { 6528 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) {
6525 next = chunk->next_chunk(); 6529 next = chunk->next_chunk();
6526 isolate_->memory_allocator()->Free(chunk); 6530 isolate_->memory_allocator()->Free(chunk);
6527 } 6531 }
6528 chunks_queued_for_free_ = NULL; 6532 chunks_queued_for_free_ = NULL;
6529 } 6533 }
6530 6534
6531 } } // namespace v8::internal 6535 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698