| 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 return IsSupported(f); | 458 return IsSupported(f); |
| 459 } | 459 } |
| 460 uint64_t enabled = isolate->enabled_cpu_features(); | 460 uint64_t enabled = isolate->enabled_cpu_features(); |
| 461 return (enabled & (static_cast<uint64_t>(1) << f)) != 0; | 461 return (enabled & (static_cast<uint64_t>(1) << f)) != 0; |
| 462 } | 462 } |
| 463 #endif | 463 #endif |
| 464 | 464 |
| 465 // Enable a specified feature within a scope. | 465 // Enable a specified feature within a scope. |
| 466 class Scope BASE_EMBEDDED { | 466 class Scope BASE_EMBEDDED { |
| 467 #ifdef DEBUG | 467 #ifdef DEBUG |
| 468 |
| 468 public: | 469 public: |
| 469 explicit Scope(CpuFeature f) { | 470 explicit Scope(CpuFeature f) { |
| 470 uint64_t mask = static_cast<uint64_t>(1) << f; | 471 uint64_t mask = static_cast<uint64_t>(1) << f; |
| 471 ASSERT(CpuFeatures::IsSupported(f)); | 472 ASSERT(CpuFeatures::IsSupported(f)); |
| 472 ASSERT(!Serializer::enabled() || | 473 ASSERT(!Serializer::enabled() || |
| 473 (CpuFeatures::found_by_runtime_probing_ & mask) == 0); | 474 (CpuFeatures::found_by_runtime_probing_ & mask) == 0); |
| 474 isolate_ = Isolate::UncheckedCurrent(); | 475 isolate_ = Isolate::UncheckedCurrent(); |
| 475 old_enabled_ = 0; | 476 old_enabled_ = 0; |
| 476 if (isolate_ != NULL) { | 477 if (isolate_ != NULL) { |
| 477 old_enabled_ = isolate_->enabled_cpu_features(); | 478 old_enabled_ = isolate_->enabled_cpu_features(); |
| 478 isolate_->set_enabled_cpu_features(old_enabled_ | mask); | 479 isolate_->set_enabled_cpu_features(old_enabled_ | mask); |
| 479 } | 480 } |
| 480 } | 481 } |
| 481 ~Scope() { | 482 ~Scope() { |
| 482 ASSERT_EQ(Isolate::UncheckedCurrent(), isolate_); | 483 ASSERT_EQ(Isolate::UncheckedCurrent(), isolate_); |
| 483 if (isolate_ != NULL) { | 484 if (isolate_ != NULL) { |
| 484 isolate_->set_enabled_cpu_features(old_enabled_); | 485 isolate_->set_enabled_cpu_features(old_enabled_); |
| 485 } | 486 } |
| 486 } | 487 } |
| 488 |
| 487 private: | 489 private: |
| 488 Isolate* isolate_; | 490 Isolate* isolate_; |
| 489 uint64_t old_enabled_; | 491 uint64_t old_enabled_; |
| 490 #else | 492 #else |
| 493 |
| 491 public: | 494 public: |
| 492 explicit Scope(CpuFeature f) {} | 495 explicit Scope(CpuFeature f) {} |
| 493 #endif | 496 #endif |
| 494 }; | 497 }; |
| 495 | 498 |
| 496 class TryForceFeatureScope BASE_EMBEDDED { | 499 class TryForceFeatureScope BASE_EMBEDDED { |
| 497 public: | 500 public: |
| 498 explicit TryForceFeatureScope(CpuFeature f) | 501 explicit TryForceFeatureScope(CpuFeature f) |
| 499 : old_supported_(CpuFeatures::supported_) { | 502 : old_supported_(CpuFeatures::supported_) { |
| 500 if (CanForce()) { | 503 if (CanForce()) { |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1148 private: | 1151 private: |
| 1149 Assembler* assembler_; | 1152 Assembler* assembler_; |
| 1150 #ifdef DEBUG | 1153 #ifdef DEBUG |
| 1151 int space_before_; | 1154 int space_before_; |
| 1152 #endif | 1155 #endif |
| 1153 }; | 1156 }; |
| 1154 | 1157 |
| 1155 } } // namespace v8::internal | 1158 } } // namespace v8::internal |
| 1156 | 1159 |
| 1157 #endif // V8_IA32_ASSEMBLER_IA32_H_ | 1160 #endif // V8_IA32_ASSEMBLER_IA32_H_ |
| OLD | NEW |