Revision: 17874
Author: [email protected]
Date: Tue Nov 19 13:08:37 2013 UTC
Log: Add a proper way to pass the number of processors to V8
BUG=321060
LOG=n
[email protected]
Review URL: https://codereview.chromium.org/73463004
http://code.google.com/p/v8/source/detail?r=17874
Modified:
/branches/bleeding_edge/include/v8.h
/branches/bleeding_edge/src/api.cc
/branches/bleeding_edge/src/d8.cc
=======================================
--- /branches/bleeding_edge/include/v8.h Tue Nov 19 12:20:08 2013 UTC
+++ /branches/bleeding_edge/include/v8.h Tue Nov 19 13:08:37 2013 UTC
@@ -3809,8 +3809,13 @@
*
* \param physical_memory The total amount of physical memory on the
current
* device, in bytes.
+ * \param number_of_processors The number of CPUs available on the
current
+ * device.
*/
- void ConfigureDefaults(uint64_t physical_memory);
+ void ConfigureDefaults(uint64_t physical_memory,
+ uint32_t number_of_processors);
+ V8_DEPRECATED("Will be removed",
+ void ConfigureDefaults(uint64_t physical_memory));
int max_young_space_size() const { return max_young_space_size_; }
void set_max_young_space_size(int value) { max_young_space_size_ =
value; }
=======================================
--- /branches/bleeding_edge/src/api.cc Tue Nov 19 11:52:47 2013 UTC
+++ /branches/bleeding_edge/src/api.cc Tue Nov 19 13:08:37 2013 UTC
@@ -566,8 +566,8 @@
stack_limit_(NULL),
max_available_threads_(0) { }
-
-void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory) {
+void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
+ uint32_t number_of_processors)
{
const int lump_of_memory = (i::kPointerSize / 4) * i::MB;
#if V8_OS_ANDROID
// Android has higher physical memory requirements before raising the
maximum
@@ -601,7 +601,12 @@
set_max_executable_size(256 * lump_of_memory);
}
- set_max_available_threads(0);
+ set_max_available_threads(i::Max(i::Min(number_of_processors, 4u), 1u));
+}
+
+
+void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory) {
+ ConfigureDefaults(physical_memory, i::CPU::NumberOfProcessorsOnline());
}
=======================================
--- /branches/bleeding_edge/src/d8.cc Mon Nov 18 14:50:45 2013 UTC
+++ /branches/bleeding_edge/src/d8.cc Tue Nov 19 13:08:37 2013 UTC
@@ -62,6 +62,7 @@
#ifndef V8_SHARED
#include "api.h"
#include "checks.h"
+#include "cpu.h"
#include "d8-debug.h"
#include "debug.h"
#include "natives.h"
@@ -1709,7 +1710,8 @@
Isolate* isolate = Isolate::GetCurrent();
#ifndef V8_SHARED
v8::ResourceConstraints constraints;
- constraints.ConfigureDefaults(i::OS::TotalPhysicalMemory());
+ constraints.ConfigureDefaults(i::OS::TotalPhysicalMemory(),
+ i::CPU::NumberOfProcessorsOnline());
v8::SetResourceConstraints(isolate, &constraints);
#endif
DumbLineEditor dumb_line_editor(isolate);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.