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

Side by Side Diff: src/heap.cc

Issue 165448: - Added simple memory reduction behavior for IdleNotification.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 4 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/spaces.h » ('j') | src/spaces.h » ('J')
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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 418
419 419
420 static void VerifySymbolTable() { 420 static void VerifySymbolTable() {
421 #ifdef DEBUG 421 #ifdef DEBUG
422 SymbolTableVerifier verifier; 422 SymbolTableVerifier verifier;
423 Heap::symbol_table()->IterateElements(&verifier); 423 Heap::symbol_table()->IterateElements(&verifier);
424 #endif // DEBUG 424 #endif // DEBUG
425 } 425 }
426 426
427 427
428 void Heap::EnsureFromSpaceIsCommitted() {
429 if (new_space_.CommitFromSpaceIfNeeded()) return;
430
431 // Committing memory to from space failed.
432 // Try shrinking and try again.
433 Shrink();
434 if (new_space_.CommitFromSpaceIfNeeded()) return;
435
436 // Committing memory to from space failed again.
437 // Memory is exhausted and we will die.
438 V8::FatalProcessOutOfMemory("Committing semi space failed.");
439 }
440
441
428 void Heap::PerformGarbageCollection(AllocationSpace space, 442 void Heap::PerformGarbageCollection(AllocationSpace space,
429 GarbageCollector collector, 443 GarbageCollector collector,
430 GCTracer* tracer) { 444 GCTracer* tracer) {
431 VerifySymbolTable(); 445 VerifySymbolTable();
432 if (collector == MARK_COMPACTOR && global_gc_prologue_callback_) { 446 if (collector == MARK_COMPACTOR && global_gc_prologue_callback_) {
433 ASSERT(!allocation_allowed_); 447 ASSERT(!allocation_allowed_);
434 global_gc_prologue_callback_(); 448 global_gc_prologue_callback_();
435 } 449 }
436 450 EnsureFromSpaceIsCommitted();
437 if (collector == MARK_COMPACTOR) { 451 if (collector == MARK_COMPACTOR) {
438 MarkCompact(tracer); 452 MarkCompact(tracer);
439 453
440 int old_gen_size = PromotedSpaceSize(); 454 int old_gen_size = PromotedSpaceSize();
441 old_gen_promotion_limit_ = 455 old_gen_promotion_limit_ =
442 old_gen_size + Max(kMinimumPromotionLimit, old_gen_size / 3); 456 old_gen_size + Max(kMinimumPromotionLimit, old_gen_size / 3);
443 old_gen_allocation_limit_ = 457 old_gen_allocation_limit_ =
444 old_gen_size + Max(kMinimumAllocationLimit, old_gen_size / 2); 458 old_gen_size + Max(kMinimumAllocationLimit, old_gen_size / 2);
445 old_gen_exhausted_ = false; 459 old_gen_exhausted_ = false;
446 } 460 }
(...skipping 3418 matching lines...) Expand 10 before | Expand all | Expand 10 after
3865 #ifdef DEBUG 3879 #ifdef DEBUG
3866 bool Heap::GarbageCollectionGreedyCheck() { 3880 bool Heap::GarbageCollectionGreedyCheck() {
3867 ASSERT(FLAG_gc_greedy); 3881 ASSERT(FLAG_gc_greedy);
3868 if (Bootstrapper::IsActive()) return true; 3882 if (Bootstrapper::IsActive()) return true;
3869 if (disallow_allocation_failure()) return true; 3883 if (disallow_allocation_failure()) return true;
3870 return CollectGarbage(0, NEW_SPACE); 3884 return CollectGarbage(0, NEW_SPACE);
3871 } 3885 }
3872 #endif 3886 #endif
3873 3887
3874 } } // namespace v8::internal 3888 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/spaces.h » ('j') | src/spaces.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698