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

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

Issue 7619: - Removed a few indirections by making the two SemiSpaces... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 2 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 | Annotate | Revision Log
« src/spaces.cc ('K') | « src/spaces-inl.h ('k') | 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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 CHECK(!invalid_page->is_valid()); 150 CHECK(!invalid_page->is_valid());
151 151
152 MemoryAllocator::TearDown(); 152 MemoryAllocator::TearDown();
153 } 153 }
154 154
155 155
156 TEST(NewSpace) { 156 TEST(NewSpace) {
157 CHECK(Heap::ConfigureHeapDefault()); 157 CHECK(Heap::ConfigureHeapDefault());
158 CHECK(MemoryAllocator::Setup(Heap::MaxCapacity())); 158 CHECK(MemoryAllocator::Setup(Heap::MaxCapacity()));
159 159
160 NewSpace* s = new NewSpace(Heap::InitialSemiSpaceSize(), 160 NewSpace new_space;
161 Heap::SemiSpaceSize(),
162 NEW_SPACE);
163 CHECK(s != NULL);
164 161
165 void* chunk = 162 void* chunk =
166 MemoryAllocator::ReserveInitialChunk(2 * Heap::YoungGenerationSize()); 163 MemoryAllocator::ReserveInitialChunk(2 * Heap::YoungGenerationSize());
167 CHECK(chunk != NULL); 164 CHECK(chunk != NULL);
168 Address start = RoundUp(static_cast<Address>(chunk), 165 Address start = RoundUp(static_cast<Address>(chunk),
169 Heap::YoungGenerationSize()); 166 Heap::YoungGenerationSize());
170 CHECK(s->Setup(start, Heap::YoungGenerationSize())); 167 CHECK(new_space.Setup(start, Heap::YoungGenerationSize()));
171 CHECK(s->HasBeenSetup()); 168 CHECK(new_space.HasBeenSetup());
172 169
173 while (s->Available() >= Page::kMaxHeapObjectSize) { 170 while (new_space.Available() >= Page::kMaxHeapObjectSize) {
174 Object* obj = s->AllocateRaw(Page::kMaxHeapObjectSize); 171 Object* obj = new_space.AllocateRaw(Page::kMaxHeapObjectSize);
175 CHECK(!obj->IsFailure()); 172 CHECK(!obj->IsFailure());
176 CHECK(s->Contains(HeapObject::cast(obj))); 173 CHECK(new_space.Contains(HeapObject::cast(obj)));
177 } 174 }
178 175
179 s->TearDown(); 176 new_space.TearDown();
180 delete s;
181 MemoryAllocator::TearDown(); 177 MemoryAllocator::TearDown();
182 } 178 }
183 179
184 180
185 TEST(OldSpace) { 181 TEST(OldSpace) {
186 CHECK(Heap::ConfigureHeapDefault()); 182 CHECK(Heap::ConfigureHeapDefault());
187 CHECK(MemoryAllocator::Setup(Heap::MaxCapacity())); 183 CHECK(MemoryAllocator::Setup(Heap::MaxCapacity()));
188 184
189 OldSpace* s = new OldSpace(Heap::OldGenerationSize(), 185 OldSpace* s = new OldSpace(Heap::OldGenerationSize(),
190 OLD_POINTER_SPACE, 186 OLD_POINTER_SPACE,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 CHECK(!lo->IsEmpty()); 242 CHECK(!lo->IsEmpty());
247 243
248 obj = lo->AllocateRaw(lo_size); 244 obj = lo->AllocateRaw(lo_size);
249 CHECK(obj->IsFailure()); 245 CHECK(obj->IsFailure());
250 246
251 lo->TearDown(); 247 lo->TearDown();
252 delete lo; 248 delete lo;
253 249
254 MemoryAllocator::TearDown(); 250 MemoryAllocator::TearDown();
255 } 251 }
OLDNEW
« src/spaces.cc ('K') | « src/spaces-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698