Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: test/cctest/heap/test-heap.cc

Issue 2652933002: [heap] Handle edge case in NewSpaceAllocationCounter test (Closed)
Patch Set: Perform a second GC instead Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698