| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 | 91 |
| 92 // Maximum size of the virtual memory. 0 means there is no artificial | 92 // Maximum size of the virtual memory. 0 means there is no artificial |
| 93 // limit. | 93 // limit. |
| 94 | 94 |
| 95 intptr_t OS::MaxVirtualMemory() { | 95 intptr_t OS::MaxVirtualMemory() { |
| 96 struct rlimit limit; | 96 struct rlimit limit; |
| 97 int result = getrlimit(RLIMIT_DATA, &limit); | 97 int result = getrlimit(RLIMIT_DATA, &limit); |
| 98 if (result != 0) return 0; | 98 if (result != 0) return 0; |
| 99 #if V8_OS_NACL |
| 100 // The NaCl compiler doesn't like resource.h constants. |
| 101 if (static_cast<int>(limit.rlim_cur) == -1) return 0; |
| 102 #else |
| 99 if (limit.rlim_cur == RLIM_INFINITY) return 0; | 103 if (limit.rlim_cur == RLIM_INFINITY) return 0; |
| 104 #endif |
| 100 return limit.rlim_cur; | 105 return limit.rlim_cur; |
| 101 } | 106 } |
| 102 | 107 |
| 103 | 108 |
| 104 uint64_t OS::TotalPhysicalMemory() { | 109 uint64_t OS::TotalPhysicalMemory() { |
| 105 #if V8_OS_MACOSX | 110 #if V8_OS_MACOSX |
| 106 int mib[2]; | 111 int mib[2]; |
| 107 mib[0] = CTL_HW; | 112 mib[0] = CTL_HW; |
| 108 mib[1] = HW_MEMSIZE; | 113 mib[1] = HW_MEMSIZE; |
| 109 int64_t size = 0; | 114 int64_t size = 0; |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 | 812 |
| 808 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { | 813 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { |
| 809 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); | 814 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); |
| 810 int result = pthread_setspecific(pthread_key, value); | 815 int result = pthread_setspecific(pthread_key, value); |
| 811 ASSERT_EQ(0, result); | 816 ASSERT_EQ(0, result); |
| 812 USE(result); | 817 USE(result); |
| 813 } | 818 } |
| 814 | 819 |
| 815 | 820 |
| 816 } } // namespace v8::internal | 821 } } // namespace v8::internal |
| OLD | NEW |