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

Unified Diff: test/cctest/test-heap.cc

Issue 1221643004: Directly remove slot buffer entries in deoptimized code objects. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/mark-compact.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index 668fb01e1723de450e396ac176e23e0202d8c9e2..64235409299198926d3453ee12f77e6216eced26 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -6015,3 +6015,45 @@ TEST(AllocationThroughput) {
throughput = tracer->AllocationThroughputInBytesPerMillisecond(100);
CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput);
}
+
+
+TEST(SlotsBufferObjectSlotsRemoval) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+ Isolate* isolate = CcTest::i_isolate();
+ Heap* heap = isolate->heap();
+ Factory* factory = isolate->factory();
+
+ SlotsBuffer* buffer = new SlotsBuffer(NULL);
+ void* fake_object[1];
+
+ Handle<FixedArray> array = factory->NewFixedArray(2, TENURED);
+ CHECK(heap->old_space()->Contains(*array));
+ array->set(0, reinterpret_cast<Object*>(fake_object), SKIP_WRITE_BARRIER);
+
+ // Firstly, let's test the regular slots buffer entry.
+ buffer->Add(HeapObject::RawField(*array, FixedArray::kHeaderSize));
+ DCHECK(reinterpret_cast<void*>(buffer->Get(0)) ==
+ HeapObject::RawField(*array, FixedArray::kHeaderSize));
+ SlotsBuffer::RemoveObjectSlots(CcTest::i_isolate()->heap(), buffer, *array);
+ DCHECK(reinterpret_cast<void*>(buffer->Get(0)) ==
+ HeapObject::RawField(heap->empty_fixed_array(),
+ FixedArrayBase::kLengthOffset));
+
+ // Secondly, let's test the typed slots buffer entry.
+ SlotsBuffer::AddTo(NULL, &buffer, SlotsBuffer::EMBEDDED_OBJECT_SLOT,
+ array->address() + FixedArray::kHeaderSize,
+ SlotsBuffer::FAIL_ON_OVERFLOW);
+ DCHECK(reinterpret_cast<void*>(buffer->Get(1)) ==
+ reinterpret_cast<Object**>(SlotsBuffer::EMBEDDED_OBJECT_SLOT));
+ DCHECK(reinterpret_cast<void*>(buffer->Get(2)) ==
+ HeapObject::RawField(*array, FixedArray::kHeaderSize));
+ SlotsBuffer::RemoveObjectSlots(CcTest::i_isolate()->heap(), buffer, *array);
+ DCHECK(reinterpret_cast<void*>(buffer->Get(1)) ==
+ HeapObject::RawField(heap->empty_fixed_array(),
+ FixedArrayBase::kLengthOffset));
+ DCHECK(reinterpret_cast<void*>(buffer->Get(2)) ==
+ HeapObject::RawField(heap->empty_fixed_array(),
+ FixedArrayBase::kLengthOffset));
+ delete buffer;
+}
« no previous file with comments | « src/heap/mark-compact.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698