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 5064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5075 // size is not big enough to fit all the initial objects. | 5075 // size is not big enough to fit all the initial objects. |
5076 bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size, | 5076 bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size, |
5077 int max_executable_size, size_t code_range_size) { | 5077 int max_executable_size, size_t code_range_size) { |
5078 if (HasBeenSetUp()) return false; | 5078 if (HasBeenSetUp()) return false; |
5079 | 5079 |
5080 // Overwrite default configuration. | 5080 // Overwrite default configuration. |
5081 if (max_semi_space_size > 0) { | 5081 if (max_semi_space_size > 0) { |
5082 max_semi_space_size_ = max_semi_space_size * MB; | 5082 max_semi_space_size_ = max_semi_space_size * MB; |
5083 } | 5083 } |
5084 if (max_old_space_size > 0) { | 5084 if (max_old_space_size > 0) { |
5085 max_old_generation_size_ = max_old_space_size * MB; | 5085 max_old_generation_size_ = static_cast<intptr_t>(max_old_space_size) * MB; |
5086 } | 5086 } |
5087 if (max_executable_size > 0) { | 5087 if (max_executable_size > 0) { |
5088 max_executable_size_ = max_executable_size * MB; | 5088 max_executable_size_ = static_cast<intptr_t>(max_executable_size) * MB; |
5089 } | 5089 } |
5090 | 5090 |
5091 // If max space size flags are specified overwrite the configuration. | 5091 // If max space size flags are specified overwrite the configuration. |
5092 if (FLAG_max_semi_space_size > 0) { | 5092 if (FLAG_max_semi_space_size > 0) { |
5093 max_semi_space_size_ = FLAG_max_semi_space_size * MB; | 5093 max_semi_space_size_ = FLAG_max_semi_space_size * MB; |
5094 } | 5094 } |
5095 if (FLAG_max_old_space_size > 0) { | 5095 if (FLAG_max_old_space_size > 0) { |
5096 max_old_generation_size_ = FLAG_max_old_space_size * MB; | 5096 max_old_generation_size_ = |
| 5097 static_cast<intptr_t>(FLAG_max_old_space_size) * MB; |
5097 } | 5098 } |
5098 if (FLAG_max_executable_size > 0) { | 5099 if (FLAG_max_executable_size > 0) { |
5099 max_executable_size_ = FLAG_max_executable_size * MB; | 5100 max_executable_size_ = static_cast<intptr_t>(FLAG_max_executable_size) * MB; |
5100 } | 5101 } |
5101 | 5102 |
5102 if (FLAG_stress_compaction) { | 5103 if (FLAG_stress_compaction) { |
5103 // This will cause more frequent GCs when stressing. | 5104 // This will cause more frequent GCs when stressing. |
5104 max_semi_space_size_ = Page::kPageSize; | 5105 max_semi_space_size_ = Page::kPageSize; |
5105 } | 5106 } |
5106 | 5107 |
5107 if (Snapshot::HaveASnapshotToStartFrom()) { | 5108 if (Snapshot::HaveASnapshotToStartFrom()) { |
5108 // If we are using a snapshot we always reserve the default amount | 5109 // If we are using a snapshot we always reserve the default amount |
5109 // of memory for each semispace because code in the snapshot has | 5110 // of memory for each semispace because code in the snapshot has |
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6437 static_cast<int>(object_sizes_last_time_[index])); | 6438 static_cast<int>(object_sizes_last_time_[index])); |
6438 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6439 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6439 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6440 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6440 | 6441 |
6441 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6442 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6442 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6443 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6443 ClearObjectStats(); | 6444 ClearObjectStats(); |
6444 } | 6445 } |
6445 } | 6446 } |
6446 } // namespace v8::internal | 6447 } // namespace v8::internal |
OLD | NEW |