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

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

Issue 1314953004: [interpreter] Add constant_pool() to BytecodeArray. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_args
Patch Set: Fix store buffer. Created 5 years, 4 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/objects-inl.h ('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 8e0928b07123bdcda4257b763a25bf5cc90c25d7..330ef542aaef4d76e7edcbc915c110f7b73332e9 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -678,14 +678,21 @@ TEST(BytecodeArray) {
Factory* factory = isolate->factory();
HandleScope scope(isolate);
+ SimulateFullSpace(heap->old_space());
+ Handle<FixedArray> constant_pool = factory->NewFixedArray(5, TENURED);
+ for (int i = 0; i < 5; i++) {
+ constant_pool->set(i, *factory->NewHeapNumber(i));
+ }
+
// Allocate and initialize BytecodeArray
Handle<BytecodeArray> array = factory->NewBytecodeArray(
- kRawBytesSize, kRawBytes, kFrameSize, kParameterCount);
+ kRawBytesSize, kRawBytes, kFrameSize, kParameterCount, constant_pool);
CHECK(array->IsBytecodeArray());
CHECK_EQ(array->length(), (int)sizeof(kRawBytes));
CHECK_EQ(array->frame_size(), kFrameSize);
CHECK_EQ(array->parameter_count(), kParameterCount);
+ CHECK_EQ(array->constant_pool(), *constant_pool);
CHECK_LE(array->address(), array->GetFirstBytecodeAddress());
CHECK_GE(array->address() + array->BytecodeArraySize(),
array->GetFirstBytecodeAddress() + array->length());
@@ -694,17 +701,26 @@ TEST(BytecodeArray) {
CHECK_EQ(array->get(i), kRawBytes[i]);
}
- // Full garbage collection
+ FixedArray* old_constant_pool_address = *constant_pool;
+
+ // Perform a full garbage collection and force the constant pool to be on an
+ // evacuation candidate.
+ Page* evac_page = Page::FromAddress(constant_pool->address());
+ evac_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING);
+ i::FLAG_always_compact = true;
Hannes Payer (out of office) 2015/08/26 22:19:49 The flag you wanna set here is: FLAG_manual_evacua
rmcilroy 2015/08/27 10:19:48 Done.
heap->CollectAllGarbage();
- // BytecodeArray should survive
+ // BytecodeArray should survive.
CHECK_EQ(array->length(), kRawBytesSize);
CHECK_EQ(array->frame_size(), kFrameSize);
-
for (int i = 0; i < kRawBytesSize; i++) {
CHECK_EQ(array->get(i), kRawBytes[i]);
CHECK_EQ(array->GetFirstBytecodeAddress()[i], kRawBytes[i]);
}
+
+ // Constant pool should have been migrated.
+ CHECK_EQ(array->constant_pool(), *constant_pool);
+ CHECK_NE(array->constant_pool(), old_constant_pool_address);
}
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698