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 2050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2061 } | 2061 } |
2062 | 2062 |
2063 | 2063 |
2064 static HeapObject* NewSpaceAllocateAligned(int size, | 2064 static HeapObject* NewSpaceAllocateAligned(int size, |
2065 AllocationAlignment alignment) { | 2065 AllocationAlignment alignment) { |
2066 Heap* heap = CcTest::heap(); | 2066 Heap* heap = CcTest::heap(); |
2067 AllocationResult allocation = | 2067 AllocationResult allocation = |
2068 heap->new_space()->AllocateRawAligned(size, alignment); | 2068 heap->new_space()->AllocateRawAligned(size, alignment); |
2069 HeapObject* obj = NULL; | 2069 HeapObject* obj = NULL; |
2070 allocation.To(&obj); | 2070 allocation.To(&obj); |
2071 heap->CreateFillerObjectAt(obj->address(), size); | 2071 heap->CreateFillerObjectAt(obj->address(), size, ClearRecordedSlots::kNo); |
2072 return obj; | 2072 return obj; |
2073 } | 2073 } |
2074 | 2074 |
2075 | 2075 |
2076 // Get new space allocation into the desired alignment. | 2076 // Get new space allocation into the desired alignment. |
2077 static Address AlignNewSpace(AllocationAlignment alignment, int offset) { | 2077 static Address AlignNewSpace(AllocationAlignment alignment, int offset) { |
2078 Address* top_addr = CcTest::heap()->new_space()->allocation_top_address(); | 2078 Address* top_addr = CcTest::heap()->new_space()->allocation_top_address(); |
2079 int fill = Heap::GetFillToAlign(*top_addr, alignment); | 2079 int fill = Heap::GetFillToAlign(*top_addr, alignment); |
2080 if (fill) { | 2080 if (fill) { |
2081 NewSpaceAllocateAligned(fill + offset, kWordAligned); | 2081 NewSpaceAllocateAligned(fill + offset, kWordAligned); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2164 } | 2164 } |
2165 | 2165 |
2166 | 2166 |
2167 static HeapObject* OldSpaceAllocateAligned(int size, | 2167 static HeapObject* OldSpaceAllocateAligned(int size, |
2168 AllocationAlignment alignment) { | 2168 AllocationAlignment alignment) { |
2169 Heap* heap = CcTest::heap(); | 2169 Heap* heap = CcTest::heap(); |
2170 AllocationResult allocation = | 2170 AllocationResult allocation = |
2171 heap->old_space()->AllocateRawAligned(size, alignment); | 2171 heap->old_space()->AllocateRawAligned(size, alignment); |
2172 HeapObject* obj = NULL; | 2172 HeapObject* obj = NULL; |
2173 allocation.To(&obj); | 2173 allocation.To(&obj); |
2174 heap->CreateFillerObjectAt(obj->address(), size); | 2174 heap->CreateFillerObjectAt(obj->address(), size, ClearRecordedSlots::kNo); |
2175 return obj; | 2175 return obj; |
2176 } | 2176 } |
2177 | 2177 |
2178 | 2178 |
2179 // Get old space allocation into the desired alignment. | 2179 // Get old space allocation into the desired alignment. |
2180 static Address AlignOldSpace(AllocationAlignment alignment, int offset) { | 2180 static Address AlignOldSpace(AllocationAlignment alignment, int offset) { |
2181 Address* top_addr = CcTest::heap()->old_space()->allocation_top_address(); | 2181 Address* top_addr = CcTest::heap()->old_space()->allocation_top_address(); |
2182 int fill = Heap::GetFillToAlign(*top_addr, alignment); | 2182 int fill = Heap::GetFillToAlign(*top_addr, alignment); |
2183 int allocation = fill + offset; | 2183 int allocation = fill + offset; |
2184 if (allocation) { | 2184 if (allocation) { |
(...skipping 2093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4278 CHECK(array->HasFastSmiOrObjectElements()); | 4278 CHECK(array->HasFastSmiOrObjectElements()); |
4279 | 4279 |
4280 // We need filler the size of AllocationMemento object, plus an extra | 4280 // We need filler the size of AllocationMemento object, plus an extra |
4281 // fill pointer value. | 4281 // fill pointer value. |
4282 HeapObject* obj = NULL; | 4282 HeapObject* obj = NULL; |
4283 AllocationResult allocation = | 4283 AllocationResult allocation = |
4284 CcTest::heap()->new_space()->AllocateRawUnaligned( | 4284 CcTest::heap()->new_space()->AllocateRawUnaligned( |
4285 AllocationMemento::kSize + kPointerSize); | 4285 AllocationMemento::kSize + kPointerSize); |
4286 CHECK(allocation.To(&obj)); | 4286 CHECK(allocation.To(&obj)); |
4287 Address addr_obj = obj->address(); | 4287 Address addr_obj = obj->address(); |
4288 CcTest::heap()->CreateFillerObjectAt( | 4288 CcTest::heap()->CreateFillerObjectAt(addr_obj, |
4289 addr_obj, AllocationMemento::kSize + kPointerSize); | 4289 AllocationMemento::kSize + kPointerSize, |
| 4290 ClearRecordedSlots::kNo); |
4290 | 4291 |
4291 // Give the array a name, making sure not to allocate strings. | 4292 // Give the array a name, making sure not to allocate strings. |
4292 v8::Local<v8::Object> array_obj = v8::Utils::ToLocal(array); | 4293 v8::Local<v8::Object> array_obj = v8::Utils::ToLocal(array); |
4293 CHECK(CcTest::global()->Set(env.local(), array_name, array_obj).FromJust()); | 4294 CHECK(CcTest::global()->Set(env.local(), array_name, array_obj).FromJust()); |
4294 | 4295 |
4295 // This should crash with a protection violation if we are running a build | 4296 // This should crash with a protection violation if we are running a build |
4296 // with the bug. | 4297 // with the bug. |
4297 AlwaysAllocateScope aa_scope(isolate); | 4298 AlwaysAllocateScope aa_scope(isolate); |
4298 v8::Script::Compile(env.local(), mote_code_string) | 4299 v8::Script::Compile(env.local(), mote_code_string) |
4299 .ToLocalChecked() | 4300 .ToLocalChecked() |
(...skipping 2226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6526 byte_array->set(j, 0x31); | 6527 byte_array->set(j, 0x31); |
6527 } | 6528 } |
6528 } | 6529 } |
6529 // Re-enable old space expansion to avoid OOM crash. | 6530 // Re-enable old space expansion to avoid OOM crash. |
6530 heap->set_force_oom(false); | 6531 heap->set_force_oom(false); |
6531 heap->CollectGarbage(NEW_SPACE); | 6532 heap->CollectGarbage(NEW_SPACE); |
6532 } | 6533 } |
6533 | 6534 |
6534 } // namespace internal | 6535 } // namespace internal |
6535 } // namespace v8 | 6536 } // namespace v8 |
OLD | NEW |