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

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

Issue 1033163002: Revert of Use a slot that is located on a heap page when removing invalid entries from the SlotsBuffer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | no next file » | 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 4540 matching lines...) Expand 10 before | Expand all | Expand 10 after
4551 buffer = allocator->AllocateBuffer(buffer); 4551 buffer = allocator->AllocateBuffer(buffer);
4552 *buffer_address = buffer; 4552 *buffer_address = buffer;
4553 } 4553 }
4554 DCHECK(buffer->HasSpaceForTypedSlot()); 4554 DCHECK(buffer->HasSpaceForTypedSlot());
4555 buffer->Add(reinterpret_cast<ObjectSlot>(type)); 4555 buffer->Add(reinterpret_cast<ObjectSlot>(type));
4556 buffer->Add(reinterpret_cast<ObjectSlot>(addr)); 4556 buffer->Add(reinterpret_cast<ObjectSlot>(addr));
4557 return true; 4557 return true;
4558 } 4558 }
4559 4559
4560 4560
4561 static Object* g_smi_slot = NULL;
4562
4563
4561 void SlotsBuffer::RemoveInvalidSlots(Heap* heap, SlotsBuffer* buffer) { 4564 void SlotsBuffer::RemoveInvalidSlots(Heap* heap, SlotsBuffer* buffer) {
4562 // Remove entries by replacing them with an old-space slot containing a smi 4565 DCHECK_EQ(Smi::FromInt(0), g_smi_slot);
4563 // that is located in an unmovable page. 4566
4564 const ObjectSlot kRemovedEntry = 4567 // Remove entries by replacing them with a dummy slot containing a smi.
4565 HeapObject::RawField(heap->empty_fixed_array(), 4568 const ObjectSlot kRemovedEntry = &g_smi_slot;
4566 FixedArrayBase::kLengthOffset);
4567 DCHECK(Page::FromAddress(
4568 reinterpret_cast<Address>(kRemovedEntry))->NeverEvacuate());
4569 4569
4570 while (buffer != NULL) { 4570 while (buffer != NULL) {
4571 SlotsBuffer::ObjectSlot* slots = buffer->slots_; 4571 SlotsBuffer::ObjectSlot* slots = buffer->slots_;
4572 intptr_t slots_count = buffer->idx_; 4572 intptr_t slots_count = buffer->idx_;
4573 4573
4574 for (int slot_idx = 0; slot_idx < slots_count; ++slot_idx) { 4574 for (int slot_idx = 0; slot_idx < slots_count; ++slot_idx) {
4575 ObjectSlot slot = slots[slot_idx]; 4575 ObjectSlot slot = slots[slot_idx];
4576 if (!IsTypedSlot(slot)) { 4576 if (!IsTypedSlot(slot)) {
4577 Object* object = *slot; 4577 Object* object = *slot;
4578 if (object->IsHeapObject()) { 4578 if (object->IsHeapObject()) {
4579 if (heap->InNewSpace(object) || 4579 if (heap->InNewSpace(object) ||
4580 !heap->mark_compact_collector()->IsSlotInLiveObject( 4580 !heap->mark_compact_collector()->IsSlotInLiveObject(
4581 reinterpret_cast<Address>(slot))) { 4581 reinterpret_cast<Address>(slot))) {
4582 slots[slot_idx] = kRemovedEntry; 4582 slots[slot_idx] = kRemovedEntry;
4583 } 4583 }
4584 } 4584 }
4585 } else { 4585 } else {
4586 ++slot_idx; 4586 ++slot_idx;
4587 DCHECK(slot_idx < slots_count); 4587 DCHECK(slot_idx < slots_count);
4588 } 4588 }
4589 } 4589 }
4590 buffer = buffer->next(); 4590 buffer = buffer->next();
4591 } 4591 }
4592 } 4592 }
4593 4593
4594 4594
4595 void SlotsBuffer::VerifySlots(Heap* heap, SlotsBuffer* buffer) { 4595 void SlotsBuffer::VerifySlots(Heap* heap, SlotsBuffer* buffer) {
4596 DCHECK_EQ(Smi::FromInt(0), g_smi_slot);
4597
4596 while (buffer != NULL) { 4598 while (buffer != NULL) {
4597 SlotsBuffer::ObjectSlot* slots = buffer->slots_; 4599 SlotsBuffer::ObjectSlot* slots = buffer->slots_;
4598 intptr_t slots_count = buffer->idx_; 4600 intptr_t slots_count = buffer->idx_;
4599 4601
4600 for (int slot_idx = 0; slot_idx < slots_count; ++slot_idx) { 4602 for (int slot_idx = 0; slot_idx < slots_count; ++slot_idx) {
4601 ObjectSlot slot = slots[slot_idx]; 4603 ObjectSlot slot = slots[slot_idx];
4602 if (!IsTypedSlot(slot)) { 4604 if (!IsTypedSlot(slot)) {
4603 Object* object = *slot; 4605 Object* object = *slot;
4604 if (object->IsHeapObject()) { 4606 if (object->IsHeapObject()) {
4605 CHECK(!heap->InNewSpace(object)); 4607 CHECK(!heap->InNewSpace(object));
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
4750 SlotsBuffer* buffer = *buffer_address; 4752 SlotsBuffer* buffer = *buffer_address;
4751 while (buffer != NULL) { 4753 while (buffer != NULL) {
4752 SlotsBuffer* next_buffer = buffer->next(); 4754 SlotsBuffer* next_buffer = buffer->next();
4753 DeallocateBuffer(buffer); 4755 DeallocateBuffer(buffer);
4754 buffer = next_buffer; 4756 buffer = next_buffer;
4755 } 4757 }
4756 *buffer_address = NULL; 4758 *buffer_address = NULL;
4757 } 4759 }
4758 } 4760 }
4759 } // namespace v8::internal 4761 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698