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 14 matching lines...) Expand all Loading... |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include <stdlib.h> | 28 #include <stdlib.h> |
29 | 29 |
30 #include "src/base/platform/platform.h" | 30 #include "src/base/platform/platform.h" |
31 #include "src/snapshot/snapshot.h" | 31 #include "src/snapshot/snapshot.h" |
32 #include "src/v8.h" | 32 #include "src/v8.h" |
33 #include "test/cctest/cctest.h" | 33 #include "test/cctest/cctest.h" |
34 #include "test/cctest/heap/heap-tester.h" | 34 #include "test/cctest/heap/heap-tester.h" |
35 #include "test/cctest/heap/utils-inl.h" | |
36 | 35 |
37 namespace v8 { | 36 namespace v8 { |
38 namespace internal { | 37 namespace internal { |
39 | 38 |
40 #if 0 | 39 #if 0 |
41 static void VerifyRegionMarking(Address page_start) { | 40 static void VerifyRegionMarking(Address page_start) { |
42 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER | 41 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER |
43 Page* p = Page::FromAddress(page_start); | 42 Page* p = Page::FromAddress(page_start); |
44 | 43 |
45 p->SetRegionMarks(Page::kAllRegionsCleanMarks); | 44 p->SetRegionMarks(Page::kAllRegionsCleanMarks); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 200 |
202 | 201 |
203 TEST(Regress3540) { | 202 TEST(Regress3540) { |
204 Isolate* isolate = CcTest::i_isolate(); | 203 Isolate* isolate = CcTest::i_isolate(); |
205 Heap* heap = isolate->heap(); | 204 Heap* heap = isolate->heap(); |
206 MemoryAllocator* memory_allocator = new MemoryAllocator(isolate); | 205 MemoryAllocator* memory_allocator = new MemoryAllocator(isolate); |
207 CHECK(memory_allocator->SetUp(heap->MaxReserved(), heap->MaxExecutableSize(), | 206 CHECK(memory_allocator->SetUp(heap->MaxReserved(), heap->MaxExecutableSize(), |
208 0)); | 207 0)); |
209 TestMemoryAllocatorScope test_allocator_scope(isolate, memory_allocator); | 208 TestMemoryAllocatorScope test_allocator_scope(isolate, memory_allocator); |
210 CodeRange* code_range = new CodeRange(isolate); | 209 CodeRange* code_range = new CodeRange(isolate); |
211 const size_t code_range_size = 4 * Page::kPageSize; | 210 size_t code_range_size = |
| 211 kMinimumCodeRangeSize > 0 ? kMinimumCodeRangeSize : 3 * MB; |
212 if (!code_range->SetUp(code_range_size)) { | 212 if (!code_range->SetUp(code_range_size)) { |
213 return; | 213 return; |
214 } | 214 } |
215 | 215 |
216 Address address; | 216 Address address; |
217 size_t size; | 217 size_t size; |
218 size_t request_size = code_range_size - 2 * Page::kPageSize; | 218 size_t request_size = code_range_size - Page::kPageSize; |
219 address = code_range->AllocateRawMemory( | 219 address = code_range->AllocateRawMemory( |
220 request_size, request_size - (2 * MemoryAllocator::CodePageGuardSize()), | 220 request_size, request_size - (2 * MemoryAllocator::CodePageGuardSize()), |
221 &size); | 221 &size); |
222 CHECK_NOT_NULL(address); | 222 CHECK_NOT_NULL(address); |
223 | 223 |
224 Address null_address; | 224 Address null_address; |
225 size_t null_size; | 225 size_t null_size; |
226 request_size = code_range_size - Page::kPageSize; | 226 request_size = code_range_size - Page::kPageSize; |
227 null_address = code_range->AllocateRawMemory( | 227 null_address = code_range->AllocateRawMemory( |
228 request_size, request_size - (2 * MemoryAllocator::CodePageGuardSize()), | 228 request_size, request_size - (2 * MemoryAllocator::CodePageGuardSize()), |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 new_space->RemoveAllocationObserver(&observer2); | 669 new_space->RemoveAllocationObserver(&observer2); |
670 | 670 |
671 CHECK_EQ(observer1.count(), 32); | 671 CHECK_EQ(observer1.count(), 32); |
672 CHECK_EQ(observer2.count(), 28); | 672 CHECK_EQ(observer2.count(), 28); |
673 } | 673 } |
674 isolate->Dispose(); | 674 isolate->Dispose(); |
675 } | 675 } |
676 | 676 |
677 } // namespace internal | 677 } // namespace internal |
678 } // namespace v8 | 678 } // namespace v8 |
OLD | NEW |