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

Side by Side Diff: src/x64/assembler-x64.h

Issue 13928006: Remove SSE2 feature checks from x64 code (it is always on) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/x64/assembler-x64.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 (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 }; 441 };
442 442
443 443
444 // CpuFeatures keeps track of which features are supported by the target CPU. 444 // CpuFeatures keeps track of which features are supported by the target CPU.
445 // Supported features must be enabled by a CpuFeatureScope before use. 445 // Supported features must be enabled by a CpuFeatureScope before use.
446 // Example: 446 // Example:
447 // if (assembler->IsSupported(SSE3)) { 447 // if (assembler->IsSupported(SSE3)) {
448 // CpuFeatureScope fscope(assembler, SSE3); 448 // CpuFeatureScope fscope(assembler, SSE3);
449 // // Generate SSE3 floating point code. 449 // // Generate SSE3 floating point code.
450 // } else { 450 // } else {
451 // // Generate standard x87 or SSE2 floating point code. 451 // // Generate standard SSE2 floating point code.
452 // } 452 // }
453 class CpuFeatures : public AllStatic { 453 class CpuFeatures : public AllStatic {
454 public: 454 public:
455 // Detect features of the target CPU. Set safe defaults if the serializer 455 // Detect features of the target CPU. Set safe defaults if the serializer
456 // is enabled (snapshots must be portable). 456 // is enabled (snapshots must be portable).
457 static void Probe(); 457 static void Probe();
458 458
459 // Check whether a feature is supported by the target CPU. 459 // Check whether a feature is supported by the target CPU.
460 static bool IsSupported(CpuFeature f) { 460 static bool IsSupported(CpuFeature f) {
461 ASSERT(initialized_); 461 ASSERT(initialized_);
462 if (f == SSE2 && !FLAG_enable_sse2) return false;
463 if (f == SSE3 && !FLAG_enable_sse3) return false; 462 if (f == SSE3 && !FLAG_enable_sse3) return false;
464 if (f == SSE4_1 && !FLAG_enable_sse4_1) return false; 463 if (f == SSE4_1 && !FLAG_enable_sse4_1) return false;
465 if (f == CMOV && !FLAG_enable_cmov) return false; 464 if (f == CMOV && !FLAG_enable_cmov) return false;
466 if (f == RDTSC && !FLAG_enable_rdtsc) return false; 465 if (f == RDTSC && !FLAG_enable_rdtsc) return false;
467 if (f == SAHF && !FLAG_enable_sahf) return false; 466 if (f == SAHF && !FLAG_enable_sahf) return false;
468 return (supported_ & (static_cast<uint64_t>(1) << f)) != 0; 467 return (supported_ & (static_cast<uint64_t>(1) << f)) != 0;
469 } 468 }
470 469
471 static bool IsFoundByRuntimeProbingOnly(CpuFeature f) { 470 static bool IsFoundByRuntimeProbingOnly(CpuFeature f) {
472 ASSERT(initialized_); 471 ASSERT(initialized_);
473 return (found_by_runtime_probing_only_ & 472 return (found_by_runtime_probing_only_ &
474 (static_cast<uint64_t>(1) << f)) != 0; 473 (static_cast<uint64_t>(1) << f)) != 0;
475 } 474 }
476 475
477 static bool IsSafeForSnapshot(CpuFeature f) { 476 static bool IsSafeForSnapshot(CpuFeature f) {
478 return (IsSupported(f) && 477 return (IsSupported(f) &&
479 (!Serializer::enabled() || !IsFoundByRuntimeProbingOnly(f))); 478 (!Serializer::enabled() || !IsFoundByRuntimeProbingOnly(f)));
480 } 479 }
481 480
482 private: 481 private:
483 // Safe defaults include SSE2 and CMOV for X64. It is always available, if 482 // Safe defaults include CMOV for X64. It is always available, if
484 // anyone checks, but they shouldn't need to check. 483 // anyone checks, but they shouldn't need to check.
485 // The required user mode extensions in X64 are (from AMD64 ABI Table A.1): 484 // The required user mode extensions in X64 are (from AMD64 ABI Table A.1):
486 // fpu, tsc, cx8, cmov, mmx, sse, sse2, fxsr, syscall 485 // fpu, tsc, cx8, cmov, mmx, sse, sse2, fxsr, syscall
487 static const uint64_t kDefaultCpuFeatures = (1 << SSE2 | 1 << CMOV); 486 static const uint64_t kDefaultCpuFeatures = (1 << CMOV);
488 487
489 #ifdef DEBUG 488 #ifdef DEBUG
490 static bool initialized_; 489 static bool initialized_;
491 #endif 490 #endif
492 static uint64_t supported_; 491 static uint64_t supported_;
493 static uint64_t found_by_runtime_probing_only_; 492 static uint64_t found_by_runtime_probing_only_;
494 493
495 friend class ExternalReference; 494 friend class ExternalReference;
496 DISALLOW_COPY_AND_ASSIGN(CpuFeatures); 495 DISALLOW_COPY_AND_ASSIGN(CpuFeatures);
497 }; 496 };
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 private: 1635 private:
1637 Assembler* assembler_; 1636 Assembler* assembler_;
1638 #ifdef DEBUG 1637 #ifdef DEBUG
1639 int space_before_; 1638 int space_before_;
1640 #endif 1639 #endif
1641 }; 1640 };
1642 1641
1643 } } // namespace v8::internal 1642 } } // namespace v8::internal
1644 1643
1645 #endif // V8_X64_ASSEMBLER_X64_H_ 1644 #endif // V8_X64_ASSEMBLER_X64_H_
OLDNEW
« no previous file with comments | « no previous file | src/x64/assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698