Chromium Code Reviews| 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); |
| } |