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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 CHECK(memory_allocator->SetUp(heap->MaxReserved(), | 184 CHECK(memory_allocator->SetUp(heap->MaxReserved(), |
185 heap->MaxExecutableSize())); | 185 heap->MaxExecutableSize())); |
186 TestMemoryAllocatorScope test_scope(isolate, memory_allocator); | 186 TestMemoryAllocatorScope test_scope(isolate, memory_allocator); |
187 | 187 |
188 NewSpace new_space(heap); | 188 NewSpace new_space(heap); |
189 | 189 |
190 CHECK(new_space.SetUp(HEAP->ReservedSemiSpaceSize(), | 190 CHECK(new_space.SetUp(HEAP->ReservedSemiSpaceSize(), |
191 HEAP->ReservedSemiSpaceSize())); | 191 HEAP->ReservedSemiSpaceSize())); |
192 CHECK(new_space.HasBeenSetUp()); | 192 CHECK(new_space.HasBeenSetUp()); |
193 | 193 |
194 while (new_space.Available() >= Page::kMaxHeapObjectSize) { | 194 while (new_space.Available() >= Page::kMaxNonCodeHeapObjectSize) { |
195 Object* obj = | 195 Object* obj = |
196 new_space.AllocateRaw(Page::kMaxHeapObjectSize)->ToObjectUnchecked(); | 196 new_space.AllocateRaw(Page::kMaxNonCodeHeapObjectSize)-> |
| 197 ToObjectUnchecked(); |
197 CHECK(new_space.Contains(HeapObject::cast(obj))); | 198 CHECK(new_space.Contains(HeapObject::cast(obj))); |
198 } | 199 } |
199 | 200 |
200 new_space.TearDown(); | 201 new_space.TearDown(); |
201 memory_allocator->TearDown(); | 202 memory_allocator->TearDown(); |
202 delete memory_allocator; | 203 delete memory_allocator; |
203 } | 204 } |
204 | 205 |
205 | 206 |
206 TEST(OldSpace) { | 207 TEST(OldSpace) { |
207 OS::SetUp(); | 208 OS::SetUp(); |
208 Isolate* isolate = Isolate::Current(); | 209 Isolate* isolate = Isolate::Current(); |
209 isolate->InitializeLoggingAndCounters(); | 210 isolate->InitializeLoggingAndCounters(); |
210 Heap* heap = isolate->heap(); | 211 Heap* heap = isolate->heap(); |
211 CHECK(heap->ConfigureHeapDefault()); | 212 CHECK(heap->ConfigureHeapDefault()); |
212 MemoryAllocator* memory_allocator = new MemoryAllocator(isolate); | 213 MemoryAllocator* memory_allocator = new MemoryAllocator(isolate); |
213 CHECK(memory_allocator->SetUp(heap->MaxReserved(), | 214 CHECK(memory_allocator->SetUp(heap->MaxReserved(), |
214 heap->MaxExecutableSize())); | 215 heap->MaxExecutableSize())); |
215 TestMemoryAllocatorScope test_scope(isolate, memory_allocator); | 216 TestMemoryAllocatorScope test_scope(isolate, memory_allocator); |
216 | 217 |
217 OldSpace* s = new OldSpace(heap, | 218 OldSpace* s = new OldSpace(heap, |
218 heap->MaxOldGenerationSize(), | 219 heap->MaxOldGenerationSize(), |
219 OLD_POINTER_SPACE, | 220 OLD_POINTER_SPACE, |
220 NOT_EXECUTABLE); | 221 NOT_EXECUTABLE); |
221 CHECK(s != NULL); | 222 CHECK(s != NULL); |
222 | 223 |
223 CHECK(s->SetUp()); | 224 CHECK(s->SetUp()); |
224 | 225 |
225 while (s->Available() > 0) { | 226 while (s->Available() > 0) { |
226 s->AllocateRaw(Page::kMaxHeapObjectSize)->ToObjectUnchecked(); | 227 s->AllocateRaw(Page::kMaxNonCodeHeapObjectSize)->ToObjectUnchecked(); |
227 } | 228 } |
228 | 229 |
229 s->TearDown(); | 230 s->TearDown(); |
230 delete s; | 231 delete s; |
231 memory_allocator->TearDown(); | 232 memory_allocator->TearDown(); |
232 delete memory_allocator; | 233 delete memory_allocator; |
233 } | 234 } |
234 | 235 |
235 | 236 |
236 TEST(LargeObjectSpace) { | 237 TEST(LargeObjectSpace) { |
(...skipping 20 matching lines...) Expand all Loading... |
257 { MaybeObject* maybe_obj = lo->AllocateRaw(lo_size, NOT_EXECUTABLE); | 258 { MaybeObject* maybe_obj = lo->AllocateRaw(lo_size, NOT_EXECUTABLE); |
258 if (!maybe_obj->ToObject(&obj)) break; | 259 if (!maybe_obj->ToObject(&obj)) break; |
259 } | 260 } |
260 CHECK(lo->Available() < available); | 261 CHECK(lo->Available() < available); |
261 }; | 262 }; |
262 | 263 |
263 CHECK(!lo->IsEmpty()); | 264 CHECK(!lo->IsEmpty()); |
264 | 265 |
265 CHECK(lo->AllocateRaw(lo_size, NOT_EXECUTABLE)->IsFailure()); | 266 CHECK(lo->AllocateRaw(lo_size, NOT_EXECUTABLE)->IsFailure()); |
266 } | 267 } |
OLD | NEW |