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

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

Issue 1352453004: Perform scavenge in idle tasks. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase 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 | « src/heap/spaces.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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 CHECK(result->SameValue(expected)); 518 CHECK(result->SameValue(expected));
519 } 519 }
520 520
521 521
522 static inline void ExpectUndefined(const char* code) { 522 static inline void ExpectUndefined(const char* code) {
523 v8::Local<v8::Value> result = CompileRun(code); 523 v8::Local<v8::Value> result = CompileRun(code);
524 CHECK(result->IsUndefined()); 524 CHECK(result->IsUndefined());
525 } 525 }
526 526
527 527
528 static inline void DisableInlineAllocationSteps(v8::internal::NewSpace* space) {
529 space->LowerInlineAllocationLimit(0);
530 }
531
532
528 // Helper function that simulates a full new-space in the heap. 533 // Helper function that simulates a full new-space in the heap.
529 static inline bool FillUpOnePage(v8::internal::NewSpace* space) { 534 static inline bool FillUpOnePage(v8::internal::NewSpace* space) {
535 DisableInlineAllocationSteps(space);
530 v8::internal::AllocationResult allocation = space->AllocateRawUnaligned( 536 v8::internal::AllocationResult allocation = space->AllocateRawUnaligned(
531 v8::internal::Page::kMaxRegularHeapObjectSize); 537 v8::internal::Page::kMaxRegularHeapObjectSize);
532 if (allocation.IsRetry()) return false; 538 if (allocation.IsRetry()) return false;
533 v8::internal::HeapObject* free_space = NULL; 539 v8::internal::HeapObject* free_space = NULL;
534 CHECK(allocation.To(&free_space)); 540 CHECK(allocation.To(&free_space));
535 space->heap()->CreateFillerObjectAt( 541 space->heap()->CreateFillerObjectAt(
536 free_space->address(), v8::internal::Page::kMaxRegularHeapObjectSize); 542 free_space->address(), v8::internal::Page::kMaxRegularHeapObjectSize);
537 return true; 543 return true;
538 } 544 }
539 545
540 546
541 // Helper function that simulates a fill new-space in the heap. 547 // Helper function that simulates a fill new-space in the heap.
542 static inline void AllocateAllButNBytes(v8::internal::NewSpace* space, 548 static inline void AllocateAllButNBytes(v8::internal::NewSpace* space,
543 int extra_bytes) { 549 int extra_bytes) {
550 DisableInlineAllocationSteps(space);
544 int space_remaining = static_cast<int>(*space->allocation_limit_address() - 551 int space_remaining = static_cast<int>(*space->allocation_limit_address() -
545 *space->allocation_top_address()); 552 *space->allocation_top_address());
546 CHECK(space_remaining >= extra_bytes); 553 CHECK(space_remaining >= extra_bytes);
547 int new_linear_size = space_remaining - extra_bytes; 554 int new_linear_size = space_remaining - extra_bytes;
548 if (new_linear_size == 0) return; 555 if (new_linear_size == 0) return;
549 v8::internal::AllocationResult allocation = 556 v8::internal::AllocationResult allocation =
550 space->AllocateRawUnaligned(new_linear_size); 557 space->AllocateRawUnaligned(new_linear_size);
551 v8::internal::HeapObject* free_space = NULL; 558 v8::internal::HeapObject* free_space = NULL;
552 CHECK(allocation.To(&free_space)); 559 CHECK(allocation.To(&free_space));
553 space->heap()->CreateFillerObjectAt(free_space->address(), new_linear_size); 560 space->heap()->CreateFillerObjectAt(free_space->address(), new_linear_size);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 HandleAndZoneScope() {} 646 HandleAndZoneScope() {}
640 647
641 // Prefixing the below with main_ reduces a lot of naming clashes. 648 // Prefixing the below with main_ reduces a lot of naming clashes.
642 i::Zone* main_zone() { return &main_zone_; } 649 i::Zone* main_zone() { return &main_zone_; }
643 650
644 private: 651 private:
645 i::Zone main_zone_; 652 i::Zone main_zone_;
646 }; 653 };
647 654
648 #endif // ifndef CCTEST_H_ 655 #endif // ifndef CCTEST_H_
OLDNEW
« no previous file with comments | « src/heap/spaces.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698