OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HEAP_H_ | 5 #ifndef V8_HEAP_H_ |
6 #define V8_HEAP_H_ | 6 #define V8_HEAP_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 // Sizes are in MB. | 1070 // Sizes are in MB. |
1071 static const int kMaxExecutableSizeLowMemoryDevice = | 1071 static const int kMaxExecutableSizeLowMemoryDevice = |
1072 128 * kPointerMultiplier; | 1072 128 * kPointerMultiplier; |
1073 static const int kMaxExecutableSizeMediumMemoryDevice = | 1073 static const int kMaxExecutableSizeMediumMemoryDevice = |
1074 256 * kPointerMultiplier; | 1074 256 * kPointerMultiplier; |
1075 static const int kMaxExecutableSizeHighMemoryDevice = | 1075 static const int kMaxExecutableSizeHighMemoryDevice = |
1076 512 * kPointerMultiplier; | 1076 512 * kPointerMultiplier; |
1077 static const int kMaxExecutableSizeHugeMemoryDevice = | 1077 static const int kMaxExecutableSizeHugeMemoryDevice = |
1078 700 * kPointerMultiplier; | 1078 700 * kPointerMultiplier; |
1079 | 1079 |
1080 intptr_t OldGenerationAllocationLimit(intptr_t old_gen_size) { | 1080 intptr_t OldGenerationAllocationLimit(intptr_t old_gen_size, |
1081 intptr_t limit = FLAG_stress_compaction | 1081 int freed_global_handles); |
1082 ? old_gen_size + old_gen_size / 10 | |
1083 : old_gen_size * old_space_growing_factor_; | |
1084 limit = Max(limit, kMinimumOldGenerationAllocationLimit); | |
1085 limit += new_space_.Capacity(); | |
1086 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; | |
1087 return Min(limit, halfway_to_the_max); | |
1088 } | |
1089 | 1082 |
1090 // Indicates whether inline bump-pointer allocation has been disabled. | 1083 // Indicates whether inline bump-pointer allocation has been disabled. |
1091 bool inline_allocation_disabled() { return inline_allocation_disabled_; } | 1084 bool inline_allocation_disabled() { return inline_allocation_disabled_; } |
1092 | 1085 |
1093 // Switch whether inline bump-pointer allocation should be used. | 1086 // Switch whether inline bump-pointer allocation should be used. |
1094 void EnableInlineAllocation(); | 1087 void EnableInlineAllocation(); |
1095 void DisableInlineAllocation(); | 1088 void DisableInlineAllocation(); |
1096 | 1089 |
1097 // Implements the corresponding V8 API function. | 1090 // Implements the corresponding V8 API function. |
1098 bool IdleNotification(int hint); | 1091 bool IdleNotification(int hint); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 Object* roots_[kRootListLength]; | 1500 Object* roots_[kRootListLength]; |
1508 | 1501 |
1509 size_t code_range_size_; | 1502 size_t code_range_size_; |
1510 int reserved_semispace_size_; | 1503 int reserved_semispace_size_; |
1511 int max_semi_space_size_; | 1504 int max_semi_space_size_; |
1512 int initial_semispace_size_; | 1505 int initial_semispace_size_; |
1513 intptr_t max_old_generation_size_; | 1506 intptr_t max_old_generation_size_; |
1514 intptr_t max_executable_size_; | 1507 intptr_t max_executable_size_; |
1515 intptr_t maximum_committed_; | 1508 intptr_t maximum_committed_; |
1516 | 1509 |
1517 // The old space growing factor is used in the old space heap growing | |
1518 // strategy. The new old space size is the current old space size times | |
1519 // old_space_growing_factor_. | |
1520 int old_space_growing_factor_; | |
1521 | |
1522 // For keeping track of how much data has survived | 1510 // For keeping track of how much data has survived |
1523 // scavenge since last new space expansion. | 1511 // scavenge since last new space expansion. |
1524 int survived_since_last_expansion_; | 1512 int survived_since_last_expansion_; |
1525 | 1513 |
1526 // For keeping track on when to flush RegExp code. | 1514 // For keeping track on when to flush RegExp code. |
1527 int sweep_generation_; | 1515 int sweep_generation_; |
1528 | 1516 |
1529 int always_allocate_scope_depth_; | 1517 int always_allocate_scope_depth_; |
1530 | 1518 |
1531 // For keeping track of context disposals. | 1519 // For keeping track of context disposals. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1591 // remain until the next failure and garbage collection. | 1579 // remain until the next failure and garbage collection. |
1592 int allocation_timeout_; | 1580 int allocation_timeout_; |
1593 #endif // DEBUG | 1581 #endif // DEBUG |
1594 | 1582 |
1595 // Limit that triggers a global GC on the next (normally caused) GC. This | 1583 // Limit that triggers a global GC on the next (normally caused) GC. This |
1596 // is checked when we have already decided to do a GC to help determine | 1584 // is checked when we have already decided to do a GC to help determine |
1597 // which collector to invoke, before expanding a paged space in the old | 1585 // which collector to invoke, before expanding a paged space in the old |
1598 // generation and on every allocation in large object space. | 1586 // generation and on every allocation in large object space. |
1599 intptr_t old_generation_allocation_limit_; | 1587 intptr_t old_generation_allocation_limit_; |
1600 | 1588 |
1601 // Used to adjust the limits that control the timing of the next GC. | |
1602 intptr_t size_of_old_gen_at_last_old_space_gc_; | |
1603 | |
1604 // Indicates that an allocation has failed in the old generation since the | 1589 // Indicates that an allocation has failed in the old generation since the |
1605 // last GC. | 1590 // last GC. |
1606 bool old_gen_exhausted_; | 1591 bool old_gen_exhausted_; |
1607 | 1592 |
1608 // Indicates that inline bump-pointer allocation has been globally disabled | 1593 // Indicates that inline bump-pointer allocation has been globally disabled |
1609 // for all spaces. This is used to disable allocations in generated code. | 1594 // for all spaces. This is used to disable allocations in generated code. |
1610 bool inline_allocation_disabled_; | 1595 bool inline_allocation_disabled_; |
1611 | 1596 |
1612 // Weak list heads, threaded through the objects. | 1597 // Weak list heads, threaded through the objects. |
1613 // List heads are initilized lazily and contain the undefined_value at start. | 1598 // List heads are initilized lazily and contain the undefined_value at start. |
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2777 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2762 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2778 | 2763 |
2779 private: | 2764 private: |
2780 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2765 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2781 }; | 2766 }; |
2782 #endif // DEBUG | 2767 #endif // DEBUG |
2783 | 2768 |
2784 } } // namespace v8::internal | 2769 } } // namespace v8::internal |
2785 | 2770 |
2786 #endif // V8_HEAP_H_ | 2771 #endif // V8_HEAP_H_ |
OLD | NEW |