OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
(...skipping 3042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3053 // Allocate emergency memory for the case when compaction fails due to out | 3053 // Allocate emergency memory for the case when compaction fails due to out |
3054 // of memory. | 3054 // of memory. |
3055 if (!space->HasEmergencyMemory()) { | 3055 if (!space->HasEmergencyMemory()) { |
3056 space->CreateEmergencyMemory(); | 3056 space->CreateEmergencyMemory(); |
3057 } | 3057 } |
3058 if (p->IsEvacuationCandidate()) { | 3058 if (p->IsEvacuationCandidate()) { |
3059 // During compaction we might have to request a new page. Check that we | 3059 // During compaction we might have to request a new page. Check that we |
3060 // have an emergency page and the space still has room for that. | 3060 // have an emergency page and the space still has room for that. |
3061 if (space->HasEmergencyMemory() && space->CanExpand()) { | 3061 if (space->HasEmergencyMemory() && space->CanExpand()) { |
3062 EvacuateLiveObjectsFromPage(p); | 3062 EvacuateLiveObjectsFromPage(p); |
| 3063 // Unlink the page from the list of pages here. We must not iterate |
| 3064 // over that page later (e.g. when scan on scavenge pages are |
| 3065 // processed). The page itself will be freed later and is still |
| 3066 // reachable from the evacuation candidates list. |
| 3067 p->Unlink(); |
3063 } else { | 3068 } else { |
3064 // Without room for expansion evacuation is not guaranteed to succeed. | 3069 // Without room for expansion evacuation is not guaranteed to succeed. |
3065 // Pessimistically abandon unevacuated pages. | 3070 // Pessimistically abandon unevacuated pages. |
3066 for (int j = i; j < npages; j++) { | 3071 for (int j = i; j < npages; j++) { |
3067 Page* page = evacuation_candidates_[j]; | 3072 Page* page = evacuation_candidates_[j]; |
3068 slots_buffer_allocator_.DeallocateChain(page->slots_buffer_address()); | 3073 slots_buffer_allocator_.DeallocateChain(page->slots_buffer_address()); |
3069 page->ClearEvacuationCandidate(); | 3074 page->ClearEvacuationCandidate(); |
3070 page->SetFlag(Page::RESCAN_ON_EVACUATION); | 3075 page->SetFlag(Page::RESCAN_ON_EVACUATION); |
3071 } | 3076 } |
3072 break; | 3077 break; |
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4413 SlotsBuffer* buffer = *buffer_address; | 4418 SlotsBuffer* buffer = *buffer_address; |
4414 while (buffer != NULL) { | 4419 while (buffer != NULL) { |
4415 SlotsBuffer* next_buffer = buffer->next(); | 4420 SlotsBuffer* next_buffer = buffer->next(); |
4416 DeallocateBuffer(buffer); | 4421 DeallocateBuffer(buffer); |
4417 buffer = next_buffer; | 4422 buffer = next_buffer; |
4418 } | 4423 } |
4419 *buffer_address = NULL; | 4424 *buffer_address = NULL; |
4420 } | 4425 } |
4421 } | 4426 } |
4422 } // namespace v8::internal | 4427 } // namespace v8::internal |
OLD | NEW |