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 "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "accessors.h" | 7 #include "accessors.h" |
8 #include "api.h" | 8 #include "api.h" |
9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
10 #include "codegen.h" | 10 #include "codegen.h" |
(...skipping 4996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5007 | 5007 |
5008 // TODO(1236194): Since the heap size is configurable on the command line | 5008 // TODO(1236194): Since the heap size is configurable on the command line |
5009 // and through the API, we should gracefully handle the case that the heap | 5009 // and through the API, we should gracefully handle the case that the heap |
5010 // size is not big enough to fit all the initial objects. | 5010 // size is not big enough to fit all the initial objects. |
5011 bool Heap::ConfigureHeap(int max_semispace_size, | 5011 bool Heap::ConfigureHeap(int max_semispace_size, |
5012 intptr_t max_old_gen_size, | 5012 intptr_t max_old_gen_size, |
5013 intptr_t max_executable_size, | 5013 intptr_t max_executable_size, |
5014 intptr_t code_range_size) { | 5014 intptr_t code_range_size) { |
5015 if (HasBeenSetUp()) return false; | 5015 if (HasBeenSetUp()) return false; |
5016 | 5016 |
| 5017 // If max space size flags are specified overwrite the configuration. |
| 5018 if (FLAG_max_new_space_size > 0) { |
| 5019 max_semispace_size = FLAG_max_new_space_size * kLumpOfMemory; |
| 5020 } |
| 5021 if (FLAG_max_old_space_size > 0) { |
| 5022 max_old_gen_size = FLAG_max_old_space_size * kLumpOfMemory; |
| 5023 } |
| 5024 if (FLAG_max_executable_size > 0) { |
| 5025 max_executable_size = FLAG_max_executable_size * kLumpOfMemory; |
| 5026 } |
| 5027 |
5017 if (FLAG_stress_compaction) { | 5028 if (FLAG_stress_compaction) { |
5018 // This will cause more frequent GCs when stressing. | 5029 // This will cause more frequent GCs when stressing. |
5019 max_semispace_size_ = Page::kPageSize; | 5030 max_semispace_size_ = Page::kPageSize; |
5020 } | 5031 } |
5021 | 5032 |
5022 if (max_semispace_size > 0) { | 5033 if (max_semispace_size > 0) { |
5023 if (max_semispace_size < Page::kPageSize) { | 5034 if (max_semispace_size < Page::kPageSize) { |
5024 max_semispace_size = Page::kPageSize; | 5035 max_semispace_size = Page::kPageSize; |
5025 if (FLAG_trace_gc) { | 5036 if (FLAG_trace_gc) { |
5026 PrintPID("Max semispace size cannot be less than %dkbytes\n", | 5037 PrintPID("Max semispace size cannot be less than %dkbytes\n", |
(...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6492 static_cast<int>(object_sizes_last_time_[index])); | 6503 static_cast<int>(object_sizes_last_time_[index])); |
6493 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6504 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6494 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6505 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6495 | 6506 |
6496 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6507 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6497 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6508 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6498 ClearObjectStats(); | 6509 ClearObjectStats(); |
6499 } | 6510 } |
6500 | 6511 |
6501 } } // namespace v8::internal | 6512 } } // namespace v8::internal |
OLD | NEW |