OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 heap::FillOldSpacePageWithFixedArrays(CcTest::heap(), kFillerSize); | 735 heap::FillOldSpacePageWithFixedArrays(CcTest::heap(), kFillerSize); |
736 Handle<FixedArray> array = arrays.back(); | 736 Handle<FixedArray> array = arrays.back(); |
737 Page* page = Page::FromAddress(array->address()); | 737 Page* page = Page::FromAddress(array->address()); |
738 CHECK_EQ(page->area_end(), array->address() + array->Size() + kFillerSize); | 738 CHECK_EQ(page->area_end(), array->address() + array->Size() + kFillerSize); |
739 | 739 |
740 // Reset space so high water mark and fillers are consistent. | 740 // Reset space so high water mark and fillers are consistent. |
741 CcTest::heap()->old_space()->ResetFreeList(); | 741 CcTest::heap()->old_space()->ResetFreeList(); |
742 CcTest::heap()->old_space()->EmptyAllocationInfo(); | 742 CcTest::heap()->old_space()->EmptyAllocationInfo(); |
743 | 743 |
744 const size_t shrinked = page->ShrinkToHighWaterMark(); | 744 const size_t shrinked = page->ShrinkToHighWaterMark(); |
745 CHECK_EQ(0, shrinked); | 745 CHECK_EQ(0u, shrinked); |
746 } | 746 } |
747 | 747 |
748 TEST(ShrinkPageToHighWaterMarkOneWordFiller) { | 748 TEST(ShrinkPageToHighWaterMarkOneWordFiller) { |
749 CcTest::InitializeVM(); | 749 CcTest::InitializeVM(); |
750 Isolate* isolate = CcTest::i_isolate(); | 750 Isolate* isolate = CcTest::i_isolate(); |
751 HandleScope scope(isolate); | 751 HandleScope scope(isolate); |
752 | 752 |
753 heap::SealCurrentObjects(CcTest::heap()); | 753 heap::SealCurrentObjects(CcTest::heap()); |
754 | 754 |
755 const int kFillerSize = kPointerSize; | 755 const int kFillerSize = kPointerSize; |
756 std::vector<Handle<FixedArray>> arrays = | 756 std::vector<Handle<FixedArray>> arrays = |
757 heap::FillOldSpacePageWithFixedArrays(CcTest::heap(), kFillerSize); | 757 heap::FillOldSpacePageWithFixedArrays(CcTest::heap(), kFillerSize); |
758 Handle<FixedArray> array = arrays.back(); | 758 Handle<FixedArray> array = arrays.back(); |
759 Page* page = Page::FromAddress(array->address()); | 759 Page* page = Page::FromAddress(array->address()); |
760 CHECK_EQ(page->area_end(), array->address() + array->Size() + kFillerSize); | 760 CHECK_EQ(page->area_end(), array->address() + array->Size() + kFillerSize); |
761 | 761 |
762 // Reset space so high water mark and fillers are consistent. | 762 // Reset space so high water mark and fillers are consistent. |
763 CcTest::heap()->old_space()->ResetFreeList(); | 763 CcTest::heap()->old_space()->ResetFreeList(); |
764 CcTest::heap()->old_space()->EmptyAllocationInfo(); | 764 CcTest::heap()->old_space()->EmptyAllocationInfo(); |
765 | 765 |
766 HeapObject* filler = | 766 HeapObject* filler = |
767 HeapObject::FromAddress(array->address() + array->Size()); | 767 HeapObject::FromAddress(array->address() + array->Size()); |
768 CHECK_EQ(filler->map(), CcTest::heap()->one_pointer_filler_map()); | 768 CHECK_EQ(filler->map(), CcTest::heap()->one_pointer_filler_map()); |
769 | 769 |
770 const size_t shrinked = page->ShrinkToHighWaterMark(); | 770 const size_t shrinked = page->ShrinkToHighWaterMark(); |
771 CHECK_EQ(0, shrinked); | 771 CHECK_EQ(0u, shrinked); |
772 } | 772 } |
773 | 773 |
774 TEST(ShrinkPageToHighWaterMarkTwoWordFiller) { | 774 TEST(ShrinkPageToHighWaterMarkTwoWordFiller) { |
775 CcTest::InitializeVM(); | 775 CcTest::InitializeVM(); |
776 Isolate* isolate = CcTest::i_isolate(); | 776 Isolate* isolate = CcTest::i_isolate(); |
777 HandleScope scope(isolate); | 777 HandleScope scope(isolate); |
778 | 778 |
779 heap::SealCurrentObjects(CcTest::heap()); | 779 heap::SealCurrentObjects(CcTest::heap()); |
780 | 780 |
781 const int kFillerSize = 2 * kPointerSize; | 781 const int kFillerSize = 2 * kPointerSize; |
782 std::vector<Handle<FixedArray>> arrays = | 782 std::vector<Handle<FixedArray>> arrays = |
783 heap::FillOldSpacePageWithFixedArrays(CcTest::heap(), kFillerSize); | 783 heap::FillOldSpacePageWithFixedArrays(CcTest::heap(), kFillerSize); |
784 Handle<FixedArray> array = arrays.back(); | 784 Handle<FixedArray> array = arrays.back(); |
785 Page* page = Page::FromAddress(array->address()); | 785 Page* page = Page::FromAddress(array->address()); |
786 CHECK_EQ(page->area_end(), array->address() + array->Size() + kFillerSize); | 786 CHECK_EQ(page->area_end(), array->address() + array->Size() + kFillerSize); |
787 | 787 |
788 // Reset space so high water mark and fillers are consistent. | 788 // Reset space so high water mark and fillers are consistent. |
789 CcTest::heap()->old_space()->ResetFreeList(); | 789 CcTest::heap()->old_space()->ResetFreeList(); |
790 CcTest::heap()->old_space()->EmptyAllocationInfo(); | 790 CcTest::heap()->old_space()->EmptyAllocationInfo(); |
791 | 791 |
792 HeapObject* filler = | 792 HeapObject* filler = |
793 HeapObject::FromAddress(array->address() + array->Size()); | 793 HeapObject::FromAddress(array->address() + array->Size()); |
794 CHECK_EQ(filler->map(), CcTest::heap()->two_pointer_filler_map()); | 794 CHECK_EQ(filler->map(), CcTest::heap()->two_pointer_filler_map()); |
795 | 795 |
796 const size_t shrinked = page->ShrinkToHighWaterMark(); | 796 const size_t shrinked = page->ShrinkToHighWaterMark(); |
797 CHECK_EQ(0, shrinked); | 797 CHECK_EQ(0u, shrinked); |
798 } | 798 } |
799 | 799 |
800 } // namespace internal | 800 } // namespace internal |
801 } // namespace v8 | 801 } // namespace v8 |
OLD | NEW |