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

Side by Side Diff: src/cpu.cc

Issue 298823008: Set SAHF flag correctly in ia32 (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: fix indentation Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 #include "cpu.h" 5 #include "cpu.h"
6 6
7 #if V8_LIBC_MSVCRT 7 #if V8_LIBC_MSVCRT
8 #include <intrin.h> // __cpuid() 8 #include <intrin.h> // __cpuid()
9 #endif 9 #endif
10 #if V8_OS_POSIX 10 #if V8_OS_POSIX
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 has_cmov_ = (cpu_info[3] & 0x00008000) != 0; 293 has_cmov_ = (cpu_info[3] & 0x00008000) != 0;
294 has_mmx_ = (cpu_info[3] & 0x00800000) != 0; 294 has_mmx_ = (cpu_info[3] & 0x00800000) != 0;
295 has_sse_ = (cpu_info[3] & 0x02000000) != 0; 295 has_sse_ = (cpu_info[3] & 0x02000000) != 0;
296 has_sse2_ = (cpu_info[3] & 0x04000000) != 0; 296 has_sse2_ = (cpu_info[3] & 0x04000000) != 0;
297 has_sse3_ = (cpu_info[2] & 0x00000001) != 0; 297 has_sse3_ = (cpu_info[2] & 0x00000001) != 0;
298 has_ssse3_ = (cpu_info[2] & 0x00000200) != 0; 298 has_ssse3_ = (cpu_info[2] & 0x00000200) != 0;
299 has_sse41_ = (cpu_info[2] & 0x00080000) != 0; 299 has_sse41_ = (cpu_info[2] & 0x00080000) != 0;
300 has_sse42_ = (cpu_info[2] & 0x00100000) != 0; 300 has_sse42_ = (cpu_info[2] & 0x00100000) != 0;
301 } 301 }
302 302
303 #if V8_HOST_ARCH_IA32
304 // SAHF is always available in compat/legacy mode,
305 has_sahf_ = true;
306 #else
303 // Query extended IDs. 307 // Query extended IDs.
304 __cpuid(cpu_info, 0x80000000); 308 __cpuid(cpu_info, 0x80000000);
305 unsigned num_ext_ids = cpu_info[0]; 309 unsigned num_ext_ids = cpu_info[0];
306 310
307 // Interpret extended CPU feature information. 311 // Interpret extended CPU feature information.
308 if (num_ext_ids > 0x80000000) { 312 if (num_ext_ids > 0x80000000) {
309 __cpuid(cpu_info, 0x80000001); 313 __cpuid(cpu_info, 0x80000001);
310 // SAHF is always available in compat/legacy mode, 314 // SAHF must be probed in long mode.
311 // but must be probed in long mode.
312 #if V8_HOST_ARCH_IA32
313 has_sahf_ = true;
314 #else
315 has_sahf_ = (cpu_info[2] & 0x00000001) != 0; 315 has_sahf_ = (cpu_info[2] & 0x00000001) != 0;
316 }
316 #endif 317 #endif
317 }
318 318
319 #elif V8_HOST_ARCH_ARM 319 #elif V8_HOST_ARCH_ARM
320 320
321 #if V8_OS_LINUX 321 #if V8_OS_LINUX
322 322
323 CPUInfo cpu_info; 323 CPUInfo cpu_info;
324 324
325 // Extract implementor from the "CPU implementer" field. 325 // Extract implementor from the "CPU implementer" field.
326 char* implementer = cpu_info.ExtractField("CPU implementer"); 326 char* implementer = cpu_info.ExtractField("CPU implementer");
327 if (implementer != NULL) { 327 if (implementer != NULL) {
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 #if V8_OS_WIN 502 #if V8_OS_WIN
503 SYSTEM_INFO info; 503 SYSTEM_INFO info;
504 GetSystemInfo(&info); 504 GetSystemInfo(&info);
505 return info.dwNumberOfProcessors; 505 return info.dwNumberOfProcessors;
506 #else 506 #else
507 return static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN)); 507 return static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN));
508 #endif 508 #endif
509 } 509 }
510 510
511 } } // namespace v8::internal 511 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698