The embedder can control how many threads it wants to use via the
v8::Platform implementation. V8 internally doesn't spin up threads
anymore. If the embedder doesn't want to use any threads at all, it's
v8::Platform implementation must either run the background jobs on
the foreground thread, or the embedder should specify --predictable
BUG=none
R=yangguo@chromium.org
LOG=y
Review URL: https://codereview.chromium.org/
1064723005
Cr-Commit-Position: refs/heads/master@{#27833}
* device, in bytes.
* \param virtual_memory_limit The amount of virtual memory on the current
* device, in bytes, or zero, if there is no limit.
- * \param number_of_processors The number of CPUs available on the current
- * device.
*/
+ void ConfigureDefaults(uint64_t physical_memory,
+ uint64_t virtual_memory_limit);
+
+ // Deprecated, will be removed soon.
void ConfigureDefaults(uint64_t physical_memory,
uint64_t virtual_memory_limit,
uint32_t number_of_processors);
uint32_t* stack_limit() const { return stack_limit_; }
// Sets an address beyond which the VM's stack may not grow.
void set_stack_limit(uint32_t* value) { stack_limit_ = value; }
- int max_available_threads() const { return max_available_threads_; }
+ V8_DEPRECATE_SOON("Unused, will be removed",
+ int max_available_threads() const) {
+ return max_available_threads_;
+ }
// Set the number of threads available to V8, assuming at least 1.
- void set_max_available_threads(int value) {
+ V8_DEPRECATE_SOON("Unused, will be removed",
+ void set_max_available_threads(int value)) {
max_available_threads_ = value;
}
size_t code_range_size() const { return code_range_size_; }
void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
uint64_t virtual_memory_limit,
uint32_t number_of_processors) {
+ ConfigureDefaults(physical_memory, virtual_memory_limit);
+}
+
+void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
+ uint64_t virtual_memory_limit) {
#if V8_OS_ANDROID
// Android has higher physical memory requirements before raising the maximum
// heap size limits since it has no swap space.
set_max_executable_size(i::Heap::kMaxExecutableSizeHugeMemoryDevice);
}
- set_max_available_threads(i::Max(i::Min(number_of_processors, 4u), 1u));
-
if (virtual_memory_limit > 0 && i::kRequiresCodeRange) {
// Reserve no more than 1/8 of the memory for the code range, but at most
// kMaximalCodeRangeSize.
uintptr_t limit = reinterpret_cast<uintptr_t>(constraints.stack_limit());
isolate->stack_guard()->SetStackLimit(limit);
}
-
- isolate->set_max_available_threads(constraints.max_available_threads());
}
#ifndef V8_SHARED
create_params.constraints.ConfigureDefaults(
base::SysInfo::AmountOfPhysicalMemory(),
- base::SysInfo::AmountOfVirtualMemory(),
- base::SysInfo::NumberOfProcessors());
+ base::SysInfo::AmountOfVirtualMemory());
Shell::counter_map_ = new CounterMap();
if (i::FLAG_dump_counters || i::FLAG_track_gc_object_stats) {
if (!ConfigureHeapDefault()) return false;
}
- concurrent_sweeping_enabled_ =
- FLAG_concurrent_sweeping && isolate_->max_available_threads() > 1;
+ concurrent_sweeping_enabled_ = FLAG_concurrent_sweeping;
base::CallOnce(&initialize_gc_once, &InitializeGCOnce);
set_event_logger(Logger::DefaultEventLoggerSentinel);
}
- // Set default value if not yet set.
- // TODO(yangguo): move this to ResourceConstraints::ConfigureDefaults
- // once ResourceConstraints becomes an argument to the Isolate constructor.
- if (max_available_threads_ < 1) {
- // Choose the default between 1 and 4.
- max_available_threads_ =
- Max(Min(base::SysInfo::NumberOfProcessors(), 4), 1);
- }
-
if (FLAG_trace_hydrogen || FLAG_trace_hydrogen_stubs) {
PrintF("Concurrent recompilation has been disabled for tracing.\n");
- } else if (OptimizingCompileDispatcher::Enabled(max_available_threads_)) {
+ } else if (OptimizingCompileDispatcher::Enabled()) {
optimizing_compile_dispatcher_ = new OptimizingCompileDispatcher(this);
}
V(HTracer*, htracer, NULL) \
V(CodeTracer*, code_tracer, NULL) \
V(bool, fp_stubs_generated, false) \
- V(int, max_available_threads, 0) \
V(uint32_t, per_isolate_assert_data, 0xFFFFFFFFu) \
V(PromiseRejectCallback, promise_reject_callback, NULL) \
V(const v8::StartupData*, snapshot_blob, NULL) \
AddToOsrBuffer(NULL);
}
- static bool Enabled(int max_available) {
- return (FLAG_concurrent_recompilation && max_available > 1);
- }
+ static bool Enabled() { return FLAG_concurrent_recompilation; }
private:
class CompileTask;