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/api.h" | 5 #include "src/api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
737 set_max_executable_size(i::Heap::kMaxExecutableSizeHugeMemoryDevice); | 737 set_max_executable_size(i::Heap::kMaxExecutableSizeHugeMemoryDevice); |
738 } | 738 } |
739 | 739 |
740 if (virtual_memory_limit > 0 && i::kRequiresCodeRange) { | 740 if (virtual_memory_limit > 0 && i::kRequiresCodeRange) { |
741 // Reserve no more than 1/8 of the memory for the code range, but at most | 741 // Reserve no more than 1/8 of the memory for the code range, but at most |
742 // kMaximalCodeRangeSize. | 742 // kMaximalCodeRangeSize. |
743 set_code_range_size( | 743 set_code_range_size( |
744 i::Min(i::kMaximalCodeRangeSize / i::MB, | 744 i::Min(i::kMaximalCodeRangeSize / i::MB, |
745 static_cast<size_t>((virtual_memory_limit >> 3) / i::MB))); | 745 static_cast<size_t>((virtual_memory_limit >> 3) / i::MB))); |
746 } | 746 } |
747 | |
748 if (physical_memory <= 512ul * i::MB) { | |
Michael Lippautz
2016/10/18 14:50:22
Use the categories already defined above, starting
| |
749 set_max_pool_size(8ul * i::KB); | |
750 } else if (physical_memory <= i::GB) { | |
751 set_max_pool_size(i::MB); | |
752 } else { | |
753 set_max_pool_size(3ul * i::MB); | |
754 } | |
747 } | 755 } |
748 | 756 |
749 | 757 |
750 void SetResourceConstraints(i::Isolate* isolate, | 758 void SetResourceConstraints(i::Isolate* isolate, |
751 const ResourceConstraints& constraints) { | 759 const ResourceConstraints& constraints) { |
752 int semi_space_size = constraints.max_semi_space_size(); | 760 int semi_space_size = constraints.max_semi_space_size(); |
753 int old_space_size = constraints.max_old_space_size(); | 761 int old_space_size = constraints.max_old_space_size(); |
754 int max_executable_size = constraints.max_executable_size(); | 762 int max_executable_size = constraints.max_executable_size(); |
755 size_t code_range_size = constraints.code_range_size(); | 763 size_t code_range_size = constraints.code_range_size(); |
764 size_t max_pool_size = constraints.max_pool_size(); | |
756 if (semi_space_size != 0 || old_space_size != 0 || | 765 if (semi_space_size != 0 || old_space_size != 0 || |
757 max_executable_size != 0 || code_range_size != 0) { | 766 max_executable_size != 0 || code_range_size != 0) { |
758 isolate->heap()->ConfigureHeap(semi_space_size, old_space_size, | 767 isolate->heap()->ConfigureHeap(semi_space_size, old_space_size, |
759 max_executable_size, code_range_size); | 768 max_executable_size, code_range_size); |
760 } | 769 } |
770 isolate->allocator()->ConfigureSegmentPool(max_pool_size); | |
771 | |
761 if (constraints.stack_limit() != NULL) { | 772 if (constraints.stack_limit() != NULL) { |
762 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints.stack_limit()); | 773 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints.stack_limit()); |
763 isolate->stack_guard()->SetStackLimit(limit); | 774 isolate->stack_guard()->SetStackLimit(limit); |
764 } | 775 } |
765 } | 776 } |
766 | 777 |
767 | 778 |
768 i::Object** V8::GlobalizeReference(i::Isolate* isolate, i::Object** obj) { | 779 i::Object** V8::GlobalizeReference(i::Isolate* isolate, i::Object** obj) { |
769 LOG_API(isolate, Persistent, New); | 780 LOG_API(isolate, Persistent, New); |
770 i::Handle<i::Object> result = isolate->global_handles()->Create(*obj); | 781 i::Handle<i::Object> result = isolate->global_handles()->Create(*obj); |
(...skipping 8644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9415 Address callback_address = | 9426 Address callback_address = |
9416 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9427 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
9417 VMState<EXTERNAL> state(isolate); | 9428 VMState<EXTERNAL> state(isolate); |
9418 ExternalCallbackScope call_scope(isolate, callback_address); | 9429 ExternalCallbackScope call_scope(isolate, callback_address); |
9419 callback(info); | 9430 callback(info); |
9420 } | 9431 } |
9421 | 9432 |
9422 | 9433 |
9423 } // namespace internal | 9434 } // namespace internal |
9424 } // namespace v8 | 9435 } // namespace v8 |
OLD | NEW |