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

Side by Side Diff: src/platform-posix.cc

Issue 300713002: Move NumberOfProcessorsOnline from CPU to OS (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/platform.h ('k') | src/platform-win32.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 // Platform-specific code for POSIX goes here. This is not a platform on its 5 // Platform-specific code for POSIX goes here. This is not a platform on its
6 // own, but contains the parts which are the same across the POSIX platforms 6 // own, but contains the parts which are the same across the POSIX platforms
7 // Linux, MacOS, FreeBSD, OpenBSD, NetBSD and QNX. 7 // Linux, MacOS, FreeBSD, OpenBSD, NetBSD and QNX.
8 8
9 #include <dlfcn.h> 9 #include <dlfcn.h>
10 #include <pthread.h> 10 #include <pthread.h>
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 // 0 is never a valid thread id. 51 // 0 is never a valid thread id.
52 static const pthread_t kNoThread = (pthread_t) 0; 52 static const pthread_t kNoThread = (pthread_t) 0;
53 53
54 54
55 unsigned OS::CpuFeaturesImpliedByPlatform() { 55 unsigned OS::CpuFeaturesImpliedByPlatform() {
56 return 0; // Nothing special. 56 return 0; // Nothing special.
57 } 57 }
58 58
59 59
60 int OS::NumberOfProcessorsOnline() {
61 return static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN));
62 }
63
64
60 // Maximum size of the virtual memory. 0 means there is no artificial 65 // Maximum size of the virtual memory. 0 means there is no artificial
61 // limit. 66 // limit.
62 67
63 intptr_t OS::MaxVirtualMemory() { 68 intptr_t OS::MaxVirtualMemory() {
64 struct rlimit limit; 69 struct rlimit limit;
65 int result = getrlimit(RLIMIT_DATA, &limit); 70 int result = getrlimit(RLIMIT_DATA, &limit);
66 if (result != 0) return 0; 71 if (result != 0) return 0;
67 #if V8_OS_NACL 72 #if V8_OS_NACL
68 // The NaCl compiler doesn't like resource.h constants. 73 // The NaCl compiler doesn't like resource.h constants.
69 if (static_cast<int>(limit.rlim_cur) == -1) return 0; 74 if (static_cast<int>(limit.rlim_cur) == -1) return 0;
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 756
752 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { 757 void Thread::SetThreadLocal(LocalStorageKey key, void* value) {
753 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); 758 pthread_key_t pthread_key = LocalKeyToPthreadKey(key);
754 int result = pthread_setspecific(pthread_key, value); 759 int result = pthread_setspecific(pthread_key, value);
755 ASSERT_EQ(0, result); 760 ASSERT_EQ(0, result);
756 USE(result); 761 USE(result);
757 } 762 }
758 763
759 764
760 } } // namespace v8::internal 765 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform.h ('k') | src/platform-win32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698