| 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 6425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6436 // To work around this we split large chunk into normal kPageSize aligned | 6436 // To work around this we split large chunk into normal kPageSize aligned |
| 6437 // pieces and initialize size, owner and flags field of every piece. | 6437 // pieces and initialize size, owner and flags field of every piece. |
| 6438 // If FromAnyPointerAddress encounters a slot that belongs to one of | 6438 // If FromAnyPointerAddress encounters a slot that belongs to one of |
| 6439 // these smaller pieces it will treat it as a slot on a normal Page. | 6439 // these smaller pieces it will treat it as a slot on a normal Page. |
| 6440 MemoryChunk* inner = MemoryChunk::FromAddress( | 6440 MemoryChunk* inner = MemoryChunk::FromAddress( |
| 6441 chunk->address() + Page::kPageSize); | 6441 chunk->address() + Page::kPageSize); |
| 6442 MemoryChunk* inner_last = MemoryChunk::FromAddress( | 6442 MemoryChunk* inner_last = MemoryChunk::FromAddress( |
| 6443 chunk->address() + chunk->size() - 1); | 6443 chunk->address() + chunk->size() - 1); |
| 6444 while (inner <= inner_last) { | 6444 while (inner <= inner_last) { |
| 6445 // Size of a large chunk is always a multiple of | 6445 // Size of a large chunk is always a multiple of |
| 6446 // MemoryChunk::kAlignment so there is always | 6446 // OS::AllocateAlignment() so there is always |
| 6447 // enough space for a fake MemoryChunk header. | 6447 // enough space for a fake MemoryChunk header. |
| 6448 inner->set_size(Page::kPageSize); | 6448 inner->set_size(Page::kPageSize); |
| 6449 inner->set_owner(lo_space()); | 6449 inner->set_owner(lo_space()); |
| 6450 inner->SetFlag(MemoryChunk::ABOUT_TO_BE_FREED); | 6450 inner->SetFlag(MemoryChunk::ABOUT_TO_BE_FREED); |
| 6451 inner = MemoryChunk::FromAddress( | 6451 inner = MemoryChunk::FromAddress( |
| 6452 inner->address() + Page::kPageSize); | 6452 inner->address() + Page::kPageSize); |
| 6453 } | 6453 } |
| 6454 } | 6454 } |
| 6455 } | 6455 } |
| 6456 isolate_->heap()->store_buffer()->Compact(); | 6456 isolate_->heap()->store_buffer()->Compact(); |
| 6457 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6457 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
| 6458 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6458 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
| 6459 next = chunk->next_chunk(); | 6459 next = chunk->next_chunk(); |
| 6460 isolate_->memory_allocator()->Free(chunk); | 6460 isolate_->memory_allocator()->Free(chunk); |
| 6461 } | 6461 } |
| 6462 chunks_queued_for_free_ = NULL; | 6462 chunks_queued_for_free_ = NULL; |
| 6463 } | 6463 } |
| 6464 | 6464 |
| 6465 } } // namespace v8::internal | 6465 } } // namespace v8::internal |
| OLD | NEW |