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

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

Issue 258993002: Simplified CPU/CpuFeatures a bit. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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
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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 // if (assembler->IsSupported(SSE2)) { 523 // if (assembler->IsSupported(SSE2)) {
524 // CpuFeatureScope fscope(assembler, SSE2); 524 // CpuFeatureScope fscope(assembler, SSE2);
525 // // Generate SSE2 floating point code. 525 // // Generate SSE2 floating point code.
526 // } else { 526 // } else {
527 // // Generate standard x87 floating point code. 527 // // Generate standard x87 floating point code.
528 // } 528 // }
529 class CpuFeatures : public AllStatic { 529 class CpuFeatures : public AllStatic {
530 public: 530 public:
531 // Detect features of the target CPU. Set safe defaults if the serializer 531 // Detect features of the target CPU. Set safe defaults if the serializer
532 // is enabled (snapshots must be portable). 532 // is enabled (snapshots must be portable).
533 static void Probe(); 533 static void Probe(bool serializer_enabled);
534 534
535 // Check whether a feature is supported by the target CPU. 535 // Check whether a feature is supported by the target CPU.
536 static bool IsSupported(CpuFeature f) { 536 static bool IsSupported(CpuFeature f) {
537 ASSERT(initialized_); 537 ASSERT(initialized_);
538 if (Check(f, cross_compile_)) return true; 538 if (Check(f, cross_compile_)) return true;
539 if (f == SSE2 && !FLAG_enable_sse2) return false; 539 if (f == SSE2 && !FLAG_enable_sse2) return false;
540 if (f == SSE3 && !FLAG_enable_sse3) return false; 540 if (f == SSE3 && !FLAG_enable_sse3) return false;
541 if (f == SSE4_1 && !FLAG_enable_sse4_1) return false; 541 if (f == SSE4_1 && !FLAG_enable_sse4_1) return false;
542 if (f == CMOV && !FLAG_enable_cmov) return false; 542 if (f == CMOV && !FLAG_enable_cmov) return false;
543 return Check(f, supported_); 543 return Check(f, supported_);
(...skipping 13 matching lines...) Expand all
557 static bool VerifyCrossCompiling() { 557 static bool VerifyCrossCompiling() {
558 return cross_compile_ == 0; 558 return cross_compile_ == 0;
559 } 559 }
560 560
561 static bool VerifyCrossCompiling(CpuFeature f) { 561 static bool VerifyCrossCompiling(CpuFeature f) {
562 uint64_t mask = flag2set(f); 562 uint64_t mask = flag2set(f);
563 return cross_compile_ == 0 || 563 return cross_compile_ == 0 ||
564 (cross_compile_ & mask) == mask; 564 (cross_compile_ & mask) == mask;
565 } 565 }
566 566
567 static bool SupportsCrankshaft() { return IsSupported(SSE2); }
568
567 private: 569 private:
568 static bool Check(CpuFeature f, uint64_t set) { 570 static bool Check(CpuFeature f, uint64_t set) {
569 return (set & flag2set(f)) != 0; 571 return (set & flag2set(f)) != 0;
570 } 572 }
571 573
572 static uint64_t flag2set(CpuFeature f) { 574 static uint64_t flag2set(CpuFeature f) {
573 return static_cast<uint64_t>(1) << f; 575 return static_cast<uint64_t>(1) << f;
574 } 576 }
575 577
576 #ifdef DEBUG 578 #ifdef DEBUG
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 private: 1292 private:
1291 Assembler* assembler_; 1293 Assembler* assembler_;
1292 #ifdef DEBUG 1294 #ifdef DEBUG
1293 int space_before_; 1295 int space_before_;
1294 #endif 1296 #endif
1295 }; 1297 };
1296 1298
1297 } } // namespace v8::internal 1299 } } // namespace v8::internal
1298 1300
1299 #endif // V8_IA32_ASSEMBLER_IA32_H_ 1301 #endif // V8_IA32_ASSEMBLER_IA32_H_
OLDNEW
« src/arm/assembler-arm.cc ('K') | « src/flags.cc ('k') | src/ia32/assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698