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 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2211 Address top = *top_addr; | 2211 Address top = *top_addr; |
2212 // Now force the remaining allocation onto the free list. | 2212 // Now force the remaining allocation onto the free list. |
2213 CcTest::heap()->old_space()->EmptyAllocationInfo(); | 2213 CcTest::heap()->old_space()->EmptyAllocationInfo(); |
2214 return top; | 2214 return top; |
2215 } | 2215 } |
2216 | 2216 |
2217 | 2217 |
2218 // Test the case where allocation must be done from the free list, so filler | 2218 // Test the case where allocation must be done from the free list, so filler |
2219 // may precede or follow the object. | 2219 // may precede or follow the object. |
2220 TEST(TestAlignedOverAllocation) { | 2220 TEST(TestAlignedOverAllocation) { |
| 2221 Heap* heap = CcTest::heap(); |
| 2222 // Test checks for fillers before and behind objects and requires a fresh |
| 2223 // page and empty free list. |
| 2224 heap::AbandonCurrentlyFreeMemory(heap->old_space()); |
| 2225 // Allocate a dummy object to properly set up the linear allocation info. |
| 2226 AllocationResult dummy = |
| 2227 heap->old_space()->AllocateRawUnaligned(kPointerSize); |
| 2228 CHECK(!dummy.IsRetry()); |
| 2229 heap->CreateFillerObjectAt( |
| 2230 HeapObject::cast(dummy.ToObjectChecked())->address(), kPointerSize, |
| 2231 ClearRecordedSlots::kNo); |
| 2232 |
2221 // Double misalignment is 4 on 32-bit platforms, 0 on 64-bit ones. | 2233 // Double misalignment is 4 on 32-bit platforms, 0 on 64-bit ones. |
2222 const intptr_t double_misalignment = kDoubleSize - kPointerSize; | 2234 const intptr_t double_misalignment = kDoubleSize - kPointerSize; |
2223 Address start; | 2235 Address start; |
2224 HeapObject* obj; | 2236 HeapObject* obj; |
2225 HeapObject* filler1; | 2237 HeapObject* filler1; |
2226 HeapObject* filler2; | 2238 HeapObject* filler2; |
2227 if (double_misalignment) { | 2239 if (double_misalignment) { |
2228 start = AlignOldSpace(kDoubleAligned, 0); | 2240 start = AlignOldSpace(kDoubleAligned, 0); |
2229 obj = OldSpaceAllocateAligned(kPointerSize, kDoubleAligned); | 2241 obj = OldSpaceAllocateAligned(kPointerSize, kDoubleAligned); |
2230 // The object is aligned, and a filler object is created after. | 2242 // The object is aligned, and a filler object is created after. |
(...skipping 4852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7083 chunk, chunk->area_end() - kPointerSize, chunk->area_end()); | 7095 chunk, chunk->area_end() - kPointerSize, chunk->area_end()); |
7084 slots[chunk->area_end() - kPointerSize] = false; | 7096 slots[chunk->area_end() - kPointerSize] = false; |
7085 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { | 7097 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { |
7086 CHECK(slots[addr]); | 7098 CHECK(slots[addr]); |
7087 return KEEP_SLOT; | 7099 return KEEP_SLOT; |
7088 }); | 7100 }); |
7089 } | 7101 } |
7090 | 7102 |
7091 } // namespace internal | 7103 } // namespace internal |
7092 } // namespace v8 | 7104 } // namespace v8 |
OLD | NEW |