OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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() { |
257 #if defined(V8_OS_QNX) | |
Benedikt Meurer
2013/11/15 11:49:59
Use #if V8_OS_QNX.
c.truta
2013/11/18 13:36:32
D'oh! Oversight. Thank you.
I also added #if V8_OS
Benedikt Meurer
2013/11/19 07:01:27
sysconf(_SC_PAGESIZE) just calls getpagesize() for
| |
258 return static_cast<size_t>(sysconf(_SC_PAGESIZE)); | |
259 #else | |
250 return getpagesize(); | 260 return getpagesize(); |
261 #endif | |
251 } | 262 } |
252 | 263 |
253 | 264 |
254 void OS::Sleep(int milliseconds) { | 265 void OS::Sleep(int milliseconds) { |
255 useconds_t ms = static_cast<useconds_t>(milliseconds); | 266 useconds_t ms = static_cast<useconds_t>(milliseconds); |
256 usleep(1000 * ms); | 267 usleep(1000 * ms); |
257 } | 268 } |
258 | 269 |
259 | 270 |
260 void OS::Abort() { | 271 void OS::Abort() { |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
774 | 785 |
775 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { | 786 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { |
776 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); | 787 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); |
777 int result = pthread_setspecific(pthread_key, value); | 788 int result = pthread_setspecific(pthread_key, value); |
778 ASSERT_EQ(0, result); | 789 ASSERT_EQ(0, result); |
779 USE(result); | 790 USE(result); |
780 } | 791 } |
781 | 792 |
782 | 793 |
783 } } // namespace v8::internal | 794 } } // namespace v8::internal |
OLD | NEW |