| 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 = FLAG_stress_compaction | 1088 intptr_t limit; |
| 1089 ? old_gen_size + old_gen_size / 10 | 1089 if (FLAG_stress_compaction) { |
| 1090 : old_gen_size * old_space_growing_factor_; | 1090 limit = old_gen_size + old_gen_size / 10; |
| 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 = static_cast<intptr_t>(old_gen_size * 1.5); |
| 1099 } else if (old_gen_size < max_old_generation_size_ / 2) { |
| 1100 limit = static_cast<intptr_t>(old_gen_size * 1.2); |
| 1101 } else { |
| 1102 limit = static_cast<intptr_t>(old_gen_size * 1.1); |
| 1103 } |
| 1104 |
| 1091 limit = Max(limit, kMinimumOldGenerationAllocationLimit); | 1105 limit = Max(limit, kMinimumOldGenerationAllocationLimit); |
| 1092 limit += new_space_.Capacity(); | 1106 limit += new_space_.Capacity(); |
| 1093 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; | 1107 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; |
| 1094 return Min(limit, halfway_to_the_max); | 1108 return Min(limit, halfway_to_the_max); |
| 1095 } | 1109 } |
| 1096 | 1110 |
| 1097 // Indicates whether inline bump-pointer allocation has been disabled. | 1111 // Indicates whether inline bump-pointer allocation has been disabled. |
| 1098 bool inline_allocation_disabled() { return inline_allocation_disabled_; } | 1112 bool inline_allocation_disabled() { return inline_allocation_disabled_; } |
| 1099 | 1113 |
| 1100 // Switch whether inline bump-pointer allocation should be used. | 1114 // Switch whether inline bump-pointer allocation should be used. |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1505 Object* roots_[kRootListLength]; | 1519 Object* roots_[kRootListLength]; |
| 1506 | 1520 |
| 1507 intptr_t code_range_size_; | 1521 intptr_t code_range_size_; |
| 1508 int reserved_semispace_size_; | 1522 int reserved_semispace_size_; |
| 1509 int max_semi_space_size_; | 1523 int max_semi_space_size_; |
| 1510 int initial_semispace_size_; | 1524 int initial_semispace_size_; |
| 1511 intptr_t max_old_generation_size_; | 1525 intptr_t max_old_generation_size_; |
| 1512 intptr_t max_executable_size_; | 1526 intptr_t max_executable_size_; |
| 1513 intptr_t maximum_committed_; | 1527 intptr_t maximum_committed_; |
| 1514 | 1528 |
| 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 | |
| 1520 // For keeping track of how much data has survived | 1529 // For keeping track of how much data has survived |
| 1521 // scavenge since last new space expansion. | 1530 // scavenge since last new space expansion. |
| 1522 int survived_since_last_expansion_; | 1531 int survived_since_last_expansion_; |
| 1523 | 1532 |
| 1524 // For keeping track on when to flush RegExp code. | 1533 // For keeping track on when to flush RegExp code. |
| 1525 int sweep_generation_; | 1534 int sweep_generation_; |
| 1526 | 1535 |
| 1527 int always_allocate_scope_depth_; | 1536 int always_allocate_scope_depth_; |
| 1528 int linear_allocation_scope_depth_; | 1537 int linear_allocation_scope_depth_; |
| 1529 | 1538 |
| (...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2783 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2792 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2784 | 2793 |
| 2785 private: | 2794 private: |
| 2786 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2795 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2787 }; | 2796 }; |
| 2788 #endif // DEBUG | 2797 #endif // DEBUG |
| 2789 | 2798 |
| 2790 } } // namespace v8::internal | 2799 } } // namespace v8::internal |
| 2791 | 2800 |
| 2792 #endif // V8_HEAP_H_ | 2801 #endif // V8_HEAP_H_ |
| OLD | NEW |