| 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 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 static const int kMaxExecutableSizeLowMemoryDevice = | 1067 static const int kMaxExecutableSizeLowMemoryDevice = |
| 1068 128 * kPointerMultiplier; | 1068 128 * kPointerMultiplier; |
| 1069 static const int kMaxExecutableSizeMediumMemoryDevice = | 1069 static const int kMaxExecutableSizeMediumMemoryDevice = |
| 1070 256 * kPointerMultiplier; | 1070 256 * kPointerMultiplier; |
| 1071 static const int kMaxExecutableSizeHighMemoryDevice = | 1071 static const int kMaxExecutableSizeHighMemoryDevice = |
| 1072 512 * kPointerMultiplier; | 1072 512 * kPointerMultiplier; |
| 1073 static const int kMaxExecutableSizeHugeMemoryDevice = | 1073 static const int kMaxExecutableSizeHugeMemoryDevice = |
| 1074 700 * kPointerMultiplier; | 1074 700 * kPointerMultiplier; |
| 1075 | 1075 |
| 1076 intptr_t OldGenerationAllocationLimit(intptr_t old_gen_size) { | 1076 intptr_t OldGenerationAllocationLimit(intptr_t old_gen_size) { |
| 1077 intptr_t limit; | 1077 intptr_t limit = FLAG_stress_compaction |
| 1078 if (FLAG_stress_compaction) { | 1078 ? old_gen_size + old_gen_size / 10 |
| 1079 limit = old_gen_size + old_gen_size / 10; | 1079 : old_gen_size * old_space_growing_factor_; |
| 1080 } else if (old_gen_size < max_old_generation_size_ / 8) { | |
| 1081 if (max_old_generation_size_ <= kMaxOldSpaceSizeMediumMemoryDevice) { | |
| 1082 limit = old_gen_size * 2; | |
| 1083 } else { | |
| 1084 limit = old_gen_size * 4; | |
| 1085 } | |
| 1086 } else if (old_gen_size < max_old_generation_size_ / 4) { | |
| 1087 limit = static_cast<intptr_t>(old_gen_size * 1.5); | |
| 1088 } else if (old_gen_size < max_old_generation_size_ / 2) { | |
| 1089 limit = static_cast<intptr_t>(old_gen_size * 1.2); | |
| 1090 } else { | |
| 1091 limit = static_cast<intptr_t>(old_gen_size * 1.1); | |
| 1092 } | |
| 1093 | |
| 1094 limit = Max(limit, kMinimumOldGenerationAllocationLimit); | 1080 limit = Max(limit, kMinimumOldGenerationAllocationLimit); |
| 1095 limit += new_space_.Capacity(); | 1081 limit += new_space_.Capacity(); |
| 1096 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; | 1082 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; |
| 1097 return Min(limit, halfway_to_the_max); | 1083 return Min(limit, halfway_to_the_max); |
| 1098 } | 1084 } |
| 1099 | 1085 |
| 1100 // Indicates whether inline bump-pointer allocation has been disabled. | 1086 // Indicates whether inline bump-pointer allocation has been disabled. |
| 1101 bool inline_allocation_disabled() { return inline_allocation_disabled_; } | 1087 bool inline_allocation_disabled() { return inline_allocation_disabled_; } |
| 1102 | 1088 |
| 1103 // Switch whether inline bump-pointer allocation should be used. | 1089 // Switch whether inline bump-pointer allocation should be used. |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 Object* roots_[kRootListLength]; | 1494 Object* roots_[kRootListLength]; |
| 1509 | 1495 |
| 1510 size_t code_range_size_; | 1496 size_t code_range_size_; |
| 1511 int reserved_semispace_size_; | 1497 int reserved_semispace_size_; |
| 1512 int max_semi_space_size_; | 1498 int max_semi_space_size_; |
| 1513 int initial_semispace_size_; | 1499 int initial_semispace_size_; |
| 1514 intptr_t max_old_generation_size_; | 1500 intptr_t max_old_generation_size_; |
| 1515 intptr_t max_executable_size_; | 1501 intptr_t max_executable_size_; |
| 1516 intptr_t maximum_committed_; | 1502 intptr_t maximum_committed_; |
| 1517 | 1503 |
| 1504 // The old space growing factor is used in the old space heap growing |
| 1505 // strategy. The new old space size is the current old space size times |
| 1506 // old_space_growing_factor_. |
| 1507 int old_space_growing_factor_; |
| 1508 |
| 1518 // For keeping track of how much data has survived | 1509 // For keeping track of how much data has survived |
| 1519 // scavenge since last new space expansion. | 1510 // scavenge since last new space expansion. |
| 1520 int survived_since_last_expansion_; | 1511 int survived_since_last_expansion_; |
| 1521 | 1512 |
| 1522 // For keeping track on when to flush RegExp code. | 1513 // For keeping track on when to flush RegExp code. |
| 1523 int sweep_generation_; | 1514 int sweep_generation_; |
| 1524 | 1515 |
| 1525 int always_allocate_scope_depth_; | 1516 int always_allocate_scope_depth_; |
| 1526 int linear_allocation_scope_depth_; | 1517 int linear_allocation_scope_depth_; |
| 1527 | 1518 |
| (...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2781 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2772 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2782 | 2773 |
| 2783 private: | 2774 private: |
| 2784 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2775 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2785 }; | 2776 }; |
| 2786 #endif // DEBUG | 2777 #endif // DEBUG |
| 2787 | 2778 |
| 2788 } } // namespace v8::internal | 2779 } } // namespace v8::internal |
| 2789 | 2780 |
| 2790 #endif // V8_HEAP_H_ | 2781 #endif // V8_HEAP_H_ |
| OLD | NEW |