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

Side by Side Diff: test/cctest/cctest.h

Issue 882443004: Revert of Only use FreeSpace objects in the free list. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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/serialize.cc ('k') | test/cctest/test-heap.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 2008 the V8 project authors. All rights reserved. 1 // Copyright 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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 v8::Local<v8::Value> result = CompileRun(code); 479 v8::Local<v8::Value> result = CompileRun(code);
480 CHECK(result->IsUndefined()); 480 CHECK(result->IsUndefined());
481 } 481 }
482 482
483 483
484 // Helper function that simulates a full new-space in the heap. 484 // Helper function that simulates a full new-space in the heap.
485 static inline bool FillUpOnePage(v8::internal::NewSpace* space) { 485 static inline bool FillUpOnePage(v8::internal::NewSpace* space) {
486 v8::internal::AllocationResult allocation = 486 v8::internal::AllocationResult allocation =
487 space->AllocateRaw(v8::internal::Page::kMaxRegularHeapObjectSize); 487 space->AllocateRaw(v8::internal::Page::kMaxRegularHeapObjectSize);
488 if (allocation.IsRetry()) return false; 488 if (allocation.IsRetry()) return false;
489 v8::internal::HeapObject* free_space; 489 v8::internal::FreeListNode* node =
490 CHECK(allocation.To(&free_space)); 490 v8::internal::FreeListNode::cast(allocation.ToObjectChecked());
491 space->heap()->CreateFillerObjectAt( 491 node->set_size(space->heap(), v8::internal::Page::kMaxRegularHeapObjectSize);
492 free_space->address(), v8::internal::Page::kMaxRegularHeapObjectSize);
493 return true; 492 return true;
494 } 493 }
495 494
496 495
497 // Helper function that simulates a fill new-space in the heap. 496 static inline void SimulateFullSpace(v8::internal::NewSpace* space) {
498 static inline void AllocateAllButNBytes(v8::internal::NewSpace* space, 497 int new_linear_size = static_cast<int>(*space->allocation_limit_address() -
499 int extra_bytes) {
500 int space_remaining = static_cast<int>(*space->allocation_limit_address() -
501 *space->allocation_top_address()); 498 *space->allocation_top_address());
502 CHECK(space_remaining >= extra_bytes); 499 if (new_linear_size > 0) {
503 int new_linear_size = space_remaining - extra_bytes; 500 // Fill up the current page.
504 if (new_linear_size == 0) return; 501 v8::internal::AllocationResult allocation =
505 v8::internal::AllocationResult allocation = 502 space->AllocateRaw(new_linear_size);
506 space->AllocateRaw(new_linear_size); 503 v8::internal::FreeListNode* node =
507 v8::internal::HeapObject* free_space; 504 v8::internal::FreeListNode::cast(allocation.ToObjectChecked());
508 CHECK(allocation.To(&free_space)); 505 node->set_size(space->heap(), new_linear_size);
509 space->heap()->CreateFillerObjectAt(free_space->address(), new_linear_size); 506 }
507 // Fill up all remaining pages.
508 while (FillUpOnePage(space))
509 ;
510 } 510 }
511 511
512 512
513 static inline void FillCurrentPage(v8::internal::NewSpace* space) {
514 AllocateAllButNBytes(space, 0);
515 }
516
517
518 static inline void SimulateFullSpace(v8::internal::NewSpace* space) {
519 FillCurrentPage(space);
520 while (FillUpOnePage(space)) {
521 }
522 }
523
524
525 // Helper function that simulates a full old-space in the heap. 513 // Helper function that simulates a full old-space in the heap.
526 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) { 514 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) {
527 space->EmptyAllocationInfo(); 515 space->EmptyAllocationInfo();
528 space->ResetFreeList(); 516 space->ResetFreeList();
529 space->ClearStats(); 517 space->ClearStats();
530 } 518 }
531 519
532 520
533 // Helper function that simulates many incremental marking steps until 521 // Helper function that simulates many incremental marking steps until
534 // marking is completed. 522 // marking is completed.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 HandleAndZoneScope() {} 580 HandleAndZoneScope() {}
593 581
594 // Prefixing the below with main_ reduces a lot of naming clashes. 582 // Prefixing the below with main_ reduces a lot of naming clashes.
595 i::Zone* main_zone() { return &main_zone_; } 583 i::Zone* main_zone() { return &main_zone_; }
596 584
597 private: 585 private:
598 i::Zone main_zone_; 586 i::Zone main_zone_;
599 }; 587 };
600 588
601 #endif // ifndef CCTEST_H_ 589 #endif // ifndef CCTEST_H_
OLDNEW
« no previous file with comments | « src/serialize.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698