It's really more an OS-level information, and this way the default
platform doesn't depend on CPU-level details
BUG=none
R=yangguo@chromium.org
LOG=n
Review URL: https://codereview.chromium.org/
300713002
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21501
ce2b1a6d-e550-0410-aec6-
3dcde31c8c00
#endif
}
-
-// static
-int CPU::NumberOfProcessorsOnline() {
-#if V8_OS_WIN
- SYSTEM_INFO info;
- GetSystemInfo(&info);
- return info.dwNumberOfProcessors;
-#else
- return static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN));
-#endif
-}
-
} } // namespace v8::internal
bool has_vfp3() const { return has_vfp3_; }
bool has_vfp3_d32() const { return has_vfp3_d32_; }
- // Returns the number of processors online.
- static int NumberOfProcessorsOnline();
-
// Flush instruction cache.
static void FlushICache(void* start, size_t size);
v8::ResourceConstraints constraints;
constraints.ConfigureDefaults(i::OS::TotalPhysicalMemory(),
i::OS::MaxVirtualMemory(),
- i::CPU::NumberOfProcessorsOnline());
+ i::OS::NumberOfProcessorsOnline());
v8::SetResourceConstraints(isolate, &constraints);
#endif
DumbLineEditor dumb_line_editor(isolate);
// 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(CPU::NumberOfProcessorsOnline(), 4), 1);
+ max_available_threads_ = Max(Min(OS::NumberOfProcessorsOnline(), 4), 1);
}
if (!FLAG_job_based_sweeping) {
// TODO(jochen): We should have our own version of checks.h.
#include "../checks.h"
-// TODO(jochen): Why is cpu.h not in platform/?
-#include "../cpu.h"
+#include "../platform.h"
#include "worker-thread.h"
namespace v8 {
LockGuard<Mutex> guard(&lock_);
ASSERT(thread_pool_size >= 0);
if (thread_pool_size < 1)
- thread_pool_size = CPU::NumberOfProcessorsOnline();
+ thread_pool_size = OS::NumberOfProcessorsOnline();
thread_pool_size_ =
std::max(std::min(thread_pool_size, kMaxThreadPoolSize), 1);
}
}
+int OS::NumberOfProcessorsOnline() {
+ return static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN));
+}
+
+
// Maximum size of the virtual memory. 0 means there is no artificial
// limit.
}
+int OS::NumberOfProcessorsOnline() {
+ SYSTEM_INFO info;
+ GetSystemInfo(&info);
+ return info.dwNumberOfProcessors;
+}
+
+
double OS::nan_value() {
#ifdef _MSC_VER
// Positive Quiet NaN with no payload (aka. Indeterminate) has all bits
// positions indicated by the members of the CpuFeature enum from globals.h
static unsigned CpuFeaturesImpliedByPlatform();
+ // Returns the number of processors online.
+ static int NumberOfProcessorsOnline();
+
// The total amount of physical memory available on the current system.
static uint64_t TotalPhysicalMemory();
TEST(NumberOfProcessorsOnline) {
- CHECK_GT(CPU::NumberOfProcessorsOnline(), 0);
+ CHECK_GT(OS::NumberOfProcessorsOnline(), 0);
}