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 |
11 // with the distribution. | 11 // with the distribution. |
12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
15 // | 15 // |
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
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/snapshot.h" | 31 #include "src/snapshot.h" |
31 #include "src/v8.h" | 32 #include "src/v8.h" |
32 #include "test/cctest/cctest.h" | 33 #include "test/cctest/cctest.h" |
33 | 34 |
34 | 35 |
35 using namespace v8::internal; | 36 using namespace v8::internal; |
36 | 37 |
37 #if 0 | 38 #if 0 |
38 static void VerifyRegionMarking(Address page_start) { | 39 static void VerifyRegionMarking(Address page_start) { |
39 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER | 40 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 206 |
206 TEST(Regress3540) { | 207 TEST(Regress3540) { |
207 Isolate* isolate = CcTest::i_isolate(); | 208 Isolate* isolate = CcTest::i_isolate(); |
208 Heap* heap = isolate->heap(); | 209 Heap* heap = isolate->heap(); |
209 MemoryAllocator* memory_allocator = new MemoryAllocator(isolate); | 210 MemoryAllocator* memory_allocator = new MemoryAllocator(isolate); |
210 CHECK( | 211 CHECK( |
211 memory_allocator->SetUp(heap->MaxReserved(), heap->MaxExecutableSize())); | 212 memory_allocator->SetUp(heap->MaxReserved(), heap->MaxExecutableSize())); |
212 TestMemoryAllocatorScope test_allocator_scope(isolate, memory_allocator); | 213 TestMemoryAllocatorScope test_allocator_scope(isolate, memory_allocator); |
213 CodeRange* code_range = new CodeRange(isolate); | 214 CodeRange* code_range = new CodeRange(isolate); |
214 const size_t code_range_size = 4 * MB; | 215 const size_t code_range_size = 4 * MB; |
215 if (!code_range->SetUp(code_range_size)) return; | 216 if (!code_range->SetUp( |
| 217 code_range_size + |
| 218 RoundUp(v8::base::OS::CommitPageSize() * kReservedCodeRangePages, |
| 219 MemoryChunk::kAlignment))) { |
| 220 return; |
| 221 } |
216 Address address; | 222 Address address; |
217 size_t size; | 223 size_t size; |
218 address = code_range->AllocateRawMemory(code_range_size - MB, | 224 address = code_range->AllocateRawMemory(code_range_size - MB, |
219 code_range_size - MB, &size); | 225 code_range_size - MB, &size); |
220 CHECK(address != NULL); | 226 CHECK(address != NULL); |
221 Address null_address; | 227 Address null_address; |
222 size_t null_size; | 228 size_t null_size; |
223 null_address = code_range->AllocateRawMemory( | 229 null_address = code_range->AllocateRawMemory( |
224 code_range_size - MB, code_range_size - MB, &null_size); | 230 code_range_size - MB, code_range_size - MB, &null_size); |
225 CHECK(null_address == NULL); | 231 CHECK(null_address == NULL); |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 CompileRun("/*empty*/"); | 449 CompileRun("/*empty*/"); |
444 for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) { | 450 for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) { |
445 // Debug code can be very large, so skip CODE_SPACE if we are generating it. | 451 // Debug code can be very large, so skip CODE_SPACE if we are generating it. |
446 if (i == CODE_SPACE && i::FLAG_debug_code) continue; | 452 if (i == CODE_SPACE && i::FLAG_debug_code) continue; |
447 CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages()); | 453 CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages()); |
448 } | 454 } |
449 | 455 |
450 // No large objects required to perform the above steps. | 456 // No large objects required to perform the above steps. |
451 CHECK(isolate->heap()->lo_space()->IsEmpty()); | 457 CHECK(isolate->heap()->lo_space()->IsEmpty()); |
452 } | 458 } |
OLD | NEW |