| 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 // Debug code can be very large, so skip CODE_SPACE if we are generating it. | 452 // Debug code can be very large, so skip CODE_SPACE if we are generating it. |
| 453 if (i == CODE_SPACE && i::FLAG_debug_code) continue; | 453 if (i == CODE_SPACE && i::FLAG_debug_code) continue; |
| 454 CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages()); | 454 CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages()); |
| 455 } | 455 } |
| 456 | 456 |
| 457 // No large objects required to perform the above steps. | 457 // No large objects required to perform the above steps. |
| 458 CHECK(isolate->heap()->lo_space()->IsEmpty()); | 458 CHECK(isolate->heap()->lo_space()->IsEmpty()); |
| 459 } | 459 } |
| 460 | 460 |
| 461 | 461 |
| 462 static inline void FillCurrentPage(v8::internal::NewSpace* space) { |
| 463 int new_linear_size = static_cast<int>(*space->allocation_limit_address() - |
| 464 *space->allocation_top_address()); |
| 465 if (new_linear_size == 0) return; |
| 466 v8::internal::AllocationResult allocation = |
| 467 space->AllocateRaw(new_linear_size); |
| 468 v8::internal::FreeListNode* node = |
| 469 v8::internal::FreeListNode::cast(allocation.ToObjectChecked()); |
| 470 node->set_size(space->heap(), new_linear_size); |
| 471 } |
| 472 |
| 473 |
| 462 UNINITIALIZED_TEST(NewSpaceGrowsToTargetCapacity) { | 474 UNINITIALIZED_TEST(NewSpaceGrowsToTargetCapacity) { |
| 463 FLAG_target_semi_space_size = 2; | 475 FLAG_target_semi_space_size = 2; |
| 464 if (FLAG_optimize_for_size) return; | 476 if (FLAG_optimize_for_size) return; |
| 465 | 477 |
| 466 v8::Isolate* isolate = v8::Isolate::New(); | 478 v8::Isolate* isolate = v8::Isolate::New(); |
| 467 { | 479 { |
| 468 v8::Isolate::Scope isolate_scope(isolate); | 480 v8::Isolate::Scope isolate_scope(isolate); |
| 469 v8::HandleScope handle_scope(isolate); | 481 v8::HandleScope handle_scope(isolate); |
| 470 v8::Context::New(isolate)->Enter(); | 482 v8::Context::New(isolate)->Enter(); |
| 471 | 483 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 483 | 495 |
| 484 // Try to allocate out of the new space. A new page should be added and | 496 // Try to allocate out of the new space. A new page should be added and |
| 485 // the | 497 // the |
| 486 // allocation should succeed. | 498 // allocation should succeed. |
| 487 v8::internal::AllocationResult allocation = new_space->AllocateRaw(80); | 499 v8::internal::AllocationResult allocation = new_space->AllocateRaw(80); |
| 488 CHECK(!allocation.IsRetry()); | 500 CHECK(!allocation.IsRetry()); |
| 489 CHECK(new_space->CommittedMemory() == 2 * Page::kPageSize); | 501 CHECK(new_space->CommittedMemory() == 2 * Page::kPageSize); |
| 490 | 502 |
| 491 // Turn the allocation into a proper object so isolate teardown won't | 503 // Turn the allocation into a proper object so isolate teardown won't |
| 492 // crash. | 504 // crash. |
| 493 HeapObject* free_space; | 505 v8::internal::FreeListNode* node = |
| 494 CHECK(allocation.To(&free_space)); | 506 v8::internal::FreeListNode::cast(allocation.ToObjectChecked()); |
| 495 new_space->heap()->CreateFillerObjectAt(free_space->address(), 80); | 507 node->set_size(new_space->heap(), 80); |
| 496 } | 508 } |
| 497 } | 509 } |
| 498 isolate->Dispose(); | 510 isolate->Dispose(); |
| 499 } | 511 } |
| OLD | NEW |