OLD | NEW |
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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 class NextField: public BitField<int, 2, 32-2> {}; | 474 class NextField: public BitField<int, 2, 32-2> {}; |
475 | 475 |
476 void init(Label* L, Type type); | 476 void init(Label* L, Type type); |
477 }; | 477 }; |
478 | 478 |
479 | 479 |
480 | 480 |
481 // CpuFeatures keeps track of which features are supported by the target CPU. | 481 // CpuFeatures keeps track of which features are supported by the target CPU. |
482 // Supported features must be enabled by a CpuFeatureScope before use. | 482 // Supported features must be enabled by a CpuFeatureScope before use. |
483 // Example: | 483 // Example: |
484 // if (assembler->IsSupported(CMOV)) { | 484 // if (assembler->IsSupported(SSE3)) { |
485 // CpuFeatureScope fscope(assembler, CMOV); | 485 // CpuFeatureScope fscope(assembler, SSE3); |
486 // // Generate code containing cmov. | 486 // // Generate code containing SSE3 instructions. |
487 // } else { | 487 // } else { |
488 // // Generate alternative code. | 488 // // Generate alternative code. |
489 // } | 489 // } |
490 class CpuFeatures : public AllStatic { | 490 class CpuFeatures : public AllStatic { |
491 public: | 491 public: |
492 // Detect features of the target CPU. Set safe defaults if the serializer | 492 // Detect features of the target CPU. Set safe defaults if the serializer |
493 // is enabled (snapshots must be portable). | 493 // is enabled (snapshots must be portable). |
494 static void Probe(bool serializer_enabled); | 494 static void Probe(bool serializer_enabled); |
495 | 495 |
496 // Check whether a feature is supported by the target CPU. | 496 // Check whether a feature is supported by the target CPU. |
497 static bool IsSupported(CpuFeature f) { | 497 static bool IsSupported(CpuFeature f) { |
498 ASSERT(initialized_); | 498 ASSERT(initialized_); |
499 if (Check(f, cross_compile_)) return true; | 499 if (Check(f, cross_compile_)) return true; |
500 if (f == SSE3 && !FLAG_enable_sse3) return false; | 500 if (f == SSE3 && !FLAG_enable_sse3) return false; |
501 if (f == SSE4_1 && !FLAG_enable_sse4_1) return false; | 501 if (f == SSE4_1 && !FLAG_enable_sse4_1) return false; |
502 if (f == CMOV && !FLAG_enable_cmov) return false; | |
503 return Check(f, supported_); | 502 return Check(f, supported_); |
504 } | 503 } |
505 | 504 |
506 static bool IsSafeForSnapshot(Isolate* isolate, CpuFeature f) { | 505 static bool IsSafeForSnapshot(Isolate* isolate, CpuFeature f) { |
507 return Check(f, cross_compile_) || | 506 return Check(f, cross_compile_) || |
508 (IsSupported(f) && | 507 (IsSupported(f) && |
509 !(Serializer::enabled(isolate) && | 508 !(Serializer::enabled(isolate) && |
510 Check(f, found_by_runtime_probing_only_))); | 509 Check(f, found_by_runtime_probing_only_))); |
511 } | 510 } |
512 | 511 |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 private: | 1247 private: |
1249 Assembler* assembler_; | 1248 Assembler* assembler_; |
1250 #ifdef DEBUG | 1249 #ifdef DEBUG |
1251 int space_before_; | 1250 int space_before_; |
1252 #endif | 1251 #endif |
1253 }; | 1252 }; |
1254 | 1253 |
1255 } } // namespace v8::internal | 1254 } } // namespace v8::internal |
1256 | 1255 |
1257 #endif // V8_IA32_ASSEMBLER_IA32_H_ | 1256 #endif // V8_IA32_ASSEMBLER_IA32_H_ |
OLD | NEW |