| 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 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 // Sizes are in MB. | 1078 // Sizes are in MB. |
| 1079 static const int kMaxExecutableSizeLowMemoryDevice = | 1079 static const int kMaxExecutableSizeLowMemoryDevice = |
| 1080 128 * kPointerMultiplier; | 1080 128 * kPointerMultiplier; |
| 1081 static const int kMaxExecutableSizeMediumMemoryDevice = | 1081 static const int kMaxExecutableSizeMediumMemoryDevice = |
| 1082 256 * kPointerMultiplier; | 1082 256 * kPointerMultiplier; |
| 1083 static const int kMaxExecutableSizeHighMemoryDevice = | 1083 static const int kMaxExecutableSizeHighMemoryDevice = |
| 1084 512 * kPointerMultiplier; | 1084 512 * kPointerMultiplier; |
| 1085 static const int kMaxExecutableSizeHugeMemoryDevice = | 1085 static const int kMaxExecutableSizeHugeMemoryDevice = |
| 1086 700 * kPointerMultiplier; | 1086 700 * kPointerMultiplier; |
| 1087 | 1087 |
| 1088 intptr_t OldGenerationAllocationLimit(intptr_t old_gen_size) { | 1088 intptr_t OldGenerationAllocationLimit(intptr_t old_gen_size, |
| 1089 intptr_t limit = FLAG_stress_compaction | 1089 int freed_global_handles); |
| 1090 ? old_gen_size + old_gen_size / 10 | |
| 1091 : old_gen_size * old_space_growing_factor_; | |
| 1092 limit = Max(limit, kMinimumOldGenerationAllocationLimit); | |
| 1093 limit += new_space_.Capacity(); | |
| 1094 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; | |
| 1095 return Min(limit, halfway_to_the_max); | |
| 1096 } | |
| 1097 | 1090 |
| 1098 // Indicates whether inline bump-pointer allocation has been disabled. | 1091 // Indicates whether inline bump-pointer allocation has been disabled. |
| 1099 bool inline_allocation_disabled() { return inline_allocation_disabled_; } | 1092 bool inline_allocation_disabled() { return inline_allocation_disabled_; } |
| 1100 | 1093 |
| 1101 // Switch whether inline bump-pointer allocation should be used. | 1094 // Switch whether inline bump-pointer allocation should be used. |
| 1102 void EnableInlineAllocation(); | 1095 void EnableInlineAllocation(); |
| 1103 void DisableInlineAllocation(); | 1096 void DisableInlineAllocation(); |
| 1104 | 1097 |
| 1105 // Implements the corresponding V8 API function. | 1098 // Implements the corresponding V8 API function. |
| 1106 bool IdleNotification(int hint); | 1099 bool IdleNotification(int hint); |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1506 Object* roots_[kRootListLength]; | 1499 Object* roots_[kRootListLength]; |
| 1507 | 1500 |
| 1508 size_t code_range_size_; | 1501 size_t code_range_size_; |
| 1509 int reserved_semispace_size_; | 1502 int reserved_semispace_size_; |
| 1510 int max_semi_space_size_; | 1503 int max_semi_space_size_; |
| 1511 int initial_semispace_size_; | 1504 int initial_semispace_size_; |
| 1512 intptr_t max_old_generation_size_; | 1505 intptr_t max_old_generation_size_; |
| 1513 intptr_t max_executable_size_; | 1506 intptr_t max_executable_size_; |
| 1514 intptr_t maximum_committed_; | 1507 intptr_t maximum_committed_; |
| 1515 | 1508 |
| 1516 // The old space growing factor is used in the old space heap growing | |
| 1517 // strategy. The new old space size is the current old space size times | |
| 1518 // old_space_growing_factor_. | |
| 1519 int old_space_growing_factor_; | |
| 1520 | |
| 1521 // For keeping track of how much data has survived | 1509 // For keeping track of how much data has survived |
| 1522 // scavenge since last new space expansion. | 1510 // scavenge since last new space expansion. |
| 1523 int survived_since_last_expansion_; | 1511 int survived_since_last_expansion_; |
| 1524 | 1512 |
| 1525 // For keeping track on when to flush RegExp code. | 1513 // For keeping track on when to flush RegExp code. |
| 1526 int sweep_generation_; | 1514 int sweep_generation_; |
| 1527 | 1515 |
| 1528 int always_allocate_scope_depth_; | 1516 int always_allocate_scope_depth_; |
| 1529 int linear_allocation_scope_depth_; | 1517 int linear_allocation_scope_depth_; |
| 1530 | 1518 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 // remain until the next failure and garbage collection. | 1567 // remain until the next failure and garbage collection. |
| 1580 int allocation_timeout_; | 1568 int allocation_timeout_; |
| 1581 #endif // DEBUG | 1569 #endif // DEBUG |
| 1582 | 1570 |
| 1583 // Limit that triggers a global GC on the next (normally caused) GC. This | 1571 // Limit that triggers a global GC on the next (normally caused) GC. This |
| 1584 // is checked when we have already decided to do a GC to help determine | 1572 // is checked when we have already decided to do a GC to help determine |
| 1585 // which collector to invoke, before expanding a paged space in the old | 1573 // which collector to invoke, before expanding a paged space in the old |
| 1586 // generation and on every allocation in large object space. | 1574 // generation and on every allocation in large object space. |
| 1587 intptr_t old_generation_allocation_limit_; | 1575 intptr_t old_generation_allocation_limit_; |
| 1588 | 1576 |
| 1589 // Used to adjust the limits that control the timing of the next GC. | |
| 1590 intptr_t size_of_old_gen_at_last_old_space_gc_; | |
| 1591 | |
| 1592 // Indicates that an allocation has failed in the old generation since the | 1577 // Indicates that an allocation has failed in the old generation since the |
| 1593 // last GC. | 1578 // last GC. |
| 1594 bool old_gen_exhausted_; | 1579 bool old_gen_exhausted_; |
| 1595 | 1580 |
| 1596 // Indicates that inline bump-pointer allocation has been globally disabled | 1581 // Indicates that inline bump-pointer allocation has been globally disabled |
| 1597 // for all spaces. This is used to disable allocations in generated code. | 1582 // for all spaces. This is used to disable allocations in generated code. |
| 1598 bool inline_allocation_disabled_; | 1583 bool inline_allocation_disabled_; |
| 1599 | 1584 |
| 1600 // Weak list heads, threaded through the objects. | 1585 // Weak list heads, threaded through the objects. |
| 1601 // List heads are initilized lazily and contain the undefined_value at start. | 1586 // List heads are initilized lazily and contain the undefined_value at start. |
| (...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2761 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2746 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2762 | 2747 |
| 2763 private: | 2748 private: |
| 2764 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2749 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2765 }; | 2750 }; |
| 2766 #endif // DEBUG | 2751 #endif // DEBUG |
| 2767 | 2752 |
| 2768 } } // namespace v8::internal | 2753 } } // namespace v8::internal |
| 2769 | 2754 |
| 2770 #endif // V8_HEAP_H_ | 2755 #endif // V8_HEAP_H_ |
| OLD | NEW |