OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 5697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5708 CcTest::CollectGarbage(NEW_SPACE); | 5708 CcTest::CollectGarbage(NEW_SPACE); |
5709 CcTest::CollectGarbage(NEW_SPACE); // Ensure new space is empty. | 5709 CcTest::CollectGarbage(NEW_SPACE); // Ensure new space is empty. |
5710 const size_t kSize = 1024; | 5710 const size_t kSize = 1024; |
5711 AllocateInSpace(isolate, kSize, NEW_SPACE); | 5711 AllocateInSpace(isolate, kSize, NEW_SPACE); |
5712 size_t counter2 = heap->NewSpaceAllocationCounter(); | 5712 size_t counter2 = heap->NewSpaceAllocationCounter(); |
5713 CHECK_EQ(kSize, counter2 - counter1); | 5713 CHECK_EQ(kSize, counter2 - counter1); |
5714 CcTest::CollectGarbage(NEW_SPACE); | 5714 CcTest::CollectGarbage(NEW_SPACE); |
5715 size_t counter3 = heap->NewSpaceAllocationCounter(); | 5715 size_t counter3 = heap->NewSpaceAllocationCounter(); |
5716 CHECK_EQ(0U, counter3 - counter2); | 5716 CHECK_EQ(0U, counter3 - counter2); |
5717 // Test counter overflow. | 5717 // Test counter overflow. |
5718 size_t max_counter = -1; | 5718 size_t max_counter = static_cast<size_t>(-1); |
5719 heap->set_new_space_allocation_counter(max_counter - 10 * kSize); | 5719 heap->set_new_space_allocation_counter(max_counter - 10 * kSize); |
5720 size_t start = heap->NewSpaceAllocationCounter(); | 5720 size_t start = heap->NewSpaceAllocationCounter(); |
5721 for (int i = 0; i < 20; i++) { | 5721 for (int i = 0; i < 20; i++) { |
5722 AllocateInSpace(isolate, kSize, NEW_SPACE); | 5722 AllocateInSpace(isolate, kSize, NEW_SPACE); |
5723 size_t counter = heap->NewSpaceAllocationCounter(); | 5723 size_t counter = heap->NewSpaceAllocationCounter(); |
5724 CHECK_EQ(kSize, counter - start); | 5724 CHECK_EQ(kSize, counter - start); |
5725 start = counter; | 5725 start = counter; |
5726 } | 5726 } |
5727 } | 5727 } |
5728 | 5728 |
(...skipping 12 matching lines...) Expand all Loading... |
5741 // TODO(ulan): replace all CHECK_LE with CHECK_EQ after v8:4148 is fixed. | 5741 // TODO(ulan): replace all CHECK_LE with CHECK_EQ after v8:4148 is fixed. |
5742 CHECK_LE(kSize, counter2 - counter1); | 5742 CHECK_LE(kSize, counter2 - counter1); |
5743 CcTest::CollectGarbage(NEW_SPACE); | 5743 CcTest::CollectGarbage(NEW_SPACE); |
5744 size_t counter3 = heap->OldGenerationAllocationCounter(); | 5744 size_t counter3 = heap->OldGenerationAllocationCounter(); |
5745 CHECK_EQ(0u, counter3 - counter2); | 5745 CHECK_EQ(0u, counter3 - counter2); |
5746 AllocateInSpace(isolate, kSize, OLD_SPACE); | 5746 AllocateInSpace(isolate, kSize, OLD_SPACE); |
5747 CcTest::CollectGarbage(OLD_SPACE); | 5747 CcTest::CollectGarbage(OLD_SPACE); |
5748 size_t counter4 = heap->OldGenerationAllocationCounter(); | 5748 size_t counter4 = heap->OldGenerationAllocationCounter(); |
5749 CHECK_LE(kSize, counter4 - counter3); | 5749 CHECK_LE(kSize, counter4 - counter3); |
5750 // Test counter overflow. | 5750 // Test counter overflow. |
5751 size_t max_counter = -1; | 5751 size_t max_counter = static_cast<size_t>(-1); |
5752 heap->set_old_generation_allocation_counter_at_last_gc(max_counter - | 5752 heap->set_old_generation_allocation_counter_at_last_gc(max_counter - |
5753 10 * kSize); | 5753 10 * kSize); |
5754 size_t start = heap->OldGenerationAllocationCounter(); | 5754 size_t start = heap->OldGenerationAllocationCounter(); |
5755 for (int i = 0; i < 20; i++) { | 5755 for (int i = 0; i < 20; i++) { |
5756 AllocateInSpace(isolate, kSize, OLD_SPACE); | 5756 AllocateInSpace(isolate, kSize, OLD_SPACE); |
5757 size_t counter = heap->OldGenerationAllocationCounter(); | 5757 size_t counter = heap->OldGenerationAllocationCounter(); |
5758 CHECK_LE(kSize, counter - start); | 5758 CHECK_LE(kSize, counter - start); |
5759 start = counter; | 5759 start = counter; |
5760 } | 5760 } |
5761 } | 5761 } |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6637 CHECK(!heap->code_space()->FirstPage()->Contains(code->address())); | 6637 CHECK(!heap->code_space()->FirstPage()->Contains(code->address())); |
6638 | 6638 |
6639 // Ensure it's not in large object space. | 6639 // Ensure it's not in large object space. |
6640 MemoryChunk* chunk = MemoryChunk::FromAddress(code->address()); | 6640 MemoryChunk* chunk = MemoryChunk::FromAddress(code->address()); |
6641 CHECK(chunk->owner()->identity() != LO_SPACE); | 6641 CHECK(chunk->owner()->identity() != LO_SPACE); |
6642 CHECK(chunk->NeverEvacuate()); | 6642 CHECK(chunk->NeverEvacuate()); |
6643 } | 6643 } |
6644 | 6644 |
6645 } // namespace internal | 6645 } // namespace internal |
6646 } // namespace v8 | 6646 } // namespace v8 |
OLD | NEW |