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

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

Issue 61153009: Add support for the QNX operating system. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Address latest review comments Created 7 years 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 | « src/platform.h ('k') | src/platform-qnx.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 123 }
124 return static_cast<uint64_t>(pages) * page_size; 124 return static_cast<uint64_t>(pages) * page_size;
125 #elif V8_OS_CYGWIN 125 #elif V8_OS_CYGWIN
126 MEMORYSTATUS memory_info; 126 MEMORYSTATUS memory_info;
127 memory_info.dwLength = sizeof(memory_info); 127 memory_info.dwLength = sizeof(memory_info);
128 if (!GlobalMemoryStatus(&memory_info)) { 128 if (!GlobalMemoryStatus(&memory_info)) {
129 UNREACHABLE(); 129 UNREACHABLE();
130 return 0; 130 return 0;
131 } 131 }
132 return static_cast<uint64_t>(memory_info.dwTotalPhys); 132 return static_cast<uint64_t>(memory_info.dwTotalPhys);
133 #elif V8_OS_QNX
134 struct stat stat_buf;
135 if (stat("/proc", &stat_buf) != 0) {
136 UNREACHABLE();
137 return 0;
138 }
139 return static_cast<uint64_t>(stat_buf.st_size);
133 #else 140 #else
134 intptr_t pages = sysconf(_SC_PHYS_PAGES); 141 intptr_t pages = sysconf(_SC_PHYS_PAGES);
135 intptr_t page_size = sysconf(_SC_PAGESIZE); 142 intptr_t page_size = sysconf(_SC_PAGESIZE);
136 if (pages == -1 || page_size == -1) { 143 if (pages == -1 || page_size == -1) {
137 UNREACHABLE(); 144 UNREACHABLE();
138 return 0; 145 return 0;
139 } 146 }
140 return static_cast<uint64_t>(pages) * page_size; 147 return static_cast<uint64_t>(pages) * page_size;
141 #endif 148 #endif
142 } 149 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 raw_addr += 0x20000000; 247 raw_addr += 0x20000000;
241 # endif 248 # endif
242 #endif 249 #endif
243 return reinterpret_cast<void*>(raw_addr); 250 return reinterpret_cast<void*>(raw_addr);
244 } 251 }
245 return NULL; 252 return NULL;
246 } 253 }
247 254
248 255
249 size_t OS::AllocateAlignment() { 256 size_t OS::AllocateAlignment() {
250 return getpagesize(); 257 return static_cast<size_t>(sysconf(_SC_PAGESIZE));
251 } 258 }
252 259
253 260
254 void OS::Sleep(int milliseconds) { 261 void OS::Sleep(int milliseconds) {
255 useconds_t ms = static_cast<useconds_t>(milliseconds); 262 useconds_t ms = static_cast<useconds_t>(milliseconds);
256 usleep(1000 * ms); 263 usleep(1000 * ms);
257 } 264 }
258 265
259 266
260 void OS::Abort() { 267 void OS::Abort() {
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 778
772 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { 779 void Thread::SetThreadLocal(LocalStorageKey key, void* value) {
773 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); 780 pthread_key_t pthread_key = LocalKeyToPthreadKey(key);
774 int result = pthread_setspecific(pthread_key, value); 781 int result = pthread_setspecific(pthread_key, value);
775 ASSERT_EQ(0, result); 782 ASSERT_EQ(0, result);
776 USE(result); 783 USE(result);
777 } 784 }
778 785
779 786
780 } } // namespace v8::internal 787 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform.h ('k') | src/platform-qnx.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698