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

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

Issue 2040813005: [snapshot] remove metadata field. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed nit Created 4 years, 6 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 | « src/snapshot/snapshot-common.cc ('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 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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 CHECK(lo->AllocateRaw(lo_size, NOT_EXECUTABLE).IsRetry()); 478 CHECK(lo->AllocateRaw(lo_size, NOT_EXECUTABLE).IsRetry());
479 } 479 }
480 480
481 481
482 TEST(SizeOfFirstPageIsLargeEnough) { 482 TEST(SizeOfFirstPageIsLargeEnough) {
483 if (i::FLAG_always_opt) return; 483 if (i::FLAG_always_opt) return;
484 // Bootstrapping without a snapshot causes more allocations. 484 // Bootstrapping without a snapshot causes more allocations.
485 CcTest::InitializeVM(); 485 CcTest::InitializeVM();
486 Isolate* isolate = CcTest::i_isolate(); 486 Isolate* isolate = CcTest::i_isolate();
487 if (!isolate->snapshot_available()) return; 487 if (!isolate->snapshot_available()) return;
488 if (Snapshot::EmbedsScript(isolate)) return; 488 HandleScope scope(isolate);
489 v8::Local<v8::Context> context = CcTest::isolate()->GetCurrentContext();
490 // Skip this test on the custom snapshot builder.
491 if (!CcTest::global()
492 ->Get(context, v8_str("assertEquals"))
493 .ToLocalChecked()
494 ->IsUndefined()) {
495 return;
496 }
489 497
490 // If this test fails due to enabling experimental natives that are not part 498 // If this test fails due to enabling experimental natives that are not part
491 // of the snapshot, we may need to adjust CalculateFirstPageSizes. 499 // of the snapshot, we may need to adjust CalculateFirstPageSizes.
492 500
493 // Freshly initialized VM gets by with one page per space. 501 // Freshly initialized VM gets by with one page per space.
494 for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) { 502 for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) {
495 // Debug code can be very large, so skip CODE_SPACE if we are generating it. 503 // Debug code can be very large, so skip CODE_SPACE if we are generating it.
496 if (i == CODE_SPACE && i::FLAG_debug_code) continue; 504 if (i == CODE_SPACE && i::FLAG_debug_code) continue;
497 CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages()); 505 CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages());
498 } 506 }
499 507
500 // Executing the empty script gets by with one page per space. 508 // Executing the empty script gets by with one page per space.
501 HandleScope scope(isolate);
502 CompileRun("/*empty*/"); 509 CompileRun("/*empty*/");
503 for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) { 510 for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) {
504 // Debug code can be very large, so skip CODE_SPACE if we are generating it. 511 // Debug code can be very large, so skip CODE_SPACE if we are generating it.
505 if (i == CODE_SPACE && i::FLAG_debug_code) continue; 512 if (i == CODE_SPACE && i::FLAG_debug_code) continue;
506 CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages()); 513 CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages());
507 } 514 }
508 515
509 // No large objects required to perform the above steps. 516 // No large objects required to perform the above steps.
510 CHECK(isolate->heap()->lo_space()->IsEmpty()); 517 CHECK(isolate->heap()->lo_space()->IsEmpty());
511 } 518 }
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 new_space->RemoveAllocationObserver(&observer2); 676 new_space->RemoveAllocationObserver(&observer2);
670 677
671 CHECK_EQ(observer1.count(), 32); 678 CHECK_EQ(observer1.count(), 32);
672 CHECK_EQ(observer2.count(), 28); 679 CHECK_EQ(observer2.count(), 28);
673 } 680 }
674 isolate->Dispose(); 681 isolate->Dispose();
675 } 682 }
676 683
677 } // namespace internal 684 } // namespace internal
678 } // namespace v8 685 } // namespace v8
OLDNEW
« no previous file with comments | « src/snapshot/snapshot-common.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698