| 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_LITHIUM_CODEGEN_ARM64_H_ | 5 #ifndef V8_ARM64_LITHIUM_CODEGEN_ARM64_H_ |
| 6 #define V8_ARM64_LITHIUM_CODEGEN_ARM64_H_ | 6 #define V8_ARM64_LITHIUM_CODEGEN_ARM64_H_ |
| 7 | 7 |
| 8 #include "arm64/lithium-arm64.h" | 8 #include "arm64/lithium-arm64.h" |
| 9 | 9 |
| 10 #include "arm64/lithium-gap-resolver-arm64.h" | 10 #include "arm64/lithium-gap-resolver-arm64.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 // Try to generate code for the entire chunk, but it may fail if the | 75 // Try to generate code for the entire chunk, but it may fail if the |
| 76 // chunk contains constructs we cannot handle. Returns true if the | 76 // chunk contains constructs we cannot handle. Returns true if the |
| 77 // code generation attempt succeeded. | 77 // code generation attempt succeeded. |
| 78 bool GenerateCode(); | 78 bool GenerateCode(); |
| 79 | 79 |
| 80 // Finish the code by setting stack height, safepoint, and bailout | 80 // Finish the code by setting stack height, safepoint, and bailout |
| 81 // information on it. | 81 // information on it. |
| 82 void FinishCode(Handle<Code> code); | 82 void FinishCode(Handle<Code> code); |
| 83 | 83 |
| 84 enum IntegerSignedness { SIGNED_INT32, UNSIGNED_INT32 }; |
| 84 // Support for converting LOperands to assembler types. | 85 // Support for converting LOperands to assembler types. |
| 85 // LOperand must be a register. | 86 // LOperand must be a register. |
| 86 Register ToRegister(LOperand* op) const; | 87 Register ToRegister(LOperand* op) const; |
| 87 Register ToRegister32(LOperand* op) const; | 88 Register ToRegister32(LOperand* op) const; |
| 88 Operand ToOperand(LOperand* op); | 89 Operand ToOperand(LOperand* op); |
| 89 Operand ToOperand32I(LOperand* op); | 90 Operand ToOperand32I(LOperand* op); |
| 90 Operand ToOperand32U(LOperand* op); | 91 Operand ToOperand32U(LOperand* op); |
| 91 enum StackMode { kMustUseFramePointer, kCanUseStackPointer }; | 92 enum StackMode { kMustUseFramePointer, kCanUseStackPointer }; |
| 92 MemOperand ToMemOperand(LOperand* op, | 93 MemOperand ToMemOperand(LOperand* op, |
| 93 StackMode stack_mode = kCanUseStackPointer) const; | 94 StackMode stack_mode = kCanUseStackPointer) const; |
| 94 Handle<Object> ToHandle(LConstantOperand* op) const; | 95 Handle<Object> ToHandle(LConstantOperand* op) const; |
| 95 | 96 |
| 97 template<class LI> |
| 98 Operand ToShiftedRightOperand32I(LOperand* right, |
| 99 LI* shift_info) { |
| 100 return ToShiftedRightOperand32(right, shift_info, SIGNED_INT32); |
| 101 } |
| 102 template<class LI> |
| 103 Operand ToShiftedRightOperand32U(LOperand* right, |
| 104 LI* shift_info) { |
| 105 return ToShiftedRightOperand32(right, shift_info, UNSIGNED_INT32); |
| 106 } |
| 107 template<class LI> |
| 108 Operand ToShiftedRightOperand32(LOperand* right, |
| 109 LI* shift_info, |
| 110 IntegerSignedness signedness); |
| 111 |
| 112 int JSShiftAmountFromLConstant(LOperand* constant) { |
| 113 return ToInteger32(LConstantOperand::cast(constant)) & 0x1f; |
| 114 } |
| 115 |
| 96 // TODO(jbramley): Examine these helpers and check that they make sense. | 116 // TODO(jbramley): Examine these helpers and check that they make sense. |
| 97 // IsInteger32Constant returns true for smi constants, for example. | 117 // IsInteger32Constant returns true for smi constants, for example. |
| 98 bool IsInteger32Constant(LConstantOperand* op) const; | 118 bool IsInteger32Constant(LConstantOperand* op) const; |
| 99 bool IsSmi(LConstantOperand* op) const; | 119 bool IsSmi(LConstantOperand* op) const; |
| 100 | 120 |
| 101 int32_t ToInteger32(LConstantOperand* op) const; | 121 int32_t ToInteger32(LConstantOperand* op) const; |
| 102 Smi* ToSmi(LConstantOperand* op) const; | 122 Smi* ToSmi(LConstantOperand* op) const; |
| 103 double ToDouble(LConstantOperand* op) const; | 123 double ToDouble(LConstantOperand* op) const; |
| 104 DoubleRegister ToDoubleRegister(LOperand* op) const; | 124 DoubleRegister ToDoubleRegister(LOperand* op) const; |
| 105 | 125 |
| 106 // Declare methods that deal with the individual node types. | 126 // Declare methods that deal with the individual node types. |
| 107 #define DECLARE_DO(type) void Do##type(L##type* node); | 127 #define DECLARE_DO(type) void Do##type(L##type* node); |
| 108 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) | 128 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) |
| 109 #undef DECLARE_DO | 129 #undef DECLARE_DO |
| 110 | 130 |
| 111 private: | 131 private: |
| 112 // Return a double scratch register which can be used locally | 132 // Return a double scratch register which can be used locally |
| 113 // when generating code for a lithium instruction. | 133 // when generating code for a lithium instruction. |
| 114 DoubleRegister double_scratch() { return crankshaft_fp_scratch; } | 134 DoubleRegister double_scratch() { return crankshaft_fp_scratch; } |
| 115 | 135 |
| 116 // Deferred code support. | 136 // Deferred code support. |
| 117 void DoDeferredNumberTagD(LNumberTagD* instr); | 137 void DoDeferredNumberTagD(LNumberTagD* instr); |
| 118 void DoDeferredStackCheck(LStackCheck* instr); | 138 void DoDeferredStackCheck(LStackCheck* instr); |
| 119 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr); | 139 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr); |
| 120 void DoDeferredStringCharFromCode(LStringCharFromCode* instr); | 140 void DoDeferredStringCharFromCode(LStringCharFromCode* instr); |
| 121 void DoDeferredMathAbsTagged(LMathAbsTagged* instr, | 141 void DoDeferredMathAbsTagged(LMathAbsTagged* instr, |
| 122 Label* exit, | 142 Label* exit, |
| 123 Label* allocation_entry); | 143 Label* allocation_entry); |
| 124 | 144 |
| 125 enum IntegerSignedness { SIGNED_INT32, UNSIGNED_INT32 }; | |
| 126 void DoDeferredNumberTagU(LInstruction* instr, | 145 void DoDeferredNumberTagU(LInstruction* instr, |
| 127 LOperand* value, | 146 LOperand* value, |
| 128 LOperand* temp1, | 147 LOperand* temp1, |
| 129 LOperand* temp2); | 148 LOperand* temp2); |
| 130 void DoDeferredTaggedToI(LTaggedToI* instr, | 149 void DoDeferredTaggedToI(LTaggedToI* instr, |
| 131 LOperand* value, | 150 LOperand* value, |
| 132 LOperand* temp1, | 151 LOperand* temp1, |
| 133 LOperand* temp2); | 152 LOperand* temp2); |
| 134 void DoDeferredAllocate(LAllocate* instr); | 153 void DoDeferredAllocate(LAllocate* instr); |
| 135 void DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr); | 154 void DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr); |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 | 495 |
| 477 protected: | 496 protected: |
| 478 MacroAssembler* masm() const { return codegen_->masm(); } | 497 MacroAssembler* masm() const { return codegen_->masm(); } |
| 479 | 498 |
| 480 LCodeGen* codegen_; | 499 LCodeGen* codegen_; |
| 481 }; | 500 }; |
| 482 | 501 |
| 483 } } // namespace v8::internal | 502 } } // namespace v8::internal |
| 484 | 503 |
| 485 #endif // V8_ARM64_LITHIUM_CODEGEN_ARM64_H_ | 504 #endif // V8_ARM64_LITHIUM_CODEGEN_ARM64_H_ |
| OLD | NEW |