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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 v8::HandleScope handle_scope(isolate); | 613 v8::HandleScope handle_scope(isolate); |
614 v8::Context::New(isolate)->Enter(); | 614 v8::Context::New(isolate)->Enter(); |
615 | 615 |
616 Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate); | 616 Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate); |
617 | 617 |
618 NewSpace* new_space = i_isolate->heap()->new_space(); | 618 NewSpace* new_space = i_isolate->heap()->new_space(); |
619 | 619 |
620 // This test doesn't work if we start with a non-default new space | 620 // This test doesn't work if we start with a non-default new space |
621 // configuration. | 621 // configuration. |
622 if (new_space->InitialTotalCapacity() == Page::kPageSize) { | 622 if (new_space->InitialTotalCapacity() == Page::kPageSize) { |
623 CHECK(new_space->CommittedMemory() == new_space->InitialTotalCapacity()); | 623 CHECK_EQ(new_space->CommittedMemory(), new_space->InitialTotalCapacity()); |
624 | 624 |
625 // Fill up the first (and only) page of the semi space. | 625 // Fill up the first (and only) page of the semi space. |
626 FillCurrentPage(new_space); | 626 FillCurrentPage(new_space); |
627 | 627 |
628 // Try to allocate out of the new space. A new page should be added and | 628 // Try to allocate out of the new space. A new page should be added and |
629 // the | 629 // the |
630 // allocation should succeed. | 630 // allocation should succeed. |
631 v8::internal::AllocationResult allocation = | 631 v8::internal::AllocationResult allocation = |
632 new_space->AllocateRawUnaligned(80); | 632 new_space->AllocateRawUnaligned(80); |
633 CHECK(!allocation.IsRetry()); | 633 CHECK(!allocation.IsRetry()); |
634 CHECK(new_space->CommittedMemory() == 2 * Page::kPageSize); | 634 CHECK_EQ(new_space->CommittedMemory(), 2 * Page::kPageSize); |
635 | 635 |
636 // Turn the allocation into a proper object so isolate teardown won't | 636 // Turn the allocation into a proper object so isolate teardown won't |
637 // crash. | 637 // crash. |
638 HeapObject* free_space = NULL; | 638 HeapObject* free_space = NULL; |
639 CHECK(allocation.To(&free_space)); | 639 CHECK(allocation.To(&free_space)); |
640 new_space->heap()->CreateFillerObjectAt(free_space->address(), 80); | 640 new_space->heap()->CreateFillerObjectAt(free_space->address(), 80); |
641 } | 641 } |
642 } | 642 } |
643 isolate->Dispose(); | 643 isolate->Dispose(); |
644 } | 644 } |
OLD | NEW |