| 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 static const int kMaxExecutableSizeLowMemoryDevice = | 1078 static const int kMaxExecutableSizeLowMemoryDevice = |
| 1079 128 * kPointerMultiplier; | 1079 128 * kPointerMultiplier; |
| 1080 static const int kMaxExecutableSizeMediumMemoryDevice = | 1080 static const int kMaxExecutableSizeMediumMemoryDevice = |
| 1081 256 * kPointerMultiplier; | 1081 256 * kPointerMultiplier; |
| 1082 static const int kMaxExecutableSizeHighMemoryDevice = | 1082 static const int kMaxExecutableSizeHighMemoryDevice = |
| 1083 512 * kPointerMultiplier; | 1083 512 * kPointerMultiplier; |
| 1084 static const int kMaxExecutableSizeHugeMemoryDevice = | 1084 static const int kMaxExecutableSizeHugeMemoryDevice = |
| 1085 700 * kPointerMultiplier; | 1085 700 * kPointerMultiplier; |
| 1086 | 1086 |
| 1087 intptr_t OldGenerationAllocationLimit(intptr_t old_gen_size) { | 1087 intptr_t OldGenerationAllocationLimit(intptr_t old_gen_size) { |
| 1088 intptr_t limit; | 1088 intptr_t limit = FLAG_stress_compaction |
| 1089 if (FLAG_stress_compaction) { | 1089 ? old_gen_size + old_gen_size / 10 |
| 1090 limit = old_gen_size + old_gen_size / 10; | 1090 : old_gen_size * old_space_growing_factor_; |
| 1091 } else if (old_gen_size < max_old_generation_size_ / 8) { | |
| 1092 if (max_old_generation_size_ <= kMaxOldSpaceSizeMediumMemoryDevice) { | |
| 1093 limit = old_gen_size * 2; | |
| 1094 } else { | |
| 1095 limit = old_gen_size * 4; | |
| 1096 } | |
| 1097 } else if (old_gen_size < max_old_generation_size_ / 4) { | |
| 1098 limit = old_gen_size * 1.5; | |
| 1099 } else if (old_gen_size < max_old_generation_size_ / 2) { | |
| 1100 limit = old_gen_size * 1.2; | |
| 1101 } else { | |
| 1102 limit = old_gen_size * 1.1; | |
| 1103 } | |
| 1104 | |
| 1105 limit = Max(limit, kMinimumOldGenerationAllocationLimit); | 1091 limit = Max(limit, kMinimumOldGenerationAllocationLimit); |
| 1106 limit += new_space_.Capacity(); | 1092 limit += new_space_.Capacity(); |
| 1107 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; | 1093 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; |
| 1108 return Min(limit, halfway_to_the_max); | 1094 return Min(limit, halfway_to_the_max); |
| 1109 } | 1095 } |
| 1110 | 1096 |
| 1111 // Indicates whether inline bump-pointer allocation has been disabled. | 1097 // Indicates whether inline bump-pointer allocation has been disabled. |
| 1112 bool inline_allocation_disabled() { return inline_allocation_disabled_; } | 1098 bool inline_allocation_disabled() { return inline_allocation_disabled_; } |
| 1113 | 1099 |
| 1114 // Switch whether inline bump-pointer allocation should be used. | 1100 // Switch whether inline bump-pointer allocation should be used. |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1519 Object* roots_[kRootListLength]; | 1505 Object* roots_[kRootListLength]; |
| 1520 | 1506 |
| 1521 intptr_t code_range_size_; | 1507 intptr_t code_range_size_; |
| 1522 int reserved_semispace_size_; | 1508 int reserved_semispace_size_; |
| 1523 int max_semi_space_size_; | 1509 int max_semi_space_size_; |
| 1524 int initial_semispace_size_; | 1510 int initial_semispace_size_; |
| 1525 intptr_t max_old_generation_size_; | 1511 intptr_t max_old_generation_size_; |
| 1526 intptr_t max_executable_size_; | 1512 intptr_t max_executable_size_; |
| 1527 intptr_t maximum_committed_; | 1513 intptr_t maximum_committed_; |
| 1528 | 1514 |
| 1515 // The old space growing factor is used in the old space heap growing |
| 1516 // strategy. The new old space size is the current old space size times |
| 1517 // old_space_growing_factor_. |
| 1518 int old_space_growing_factor_; |
| 1519 |
| 1529 // For keeping track of how much data has survived | 1520 // For keeping track of how much data has survived |
| 1530 // scavenge since last new space expansion. | 1521 // scavenge since last new space expansion. |
| 1531 int survived_since_last_expansion_; | 1522 int survived_since_last_expansion_; |
| 1532 | 1523 |
| 1533 // For keeping track on when to flush RegExp code. | 1524 // For keeping track on when to flush RegExp code. |
| 1534 int sweep_generation_; | 1525 int sweep_generation_; |
| 1535 | 1526 |
| 1536 int always_allocate_scope_depth_; | 1527 int always_allocate_scope_depth_; |
| 1537 int linear_allocation_scope_depth_; | 1528 int linear_allocation_scope_depth_; |
| 1538 | 1529 |
| (...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2789 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2780 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2790 | 2781 |
| 2791 private: | 2782 private: |
| 2792 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2783 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2793 }; | 2784 }; |
| 2794 #endif // DEBUG | 2785 #endif // DEBUG |
| 2795 | 2786 |
| 2796 } } // namespace v8::internal | 2787 } } // namespace v8::internal |
| 2797 | 2788 |
| 2798 #endif // V8_HEAP_H_ | 2789 #endif // V8_HEAP_H_ |
| OLD | NEW |