Chromium Code Reviews| 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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 540 other->next_chunk_->prev_chunk_ = this; | 540 other->next_chunk_->prev_chunk_ = this; |
| 541 other->next_chunk_ = this; | 541 other->next_chunk_ = this; |
| 542 } | 542 } |
| 543 | 543 |
| 544 | 544 |
| 545 void MemoryChunk::Unlink() { | 545 void MemoryChunk::Unlink() { |
| 546 if (!InNewSpace() && IsFlagSet(SCAN_ON_SCAVENGE)) { | 546 if (!InNewSpace() && IsFlagSet(SCAN_ON_SCAVENGE)) { |
| 547 heap_->decrement_scan_on_scavenge_pages(); | 547 heap_->decrement_scan_on_scavenge_pages(); |
| 548 ClearFlag(SCAN_ON_SCAVENGE); | 548 ClearFlag(SCAN_ON_SCAVENGE); |
| 549 } | 549 } |
| 550 next_chunk_->prev_chunk_ = prev_chunk_; | 550 if (next_chunk_ != NULL) { |
|
Michael Starzinger
2013/03/08 12:52:06
This would indicate that you try to unlink a Page
Hannes Payer (out of office)
2013/03/08 14:02:30
Done.
| |
| 551 prev_chunk_->next_chunk_ = next_chunk_; | 551 next_chunk_->prev_chunk_ = prev_chunk_; |
| 552 } | |
| 553 if (prev_chunk_ != NULL) { | |
| 554 prev_chunk_->next_chunk_ = next_chunk_; | |
| 555 } | |
| 552 prev_chunk_ = NULL; | 556 prev_chunk_ = NULL; |
| 553 next_chunk_ = NULL; | 557 next_chunk_ = NULL; |
| 554 } | 558 } |
| 555 | 559 |
| 556 | 560 |
| 557 MemoryChunk* MemoryAllocator::AllocateChunk(intptr_t reserve_area_size, | 561 MemoryChunk* MemoryAllocator::AllocateChunk(intptr_t reserve_area_size, |
| 558 intptr_t commit_area_size, | 562 intptr_t commit_area_size, |
| 559 Executability executable, | 563 Executability executable, |
| 560 Space* owner) { | 564 Space* owner) { |
| 561 ASSERT(commit_area_size <= reserve_area_size); | 565 ASSERT(commit_area_size <= reserve_area_size); |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 974 if (Capacity() == max_capacity_) return false; | 978 if (Capacity() == max_capacity_) return false; |
| 975 | 979 |
| 976 ASSERT(Capacity() < max_capacity_); | 980 ASSERT(Capacity() < max_capacity_); |
| 977 | 981 |
| 978 // Are we going to exceed capacity for this space? | 982 // Are we going to exceed capacity for this space? |
| 979 if ((Capacity() + Page::kPageSize) > max_capacity_) return false; | 983 if ((Capacity() + Page::kPageSize) > max_capacity_) return false; |
| 980 | 984 |
| 981 return true; | 985 return true; |
| 982 } | 986 } |
| 983 | 987 |
| 988 | |
| 984 bool PagedSpace::Expand() { | 989 bool PagedSpace::Expand() { |
| 985 if (!CanExpand()) return false; | 990 if (!CanExpand()) return false; |
| 986 | 991 |
| 987 intptr_t size = AreaSize(); | 992 intptr_t size = AreaSize(); |
| 988 | 993 |
| 989 if (anchor_.next_page() == &anchor_) { | 994 if (anchor_.next_page() == &anchor_) { |
| 990 size = SizeOfFirstPage(); | 995 size = SizeOfFirstPage(); |
| 991 } | 996 } |
| 992 | 997 |
| 993 Page* p = heap()->isolate()->memory_allocator()->AllocatePage( | 998 Page* p = heap()->isolate()->memory_allocator()->AllocatePage( |
| (...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2548 } | 2553 } |
| 2549 | 2554 |
| 2550 | 2555 |
| 2551 bool PagedSpace::EnsureSweeperProgress(intptr_t size_in_bytes) { | 2556 bool PagedSpace::EnsureSweeperProgress(intptr_t size_in_bytes) { |
| 2552 MarkCompactCollector* collector = heap()->mark_compact_collector(); | 2557 MarkCompactCollector* collector = heap()->mark_compact_collector(); |
| 2553 if (collector->AreSweeperThreadsActivated()) { | 2558 if (collector->AreSweeperThreadsActivated()) { |
| 2554 if (collector->IsConcurrentSweepingInProgress()) { | 2559 if (collector->IsConcurrentSweepingInProgress()) { |
| 2555 if (collector->StealMemoryFromSweeperThreads(this) < size_in_bytes) { | 2560 if (collector->StealMemoryFromSweeperThreads(this) < size_in_bytes) { |
| 2556 if (!collector->sequential_sweeping()) { | 2561 if (!collector->sequential_sweeping()) { |
| 2557 collector->WaitUntilSweepingCompleted(); | 2562 collector->WaitUntilSweepingCompleted(); |
| 2558 collector->FinalizeSweeping(); | |
| 2559 return true; | 2563 return true; |
| 2560 } | 2564 } |
| 2561 } | 2565 } |
| 2562 return false; | 2566 return false; |
| 2563 } | 2567 } |
| 2564 return true; | 2568 return true; |
| 2565 } else { | 2569 } else { |
| 2566 return AdvanceSweeper(size_in_bytes); | 2570 return AdvanceSweeper(size_in_bytes); |
| 2567 } | 2571 } |
| 2568 } | 2572 } |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3130 object->ShortPrint(); | 3134 object->ShortPrint(); |
| 3131 PrintF("\n"); | 3135 PrintF("\n"); |
| 3132 } | 3136 } |
| 3133 printf(" --------------------------------------\n"); | 3137 printf(" --------------------------------------\n"); |
| 3134 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3138 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3135 } | 3139 } |
| 3136 | 3140 |
| 3137 #endif // DEBUG | 3141 #endif // DEBUG |
| 3138 | 3142 |
| 3139 } } // namespace v8::internal | 3143 } } // namespace v8::internal |
| OLD | NEW |