| 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 | 5 // modification, are permitted provided that the following conditions |
| 6 // are met: | 6 // are 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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 class CpuFeatures : public AllStatic { | 503 class CpuFeatures : public AllStatic { |
| 504 public: | 504 public: |
| 505 // Detect features of the target CPU. Set safe defaults if the serializer | 505 // Detect features of the target CPU. Set safe defaults if the serializer |
| 506 // is enabled (snapshots must be portable). | 506 // is enabled (snapshots must be portable). |
| 507 static void Probe(); | 507 static void Probe(); |
| 508 | 508 |
| 509 // Check whether a feature is supported by the target CPU. | 509 // Check whether a feature is supported by the target CPU. |
| 510 static bool IsSupported(CpuFeature f) { | 510 static bool IsSupported(CpuFeature f) { |
| 511 ASSERT(initialized_); | 511 ASSERT(initialized_); |
| 512 if (f == VFP3 && !FLAG_enable_vfp3) return false; | 512 if (f == VFP3 && !FLAG_enable_vfp3) return false; |
| 513 return (supported_ & (1u << f)) != 0; | 513 return (supported_ & (static_cast<uint64_t>(1u) << f)) != 0; |
| 514 } | 514 } |
| 515 | 515 |
| 516 #ifdef DEBUG | 516 #ifdef DEBUG |
| 517 // Check whether a feature is currently enabled. | 517 // Check whether a feature is currently enabled. |
| 518 static bool IsEnabled(CpuFeature f) { | 518 static bool IsEnabled(CpuFeature f) { |
| 519 ASSERT(initialized_); | 519 ASSERT(initialized_); |
| 520 Isolate* isolate = Isolate::UncheckedCurrent(); | 520 Isolate* isolate = Isolate::UncheckedCurrent(); |
| 521 if (isolate == NULL) { | 521 if (isolate == NULL) { |
| 522 // When no isolate is available, work as if we're running in | 522 // When no isolate is available, work as if we're running in |
| 523 // release mode. | 523 // release mode. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 public: | 560 public: |
| 561 explicit Scope(CpuFeature f) {} | 561 explicit Scope(CpuFeature f) {} |
| 562 #endif | 562 #endif |
| 563 }; | 563 }; |
| 564 | 564 |
| 565 class TryForceFeatureScope BASE_EMBEDDED { | 565 class TryForceFeatureScope BASE_EMBEDDED { |
| 566 public: | 566 public: |
| 567 explicit TryForceFeatureScope(CpuFeature f) | 567 explicit TryForceFeatureScope(CpuFeature f) |
| 568 : old_supported_(CpuFeatures::supported_) { | 568 : old_supported_(CpuFeatures::supported_) { |
| 569 if (CanForce()) { | 569 if (CanForce()) { |
| 570 CpuFeatures::supported_ |= (1u << f); | 570 CpuFeatures::supported_ |= (static_cast<uint64_t>(1u) << f); |
| 571 } | 571 } |
| 572 } | 572 } |
| 573 | 573 |
| 574 ~TryForceFeatureScope() { | 574 ~TryForceFeatureScope() { |
| 575 if (CanForce()) { | 575 if (CanForce()) { |
| 576 CpuFeatures::supported_ = old_supported_; | 576 CpuFeatures::supported_ = old_supported_; |
| 577 } | 577 } |
| 578 } | 578 } |
| 579 | 579 |
| 580 private: | 580 private: |
| 581 static bool CanForce() { | 581 static bool CanForce() { |
| 582 // It's only safe to temporarily force support of CPU features | 582 // It's only safe to temporarily force support of CPU features |
| 583 // when there's only a single isolate, which is guaranteed when | 583 // when there's only a single isolate, which is guaranteed when |
| 584 // the serializer is enabled. | 584 // the serializer is enabled. |
| 585 return Serializer::enabled(); | 585 return Serializer::enabled(); |
| 586 } | 586 } |
| 587 | 587 |
| 588 const unsigned old_supported_; | 588 const uint64_t old_supported_; |
| 589 }; | 589 }; |
| 590 | 590 |
| 591 private: | 591 private: |
| 592 #ifdef DEBUG | 592 #ifdef DEBUG |
| 593 static bool initialized_; | 593 static bool initialized_; |
| 594 #endif | 594 #endif |
| 595 static unsigned supported_; | 595 static uint64_t supported_; |
| 596 static unsigned found_by_runtime_probing_; | 596 static uint64_t found_by_runtime_probing_; |
| 597 | 597 |
| 598 DISALLOW_COPY_AND_ASSIGN(CpuFeatures); | 598 DISALLOW_COPY_AND_ASSIGN(CpuFeatures); |
| 599 }; | 599 }; |
| 600 | 600 |
| 601 | 601 |
| 602 extern const Instr kMovLrPc; | 602 extern const Instr kMovLrPc; |
| 603 extern const Instr kLdrPCMask; | 603 extern const Instr kLdrPCMask; |
| 604 extern const Instr kLdrPCPattern; | 604 extern const Instr kLdrPCPattern; |
| 605 extern const Instr kBlxRegMask; | 605 extern const Instr kBlxRegMask; |
| 606 extern const Instr kBlxRegPattern; | 606 extern const Instr kBlxRegPattern; |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 public: | 1435 public: |
| 1436 explicit EnsureSpace(Assembler* assembler) { | 1436 explicit EnsureSpace(Assembler* assembler) { |
| 1437 assembler->CheckBuffer(); | 1437 assembler->CheckBuffer(); |
| 1438 } | 1438 } |
| 1439 }; | 1439 }; |
| 1440 | 1440 |
| 1441 | 1441 |
| 1442 } } // namespace v8::internal | 1442 } } // namespace v8::internal |
| 1443 | 1443 |
| 1444 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1444 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
| OLD | NEW |