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

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

Issue 1023443004: Version 4.3.48.1 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.3.48
Patch Set: Created 5 years, 9 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 | « test/cctest/test-serialize.cc ('k') | test/cctest/test-unboxed-doubles.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 301
302 TEST(MemoryAllocator) { 302 TEST(MemoryAllocator) {
303 Isolate* isolate = CcTest::i_isolate(); 303 Isolate* isolate = CcTest::i_isolate();
304 Heap* heap = isolate->heap(); 304 Heap* heap = isolate->heap();
305 305
306 MemoryAllocator* memory_allocator = new MemoryAllocator(isolate); 306 MemoryAllocator* memory_allocator = new MemoryAllocator(isolate);
307 CHECK(memory_allocator->SetUp(heap->MaxReserved(), 307 CHECK(memory_allocator->SetUp(heap->MaxReserved(),
308 heap->MaxExecutableSize())); 308 heap->MaxExecutableSize()));
309 309
310 int total_pages = 0; 310 int total_pages = 0;
311 OldSpace faked_space(heap, heap->MaxReserved(), OLD_SPACE, NOT_EXECUTABLE); 311 OldSpace faked_space(heap, heap->MaxReserved(), OLD_POINTER_SPACE,
312 NOT_EXECUTABLE);
312 Page* first_page = memory_allocator->AllocatePage( 313 Page* first_page = memory_allocator->AllocatePage(
313 faked_space.AreaSize(), &faked_space, NOT_EXECUTABLE); 314 faked_space.AreaSize(), &faked_space, NOT_EXECUTABLE);
314 315
315 first_page->InsertAfter(faked_space.anchor()->prev_page()); 316 first_page->InsertAfter(faked_space.anchor()->prev_page());
316 CHECK(first_page->is_valid()); 317 CHECK(first_page->is_valid());
317 CHECK(first_page->next_page() == faked_space.anchor()); 318 CHECK(first_page->next_page() == faked_space.anchor());
318 total_pages++; 319 total_pages++;
319 320
320 for (Page* p = first_page; p != faked_space.anchor(); p = p->next_page()) { 321 for (Page* p = first_page; p != faked_space.anchor(); p = p->next_page()) {
321 CHECK(p->owner() == &faked_space); 322 CHECK(p->owner() == &faked_space);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 371
371 372
372 TEST(OldSpace) { 373 TEST(OldSpace) {
373 Isolate* isolate = CcTest::i_isolate(); 374 Isolate* isolate = CcTest::i_isolate();
374 Heap* heap = isolate->heap(); 375 Heap* heap = isolate->heap();
375 MemoryAllocator* memory_allocator = new MemoryAllocator(isolate); 376 MemoryAllocator* memory_allocator = new MemoryAllocator(isolate);
376 CHECK(memory_allocator->SetUp(heap->MaxReserved(), 377 CHECK(memory_allocator->SetUp(heap->MaxReserved(),
377 heap->MaxExecutableSize())); 378 heap->MaxExecutableSize()));
378 TestMemoryAllocatorScope test_scope(isolate, memory_allocator); 379 TestMemoryAllocatorScope test_scope(isolate, memory_allocator);
379 380
380 OldSpace* s = new OldSpace(heap, heap->MaxOldGenerationSize(), OLD_SPACE, 381 OldSpace* s = new OldSpace(heap, heap->MaxOldGenerationSize(),
381 NOT_EXECUTABLE); 382 OLD_POINTER_SPACE, NOT_EXECUTABLE);
382 CHECK(s != NULL); 383 CHECK(s != NULL);
383 384
384 CHECK(s->SetUp()); 385 CHECK(s->SetUp());
385 386
386 while (s->Available() > 0) { 387 while (s->Available() > 0) {
387 s->AllocateRaw(Page::kMaxRegularHeapObjectSize).ToObjectChecked(); 388 s->AllocateRaw(Page::kMaxRegularHeapObjectSize).ToObjectChecked();
388 } 389 }
389 390
390 s->TearDown(); 391 s->TearDown();
391 delete s; 392 delete s;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 490
490 // Turn the allocation into a proper object so isolate teardown won't 491 // Turn the allocation into a proper object so isolate teardown won't
491 // crash. 492 // crash.
492 HeapObject* free_space = NULL; 493 HeapObject* free_space = NULL;
493 CHECK(allocation.To(&free_space)); 494 CHECK(allocation.To(&free_space));
494 new_space->heap()->CreateFillerObjectAt(free_space->address(), 80); 495 new_space->heap()->CreateFillerObjectAt(free_space->address(), 80);
495 } 496 }
496 } 497 }
497 isolate->Dispose(); 498 isolate->Dispose();
498 } 499 }
OLDNEW
« no previous file with comments | « test/cctest/test-serialize.cc ('k') | test/cctest/test-unboxed-doubles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698