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 4962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4973 // output a flag to the snapshot. However at this point the serializer and | 4973 // output a flag to the snapshot. However at this point the serializer and |
4974 // deserializer are deliberately a little unsynchronized (see above) so the | 4974 // deserializer are deliberately a little unsynchronized (see above) so the |
4975 // checking of the sync flag in the snapshot would fail. | 4975 // checking of the sync flag in the snapshot would fail. |
4976 } | 4976 } |
4977 | 4977 |
4978 | 4978 |
4979 // TODO(1236194): Since the heap size is configurable on the command line | 4979 // TODO(1236194): Since the heap size is configurable on the command line |
4980 // and through the API, we should gracefully handle the case that the heap | 4980 // and through the API, we should gracefully handle the case that the heap |
4981 // size is not big enough to fit all the initial objects. | 4981 // size is not big enough to fit all the initial objects. |
4982 bool Heap::ConfigureHeap(int max_semispace_size, | 4982 bool Heap::ConfigureHeap(int max_semispace_size, |
4983 intptr_t max_old_gen_size, | 4983 intptr_t max_old_space_size, |
4984 intptr_t max_executable_size, | 4984 intptr_t max_executable_size, |
4985 intptr_t code_range_size) { | 4985 intptr_t code_range_size) { |
4986 if (HasBeenSetUp()) return false; | 4986 if (HasBeenSetUp()) return false; |
4987 | 4987 |
4988 // If max space size flags are specified overwrite the configuration. | 4988 // If max space size flags are specified overwrite the configuration. |
4989 if (FLAG_max_new_space_size > 0) { | 4989 if (FLAG_max_new_space_size > 0) { |
4990 max_semispace_size = FLAG_max_new_space_size * kLumpOfMemory; | 4990 max_semispace_size = (FLAG_max_new_space_size / 2) * kLumpOfMemory; |
4991 } | 4991 } |
4992 if (FLAG_max_old_space_size > 0) { | 4992 if (FLAG_max_old_space_size > 0) { |
4993 max_old_gen_size = FLAG_max_old_space_size * kLumpOfMemory; | 4993 max_old_space_size = FLAG_max_old_space_size * kLumpOfMemory; |
4994 } | 4994 } |
4995 if (FLAG_max_executable_size > 0) { | 4995 if (FLAG_max_executable_size > 0) { |
4996 max_executable_size = FLAG_max_executable_size * kLumpOfMemory; | 4996 max_executable_size = FLAG_max_executable_size * kLumpOfMemory; |
4997 } | 4997 } |
4998 | 4998 |
4999 if (FLAG_stress_compaction) { | 4999 if (FLAG_stress_compaction) { |
5000 // This will cause more frequent GCs when stressing. | 5000 // This will cause more frequent GCs when stressing. |
5001 max_semispace_size_ = Page::kPageSize; | 5001 max_semispace_size_ = Page::kPageSize; |
5002 } | 5002 } |
5003 | 5003 |
(...skipping 20 matching lines...) Expand all Loading... |
5024 PrintPID("Max semispace size cannot be more than %dkbytes\n", | 5024 PrintPID("Max semispace size cannot be more than %dkbytes\n", |
5025 reserved_semispace_size_ >> 10); | 5025 reserved_semispace_size_ >> 10); |
5026 } | 5026 } |
5027 } | 5027 } |
5028 } else { | 5028 } else { |
5029 // If we are not using snapshots we reserve space for the actual | 5029 // If we are not using snapshots we reserve space for the actual |
5030 // max semispace size. | 5030 // max semispace size. |
5031 reserved_semispace_size_ = max_semispace_size_; | 5031 reserved_semispace_size_ = max_semispace_size_; |
5032 } | 5032 } |
5033 | 5033 |
5034 if (max_old_gen_size > 0) max_old_generation_size_ = max_old_gen_size; | 5034 if (max_old_space_size > 0) max_old_generation_size_ = max_old_space_size; |
5035 if (max_executable_size > 0) { | 5035 if (max_executable_size > 0) { |
5036 max_executable_size_ = RoundUp(max_executable_size, Page::kPageSize); | 5036 max_executable_size_ = RoundUp(max_executable_size, Page::kPageSize); |
5037 } | 5037 } |
5038 | 5038 |
5039 // The max executable size must be less than or equal to the max old | 5039 // The max executable size must be less than or equal to the max old |
5040 // generation size. | 5040 // generation size. |
5041 if (max_executable_size_ > max_old_generation_size_) { | 5041 if (max_executable_size_ > max_old_generation_size_) { |
5042 max_executable_size_ = max_old_generation_size_; | 5042 max_executable_size_ = max_old_generation_size_; |
5043 } | 5043 } |
5044 | 5044 |
(...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6478 static_cast<int>(object_sizes_last_time_[index])); | 6478 static_cast<int>(object_sizes_last_time_[index])); |
6479 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6479 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6480 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6480 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6481 | 6481 |
6482 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6482 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6483 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6483 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6484 ClearObjectStats(); | 6484 ClearObjectStats(); |
6485 } | 6485 } |
6486 | 6486 |
6487 } } // namespace v8::internal | 6487 } } // namespace v8::internal |
OLD | NEW |