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

Side by Side Diff: src/heap.h

Issue 9813019: Start incremental marking only if there are enough promoted objects since the last GC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 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/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 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 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 1330
1331 // Allocate uninitialized fixed array. 1331 // Allocate uninitialized fixed array.
1332 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length); 1332 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length);
1333 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length, 1333 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length,
1334 PretenureFlag pretenure); 1334 PretenureFlag pretenure);
1335 1335
1336 inline intptr_t PromotedTotalSize() { 1336 inline intptr_t PromotedTotalSize() {
1337 return PromotedSpaceSize() + PromotedExternalMemorySize(); 1337 return PromotedSpaceSize() + PromotedExternalMemorySize();
1338 } 1338 }
1339 1339
1340 inline intptr_t PromotedTotalSizeOfObjects() {
1341 return PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize();
1342 }
1343
1340 // True if we have reached the allocation limit in the old generation that 1344 // True if we have reached the allocation limit in the old generation that
1341 // should force the next GC (caused normally) to be a full one. 1345 // should force the next GC (caused normally) to be a full one.
1342 inline bool OldGenerationPromotionLimitReached() { 1346 inline bool OldGenerationPromotionLimitReached() {
1343 return PromotedTotalSize() > old_gen_promotion_limit_; 1347 return PromotedTotalSize() > old_gen_promotion_limit_;
1344 } 1348 }
1345 1349
1346 inline intptr_t OldGenerationSpaceAvailable() { 1350 inline intptr_t OldGenerationSpaceAvailable() {
1347 return old_gen_allocation_limit_ - PromotedTotalSize(); 1351 return old_gen_allocation_limit_ - PromotedTotalSize();
1348 } 1352 }
1349 1353
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 // Check new space expansion criteria and expand semispaces if it was hit. 1437 // Check new space expansion criteria and expand semispaces if it was hit.
1434 void CheckNewSpaceExpansionCriteria(); 1438 void CheckNewSpaceExpansionCriteria();
1435 1439
1436 inline void IncrementYoungSurvivorsCounter(int survived) { 1440 inline void IncrementYoungSurvivorsCounter(int survived) {
1437 ASSERT(survived >= 0); 1441 ASSERT(survived >= 0);
1438 young_survivors_after_last_gc_ = survived; 1442 young_survivors_after_last_gc_ = survived;
1439 survived_since_last_expansion_ += survived; 1443 survived_since_last_expansion_ += survived;
1440 } 1444 }
1441 1445
1442 inline bool NextGCIsLikelyToBeFull() { 1446 inline bool NextGCIsLikelyToBeFull() {
1447 const int kPromotionFraction = 8;
1448
1443 if (FLAG_gc_global) return true; 1449 if (FLAG_gc_global) return true;
1444 1450
1451 intptr_t promoted_at_gc = total_promoted_at_last_old_space_gc_;
1452 intptr_t promoted_since_gc = PromotedTotalSizeOfObjects() - promoted_at_gc;
1453
1454 if (promoted_since_gc < promoted_at_gc / kPromotionFraction) return false;
1455
1445 intptr_t total_promoted = PromotedTotalSize(); 1456 intptr_t total_promoted = PromotedTotalSize();
1446 1457
1447 intptr_t adjusted_promotion_limit = 1458 intptr_t adjusted_promotion_limit =
1448 old_gen_promotion_limit_ - new_space_.Capacity(); 1459 old_gen_promotion_limit_ - new_space_.Capacity();
1449 1460
1450 if (total_promoted >= adjusted_promotion_limit) return true; 1461 if (total_promoted >= adjusted_promotion_limit) return true;
1451 1462
1452 intptr_t adjusted_allocation_limit = 1463 intptr_t adjusted_allocation_limit =
1453 old_gen_allocation_limit_ - new_space_.Capacity() / 5; 1464 old_gen_allocation_limit_ - new_space_.Capacity() / 5;
1454 1465
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1683 // every allocation in large object space. 1694 // every allocation in large object space.
1684 intptr_t old_gen_allocation_limit_; 1695 intptr_t old_gen_allocation_limit_;
1685 1696
1686 // Sometimes the heuristics dictate that those limits are increased. This 1697 // Sometimes the heuristics dictate that those limits are increased. This
1687 // variable records that fact. 1698 // variable records that fact.
1688 int old_gen_limit_factor_; 1699 int old_gen_limit_factor_;
1689 1700
1690 // Used to adjust the limits that control the timing of the next GC. 1701 // Used to adjust the limits that control the timing of the next GC.
1691 intptr_t size_of_old_gen_at_last_old_space_gc_; 1702 intptr_t size_of_old_gen_at_last_old_space_gc_;
1692 1703
1704 intptr_t total_promoted_at_last_old_space_gc_;
1705
1693 // Limit on the amount of externally allocated memory allowed 1706 // Limit on the amount of externally allocated memory allowed
1694 // between global GCs. If reached a global GC is forced. 1707 // between global GCs. If reached a global GC is forced.
1695 intptr_t external_allocation_limit_; 1708 intptr_t external_allocation_limit_;
1696 1709
1697 // The amount of external memory registered through the API kept alive 1710 // The amount of external memory registered through the API kept alive
1698 // by global handles 1711 // by global handles
1699 int amount_of_external_allocated_memory_; 1712 int amount_of_external_allocated_memory_;
1700 1713
1701 // Caches the amount of external memory registered at the last global gc. 1714 // Caches the amount of external memory registered at the last global gc.
1702 int amount_of_external_allocated_memory_at_last_global_gc_; 1715 int amount_of_external_allocated_memory_at_last_global_gc_;
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
2692 AssertNoAllocation no_alloc; // i.e. no gc allowed. 2705 AssertNoAllocation no_alloc; // i.e. no gc allowed.
2693 2706
2694 private: 2707 private:
2695 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2708 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2696 }; 2709 };
2697 #endif // DEBUG || LIVE_OBJECT_LIST 2710 #endif // DEBUG || LIVE_OBJECT_LIST
2698 2711
2699 } } // namespace v8::internal 2712 } } // namespace v8::internal
2700 2713
2701 #endif // V8_HEAP_H_ 2714 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698