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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 int32_t offset_; // valid if rm_ == no_reg | 461 int32_t offset_; // valid if rm_ == no_reg |
462 ShiftOp shift_op_; | 462 ShiftOp shift_op_; |
463 int shift_imm_; // valid if rm_ != no_reg && rs_ == no_reg | 463 int shift_imm_; // valid if rm_ != no_reg && rs_ == no_reg |
464 AddrMode am_; // bits P, U, and W | 464 AddrMode am_; // bits P, U, and W |
465 | 465 |
466 friend class Assembler; | 466 friend class Assembler; |
467 }; | 467 }; |
468 | 468 |
469 // CpuFeatures keeps track of which features are supported by the target CPU. | 469 // CpuFeatures keeps track of which features are supported by the target CPU. |
470 // Supported features must be enabled by a Scope before use. | 470 // Supported features must be enabled by a Scope before use. |
471 class CpuFeatures : public AllStatic { | 471 class CpuFeatures { |
472 public: | 472 public: |
473 // Detect features of the target CPU. Set safe defaults if the serializer | 473 // Detect features of the target CPU. Set safe defaults if the serializer |
474 // is enabled (snapshots must be portable). | 474 // is enabled (snapshots must be portable). |
475 static void Probe(bool portable); | 475 void Probe(bool portable); |
476 | 476 |
477 // Check whether a feature is supported by the target CPU. | 477 // Check whether a feature is supported by the target CPU. |
478 static bool IsSupported(CpuFeature f) { | 478 bool IsSupported(CpuFeature f) const { |
479 if (f == VFP3 && !FLAG_enable_vfp3) return false; | 479 if (f == VFP3 && !FLAG_enable_vfp3) return false; |
480 return (supported_ & (1u << f)) != 0; | 480 return (supported_ & (1u << f)) != 0; |
481 } | 481 } |
482 | 482 |
483 // Check whether a feature is currently enabled. | 483 // Check whether a feature is currently enabled. |
484 static bool IsEnabled(CpuFeature f) { | 484 bool IsEnabled(CpuFeature f) const { |
485 return (enabled_ & (1u << f)) != 0; | 485 return (enabled_ & (1u << f)) != 0; |
486 } | 486 } |
487 | 487 |
488 // Enable a specified feature within a scope. | 488 // Enable a specified feature within a scope. |
489 class Scope BASE_EMBEDDED { | 489 class Scope BASE_EMBEDDED { |
490 #ifdef DEBUG | 490 #ifdef DEBUG |
491 public: | 491 public: |
492 explicit Scope(CpuFeature f) { | 492 explicit Scope(CpuFeature f) |
493 ASSERT(CpuFeatures::IsSupported(f)); | 493 : cpu_features_(Isolate::Current()->cpu_features()), |
| 494 isolate_(Isolate::Current()) { |
| 495 ASSERT(cpu_features_->IsSupported(f)); |
494 ASSERT(!Serializer::enabled() || | 496 ASSERT(!Serializer::enabled() || |
495 (found_by_runtime_probing_ & (1u << f)) == 0); | 497 (cpu_features_->found_by_runtime_probing_ & (1u << f)) == 0); |
496 old_enabled_ = CpuFeatures::enabled_; | 498 old_enabled_ = cpu_features_->enabled_; |
497 CpuFeatures::enabled_ |= 1u << f; | 499 cpu_features_->enabled_ |= 1u << f; |
498 } | 500 } |
499 ~Scope() { CpuFeatures::enabled_ = old_enabled_; } | 501 ~Scope() { |
| 502 ASSERT_EQ(Isolate::Current(), isolate_); |
| 503 cpu_features_->enabled_ = old_enabled_; |
| 504 } |
500 private: | 505 private: |
501 unsigned old_enabled_; | 506 unsigned old_enabled_; |
| 507 CpuFeatures* cpu_features_; |
| 508 Isolate* isolate_; |
502 #else | 509 #else |
503 public: | 510 public: |
504 explicit Scope(CpuFeature f) {} | 511 explicit Scope(CpuFeature f) {} |
505 #endif | 512 #endif |
506 }; | 513 }; |
507 | 514 |
508 private: | 515 private: |
509 static unsigned supported_; | 516 CpuFeatures(); |
510 static unsigned enabled_; | 517 |
511 static unsigned found_by_runtime_probing_; | 518 unsigned supported_; |
| 519 unsigned enabled_; |
| 520 unsigned found_by_runtime_probing_; |
| 521 |
| 522 friend class Isolate; |
| 523 |
| 524 DISALLOW_COPY_AND_ASSIGN(CpuFeatures); |
512 }; | 525 }; |
513 | 526 |
514 | 527 |
515 extern const Instr kMovLrPc; | 528 extern const Instr kMovLrPc; |
516 extern const Instr kLdrPCMask; | 529 extern const Instr kLdrPCMask; |
517 extern const Instr kLdrPCPattern; | 530 extern const Instr kLdrPCPattern; |
518 extern const Instr kBlxRegMask; | 531 extern const Instr kBlxRegMask; |
519 extern const Instr kBlxRegPattern; | 532 extern const Instr kBlxRegPattern; |
520 | 533 |
521 extern const Instr kMovMvnMask; | 534 extern const Instr kMovMvnMask; |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 public: | 1310 public: |
1298 explicit EnsureSpace(Assembler* assembler) { | 1311 explicit EnsureSpace(Assembler* assembler) { |
1299 assembler->CheckBuffer(); | 1312 assembler->CheckBuffer(); |
1300 } | 1313 } |
1301 }; | 1314 }; |
1302 | 1315 |
1303 | 1316 |
1304 } } // namespace v8::internal | 1317 } } // namespace v8::internal |
1305 | 1318 |
1306 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1319 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
OLD | NEW |