Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: src/api.cc

Issue 1064723005: Remove support for specifying the number of available threads (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/v8.h ('k') | src/d8.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 : max_semi_space_size_(0), 437 : max_semi_space_size_(0),
438 max_old_space_size_(0), 438 max_old_space_size_(0),
439 max_executable_size_(0), 439 max_executable_size_(0),
440 stack_limit_(NULL), 440 stack_limit_(NULL),
441 max_available_threads_(0), 441 max_available_threads_(0),
442 code_range_size_(0) { } 442 code_range_size_(0) { }
443 443
444 void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory, 444 void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
445 uint64_t virtual_memory_limit, 445 uint64_t virtual_memory_limit,
446 uint32_t number_of_processors) { 446 uint32_t number_of_processors) {
447 ConfigureDefaults(physical_memory, virtual_memory_limit);
448 }
449
450 void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
451 uint64_t virtual_memory_limit) {
447 #if V8_OS_ANDROID 452 #if V8_OS_ANDROID
448 // Android has higher physical memory requirements before raising the maximum 453 // Android has higher physical memory requirements before raising the maximum
449 // heap size limits since it has no swap space. 454 // heap size limits since it has no swap space.
450 const uint64_t low_limit = 512ul * i::MB; 455 const uint64_t low_limit = 512ul * i::MB;
451 const uint64_t medium_limit = 1ul * i::GB; 456 const uint64_t medium_limit = 1ul * i::GB;
452 const uint64_t high_limit = 2ul * i::GB; 457 const uint64_t high_limit = 2ul * i::GB;
453 #else 458 #else
454 const uint64_t low_limit = 512ul * i::MB; 459 const uint64_t low_limit = 512ul * i::MB;
455 const uint64_t medium_limit = 768ul * i::MB; 460 const uint64_t medium_limit = 768ul * i::MB;
456 const uint64_t high_limit = 1ul * i::GB; 461 const uint64_t high_limit = 1ul * i::GB;
(...skipping 10 matching lines...) Expand all
467 } else if (physical_memory <= high_limit) { 472 } else if (physical_memory <= high_limit) {
468 set_max_semi_space_size(i::Heap::kMaxSemiSpaceSizeHighMemoryDevice); 473 set_max_semi_space_size(i::Heap::kMaxSemiSpaceSizeHighMemoryDevice);
469 set_max_old_space_size(i::Heap::kMaxOldSpaceSizeHighMemoryDevice); 474 set_max_old_space_size(i::Heap::kMaxOldSpaceSizeHighMemoryDevice);
470 set_max_executable_size(i::Heap::kMaxExecutableSizeHighMemoryDevice); 475 set_max_executable_size(i::Heap::kMaxExecutableSizeHighMemoryDevice);
471 } else { 476 } else {
472 set_max_semi_space_size(i::Heap::kMaxSemiSpaceSizeHugeMemoryDevice); 477 set_max_semi_space_size(i::Heap::kMaxSemiSpaceSizeHugeMemoryDevice);
473 set_max_old_space_size(i::Heap::kMaxOldSpaceSizeHugeMemoryDevice); 478 set_max_old_space_size(i::Heap::kMaxOldSpaceSizeHugeMemoryDevice);
474 set_max_executable_size(i::Heap::kMaxExecutableSizeHugeMemoryDevice); 479 set_max_executable_size(i::Heap::kMaxExecutableSizeHugeMemoryDevice);
475 } 480 }
476 481
477 set_max_available_threads(i::Max(i::Min(number_of_processors, 4u), 1u));
478
479 if (virtual_memory_limit > 0 && i::kRequiresCodeRange) { 482 if (virtual_memory_limit > 0 && i::kRequiresCodeRange) {
480 // Reserve no more than 1/8 of the memory for the code range, but at most 483 // Reserve no more than 1/8 of the memory for the code range, but at most
481 // kMaximalCodeRangeSize. 484 // kMaximalCodeRangeSize.
482 set_code_range_size( 485 set_code_range_size(
483 i::Min(i::kMaximalCodeRangeSize / i::MB, 486 i::Min(i::kMaximalCodeRangeSize / i::MB,
484 static_cast<size_t>((virtual_memory_limit >> 3) / i::MB))); 487 static_cast<size_t>((virtual_memory_limit >> 3) / i::MB)));
485 } 488 }
486 } 489 }
487 490
488 491
489 void SetResourceConstraints(i::Isolate* isolate, 492 void SetResourceConstraints(i::Isolate* isolate,
490 const ResourceConstraints& constraints) { 493 const ResourceConstraints& constraints) {
491 int semi_space_size = constraints.max_semi_space_size(); 494 int semi_space_size = constraints.max_semi_space_size();
492 int old_space_size = constraints.max_old_space_size(); 495 int old_space_size = constraints.max_old_space_size();
493 int max_executable_size = constraints.max_executable_size(); 496 int max_executable_size = constraints.max_executable_size();
494 size_t code_range_size = constraints.code_range_size(); 497 size_t code_range_size = constraints.code_range_size();
495 if (semi_space_size != 0 || old_space_size != 0 || 498 if (semi_space_size != 0 || old_space_size != 0 ||
496 max_executable_size != 0 || code_range_size != 0) { 499 max_executable_size != 0 || code_range_size != 0) {
497 isolate->heap()->ConfigureHeap(semi_space_size, old_space_size, 500 isolate->heap()->ConfigureHeap(semi_space_size, old_space_size,
498 max_executable_size, code_range_size); 501 max_executable_size, code_range_size);
499 } 502 }
500 if (constraints.stack_limit() != NULL) { 503 if (constraints.stack_limit() != NULL) {
501 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints.stack_limit()); 504 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints.stack_limit());
502 isolate->stack_guard()->SetStackLimit(limit); 505 isolate->stack_guard()->SetStackLimit(limit);
503 } 506 }
504
505 isolate->set_max_available_threads(constraints.max_available_threads());
506 } 507 }
507 508
508 509
509 i::Object** V8::GlobalizeReference(i::Isolate* isolate, i::Object** obj) { 510 i::Object** V8::GlobalizeReference(i::Isolate* isolate, i::Object** obj) {
510 LOG_API(isolate, "Persistent::New"); 511 LOG_API(isolate, "Persistent::New");
511 i::Handle<i::Object> result = isolate->global_handles()->Create(*obj); 512 i::Handle<i::Object> result = isolate->global_handles()->Create(*obj);
512 #ifdef VERIFY_HEAP 513 #ifdef VERIFY_HEAP
513 if (i::FLAG_verify_heap) { 514 if (i::FLAG_verify_heap) {
514 (*obj)->ObjectVerify(); 515 (*obj)->ObjectVerify();
515 } 516 }
(...skipping 7593 matching lines...) Expand 10 before | Expand all | Expand 10 after
8109 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 8110 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
8110 Address callback_address = 8111 Address callback_address =
8111 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8112 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8112 VMState<EXTERNAL> state(isolate); 8113 VMState<EXTERNAL> state(isolate);
8113 ExternalCallbackScope call_scope(isolate, callback_address); 8114 ExternalCallbackScope call_scope(isolate, callback_address);
8114 callback(info); 8115 callback(info);
8115 } 8116 }
8116 8117
8117 8118
8118 } } // namespace v8::internal 8119 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/d8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698