Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(959)

Side by Side Diff: src/heap/mark-compact.cc

Issue 1225573002: Record code slots that may point to evacuation candidate objects after deoptimizing them. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/mark-compact.h ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3218 matching lines...) Expand 10 before | Expand all | Expand 10 after
3229 // The target object has to be black. 3229 // The target object has to be black.
3230 CHECK(Marking::IsBlack(Marking::MarkBitFrom(object))); 3230 CHECK(Marking::IsBlack(Marking::MarkBitFrom(object)));
3231 3231
3232 // The target object is black but we don't know if the source slot is black. 3232 // The target object is black but we don't know if the source slot is black.
3233 // The source object could have died and the slot could be part of a free 3233 // The source object could have died and the slot could be part of a free
3234 // space. Use the mark bit iterator to find out about liveness of the slot. 3234 // space. Use the mark bit iterator to find out about liveness of the slot.
3235 CHECK(IsSlotInBlackObjectSlow(Page::FromAddress(slot), slot)); 3235 CHECK(IsSlotInBlackObjectSlow(Page::FromAddress(slot), slot));
3236 } 3236 }
3237 3237
3238 3238
3239 void MarkCompactCollector::RemoveObjectSlots(HeapObject* invalid_object) { 3239 void MarkCompactCollector::RemoveObjectSlots(Address start_slot,
3240 Address end_slot) {
3240 // Remove entries by replacing them with an old-space slot containing a smi 3241 // Remove entries by replacing them with an old-space slot containing a smi
3241 // that is located in an unmovable page. 3242 // that is located in an unmovable page.
3242 int npages = evacuation_candidates_.length(); 3243 int npages = evacuation_candidates_.length();
3243 for (int i = 0; i < npages; i++) { 3244 for (int i = 0; i < npages; i++) {
3244 Page* p = evacuation_candidates_[i]; 3245 Page* p = evacuation_candidates_[i];
3245 DCHECK(p->IsEvacuationCandidate() || 3246 DCHECK(p->IsEvacuationCandidate() ||
3246 p->IsFlagSet(Page::RESCAN_ON_EVACUATION)); 3247 p->IsFlagSet(Page::RESCAN_ON_EVACUATION));
3247 if (p->IsEvacuationCandidate()) { 3248 if (p->IsEvacuationCandidate()) {
3248 SlotsBuffer::RemoveObjectSlots(heap_, p->slots_buffer(), invalid_object); 3249 SlotsBuffer::RemoveObjectSlots(heap_, p->slots_buffer(), start_slot,
3250 end_slot);
3249 } 3251 }
3250 } 3252 }
3251 } 3253 }
3252 3254
3253 3255
3254 void MarkCompactCollector::EvacuateNewSpace() { 3256 void MarkCompactCollector::EvacuateNewSpace() {
3255 // There are soft limits in the allocation code, designed trigger a mark 3257 // There are soft limits in the allocation code, designed trigger a mark
3256 // sweep collection by failing allocations. But since we are already in 3258 // sweep collection by failing allocations. But since we are already in
3257 // a mark-sweep allocation, there is no sense in trying to trigger one. 3259 // a mark-sweep allocation, there is no sense in trying to trigger one.
3258 AlwaysAllocateScope scope(isolate()); 3260 AlwaysAllocateScope scope(isolate());
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after
4495 ++slot_idx; 4497 ++slot_idx;
4496 DCHECK(slot_idx < slots_count); 4498 DCHECK(slot_idx < slots_count);
4497 } 4499 }
4498 } 4500 }
4499 buffer = buffer->next(); 4501 buffer = buffer->next();
4500 } 4502 }
4501 } 4503 }
4502 4504
4503 4505
4504 void SlotsBuffer::RemoveObjectSlots(Heap* heap, SlotsBuffer* buffer, 4506 void SlotsBuffer::RemoveObjectSlots(Heap* heap, SlotsBuffer* buffer,
4505 HeapObject* invalid_object) { 4507 Address start_slot, Address end_slot) {
4506 // Remove entries by replacing them with an old-space slot containing a smi 4508 // Remove entries by replacing them with an old-space slot containing a smi
4507 // that is located in an unmovable page. 4509 // that is located in an unmovable page.
4508 const ObjectSlot kRemovedEntry = HeapObject::RawField( 4510 const ObjectSlot kRemovedEntry = HeapObject::RawField(
4509 heap->empty_fixed_array(), FixedArrayBase::kLengthOffset); 4511 heap->empty_fixed_array(), FixedArrayBase::kLengthOffset);
4510 DCHECK(Page::FromAddress(reinterpret_cast<Address>(kRemovedEntry)) 4512 DCHECK(Page::FromAddress(reinterpret_cast<Address>(kRemovedEntry))
4511 ->NeverEvacuate()); 4513 ->NeverEvacuate());
4512 4514
4513 while (buffer != NULL) { 4515 while (buffer != NULL) {
4514 SlotsBuffer::ObjectSlot* slots = buffer->slots_; 4516 SlotsBuffer::ObjectSlot* slots = buffer->slots_;
4515 intptr_t slots_count = buffer->idx_; 4517 intptr_t slots_count = buffer->idx_;
4516 bool is_typed_slot = false; 4518 bool is_typed_slot = false;
4517 4519
4518 for (int slot_idx = 0; slot_idx < slots_count; ++slot_idx) { 4520 for (int slot_idx = 0; slot_idx < slots_count; ++slot_idx) {
4519 ObjectSlot slot = slots[slot_idx]; 4521 ObjectSlot slot = slots[slot_idx];
4520 if (!IsTypedSlot(slot)) { 4522 if (!IsTypedSlot(slot)) {
4521 Address slot_address = reinterpret_cast<Address>(slot); 4523 Address slot_address = reinterpret_cast<Address>(slot);
4522 if (slot_address >= invalid_object->address() && 4524 if (slot_address >= start_slot && slot_address < end_slot) {
4523 slot_address <
4524 (invalid_object->address() + invalid_object->Size())) {
4525 slots[slot_idx] = kRemovedEntry; 4525 slots[slot_idx] = kRemovedEntry;
4526 if (is_typed_slot) { 4526 if (is_typed_slot) {
4527 slots[slot_idx - 1] = kRemovedEntry; 4527 slots[slot_idx - 1] = kRemovedEntry;
4528 } 4528 }
4529 } 4529 }
4530 is_typed_slot = false; 4530 is_typed_slot = false;
4531 } else { 4531 } else {
4532 is_typed_slot = true; 4532 is_typed_slot = true;
4533 DCHECK(slot_idx < slots_count); 4533 DCHECK(slot_idx < slots_count);
4534 } 4534 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
4695 SlotsBuffer* buffer = *buffer_address; 4695 SlotsBuffer* buffer = *buffer_address;
4696 while (buffer != NULL) { 4696 while (buffer != NULL) {
4697 SlotsBuffer* next_buffer = buffer->next(); 4697 SlotsBuffer* next_buffer = buffer->next();
4698 DeallocateBuffer(buffer); 4698 DeallocateBuffer(buffer);
4699 buffer = next_buffer; 4699 buffer = next_buffer;
4700 } 4700 }
4701 *buffer_address = NULL; 4701 *buffer_address = NULL;
4702 } 4702 }
4703 } // namespace internal 4703 } // namespace internal
4704 } // namespace v8 4704 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/mark-compact.h ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698