| 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 6141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6152 } | 6152 } |
| 6153 | 6153 |
| 6154 | 6154 |
| 6155 TEST(NewSpaceAllocationCounter) { | 6155 TEST(NewSpaceAllocationCounter) { |
| 6156 CcTest::InitializeVM(); | 6156 CcTest::InitializeVM(); |
| 6157 v8::HandleScope scope(CcTest::isolate()); | 6157 v8::HandleScope scope(CcTest::isolate()); |
| 6158 Isolate* isolate = CcTest::i_isolate(); | 6158 Isolate* isolate = CcTest::i_isolate(); |
| 6159 Heap* heap = isolate->heap(); | 6159 Heap* heap = isolate->heap(); |
| 6160 size_t counter1 = heap->NewSpaceAllocationCounter(); | 6160 size_t counter1 = heap->NewSpaceAllocationCounter(); |
| 6161 CcTest::CollectGarbage(NEW_SPACE); | 6161 CcTest::CollectGarbage(NEW_SPACE); |
| 6162 CcTest::CollectGarbage(NEW_SPACE); // Ensure new space is empty. |
| 6162 const size_t kSize = 1024; | 6163 const size_t kSize = 1024; |
| 6163 AllocateInSpace(isolate, kSize, NEW_SPACE); | 6164 AllocateInSpace(isolate, kSize, NEW_SPACE); |
| 6164 size_t counter2 = heap->NewSpaceAllocationCounter(); | 6165 size_t counter2 = heap->NewSpaceAllocationCounter(); |
| 6165 CHECK_EQ(kSize, counter2 - counter1); | 6166 CHECK_EQ(kSize, counter2 - counter1); |
| 6166 CcTest::CollectGarbage(NEW_SPACE); | 6167 CcTest::CollectGarbage(NEW_SPACE); |
| 6167 size_t counter3 = heap->NewSpaceAllocationCounter(); | 6168 size_t counter3 = heap->NewSpaceAllocationCounter(); |
| 6168 CHECK_EQ(0U, counter3 - counter2); | 6169 CHECK_EQ(0U, counter3 - counter2); |
| 6169 // Test counter overflow. | 6170 // Test counter overflow. |
| 6170 size_t max_counter = -1; | 6171 size_t max_counter = -1; |
| 6171 heap->set_new_space_allocation_counter(max_counter - 10 * kSize); | 6172 heap->set_new_space_allocation_counter(max_counter - 10 * kSize); |
| (...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7089 CHECK(!heap->code_space()->FirstPage()->Contains(code->address())); | 7090 CHECK(!heap->code_space()->FirstPage()->Contains(code->address())); |
| 7090 | 7091 |
| 7091 // Ensure it's not in large object space. | 7092 // Ensure it's not in large object space. |
| 7092 MemoryChunk* chunk = MemoryChunk::FromAddress(code->address()); | 7093 MemoryChunk* chunk = MemoryChunk::FromAddress(code->address()); |
| 7093 CHECK(chunk->owner()->identity() != LO_SPACE); | 7094 CHECK(chunk->owner()->identity() != LO_SPACE); |
| 7094 CHECK(chunk->NeverEvacuate()); | 7095 CHECK(chunk->NeverEvacuate()); |
| 7095 } | 7096 } |
| 7096 | 7097 |
| 7097 } // namespace internal | 7098 } // namespace internal |
| 7098 } // namespace v8 | 7099 } // namespace v8 |
| OLD | NEW |