OLD | NEW |
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 6374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6385 next = chunk->next_chunk(); | 6385 next = chunk->next_chunk(); |
6386 chunk->SetFlag(MemoryChunk::ABOUT_TO_BE_FREED); | 6386 chunk->SetFlag(MemoryChunk::ABOUT_TO_BE_FREED); |
6387 | 6387 |
6388 if (chunk->owner()->identity() == LO_SPACE) { | 6388 if (chunk->owner()->identity() == LO_SPACE) { |
6389 // StoreBuffer::Filter relies on MemoryChunk::FromAnyPointerAddress. | 6389 // StoreBuffer::Filter relies on MemoryChunk::FromAnyPointerAddress. |
6390 // If FromAnyPointerAddress encounters a slot that belongs to a large | 6390 // If FromAnyPointerAddress encounters a slot that belongs to a large |
6391 // chunk queued for deletion it will fail to find the chunk because | 6391 // chunk queued for deletion it will fail to find the chunk because |
6392 // it try to perform a search in the list of pages owned by of the large | 6392 // it try to perform a search in the list of pages owned by of the large |
6393 // object space and queued chunks were detached from that list. | 6393 // object space and queued chunks were detached from that list. |
6394 // To work around this we split large chunk into normal kPageSize aligned | 6394 // To work around this we split large chunk into normal kPageSize aligned |
6395 // pieces and initialize owner field and flags of every piece. | 6395 // pieces and initialize size, owner and flags field of every piece. |
6396 // If FromAnyPointerAddress encounteres a slot that belongs to one of | 6396 // If FromAnyPointerAddress encounters a slot that belongs to one of |
6397 // these smaller pieces it will treat it as a slot on a normal Page. | 6397 // these smaller pieces it will treat it as a slot on a normal Page. |
6398 MemoryChunk* inner = MemoryChunk::FromAddress( | 6398 MemoryChunk* inner = MemoryChunk::FromAddress( |
6399 chunk->address() + Page::kPageSize); | 6399 chunk->address() + Page::kPageSize); |
6400 MemoryChunk* inner_last = MemoryChunk::FromAddress( | 6400 MemoryChunk* inner_last = MemoryChunk::FromAddress( |
6401 chunk->address() + chunk->size() - 1); | 6401 chunk->address() + chunk->size() - 1); |
6402 while (inner <= inner_last) { | 6402 while (inner <= inner_last) { |
6403 // Size of a large chunk is always a multiple of | 6403 // Size of a large chunk is always a multiple of |
6404 // OS::AllocationAlignment() so there is always | 6404 // MemoryChunk::kAlignment so there is always |
6405 // enough space for a fake MemoryChunk header. | 6405 // enough space for a fake MemoryChunk header. |
| 6406 inner->set_size(Page::kPageSize); |
6406 inner->set_owner(lo_space()); | 6407 inner->set_owner(lo_space()); |
6407 inner->SetFlag(MemoryChunk::ABOUT_TO_BE_FREED); | 6408 inner->SetFlag(MemoryChunk::ABOUT_TO_BE_FREED); |
6408 inner = MemoryChunk::FromAddress( | 6409 inner = MemoryChunk::FromAddress( |
6409 inner->address() + Page::kPageSize); | 6410 inner->address() + Page::kPageSize); |
6410 } | 6411 } |
6411 } | 6412 } |
6412 } | 6413 } |
6413 isolate_->heap()->store_buffer()->Compact(); | 6414 isolate_->heap()->store_buffer()->Compact(); |
6414 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6415 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
6415 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6416 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
6416 next = chunk->next_chunk(); | 6417 next = chunk->next_chunk(); |
6417 isolate_->memory_allocator()->Free(chunk); | 6418 isolate_->memory_allocator()->Free(chunk); |
6418 } | 6419 } |
6419 chunks_queued_for_free_ = NULL; | 6420 chunks_queued_for_free_ = NULL; |
6420 } | 6421 } |
6421 | 6422 |
6422 } } // namespace v8::internal | 6423 } } // namespace v8::internal |
OLD | NEW |