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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 set_max_old_space_size(i::Heap::kMaxOldSpaceSizeHighMemoryDevice); | 458 set_max_old_space_size(i::Heap::kMaxOldSpaceSizeHighMemoryDevice); |
459 set_max_executable_size(i::Heap::kMaxExecutableSizeHighMemoryDevice); | 459 set_max_executable_size(i::Heap::kMaxExecutableSizeHighMemoryDevice); |
460 } else { | 460 } else { |
461 set_max_semi_space_size(i::Heap::kMaxSemiSpaceSizeHugeMemoryDevice); | 461 set_max_semi_space_size(i::Heap::kMaxSemiSpaceSizeHugeMemoryDevice); |
462 set_max_old_space_size(i::Heap::kMaxOldSpaceSizeHugeMemoryDevice); | 462 set_max_old_space_size(i::Heap::kMaxOldSpaceSizeHugeMemoryDevice); |
463 set_max_executable_size(i::Heap::kMaxExecutableSizeHugeMemoryDevice); | 463 set_max_executable_size(i::Heap::kMaxExecutableSizeHugeMemoryDevice); |
464 } | 464 } |
465 | 465 |
466 set_max_available_threads(i::Max(i::Min(number_of_processors, 4u), 1u)); | 466 set_max_available_threads(i::Max(i::Min(number_of_processors, 4u), 1u)); |
467 | 467 |
468 if (virtual_memory_limit > 0 && i::kRequiresCodeRange) { | 468 if (virtual_memory_limit > 0 && i::kIs64BitArch) { |
469 // Reserve no more than 1/8 of the memory for the code range, but at most | 469 // Reserve no more than 1/8 of the memory for the code range, but at most |
470 // kMaximalCodeRangeSize. | 470 // 512 MB. |
471 set_code_range_size( | 471 set_code_range_size( |
472 i::Min(i::kMaximalCodeRangeSize / i::MB, | 472 i::Min(512, static_cast<int>((virtual_memory_limit >> 3) / i::MB))); |
473 static_cast<int>((virtual_memory_limit >> 3) / i::MB))); | |
474 } | 473 } |
475 } | 474 } |
476 | 475 |
477 | 476 |
478 bool SetResourceConstraints(Isolate* v8_isolate, | 477 bool SetResourceConstraints(Isolate* v8_isolate, |
479 ResourceConstraints* constraints) { | 478 ResourceConstraints* constraints) { |
480 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 479 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
481 int semi_space_size = constraints->max_semi_space_size(); | 480 int semi_space_size = constraints->max_semi_space_size(); |
482 int old_space_size = constraints->max_old_space_size(); | 481 int old_space_size = constraints->max_old_space_size(); |
483 int max_executable_size = constraints->max_executable_size(); | 482 int max_executable_size = constraints->max_executable_size(); |
(...skipping 7096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7580 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7579 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7581 Address callback_address = | 7580 Address callback_address = |
7582 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7581 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7583 VMState<EXTERNAL> state(isolate); | 7582 VMState<EXTERNAL> state(isolate); |
7584 ExternalCallbackScope call_scope(isolate, callback_address); | 7583 ExternalCallbackScope call_scope(isolate, callback_address); |
7585 callback(info); | 7584 callback(info); |
7586 } | 7585 } |
7587 | 7586 |
7588 | 7587 |
7589 } } // namespace v8::internal | 7588 } } // namespace v8::internal |
OLD | NEW |