OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
671 static const int kRawBytesSize = sizeof(kRawBytes); | 671 static const int kRawBytesSize = sizeof(kRawBytes); |
672 static const int kFrameSize = 32; | 672 static const int kFrameSize = 32; |
673 static const int kParameterCount = 2; | 673 static const int kParameterCount = 2; |
674 | 674 |
675 CcTest::InitializeVM(); | 675 CcTest::InitializeVM(); |
676 Isolate* isolate = CcTest::i_isolate(); | 676 Isolate* isolate = CcTest::i_isolate(); |
677 Heap* heap = isolate->heap(); | 677 Heap* heap = isolate->heap(); |
678 Factory* factory = isolate->factory(); | 678 Factory* factory = isolate->factory(); |
679 HandleScope scope(isolate); | 679 HandleScope scope(isolate); |
680 | 680 |
681 SimulateFullSpace(heap->old_space()); | |
682 Handle<FixedArray> constant_pool = factory->NewFixedArray(5, TENURED); | |
683 for (int i = 0; i < 5; i++) { | |
684 constant_pool->set(i, *factory->NewHeapNumber(i)); | |
685 } | |
686 | |
681 // Allocate and initialize BytecodeArray | 687 // Allocate and initialize BytecodeArray |
682 Handle<BytecodeArray> array = factory->NewBytecodeArray( | 688 Handle<BytecodeArray> array = factory->NewBytecodeArray( |
683 kRawBytesSize, kRawBytes, kFrameSize, kParameterCount); | 689 kRawBytesSize, kRawBytes, kFrameSize, kParameterCount, constant_pool); |
684 | 690 |
685 CHECK(array->IsBytecodeArray()); | 691 CHECK(array->IsBytecodeArray()); |
686 CHECK_EQ(array->length(), (int)sizeof(kRawBytes)); | 692 CHECK_EQ(array->length(), (int)sizeof(kRawBytes)); |
687 CHECK_EQ(array->frame_size(), kFrameSize); | 693 CHECK_EQ(array->frame_size(), kFrameSize); |
688 CHECK_EQ(array->parameter_count(), kParameterCount); | 694 CHECK_EQ(array->parameter_count(), kParameterCount); |
695 CHECK_EQ(array->constant_pool(), *constant_pool); | |
689 CHECK_LE(array->address(), array->GetFirstBytecodeAddress()); | 696 CHECK_LE(array->address(), array->GetFirstBytecodeAddress()); |
690 CHECK_GE(array->address() + array->BytecodeArraySize(), | 697 CHECK_GE(array->address() + array->BytecodeArraySize(), |
691 array->GetFirstBytecodeAddress() + array->length()); | 698 array->GetFirstBytecodeAddress() + array->length()); |
692 for (int i = 0; i < kRawBytesSize; i++) { | 699 for (int i = 0; i < kRawBytesSize; i++) { |
693 CHECK_EQ(array->GetFirstBytecodeAddress()[i], kRawBytes[i]); | 700 CHECK_EQ(array->GetFirstBytecodeAddress()[i], kRawBytes[i]); |
694 CHECK_EQ(array->get(i), kRawBytes[i]); | 701 CHECK_EQ(array->get(i), kRawBytes[i]); |
695 } | 702 } |
696 | 703 |
697 // Full garbage collection | 704 FixedArray* old_constant_pool_address = *constant_pool; |
705 | |
706 // Perform a full garbage collection and force the constant pool to be on an | |
707 // evacuation candidate. | |
708 Page* evac_page = Page::FromAddress(constant_pool->address()); | |
709 evac_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); | |
710 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.
| |
698 heap->CollectAllGarbage(); | 711 heap->CollectAllGarbage(); |
699 | 712 |
700 // BytecodeArray should survive | 713 // BytecodeArray should survive. |
701 CHECK_EQ(array->length(), kRawBytesSize); | 714 CHECK_EQ(array->length(), kRawBytesSize); |
702 CHECK_EQ(array->frame_size(), kFrameSize); | 715 CHECK_EQ(array->frame_size(), kFrameSize); |
703 | |
704 for (int i = 0; i < kRawBytesSize; i++) { | 716 for (int i = 0; i < kRawBytesSize; i++) { |
705 CHECK_EQ(array->get(i), kRawBytes[i]); | 717 CHECK_EQ(array->get(i), kRawBytes[i]); |
706 CHECK_EQ(array->GetFirstBytecodeAddress()[i], kRawBytes[i]); | 718 CHECK_EQ(array->GetFirstBytecodeAddress()[i], kRawBytes[i]); |
707 } | 719 } |
720 | |
721 // Constant pool should have been migrated. | |
722 CHECK_EQ(array->constant_pool(), *constant_pool); | |
723 CHECK_NE(array->constant_pool(), old_constant_pool_address); | |
708 } | 724 } |
709 | 725 |
710 | 726 |
711 static const char* not_so_random_string_table[] = { | 727 static const char* not_so_random_string_table[] = { |
712 "abstract", | 728 "abstract", |
713 "boolean", | 729 "boolean", |
714 "break", | 730 "break", |
715 "byte", | 731 "byte", |
716 "case", | 732 "case", |
717 "catch", | 733 "catch", |
(...skipping 5805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6523 { | 6539 { |
6524 SharedFunctionInfo::Iterator iterator(isolate); | 6540 SharedFunctionInfo::Iterator iterator(isolate); |
6525 while (iterator.Next()) sfi_count--; | 6541 while (iterator.Next()) sfi_count--; |
6526 } | 6542 } |
6527 | 6543 |
6528 CHECK_EQ(0, sfi_count); | 6544 CHECK_EQ(0, sfi_count); |
6529 } | 6545 } |
6530 | 6546 |
6531 } // namespace internal | 6547 } // namespace internal |
6532 } // namespace v8 | 6548 } // namespace v8 |
OLD | NEW |