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

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

Issue 258993002: Simplified CPU/CpuFeatures a bit. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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
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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 // if (assembler->IsSupported(SSE3)) { 443 // if (assembler->IsSupported(SSE3)) {
444 // CpuFeatureScope fscope(assembler, SSE3); 444 // CpuFeatureScope fscope(assembler, SSE3);
445 // // Generate SSE3 floating point code. 445 // // Generate SSE3 floating point code.
446 // } else { 446 // } else {
447 // // Generate standard SSE2 floating point code. 447 // // Generate standard SSE2 floating point code.
448 // } 448 // }
449 class CpuFeatures : public AllStatic { 449 class CpuFeatures : public AllStatic {
450 public: 450 public:
451 // Detect features of the target CPU. Set safe defaults if the serializer 451 // Detect features of the target CPU. Set safe defaults if the serializer
452 // is enabled (snapshots must be portable). 452 // is enabled (snapshots must be portable).
453 static void Probe(); 453 static void Probe(bool serializer_enabled);
454 454
455 // Check whether a feature is supported by the target CPU. 455 // Check whether a feature is supported by the target CPU.
456 static bool IsSupported(CpuFeature f) { 456 static bool IsSupported(CpuFeature f) {
457 if (Check(f, cross_compile_)) return true; 457 if (Check(f, cross_compile_)) return true;
458 ASSERT(initialized_); 458 ASSERT(initialized_);
459 if (f == SSE3 && !FLAG_enable_sse3) return false; 459 if (f == SSE3 && !FLAG_enable_sse3) return false;
460 if (f == SSE4_1 && !FLAG_enable_sse4_1) return false; 460 if (f == SSE4_1 && !FLAG_enable_sse4_1) return false;
461 if (f == CMOV && !FLAG_enable_cmov) return false; 461 if (f == CMOV && !FLAG_enable_cmov) return false;
462 if (f == SAHF && !FLAG_enable_sahf) return false; 462 if (f == SAHF && !FLAG_enable_sahf) return false;
463 return Check(f, supported_); 463 return Check(f, supported_);
(...skipping 13 matching lines...) Expand all
477 static bool VerifyCrossCompiling() { 477 static bool VerifyCrossCompiling() {
478 return cross_compile_ == 0; 478 return cross_compile_ == 0;
479 } 479 }
480 480
481 static bool VerifyCrossCompiling(CpuFeature f) { 481 static bool VerifyCrossCompiling(CpuFeature f) {
482 uint64_t mask = flag2set(f); 482 uint64_t mask = flag2set(f);
483 return cross_compile_ == 0 || 483 return cross_compile_ == 0 ||
484 (cross_compile_ & mask) == mask; 484 (cross_compile_ & mask) == mask;
485 } 485 }
486 486
487 static bool SupportsCrankshaft() { return true; }
488
487 private: 489 private:
488 static bool Check(CpuFeature f, uint64_t set) { 490 static bool Check(CpuFeature f, uint64_t set) {
489 return (set & flag2set(f)) != 0; 491 return (set & flag2set(f)) != 0;
490 } 492 }
491 493
492 static uint64_t flag2set(CpuFeature f) { 494 static uint64_t flag2set(CpuFeature f) {
493 return static_cast<uint64_t>(1) << f; 495 return static_cast<uint64_t>(1) << f;
494 } 496 }
495 497
496 // Safe defaults include CMOV for X64. It is always available, if 498 // Safe defaults include CMOV for X64. It is always available, if
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1652 private: 1654 private:
1653 Assembler* assembler_; 1655 Assembler* assembler_;
1654 #ifdef DEBUG 1656 #ifdef DEBUG
1655 int space_before_; 1657 int space_before_;
1656 #endif 1658 #endif
1657 }; 1659 };
1658 1660
1659 } } // namespace v8::internal 1661 } } // namespace v8::internal
1660 1662
1661 #endif // V8_X64_ASSEMBLER_X64_H_ 1663 #endif // V8_X64_ASSEMBLER_X64_H_
OLDNEW
« src/arm/assembler-arm.cc ('K') | « src/v8.cc ('k') | src/x64/assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698