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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 VirtualProtect(address, size, PAGE_READONLY | PAGE_GUARD, &oldprotect); | 170 VirtualProtect(address, size, PAGE_READONLY | PAGE_GUARD, &oldprotect); |
171 } | 171 } |
172 | 172 |
173 | 173 |
174 void OS::Sleep(int milliseconds) { | 174 void OS::Sleep(int milliseconds) { |
175 unsigned int ms = static_cast<unsigned int>(milliseconds); | 175 unsigned int ms = static_cast<unsigned int>(milliseconds); |
176 usleep(1000 * ms); | 176 usleep(1000 * ms); |
177 } | 177 } |
178 | 178 |
179 | 179 |
| 180 int OS::NumberOfCores() { |
| 181 return sysconf(_SC_NPROCESSORS_ONLN); |
| 182 } |
| 183 |
| 184 |
180 void OS::Abort() { | 185 void OS::Abort() { |
181 // Redirect to std abort to signal abnormal program termination. | 186 // Redirect to std abort to signal abnormal program termination. |
182 abort(); | 187 abort(); |
183 } | 188 } |
184 | 189 |
185 | 190 |
186 void OS::DebugBreak() { | 191 void OS::DebugBreak() { |
187 asm("int $3"); | 192 asm("int $3"); |
188 } | 193 } |
189 | 194 |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 | 770 |
766 | 771 |
767 void Sampler::Stop() { | 772 void Sampler::Stop() { |
768 ASSERT(IsActive()); | 773 ASSERT(IsActive()); |
769 SamplerThread::RemoveActiveSampler(this); | 774 SamplerThread::RemoveActiveSampler(this); |
770 SetActive(false); | 775 SetActive(false); |
771 } | 776 } |
772 | 777 |
773 | 778 |
774 } } // namespace v8::internal | 779 } } // namespace v8::internal |
OLD | NEW |