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

Side by Side Diff: src/heap.cc

Issue 661175: - Moved the computation of old space limits to after the mandatory scavenge.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 10 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 | no next file » | 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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 void Heap::PerformGarbageCollection(AllocationSpace space, 555 void Heap::PerformGarbageCollection(AllocationSpace space,
556 GarbageCollector collector, 556 GarbageCollector collector,
557 GCTracer* tracer) { 557 GCTracer* tracer) {
558 VerifySymbolTable(); 558 VerifySymbolTable();
559 if (collector == MARK_COMPACTOR && global_gc_prologue_callback_) { 559 if (collector == MARK_COMPACTOR && global_gc_prologue_callback_) {
560 ASSERT(!allocation_allowed_); 560 ASSERT(!allocation_allowed_);
561 GCTracer::ExternalScope scope(tracer); 561 GCTracer::ExternalScope scope(tracer);
562 global_gc_prologue_callback_(); 562 global_gc_prologue_callback_();
563 } 563 }
564 EnsureFromSpaceIsCommitted(); 564 EnsureFromSpaceIsCommitted();
565
566 // Perform mark-sweep with optional compaction.
565 if (collector == MARK_COMPACTOR) { 567 if (collector == MARK_COMPACTOR) {
566 MarkCompact(tracer); 568 MarkCompact(tracer);
569 }
567 570
571 // Always perform a scavenge to make room in new space.
572 Scavenge();
573
574 // Update the old space promotion limits after the scavenge due to
575 // promotions during scavenge.
576 if (collector == MARK_COMPACTOR) {
568 int old_gen_size = PromotedSpaceSize(); 577 int old_gen_size = PromotedSpaceSize();
569 old_gen_promotion_limit_ = 578 old_gen_promotion_limit_ =
570 old_gen_size + Max(kMinimumPromotionLimit, old_gen_size / 3); 579 old_gen_size + Max(kMinimumPromotionLimit, old_gen_size / 3);
571 old_gen_allocation_limit_ = 580 old_gen_allocation_limit_ =
572 old_gen_size + Max(kMinimumAllocationLimit, old_gen_size / 2); 581 old_gen_size + Max(kMinimumAllocationLimit, old_gen_size / 2);
573 old_gen_exhausted_ = false; 582 old_gen_exhausted_ = false;
574 } 583 }
575 Scavenge();
576 584
577 Counters::objs_since_last_young.Set(0); 585 Counters::objs_since_last_young.Set(0);
578 586
579 if (collector == MARK_COMPACTOR) { 587 if (collector == MARK_COMPACTOR) {
580 DisableAssertNoAllocation allow_allocation; 588 DisableAssertNoAllocation allow_allocation;
581 GlobalHandles::PostGarbageCollectionProcessing(); 589 GlobalHandles::PostGarbageCollectionProcessing();
582 } 590 }
583 591
584 // Update relocatables. 592 // Update relocatables.
585 Relocatable::PostGarbageCollectionProcessing(); 593 Relocatable::PostGarbageCollectionProcessing();
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 return true; 1674 return true;
1667 } 1675 }
1668 1676
1669 1677
1670 Object* Heap::InitializeNumberStringCache() { 1678 Object* Heap::InitializeNumberStringCache() {
1671 // Compute the size of the number string cache based on the max heap size. 1679 // Compute the size of the number string cache based on the max heap size.
1672 // max_semispace_size_ == 512 KB => number_string_cache_size = 32. 1680 // max_semispace_size_ == 512 KB => number_string_cache_size = 32.
1673 // max_semispace_size_ == 8 MB => number_string_cache_size = 16KB. 1681 // max_semispace_size_ == 8 MB => number_string_cache_size = 16KB.
1674 int number_string_cache_size = max_semispace_size_ / 512; 1682 int number_string_cache_size = max_semispace_size_ / 512;
1675 number_string_cache_size = Max(32, Min(16*KB, number_string_cache_size)); 1683 number_string_cache_size = Max(32, Min(16*KB, number_string_cache_size));
1676 Object* obj = AllocateFixedArray(number_string_cache_size * 2); 1684 Object* obj = AllocateFixedArray(number_string_cache_size * 2, TENURED);
1677 if (!obj->IsFailure()) set_number_string_cache(FixedArray::cast(obj)); 1685 if (!obj->IsFailure()) set_number_string_cache(FixedArray::cast(obj));
1678 return obj; 1686 return obj;
1679 } 1687 }
1680 1688
1681 1689
1682 void Heap::FlushNumberStringCache() { 1690 void Heap::FlushNumberStringCache() {
1683 // Flush the number to string cache. 1691 // Flush the number to string cache.
1684 int len = number_string_cache()->length(); 1692 int len = number_string_cache()->length();
1685 for (int i = 0; i < len; i++) { 1693 for (int i = 0; i < len; i++) {
1686 number_string_cache()->set_undefined(i); 1694 number_string_cache()->set_undefined(i);
(...skipping 2537 matching lines...) Expand 10 before | Expand all | Expand 10 after
4224 void ExternalStringTable::TearDown() { 4232 void ExternalStringTable::TearDown() {
4225 new_space_strings_.Free(); 4233 new_space_strings_.Free();
4226 old_space_strings_.Free(); 4234 old_space_strings_.Free();
4227 } 4235 }
4228 4236
4229 4237
4230 List<Object*> ExternalStringTable::new_space_strings_; 4238 List<Object*> ExternalStringTable::new_space_strings_;
4231 List<Object*> ExternalStringTable::old_space_strings_; 4239 List<Object*> ExternalStringTable::old_space_strings_;
4232 4240
4233 } } // namespace v8::internal 4241 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698