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

Side by Side Diff: src/heap.cc

Issue 10933124: Do 2 GCs on LowMemoryNotification instead of 7. Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 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 | « src/heap.h ('k') | src/heap-inl.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 gc_count_(0), 112 gc_count_(0),
113 remembered_unmapped_pages_index_(0), 113 remembered_unmapped_pages_index_(0),
114 unflattened_strings_length_(0), 114 unflattened_strings_length_(0),
115 #ifdef DEBUG 115 #ifdef DEBUG
116 allocation_allowed_(true), 116 allocation_allowed_(true),
117 allocation_timeout_(0), 117 allocation_timeout_(0),
118 disallow_allocation_failure_(false), 118 disallow_allocation_failure_(false),
119 debug_utils_(NULL), 119 debug_utils_(NULL),
120 #endif // DEBUG 120 #endif // DEBUG
121 new_space_high_promotion_mode_active_(false), 121 new_space_high_promotion_mode_active_(false),
122 flush_eagerly_(false),
122 old_gen_promotion_limit_(kMinimumPromotionLimit), 123 old_gen_promotion_limit_(kMinimumPromotionLimit),
123 old_gen_allocation_limit_(kMinimumAllocationLimit), 124 old_gen_allocation_limit_(kMinimumAllocationLimit),
124 old_gen_limit_factor_(1), 125 old_gen_limit_factor_(1),
125 size_of_old_gen_at_last_old_space_gc_(0), 126 size_of_old_gen_at_last_old_space_gc_(0),
126 external_allocation_limit_(0), 127 external_allocation_limit_(0),
127 amount_of_external_allocated_memory_(0), 128 amount_of_external_allocated_memory_(0),
128 amount_of_external_allocated_memory_at_last_global_gc_(0), 129 amount_of_external_allocated_memory_at_last_global_gc_(0),
129 old_gen_exhausted_(false), 130 old_gen_exhausted_(false),
130 store_buffer_rebuilder_(store_buffer()), 131 store_buffer_rebuilder_(store_buffer()),
131 hidden_symbol_(NULL), 132 hidden_symbol_(NULL),
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 // handles, but won't collect weakly reachable objects until next 540 // handles, but won't collect weakly reachable objects until next
540 // major GC. Therefore if we collect aggressively and weak handle callback 541 // major GC. Therefore if we collect aggressively and weak handle callback
541 // has been invoked, we rerun major GC to release objects which become 542 // has been invoked, we rerun major GC to release objects which become
542 // garbage. 543 // garbage.
543 // Note: as weak callbacks can execute arbitrary code, we cannot 544 // Note: as weak callbacks can execute arbitrary code, we cannot
544 // hope that eventually there will be no weak callbacks invocations. 545 // hope that eventually there will be no weak callbacks invocations.
545 // Therefore stop recollecting after several attempts. 546 // Therefore stop recollecting after several attempts.
546 mark_compact_collector()->SetFlags(kMakeHeapIterableMask | 547 mark_compact_collector()->SetFlags(kMakeHeapIterableMask |
547 kReduceMemoryFootprintMask); 548 kReduceMemoryFootprintMask);
548 isolate_->compilation_cache()->Clear(); 549 isolate_->compilation_cache()->Clear();
549 const int kMaxNumberOfAttempts = 7; 550 const int kMaxNumberOfAttempts = 2;
551 FlushEagerly flush_eagerly_scope;
550 for (int attempt = 0; attempt < kMaxNumberOfAttempts; attempt++) { 552 for (int attempt = 0; attempt < kMaxNumberOfAttempts; attempt++) {
551 if (!CollectGarbage(OLD_POINTER_SPACE, MARK_COMPACTOR, gc_reason, NULL)) { 553 if (!CollectGarbage(OLD_POINTER_SPACE, MARK_COMPACTOR, gc_reason, NULL)) {
552 break; 554 break;
553 } 555 }
554 } 556 }
555 mark_compact_collector()->SetFlags(kNoGCFlags); 557 mark_compact_collector()->SetFlags(kNoGCFlags);
556 new_space_.Shrink(); 558 new_space_.Shrink();
557 UncommitFromSpace(); 559 UncommitFromSpace();
558 Shrink(); 560 Shrink();
559 incremental_marking()->UncommitMarkingDeque(); 561 incremental_marking()->UncommitMarkingDeque();
(...skipping 6760 matching lines...) Expand 10 before | Expand all | Expand 10 after
7320 static_cast<int>(object_sizes_last_time_[index])); 7322 static_cast<int>(object_sizes_last_time_[index]));
7321 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7323 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7322 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7324 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7323 7325
7324 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7326 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7325 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7327 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7326 ClearObjectStats(); 7328 ClearObjectStats();
7327 } 7329 }
7328 7330
7329 } } // namespace v8::internal 7331 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698