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

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

Issue 652543007: Add support for a target new space size (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/heap/spaces.cc ('k') | test/cctest/test-spaces.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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 } 474 }
475 475
476 476
477 static inline void ExpectUndefined(const char* code) { 477 static inline void ExpectUndefined(const char* code) {
478 v8::Local<v8::Value> result = CompileRun(code); 478 v8::Local<v8::Value> result = CompileRun(code);
479 CHECK(result->IsUndefined()); 479 CHECK(result->IsUndefined());
480 } 480 }
481 481
482 482
483 // Helper function that simulates a full new-space in the heap. 483 // Helper function that simulates a full new-space in the heap.
484 static inline void SimulateFullSpace(v8::internal::NewSpace* space) { 484 static inline bool FillUpOnePage(v8::internal::NewSpace* space) {
485 int new_linear_size = static_cast<int>(
486 *space->allocation_limit_address() - *space->allocation_top_address());
487 if (new_linear_size == 0) return;
488 v8::internal::AllocationResult allocation = 485 v8::internal::AllocationResult allocation =
489 space->AllocateRaw(new_linear_size); 486 space->AllocateRaw(v8::internal::Page::kMaxRegularHeapObjectSize);
487 if (allocation.IsRetry()) return false;
490 v8::internal::FreeListNode* node = 488 v8::internal::FreeListNode* node =
491 v8::internal::FreeListNode::cast(allocation.ToObjectChecked()); 489 v8::internal::FreeListNode::cast(allocation.ToObjectChecked());
492 node->set_size(space->heap(), new_linear_size); 490 node->set_size(space->heap(), v8::internal::Page::kMaxRegularHeapObjectSize);
491 return true;
493 } 492 }
494 493
495 494
495 static inline void SimulateFullSpace(v8::internal::NewSpace* space) {
496 int new_linear_size = static_cast<int>(*space->allocation_limit_address() -
497 *space->allocation_top_address());
498 if (new_linear_size > 0) {
499 // Fill up the current page.
500 v8::internal::AllocationResult allocation =
501 space->AllocateRaw(new_linear_size);
502 v8::internal::FreeListNode* node =
503 v8::internal::FreeListNode::cast(allocation.ToObjectChecked());
504 node->set_size(space->heap(), new_linear_size);
505 }
506 // Fill up all remaining pages.
507 while (FillUpOnePage(space))
508 ;
509 }
510
511
496 // Helper function that simulates a full old-space in the heap. 512 // Helper function that simulates a full old-space in the heap.
497 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) { 513 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) {
498 space->EmptyAllocationInfo(); 514 space->EmptyAllocationInfo();
499 space->ResetFreeList(); 515 space->ResetFreeList();
500 space->ClearStats(); 516 space->ClearStats();
501 } 517 }
502 518
503 519
504 // Helper function that simulates many incremental marking steps until 520 // Helper function that simulates many incremental marking steps until
505 // marking is completed. 521 // marking is completed.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 HandleAndZoneScope() : main_zone_(main_isolate()) {} 579 HandleAndZoneScope() : main_zone_(main_isolate()) {}
564 580
565 // Prefixing the below with main_ reduces a lot of naming clashes. 581 // Prefixing the below with main_ reduces a lot of naming clashes.
566 i::Zone* main_zone() { return &main_zone_; } 582 i::Zone* main_zone() { return &main_zone_; }
567 583
568 private: 584 private:
569 i::Zone main_zone_; 585 i::Zone main_zone_;
570 }; 586 };
571 587
572 #endif // ifndef CCTEST_H_ 588 #endif // ifndef CCTEST_H_
OLDNEW
« no previous file with comments | « src/heap/spaces.cc ('k') | test/cctest/test-spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698