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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 5090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5101 // size is not big enough to fit all the initial objects. | 5101 // size is not big enough to fit all the initial objects. |
5102 bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size, | 5102 bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size, |
5103 int max_executable_size, size_t code_range_size) { | 5103 int max_executable_size, size_t code_range_size) { |
5104 if (HasBeenSetUp()) return false; | 5104 if (HasBeenSetUp()) return false; |
5105 | 5105 |
5106 // Overwrite default configuration. | 5106 // Overwrite default configuration. |
5107 if (max_semi_space_size > 0) { | 5107 if (max_semi_space_size > 0) { |
5108 max_semi_space_size_ = max_semi_space_size * MB; | 5108 max_semi_space_size_ = max_semi_space_size * MB; |
5109 } | 5109 } |
5110 if (max_old_space_size > 0) { | 5110 if (max_old_space_size > 0) { |
5111 max_old_generation_size_ = max_old_space_size * MB; | 5111 max_old_generation_size_ = static_cast<intptr_t>(max_old_space_size) * MB; |
5112 } | 5112 } |
5113 if (max_executable_size > 0) { | 5113 if (max_executable_size > 0) { |
5114 max_executable_size_ = max_executable_size * MB; | 5114 max_executable_size_ = static_cast<intptr_t>(max_executable_size) * MB; |
5115 } | 5115 } |
5116 | 5116 |
5117 // If max space size flags are specified overwrite the configuration. | 5117 // If max space size flags are specified overwrite the configuration. |
5118 if (FLAG_max_semi_space_size > 0) { | 5118 if (FLAG_max_semi_space_size > 0) { |
5119 max_semi_space_size_ = FLAG_max_semi_space_size * MB; | 5119 max_semi_space_size_ = FLAG_max_semi_space_size * MB; |
5120 } | 5120 } |
5121 if (FLAG_max_old_space_size > 0) { | 5121 if (FLAG_max_old_space_size > 0) { |
5122 max_old_generation_size_ = FLAG_max_old_space_size * MB; | 5122 max_old_generation_size_ = |
| 5123 static_cast<intptr_t>(FLAG_max_old_space_size) * MB; |
5123 } | 5124 } |
5124 if (FLAG_max_executable_size > 0) { | 5125 if (FLAG_max_executable_size > 0) { |
5125 max_executable_size_ = FLAG_max_executable_size * MB; | 5126 max_executable_size_ = static_cast<intptr_t>(FLAG_max_executable_size) * MB; |
5126 } | 5127 } |
5127 | 5128 |
5128 if (FLAG_stress_compaction) { | 5129 if (FLAG_stress_compaction) { |
5129 // This will cause more frequent GCs when stressing. | 5130 // This will cause more frequent GCs when stressing. |
5130 max_semi_space_size_ = Page::kPageSize; | 5131 max_semi_space_size_ = Page::kPageSize; |
5131 } | 5132 } |
5132 | 5133 |
5133 if (Snapshot::HaveASnapshotToStartFrom()) { | 5134 if (Snapshot::HaveASnapshotToStartFrom()) { |
5134 // If we are using a snapshot we always reserve the default amount | 5135 // If we are using a snapshot we always reserve the default amount |
5135 // of memory for each semispace because code in the snapshot has | 5136 // of memory for each semispace because code in the snapshot has |
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6463 static_cast<int>(object_sizes_last_time_[index])); | 6464 static_cast<int>(object_sizes_last_time_[index])); |
6464 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6465 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6465 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6466 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6466 | 6467 |
6467 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6468 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6468 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6469 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6469 ClearObjectStats(); | 6470 ClearObjectStats(); |
6470 } | 6471 } |
6471 } | 6472 } |
6472 } // namespace v8::internal | 6473 } // namespace v8::internal |
OLD | NEW |