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 /** \mainpage V8 API Reference Guide | 5 /** \mainpage V8 API Reference Guide |
6 * | 6 * |
7 * V8 is Google's open source JavaScript engine. | 7 * V8 is Google's open source JavaScript engine. |
8 * | 8 * |
9 * This set of documents provides reference material generated from the | 9 * This set of documents provides reference material generated from the |
10 * V8 header file, include/v8.h. | 10 * V8 header file, include/v8.h. |
(...skipping 5943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5954 * A set of constraints that specifies the limits of the runtime's memory use. | 5954 * A set of constraints that specifies the limits of the runtime's memory use. |
5955 * You must set the heap size before initializing the VM - the size cannot be | 5955 * You must set the heap size before initializing the VM - the size cannot be |
5956 * adjusted after the VM is initialized. | 5956 * adjusted after the VM is initialized. |
5957 * | 5957 * |
5958 * If you are using threads then you should hold the V8::Locker lock while | 5958 * If you are using threads then you should hold the V8::Locker lock while |
5959 * setting the stack limit and you must set a non-default stack limit separately | 5959 * setting the stack limit and you must set a non-default stack limit separately |
5960 * for each thread. | 5960 * for each thread. |
5961 * | 5961 * |
5962 * The arguments for set_max_semi_space_size, set_max_old_space_size, | 5962 * The arguments for set_max_semi_space_size, set_max_old_space_size, |
5963 * set_max_executable_size, set_code_range_size specify limits in MB. | 5963 * set_max_executable_size, set_code_range_size specify limits in MB. |
5964 * | |
5965 * The argument for set_max_semi_space_size_in_kb is in KB. | |
5964 */ | 5966 */ |
5965 class V8_EXPORT ResourceConstraints { | 5967 class V8_EXPORT ResourceConstraints { |
5966 public: | 5968 public: |
5967 ResourceConstraints(); | 5969 ResourceConstraints(); |
5968 | 5970 |
5969 /** | 5971 /** |
5970 * Configures the constraints with reasonable default values based on the | 5972 * Configures the constraints with reasonable default values based on the |
5971 * capabilities of the current device the VM is running on. | 5973 * capabilities of the current device the VM is running on. |
5972 * | 5974 * |
5973 * \param physical_memory The total amount of physical memory on the current | 5975 * \param physical_memory The total amount of physical memory on the current |
5974 * device, in bytes. | 5976 * device, in bytes. |
5975 * \param virtual_memory_limit The amount of virtual memory on the current | 5977 * \param virtual_memory_limit The amount of virtual memory on the current |
5976 * device, in bytes, or zero, if there is no limit. | 5978 * device, in bytes, or zero, if there is no limit. |
5977 */ | 5979 */ |
5978 void ConfigureDefaults(uint64_t physical_memory, | 5980 void ConfigureDefaults(uint64_t physical_memory, |
5979 uint64_t virtual_memory_limit); | 5981 uint64_t virtual_memory_limit); |
5980 | 5982 |
5981 int max_semi_space_size() const { return max_semi_space_size_; } | 5983 // Returns the max semi-space size in MB. |
5984 int max_semi_space_size() const { return max_semi_space_size_in_kb_ / 1024; } | |
Michael Lippautz
2017/06/14 07:25:08
Maybe deprecate?
Hannes Payer (out of office)
2017/06/14 07:57:02
Done.
| |
5985 | |
5986 // Sets the max semi-space size in MB. | |
5982 void set_max_semi_space_size(int limit_in_mb) { | 5987 void set_max_semi_space_size(int limit_in_mb) { |
5983 max_semi_space_size_ = limit_in_mb; | 5988 max_semi_space_size_in_kb_ = limit_in_mb * 1024; |
5984 } | 5989 } |
5990 | |
5991 // Returns the max semi-space size in KB. | |
5992 int max_semi_space_size_in_kb() const { return max_semi_space_size_in_kb_; } | |
Michael Lippautz
2017/06/14 07:25:08
I know that everything here is int, but should we
Hannes Payer (out of office)
2017/06/14 07:57:02
Done.
| |
5993 | |
5994 // Sets the max semi-space size in KB. | |
5995 void set_max_semi_space_size_in_kb(int limit_in_kb) { | |
5996 max_semi_space_size_in_kb_ = limit_in_kb; | |
5997 } | |
5998 | |
5985 int max_old_space_size() const { return max_old_space_size_; } | 5999 int max_old_space_size() const { return max_old_space_size_; } |
5986 void set_max_old_space_size(int limit_in_mb) { | 6000 void set_max_old_space_size(int limit_in_mb) { |
5987 max_old_space_size_ = limit_in_mb; | 6001 max_old_space_size_ = limit_in_mb; |
5988 } | 6002 } |
5989 V8_DEPRECATE_SOON("max_executable_size_ is subsumed by max_old_space_size_", | 6003 V8_DEPRECATE_SOON("max_executable_size_ is subsumed by max_old_space_size_", |
5990 int max_executable_size() const) { | 6004 int max_executable_size() const) { |
5991 return max_executable_size_; | 6005 return max_executable_size_; |
5992 } | 6006 } |
5993 V8_DEPRECATE_SOON("max_executable_size_ is subsumed by max_old_space_size_", | 6007 V8_DEPRECATE_SOON("max_executable_size_ is subsumed by max_old_space_size_", |
5994 void set_max_executable_size(int limit_in_mb)) { | 6008 void set_max_executable_size(int limit_in_mb)) { |
5995 max_executable_size_ = limit_in_mb; | 6009 max_executable_size_ = limit_in_mb; |
5996 } | 6010 } |
5997 uint32_t* stack_limit() const { return stack_limit_; } | 6011 uint32_t* stack_limit() const { return stack_limit_; } |
5998 // Sets an address beyond which the VM's stack may not grow. | 6012 // Sets an address beyond which the VM's stack may not grow. |
5999 void set_stack_limit(uint32_t* value) { stack_limit_ = value; } | 6013 void set_stack_limit(uint32_t* value) { stack_limit_ = value; } |
6000 size_t code_range_size() const { return code_range_size_; } | 6014 size_t code_range_size() const { return code_range_size_; } |
6001 void set_code_range_size(size_t limit_in_mb) { | 6015 void set_code_range_size(size_t limit_in_mb) { |
6002 code_range_size_ = limit_in_mb; | 6016 code_range_size_ = limit_in_mb; |
6003 } | 6017 } |
6004 size_t max_zone_pool_size() const { return max_zone_pool_size_; } | 6018 size_t max_zone_pool_size() const { return max_zone_pool_size_; } |
6005 void set_max_zone_pool_size(const size_t bytes) { | 6019 void set_max_zone_pool_size(const size_t bytes) { |
6006 max_zone_pool_size_ = bytes; | 6020 max_zone_pool_size_ = bytes; |
6007 } | 6021 } |
6008 | 6022 |
6009 private: | 6023 private: |
6010 int max_semi_space_size_; | 6024 // max_semi_space_size_ is in KB |
6025 int max_semi_space_size_in_kb_; | |
6026 | |
6027 // The remaining limits are in MB | |
6011 int max_old_space_size_; | 6028 int max_old_space_size_; |
6012 int max_executable_size_; | 6029 int max_executable_size_; |
6013 uint32_t* stack_limit_; | 6030 uint32_t* stack_limit_; |
6014 size_t code_range_size_; | 6031 size_t code_range_size_; |
6015 size_t max_zone_pool_size_; | 6032 size_t max_zone_pool_size_; |
6016 }; | 6033 }; |
6017 | 6034 |
6018 | 6035 |
6019 // --- Exceptions --- | 6036 // --- Exceptions --- |
6020 | 6037 |
(...skipping 4219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10240 */ | 10257 */ |
10241 | 10258 |
10242 | 10259 |
10243 } // namespace v8 | 10260 } // namespace v8 |
10244 | 10261 |
10245 | 10262 |
10246 #undef TYPE_CHECK | 10263 #undef TYPE_CHECK |
10247 | 10264 |
10248 | 10265 |
10249 #endif // INCLUDE_V8_H_ | 10266 #endif // INCLUDE_V8_H_ |
OLD | NEW |