| 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 CHECK(memory_allocator->SetUp(heap->MaxReserved(), | 320 CHECK(memory_allocator->SetUp(heap->MaxReserved(), |
| 321 heap->MaxExecutableSize())); | 321 heap->MaxExecutableSize())); |
| 322 TestMemoryAllocatorScope test_scope(isolate, memory_allocator); | 322 TestMemoryAllocatorScope test_scope(isolate, memory_allocator); |
| 323 | 323 |
| 324 NewSpace new_space(heap); | 324 NewSpace new_space(heap); |
| 325 | 325 |
| 326 CHECK(new_space.SetUp(CcTest::heap()->ReservedSemiSpaceSize(), | 326 CHECK(new_space.SetUp(CcTest::heap()->ReservedSemiSpaceSize(), |
| 327 CcTest::heap()->ReservedSemiSpaceSize())); | 327 CcTest::heap()->ReservedSemiSpaceSize())); |
| 328 CHECK(new_space.HasBeenSetUp()); | 328 CHECK(new_space.HasBeenSetUp()); |
| 329 | 329 |
| 330 while (new_space.Available() >= Page::kMaxNonCodeHeapObjectSize) { | 330 while (new_space.Available() >= Page::kMaxRegularHeapObjectSize) { |
| 331 Object* obj = | 331 Object* obj = |
| 332 new_space.AllocateRaw(Page::kMaxNonCodeHeapObjectSize)-> | 332 new_space.AllocateRaw(Page::kMaxRegularHeapObjectSize)-> |
| 333 ToObjectUnchecked(); | 333 ToObjectUnchecked(); |
| 334 CHECK(new_space.Contains(HeapObject::cast(obj))); | 334 CHECK(new_space.Contains(HeapObject::cast(obj))); |
| 335 } | 335 } |
| 336 | 336 |
| 337 new_space.TearDown(); | 337 new_space.TearDown(); |
| 338 memory_allocator->TearDown(); | 338 memory_allocator->TearDown(); |
| 339 delete memory_allocator; | 339 delete memory_allocator; |
| 340 } | 340 } |
| 341 | 341 |
| 342 | 342 |
| 343 TEST(OldSpace) { | 343 TEST(OldSpace) { |
| 344 Isolate* isolate = CcTest::i_isolate(); | 344 Isolate* isolate = CcTest::i_isolate(); |
| 345 isolate->InitializeLoggingAndCounters(); | 345 isolate->InitializeLoggingAndCounters(); |
| 346 Heap* heap = isolate->heap(); | 346 Heap* heap = isolate->heap(); |
| 347 CHECK(heap->ConfigureHeapDefault()); | 347 CHECK(heap->ConfigureHeapDefault()); |
| 348 MemoryAllocator* memory_allocator = new MemoryAllocator(isolate); | 348 MemoryAllocator* memory_allocator = new MemoryAllocator(isolate); |
| 349 CHECK(memory_allocator->SetUp(heap->MaxReserved(), | 349 CHECK(memory_allocator->SetUp(heap->MaxReserved(), |
| 350 heap->MaxExecutableSize())); | 350 heap->MaxExecutableSize())); |
| 351 TestMemoryAllocatorScope test_scope(isolate, memory_allocator); | 351 TestMemoryAllocatorScope test_scope(isolate, memory_allocator); |
| 352 | 352 |
| 353 OldSpace* s = new OldSpace(heap, | 353 OldSpace* s = new OldSpace(heap, |
| 354 heap->MaxOldGenerationSize(), | 354 heap->MaxOldGenerationSize(), |
| 355 OLD_POINTER_SPACE, | 355 OLD_POINTER_SPACE, |
| 356 NOT_EXECUTABLE); | 356 NOT_EXECUTABLE); |
| 357 CHECK(s != NULL); | 357 CHECK(s != NULL); |
| 358 | 358 |
| 359 CHECK(s->SetUp()); | 359 CHECK(s->SetUp()); |
| 360 | 360 |
| 361 while (s->Available() > 0) { | 361 while (s->Available() > 0) { |
| 362 s->AllocateRaw(Page::kMaxNonCodeHeapObjectSize)->ToObjectUnchecked(); | 362 s->AllocateRaw(Page::kMaxRegularHeapObjectSize)->ToObjectUnchecked(); |
| 363 } | 363 } |
| 364 | 364 |
| 365 s->TearDown(); | 365 s->TearDown(); |
| 366 delete s; | 366 delete s; |
| 367 memory_allocator->TearDown(); | 367 memory_allocator->TearDown(); |
| 368 delete memory_allocator; | 368 delete memory_allocator; |
| 369 } | 369 } |
| 370 | 370 |
| 371 | 371 |
| 372 TEST(LargeObjectSpace) { | 372 TEST(LargeObjectSpace) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 // Executing the empty script gets by with one page per space. | 415 // Executing the empty script gets by with one page per space. |
| 416 HandleScope scope(isolate); | 416 HandleScope scope(isolate); |
| 417 CompileRun("/*empty*/"); | 417 CompileRun("/*empty*/"); |
| 418 for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) { | 418 for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) { |
| 419 CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages()); | 419 CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages()); |
| 420 } | 420 } |
| 421 | 421 |
| 422 // No large objects required to perform the above steps. | 422 // No large objects required to perform the above steps. |
| 423 CHECK(isolate->heap()->lo_space()->IsEmpty()); | 423 CHECK(isolate->heap()->lo_space()->IsEmpty()); |
| 424 } | 424 } |
| OLD | NEW |