Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1202 inline bool OldGenerationPromotionLimitReached() { | 1202 inline bool OldGenerationPromotionLimitReached() { |
| 1203 return (PromotedSpaceSize() + PromotedExternalMemorySize()) | 1203 return (PromotedSpaceSize() + PromotedExternalMemorySize()) |
| 1204 > old_gen_promotion_limit_; | 1204 > old_gen_promotion_limit_; |
| 1205 } | 1205 } |
| 1206 | 1206 |
| 1207 inline intptr_t OldGenerationSpaceAvailable() { | 1207 inline intptr_t OldGenerationSpaceAvailable() { |
| 1208 return old_gen_allocation_limit_ - | 1208 return old_gen_allocation_limit_ - |
| 1209 (PromotedSpaceSize() + PromotedExternalMemorySize()); | 1209 (PromotedSpaceSize() + PromotedExternalMemorySize()); |
| 1210 } | 1210 } |
| 1211 | 1211 |
| 1212 static const intptr_t kMinimumPromotionLimit = | |
| 1213 2 * (Page::kPageSize > MB ? Page::kPageSize : MB); | |
| 1214 static const intptr_t kMinimumAllocationLimit = | |
| 1215 8 * (Page::kPageSize > MB ? Page::kPageSize : MB); | |
| 1216 static inline intptr_t PromotionFactor(intptr_t size) { | |
|
Vyacheslav Egorov (Chromium)
2011/08/11 15:11:34
More comments about this magical functions would b
Erik Corry
2011/08/11 16:09:08
This function does not exist any more.
| |
| 1217 return size + size / 3; | |
| 1218 } | |
| 1219 static inline intptr_t AllocationFactor(intptr_t size) { | |
| 1220 return size + size / 2; | |
| 1221 } | |
| 1222 | |
| 1212 inline void LowerOldGenLimits(intptr_t bytes) { | 1223 inline void LowerOldGenLimits(intptr_t bytes) { |
| 1213 old_gen_promotion_limit_ -= bytes; | 1224 old_gen_promotion_limit_ = |
| 1214 old_gen_allocation_limit_ -= bytes; | 1225 Max(old_gen_promotion_limit_ - |
| 1226 PromotionFactor(bytes) * old_gen_limit_factor_, | |
|
Vyacheslav Egorov (Chromium)
2011/08/11 15:11:34
multiplying factor by factor. confusing. more comm
Erik Corry
2011/08/11 16:09:08
I was unable to find a better name, but I clarifie
| |
| 1227 (kMinimumAllocationLimit + new_space_.Capacity()) * | |
| 1228 old_gen_limit_factor_); | |
| 1229 old_gen_allocation_limit_ = | |
| 1230 Max(old_gen_allocation_limit_ - | |
| 1231 AllocationFactor(bytes) * old_gen_limit_factor_, | |
| 1232 (kMinimumAllocationLimit + new_space_.Capacity()) * | |
| 1233 old_gen_limit_factor_); | |
| 1215 } | 1234 } |
| 1216 | 1235 |
| 1217 // Can be called when the embedding application is idle. | 1236 // Can be called when the embedding application is idle. |
| 1218 bool IdleNotification(); | 1237 bool IdleNotification(); |
| 1219 | 1238 |
| 1220 // Declare all the root indices. | 1239 // Declare all the root indices. |
| 1221 enum RootListIndex { | 1240 enum RootListIndex { |
| 1222 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, | 1241 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, |
| 1223 STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION) | 1242 STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION) |
| 1224 #undef ROOT_INDEX_DECLARATION | 1243 #undef ROOT_INDEX_DECLARATION |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1451 // Limit that triggers a global GC on the next (normally caused) GC. This | 1470 // Limit that triggers a global GC on the next (normally caused) GC. This |
| 1452 // is checked when we have already decided to do a GC to help determine | 1471 // is checked when we have already decided to do a GC to help determine |
| 1453 // which collector to invoke. | 1472 // which collector to invoke. |
| 1454 intptr_t old_gen_promotion_limit_; | 1473 intptr_t old_gen_promotion_limit_; |
| 1455 | 1474 |
| 1456 // Limit that triggers a global GC as soon as is reasonable. This is | 1475 // Limit that triggers a global GC as soon as is reasonable. This is |
| 1457 // checked before expanding a paged space in the old generation and on | 1476 // checked before expanding a paged space in the old generation and on |
| 1458 // every allocation in large object space. | 1477 // every allocation in large object space. |
| 1459 intptr_t old_gen_allocation_limit_; | 1478 intptr_t old_gen_allocation_limit_; |
| 1460 | 1479 |
| 1480 // Sometimes the heuristics dictate that those limits are increased. This | |
| 1481 // variable records that fact. | |
| 1482 int old_gen_limit_factor_; | |
| 1483 | |
| 1461 // Limit on the amount of externally allocated memory allowed | 1484 // Limit on the amount of externally allocated memory allowed |
| 1462 // between global GCs. If reached a global GC is forced. | 1485 // between global GCs. If reached a global GC is forced. |
| 1463 intptr_t external_allocation_limit_; | 1486 intptr_t external_allocation_limit_; |
| 1464 | 1487 |
| 1465 // The amount of external memory registered through the API kept alive | 1488 // The amount of external memory registered through the API kept alive |
| 1466 // by global handles | 1489 // by global handles |
| 1467 int amount_of_external_allocated_memory_; | 1490 int amount_of_external_allocated_memory_; |
| 1468 | 1491 |
| 1469 // Caches the amount of external memory registered at the last global gc. | 1492 // Caches the amount of external memory registered at the last global gc. |
| 1470 int amount_of_external_allocated_memory_at_last_global_gc_; | 1493 int amount_of_external_allocated_memory_at_last_global_gc_; |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2387 | 2410 |
| 2388 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2411 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2389 }; | 2412 }; |
| 2390 #endif // DEBUG || LIVE_OBJECT_LIST | 2413 #endif // DEBUG || LIVE_OBJECT_LIST |
| 2391 | 2414 |
| 2392 } } // namespace v8::internal | 2415 } } // namespace v8::internal |
| 2393 | 2416 |
| 2394 #undef HEAP | 2417 #undef HEAP |
| 2395 | 2418 |
| 2396 #endif // V8_HEAP_H_ | 2419 #endif // V8_HEAP_H_ |
| OLD | NEW |