| 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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 return IsSupported(f); | 446 return IsSupported(f); |
| 447 } | 447 } |
| 448 uint64_t enabled = isolate->enabled_cpu_features(); | 448 uint64_t enabled = isolate->enabled_cpu_features(); |
| 449 return (enabled & (V8_UINT64_C(1) << f)) != 0; | 449 return (enabled & (V8_UINT64_C(1) << f)) != 0; |
| 450 } | 450 } |
| 451 #endif | 451 #endif |
| 452 | 452 |
| 453 // Enable a specified feature within a scope. | 453 // Enable a specified feature within a scope. |
| 454 class Scope BASE_EMBEDDED { | 454 class Scope BASE_EMBEDDED { |
| 455 #ifdef DEBUG | 455 #ifdef DEBUG |
| 456 |
| 456 public: | 457 public: |
| 457 explicit Scope(CpuFeature f) { | 458 explicit Scope(CpuFeature f) { |
| 458 uint64_t mask = V8_UINT64_C(1) << f; | 459 uint64_t mask = V8_UINT64_C(1) << f; |
| 459 ASSERT(CpuFeatures::IsSupported(f)); | 460 ASSERT(CpuFeatures::IsSupported(f)); |
| 460 ASSERT(!Serializer::enabled() || | 461 ASSERT(!Serializer::enabled() || |
| 461 (CpuFeatures::found_by_runtime_probing_ & mask) == 0); | 462 (CpuFeatures::found_by_runtime_probing_ & mask) == 0); |
| 462 isolate_ = Isolate::UncheckedCurrent(); | 463 isolate_ = Isolate::UncheckedCurrent(); |
| 463 old_enabled_ = 0; | 464 old_enabled_ = 0; |
| 464 if (isolate_ != NULL) { | 465 if (isolate_ != NULL) { |
| 465 old_enabled_ = isolate_->enabled_cpu_features(); | 466 old_enabled_ = isolate_->enabled_cpu_features(); |
| 466 isolate_->set_enabled_cpu_features(old_enabled_ | mask); | 467 isolate_->set_enabled_cpu_features(old_enabled_ | mask); |
| 467 } | 468 } |
| 468 } | 469 } |
| 469 ~Scope() { | 470 ~Scope() { |
| 470 ASSERT_EQ(Isolate::UncheckedCurrent(), isolate_); | 471 ASSERT_EQ(Isolate::UncheckedCurrent(), isolate_); |
| 471 if (isolate_ != NULL) { | 472 if (isolate_ != NULL) { |
| 472 isolate_->set_enabled_cpu_features(old_enabled_); | 473 isolate_->set_enabled_cpu_features(old_enabled_); |
| 473 } | 474 } |
| 474 } | 475 } |
| 476 |
| 475 private: | 477 private: |
| 476 Isolate* isolate_; | 478 Isolate* isolate_; |
| 477 uint64_t old_enabled_; | 479 uint64_t old_enabled_; |
| 478 #else | 480 #else |
| 481 |
| 479 public: | 482 public: |
| 480 explicit Scope(CpuFeature f) {} | 483 explicit Scope(CpuFeature f) {} |
| 481 #endif | 484 #endif |
| 482 }; | 485 }; |
| 483 | 486 |
| 484 private: | 487 private: |
| 485 // Safe defaults include SSE2 and CMOV for X64. It is always available, if | 488 // Safe defaults include SSE2 and CMOV for X64. It is always available, if |
| 486 // anyone checks, but they shouldn't need to check. | 489 // anyone checks, but they shouldn't need to check. |
| 487 // The required user mode extensions in X64 are (from AMD64 ABI Table A.1): | 490 // The required user mode extensions in X64 are (from AMD64 ABI Table A.1): |
| 488 // fpu, tsc, cx8, cmov, mmx, sse, sse2, fxsr, syscall | 491 // fpu, tsc, cx8, cmov, mmx, sse, sse2, fxsr, syscall |
| (...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1627 private: | 1630 private: |
| 1628 Assembler* assembler_; | 1631 Assembler* assembler_; |
| 1629 #ifdef DEBUG | 1632 #ifdef DEBUG |
| 1630 int space_before_; | 1633 int space_before_; |
| 1631 #endif | 1634 #endif |
| 1632 }; | 1635 }; |
| 1633 | 1636 |
| 1634 } } // namespace v8::internal | 1637 } } // namespace v8::internal |
| 1635 | 1638 |
| 1636 #endif // V8_X64_ASSEMBLER_X64_H_ | 1639 #endif // V8_X64_ASSEMBLER_X64_H_ |
| OLD | NEW |