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

Side by Side Diff: src/heap.cc

Issue 174521: Push change to move shrinking of new space from compaction to idle... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 11 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/version.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 EnsureFromSpaceIsCommitted(); 458 EnsureFromSpaceIsCommitted();
459 if (collector == MARK_COMPACTOR) { 459 if (collector == MARK_COMPACTOR) {
460 MarkCompact(tracer); 460 MarkCompact(tracer);
461 461
462 int old_gen_size = PromotedSpaceSize(); 462 int old_gen_size = PromotedSpaceSize();
463 old_gen_promotion_limit_ = 463 old_gen_promotion_limit_ =
464 old_gen_size + Max(kMinimumPromotionLimit, old_gen_size / 3); 464 old_gen_size + Max(kMinimumPromotionLimit, old_gen_size / 3);
465 old_gen_allocation_limit_ = 465 old_gen_allocation_limit_ =
466 old_gen_size + Max(kMinimumAllocationLimit, old_gen_size / 2); 466 old_gen_size + Max(kMinimumAllocationLimit, old_gen_size / 2);
467 old_gen_exhausted_ = false; 467 old_gen_exhausted_ = false;
468 } else {
469 Scavenge();
470 } 468 }
469 Scavenge();
470
471 Counters::objs_since_last_young.Set(0); 471 Counters::objs_since_last_young.Set(0);
472 472
473 PostGarbageCollectionProcessing(); 473 PostGarbageCollectionProcessing();
474 474
475 if (collector == MARK_COMPACTOR) { 475 if (collector == MARK_COMPACTOR) {
476 // Register the amount of external allocated memory. 476 // Register the amount of external allocated memory.
477 amount_of_external_allocated_memory_at_last_global_gc_ = 477 amount_of_external_allocated_memory_at_last_global_gc_ =
478 amount_of_external_allocated_memory_; 478 amount_of_external_allocated_memory_;
479 } 479 }
480 480
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 MarkCompactEpilogue(is_compacting); 514 MarkCompactEpilogue(is_compacting);
515 515
516 LOG(ResourceEvent("markcompact", "end")); 516 LOG(ResourceEvent("markcompact", "end"));
517 517
518 gc_state_ = NOT_IN_GC; 518 gc_state_ = NOT_IN_GC;
519 519
520 Shrink(); 520 Shrink();
521 521
522 Counters::objs_since_last_full.Set(0); 522 Counters::objs_since_last_full.Set(0);
523 context_disposed_pending_ = false; 523 context_disposed_pending_ = false;
524
525 Scavenge();
526
527 // Shrink new space as much as possible after compacting full
528 // garbage collections.
529 if (is_compacting) new_space_.Shrink();
530 } 524 }
531 525
532 526
533 void Heap::MarkCompactPrologue(bool is_compacting) { 527 void Heap::MarkCompactPrologue(bool is_compacting) {
534 // At any old GC clear the keyed lookup cache to enable collection of unused 528 // At any old GC clear the keyed lookup cache to enable collection of unused
535 // maps. 529 // maps.
536 KeyedLookupCache::Clear(); 530 KeyedLookupCache::Clear();
537 ContextSlotCache::Clear(); 531 ContextSlotCache::Clear();
538 DescriptorLookupCache::Clear(); 532 DescriptorLookupCache::Clear();
539 533
(...skipping 2260 matching lines...) Expand 10 before | Expand all | Expand 10 after
2800 } 2794 }
2801 2795
2802 if (number_idle_notifications >= kIdlesBeforeCollection) { 2796 if (number_idle_notifications >= kIdlesBeforeCollection) {
2803 // The first time through we collect without forcing compaction. 2797 // The first time through we collect without forcing compaction.
2804 // The second time through we force compaction and quit. 2798 // The second time through we force compaction and quit.
2805 bool force_compaction = 2799 bool force_compaction =
2806 number_idle_notifications > kIdlesBeforeCollection; 2800 number_idle_notifications > kIdlesBeforeCollection;
2807 CollectAllGarbage(force_compaction); 2801 CollectAllGarbage(force_compaction);
2808 last_gc_count = gc_count_; 2802 last_gc_count = gc_count_;
2809 if (force_compaction) { 2803 if (force_compaction) {
2804 // Shrink new space.
2805 new_space_.Shrink();
2810 number_idle_notifications = 0; 2806 number_idle_notifications = 0;
2811 finished = true; 2807 finished = true;
2812 } 2808 }
2813 } 2809 }
2814 2810
2815 // Uncommit unused memory in new space. 2811 // Uncommit unused memory in new space.
2816 Heap::UncommitFromSpace(); 2812 Heap::UncommitFromSpace();
2817 return finished; 2813 return finished;
2818 } 2814 }
2819 2815
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
3959 #ifdef DEBUG 3955 #ifdef DEBUG
3960 bool Heap::GarbageCollectionGreedyCheck() { 3956 bool Heap::GarbageCollectionGreedyCheck() {
3961 ASSERT(FLAG_gc_greedy); 3957 ASSERT(FLAG_gc_greedy);
3962 if (Bootstrapper::IsActive()) return true; 3958 if (Bootstrapper::IsActive()) return true;
3963 if (disallow_allocation_failure()) return true; 3959 if (disallow_allocation_failure()) return true;
3964 return CollectGarbage(0, NEW_SPACE); 3960 return CollectGarbage(0, NEW_SPACE);
3965 } 3961 }
3966 #endif 3962 #endif
3967 3963
3968 } } // namespace v8::internal 3964 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698