| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_ARM64_DELAYED_MASM_ARM64_H_ | 5 #ifndef V8_ARM64_DELAYED_MASM_ARM64_H_ |
| 6 #define V8_ARM64_DELAYED_MASM_ARM64_H_ | 6 #define V8_ARM64_DELAYED_MASM_ARM64_H_ |
| 7 | 7 |
| 8 #include "src/lithium.h" | 8 #include "src/lithium.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 : cgen_(owner), masm_(masm), scratch_register_(scratch_register), | 26 : cgen_(owner), masm_(masm), scratch_register_(scratch_register), |
| 27 scratch_register_used_(false), pending_(kNone), saved_value_(0) { | 27 scratch_register_used_(false), pending_(kNone), saved_value_(0) { |
| 28 #ifdef DEBUG | 28 #ifdef DEBUG |
| 29 pending_register_ = no_reg; | 29 pending_register_ = no_reg; |
| 30 pending_value_ = 0; | 30 pending_value_ = 0; |
| 31 pending_pc_ = 0; | 31 pending_pc_ = 0; |
| 32 scratch_register_acquired_ = false; | 32 scratch_register_acquired_ = false; |
| 33 #endif | 33 #endif |
| 34 } | 34 } |
| 35 ~DelayedMasm() { | 35 ~DelayedMasm() { |
| 36 ASSERT(!scratch_register_acquired_); | 36 DCHECK(!scratch_register_acquired_); |
| 37 ASSERT(!scratch_register_used_); | 37 DCHECK(!scratch_register_used_); |
| 38 ASSERT(!pending()); | 38 DCHECK(!pending()); |
| 39 } | 39 } |
| 40 inline void EndDelayedUse(); | 40 inline void EndDelayedUse(); |
| 41 | 41 |
| 42 const Register& ScratchRegister() { | 42 const Register& ScratchRegister() { |
| 43 scratch_register_used_ = true; | 43 scratch_register_used_ = true; |
| 44 return scratch_register_; | 44 return scratch_register_; |
| 45 } | 45 } |
| 46 bool IsScratchRegister(const CPURegister& reg) { | 46 bool IsScratchRegister(const CPURegister& reg) { |
| 47 return reg.Is(scratch_register_); | 47 return reg.Is(scratch_register_); |
| 48 } | 48 } |
| 49 bool scratch_register_used() const { return scratch_register_used_; } | 49 bool scratch_register_used() const { return scratch_register_used_; } |
| 50 void reset_scratch_register_used() { scratch_register_used_ = false; } | 50 void reset_scratch_register_used() { scratch_register_used_ = false; } |
| 51 // Acquire/Release scratch register for use outside this class. | 51 // Acquire/Release scratch register for use outside this class. |
| 52 void AcquireScratchRegister() { | 52 void AcquireScratchRegister() { |
| 53 EmitPending(); | 53 EmitPending(); |
| 54 ResetSavedValue(); | 54 ResetSavedValue(); |
| 55 #ifdef DEBUG | 55 #ifdef DEBUG |
| 56 ASSERT(!scratch_register_acquired_); | 56 DCHECK(!scratch_register_acquired_); |
| 57 scratch_register_acquired_ = true; | 57 scratch_register_acquired_ = true; |
| 58 #endif | 58 #endif |
| 59 } | 59 } |
| 60 void ReleaseScratchRegister() { | 60 void ReleaseScratchRegister() { |
| 61 #ifdef DEBUG | 61 #ifdef DEBUG |
| 62 ASSERT(scratch_register_acquired_); | 62 DCHECK(scratch_register_acquired_); |
| 63 scratch_register_acquired_ = false; | 63 scratch_register_acquired_ = false; |
| 64 #endif | 64 #endif |
| 65 } | 65 } |
| 66 bool pending() { return pending_ != kNone; } | 66 bool pending() { return pending_ != kNone; } |
| 67 | 67 |
| 68 // Extra layer over the macro-assembler instructions (which emits the | 68 // Extra layer over the macro-assembler instructions (which emits the |
| 69 // potential pending instruction). | 69 // potential pending instruction). |
| 70 inline void Mov(const Register& rd, | 70 inline void Mov(const Register& rd, |
| 71 const Operand& operand, | 71 const Operand& operand, |
| 72 DiscardMoveMode discard_mode = kDontDiscardForSameWReg); | 72 DiscardMoveMode discard_mode = kDontDiscardForSameWReg); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 93 pending_pc_ = 0; | 93 pending_pc_ = 0; |
| 94 #endif | 94 #endif |
| 95 } | 95 } |
| 96 void InitializeRootRegister() { | 96 void InitializeRootRegister() { |
| 97 masm_->InitializeRootRegister(); | 97 masm_->InitializeRootRegister(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 // Set the saved value and load the ScratchRegister with it. | 101 // Set the saved value and load the ScratchRegister with it. |
| 102 void SetSavedValue(uint64_t saved_value) { | 102 void SetSavedValue(uint64_t saved_value) { |
| 103 ASSERT(saved_value != 0); | 103 DCHECK(saved_value != 0); |
| 104 if (saved_value_ != saved_value) { | 104 if (saved_value_ != saved_value) { |
| 105 masm_->Mov(ScratchRegister(), saved_value); | 105 masm_->Mov(ScratchRegister(), saved_value); |
| 106 saved_value_ = saved_value; | 106 saved_value_ = saved_value; |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 // Reset the saved value (i.e. the value of ScratchRegister is no longer | 109 // Reset the saved value (i.e. the value of ScratchRegister is no longer |
| 110 // known). | 110 // known). |
| 111 void ResetSavedValue() { | 111 void ResetSavedValue() { |
| 112 saved_value_ = 0; | 112 saved_value_ = 0; |
| 113 } | 113 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 int pending_pc_; | 155 int pending_pc_; |
| 156 // If true, the scratch register has been acquired outside this class. The | 156 // If true, the scratch register has been acquired outside this class. The |
| 157 // scratch register can no longer be used for constants. | 157 // scratch register can no longer be used for constants. |
| 158 bool scratch_register_acquired_; | 158 bool scratch_register_acquired_; |
| 159 #endif | 159 #endif |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 } } // namespace v8::internal | 162 } } // namespace v8::internal |
| 163 | 163 |
| 164 #endif // V8_ARM64_DELAYED_MASM_ARM64_H_ | 164 #endif // V8_ARM64_DELAYED_MASM_ARM64_H_ |
| OLD | NEW |