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

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

Issue 1361853005: [heap] Prepare code for smaller large object allocation limit than max allocatable memory. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « test/cctest/test-heap.cc ('k') | test/cctest/test-weakmaps.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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 CHECK(compaction_space != NULL); 419 CHECK(compaction_space != NULL);
420 CHECK(compaction_space->SetUp()); 420 CHECK(compaction_space->SetUp());
421 421
422 OldSpace* old_space = new OldSpace(heap, OLD_SPACE, NOT_EXECUTABLE); 422 OldSpace* old_space = new OldSpace(heap, OLD_SPACE, NOT_EXECUTABLE);
423 CHECK(old_space != NULL); 423 CHECK(old_space != NULL);
424 CHECK(old_space->SetUp()); 424 CHECK(old_space->SetUp());
425 425
426 // Cannot loop until "Available()" since we initially have 0 bytes available 426 // Cannot loop until "Available()" since we initially have 0 bytes available
427 // and would thus neither grow, nor be able to allocate an object. 427 // and would thus neither grow, nor be able to allocate an object.
428 const int kNumObjects = 100; 428 const int kNumObjects = 100;
429 const int kExpectedPages = kNumObjects; 429 const int kExpectedPages = (kNumObjects / (compaction_space->AreaSize() /
430 Page::kMaxRegularHeapObjectSize));
430 for (int i = 0; i < kNumObjects; i++) { 431 for (int i = 0; i < kNumObjects; i++) {
431 compaction_space->AllocateRawUnaligned(Page::kMaxRegularHeapObjectSize) 432 compaction_space->AllocateRawUnaligned(Page::kMaxRegularHeapObjectSize)
432 .ToObjectChecked(); 433 .ToObjectChecked();
433 } 434 }
434 int pages_in_old_space = old_space->CountTotalPages(); 435 int pages_in_old_space = old_space->CountTotalPages();
435 int pages_in_compaction_space = compaction_space->CountTotalPages(); 436 int pages_in_compaction_space = compaction_space->CountTotalPages();
436 CHECK_EQ(pages_in_compaction_space, kExpectedPages); 437 CHECK_EQ(pages_in_compaction_space, kExpectedPages);
437 CHECK_LE(pages_in_old_space, 1); 438 CHECK_LE(pages_in_old_space, 1);
438 439
439 old_space->MergeCompactionSpace(compaction_space); 440 old_space->MergeCompactionSpace(compaction_space);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 635
635 // Turn the allocation into a proper object so isolate teardown won't 636 // Turn the allocation into a proper object so isolate teardown won't
636 // crash. 637 // crash.
637 HeapObject* free_space = NULL; 638 HeapObject* free_space = NULL;
638 CHECK(allocation.To(&free_space)); 639 CHECK(allocation.To(&free_space));
639 new_space->heap()->CreateFillerObjectAt(free_space->address(), 80); 640 new_space->heap()->CreateFillerObjectAt(free_space->address(), 80);
640 } 641 }
641 } 642 }
642 isolate->Dispose(); 643 isolate->Dispose();
643 } 644 }
OLDNEW
« no previous file with comments | « test/cctest/test-heap.cc ('k') | test/cctest/test-weakmaps.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698