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 3034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3045 // Allocate emergency memory for the case when compaction fails due to out | 3045 // Allocate emergency memory for the case when compaction fails due to out |
3046 // of memory. | 3046 // of memory. |
3047 if (!space->HasEmergencyMemory()) { | 3047 if (!space->HasEmergencyMemory()) { |
3048 space->CreateEmergencyMemory(); | 3048 space->CreateEmergencyMemory(); |
3049 } | 3049 } |
3050 if (p->IsEvacuationCandidate()) { | 3050 if (p->IsEvacuationCandidate()) { |
3051 // During compaction we might have to request a new page. Check that we | 3051 // During compaction we might have to request a new page. Check that we |
3052 // have an emergency page and the space still has room for that. | 3052 // have an emergency page and the space still has room for that. |
3053 if (space->HasEmergencyMemory() && space->CanExpand()) { | 3053 if (space->HasEmergencyMemory() && space->CanExpand()) { |
3054 EvacuateLiveObjectsFromPage(p); | 3054 EvacuateLiveObjectsFromPage(p); |
| 3055 // Unlink the page from the list of pages here. We must not iterate |
| 3056 // over that page later (e.g. when scan on scavenge pages are |
| 3057 // processed). The page itself will be freed later and is still |
| 3058 // reachable from the evacuation candidates list. |
| 3059 p->Unlink(); |
3055 } else { | 3060 } else { |
3056 // Without room for expansion evacuation is not guaranteed to succeed. | 3061 // Without room for expansion evacuation is not guaranteed to succeed. |
3057 // Pessimistically abandon unevacuated pages. | 3062 // Pessimistically abandon unevacuated pages. |
3058 for (int j = i; j < npages; j++) { | 3063 for (int j = i; j < npages; j++) { |
3059 Page* page = evacuation_candidates_[j]; | 3064 Page* page = evacuation_candidates_[j]; |
3060 slots_buffer_allocator_.DeallocateChain(page->slots_buffer_address()); | 3065 slots_buffer_allocator_.DeallocateChain(page->slots_buffer_address()); |
3061 page->ClearEvacuationCandidate(); | 3066 page->ClearEvacuationCandidate(); |
3062 page->SetFlag(Page::RESCAN_ON_EVACUATION); | 3067 page->SetFlag(Page::RESCAN_ON_EVACUATION); |
3063 } | 3068 } |
3064 break; | 3069 break; |
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4403 SlotsBuffer* buffer = *buffer_address; | 4408 SlotsBuffer* buffer = *buffer_address; |
4404 while (buffer != NULL) { | 4409 while (buffer != NULL) { |
4405 SlotsBuffer* next_buffer = buffer->next(); | 4410 SlotsBuffer* next_buffer = buffer->next(); |
4406 DeallocateBuffer(buffer); | 4411 DeallocateBuffer(buffer); |
4407 buffer = next_buffer; | 4412 buffer = next_buffer; |
4408 } | 4413 } |
4409 *buffer_address = NULL; | 4414 *buffer_address = NULL; |
4410 } | 4415 } |
4411 } | 4416 } |
4412 } // namespace v8::internal | 4417 } // namespace v8::internal |
OLD | NEW |