Chromium Code Reviews| 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 if (f == VFP2 && !FLAG_enable_vfp3) return false; | |
|
Sven Panne
2012/07/25 07:49:06
This is confusing, I think we should add a new fla
| |
| 513 return (supported_ & (1u << f)) != 0; | 514 return (supported_ & (1u << f)) != 0; |
| 514 } | 515 } |
| 515 | 516 |
| 516 #ifdef DEBUG | 517 #ifdef DEBUG |
| 517 // Check whether a feature is currently enabled. | 518 // Check whether a feature is currently enabled. |
| 518 static bool IsEnabled(CpuFeature f) { | 519 static bool IsEnabled(CpuFeature f) { |
| 519 ASSERT(initialized_); | 520 ASSERT(initialized_); |
| 520 Isolate* isolate = Isolate::UncheckedCurrent(); | 521 Isolate* isolate = Isolate::UncheckedCurrent(); |
| 521 if (isolate == NULL) { | 522 if (isolate == NULL) { |
| 522 // When no isolate is available, work as if we're running in | 523 // When no isolate is available, work as if we're running in |
| 523 // release mode. | 524 // release mode. |
| 524 return IsSupported(f); | 525 return IsSupported(f); |
| 525 } | 526 } |
| 526 unsigned enabled = static_cast<unsigned>(isolate->enabled_cpu_features()); | 527 unsigned enabled = static_cast<unsigned>(isolate->enabled_cpu_features()); |
| 527 return (enabled & (1u << f)) != 0; | 528 return (enabled & (1u << f)) != 0; |
| 528 } | 529 } |
| 529 #endif | 530 #endif |
| 530 | 531 |
| 531 // Enable a specified feature within a scope. | 532 // Enable a specified feature within a scope. |
| 532 class Scope BASE_EMBEDDED { | 533 class Scope BASE_EMBEDDED { |
| 533 #ifdef DEBUG | 534 #ifdef DEBUG |
| 534 | 535 |
| 535 public: | 536 public: |
| 536 explicit Scope(CpuFeature f) { | 537 explicit Scope(CpuFeature f) { |
| 537 unsigned mask = 1u << f; | 538 unsigned mask = 1u << f; |
| 539 // VFP2 and ARMv2 are implied by VFP3. | |
|
Sven Panne
2012/07/25 07:49:06
ARMv7?
| |
| 540 if (f == VFP3) mask |= 1u << VFP2 | 1u << ARMv7; | |
| 538 ASSERT(CpuFeatures::IsSupported(f)); | 541 ASSERT(CpuFeatures::IsSupported(f)); |
| 539 ASSERT(!Serializer::enabled() || | 542 ASSERT(!Serializer::enabled() || |
| 540 (CpuFeatures::found_by_runtime_probing_ & mask) == 0); | 543 (CpuFeatures::found_by_runtime_probing_ & mask) == 0); |
| 541 isolate_ = Isolate::UncheckedCurrent(); | 544 isolate_ = Isolate::UncheckedCurrent(); |
| 542 old_enabled_ = 0; | 545 old_enabled_ = 0; |
| 543 if (isolate_ != NULL) { | 546 if (isolate_ != NULL) { |
| 544 old_enabled_ = static_cast<unsigned>(isolate_->enabled_cpu_features()); | 547 old_enabled_ = static_cast<unsigned>(isolate_->enabled_cpu_features()); |
| 545 isolate_->set_enabled_cpu_features(old_enabled_ | mask); | 548 isolate_->set_enabled_cpu_features(old_enabled_ | mask); |
| 546 } | 549 } |
| 547 } | 550 } |
| (...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1454 public: | 1457 public: |
| 1455 explicit EnsureSpace(Assembler* assembler) { | 1458 explicit EnsureSpace(Assembler* assembler) { |
| 1456 assembler->CheckBuffer(); | 1459 assembler->CheckBuffer(); |
| 1457 } | 1460 } |
| 1458 }; | 1461 }; |
| 1459 | 1462 |
| 1460 | 1463 |
| 1461 } } // namespace v8::internal | 1464 } } // namespace v8::internal |
| 1462 | 1465 |
| 1463 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1466 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
| OLD | NEW |