OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 5 #ifndef V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
6 #define V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 6 #define V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
7 | 7 |
8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/globals.h" | 9 #include "src/globals.h" |
10 #include "src/mips64/assembler-mips64.h" | 10 #include "src/mips64/assembler-mips64.h" |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 void instr(Register rs, const Operand& rt); \ | 592 void instr(Register rs, const Operand& rt); \ |
593 void instr(Register rs, Register rt) { \ | 593 void instr(Register rs, Register rt) { \ |
594 instr(rs, Operand(rt)); \ | 594 instr(rs, Operand(rt)); \ |
595 } \ | 595 } \ |
596 void instr(Register rs, int32_t j) { \ | 596 void instr(Register rs, int32_t j) { \ |
597 instr(rs, Operand(j)); \ | 597 instr(rs, Operand(j)); \ |
598 } | 598 } |
599 | 599 |
600 DEFINE_INSTRUCTION(Addu); | 600 DEFINE_INSTRUCTION(Addu); |
601 DEFINE_INSTRUCTION(Daddu); | 601 DEFINE_INSTRUCTION(Daddu); |
| 602 DEFINE_INSTRUCTION(Div); |
| 603 DEFINE_INSTRUCTION(Divu); |
| 604 DEFINE_INSTRUCTION(Ddivu); |
| 605 DEFINE_INSTRUCTION(Mod); |
| 606 DEFINE_INSTRUCTION(Modu); |
602 DEFINE_INSTRUCTION(Ddiv); | 607 DEFINE_INSTRUCTION(Ddiv); |
603 DEFINE_INSTRUCTION(Subu); | 608 DEFINE_INSTRUCTION(Subu); |
604 DEFINE_INSTRUCTION(Dsubu); | 609 DEFINE_INSTRUCTION(Dsubu); |
605 DEFINE_INSTRUCTION(Dmod); | 610 DEFINE_INSTRUCTION(Dmod); |
| 611 DEFINE_INSTRUCTION(Dmodu); |
606 DEFINE_INSTRUCTION(Mul); | 612 DEFINE_INSTRUCTION(Mul); |
607 DEFINE_INSTRUCTION(Mulh); | 613 DEFINE_INSTRUCTION(Mulh); |
| 614 DEFINE_INSTRUCTION(Mulhu); |
608 DEFINE_INSTRUCTION(Dmul); | 615 DEFINE_INSTRUCTION(Dmul); |
609 DEFINE_INSTRUCTION(Dmulh); | 616 DEFINE_INSTRUCTION(Dmulh); |
610 DEFINE_INSTRUCTION2(Mult); | 617 DEFINE_INSTRUCTION2(Mult); |
611 DEFINE_INSTRUCTION2(Dmult); | 618 DEFINE_INSTRUCTION2(Dmult); |
612 DEFINE_INSTRUCTION2(Multu); | 619 DEFINE_INSTRUCTION2(Multu); |
613 DEFINE_INSTRUCTION2(Dmultu); | 620 DEFINE_INSTRUCTION2(Dmultu); |
614 DEFINE_INSTRUCTION2(Div); | 621 DEFINE_INSTRUCTION2(Div); |
615 DEFINE_INSTRUCTION2(Ddiv); | 622 DEFINE_INSTRUCTION2(Ddiv); |
616 DEFINE_INSTRUCTION2(Divu); | 623 DEFINE_INSTRUCTION2(Divu); |
617 DEFINE_INSTRUCTION2(Ddivu); | 624 DEFINE_INSTRUCTION2(Ddivu); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 void LoadFromSafepointRegisterSlot(Register dst, Register src); | 758 void LoadFromSafepointRegisterSlot(Register dst, Register src); |
752 | 759 |
753 // Flush the I-cache from asm code. You should use CpuFeatures::FlushICache | 760 // Flush the I-cache from asm code. You should use CpuFeatures::FlushICache |
754 // from C. | 761 // from C. |
755 // Does not handle errors. | 762 // Does not handle errors. |
756 void FlushICache(Register address, unsigned instructions); | 763 void FlushICache(Register address, unsigned instructions); |
757 | 764 |
758 // MIPS64 R2 instruction macro. | 765 // MIPS64 R2 instruction macro. |
759 void Ins(Register rt, Register rs, uint16_t pos, uint16_t size); | 766 void Ins(Register rt, Register rs, uint16_t pos, uint16_t size); |
760 void Ext(Register rt, Register rs, uint16_t pos, uint16_t size); | 767 void Ext(Register rt, Register rs, uint16_t pos, uint16_t size); |
| 768 void Dext(Register rt, Register rs, uint16_t pos, uint16_t size); |
761 | 769 |
762 // --------------------------------------------------------------------------- | 770 // --------------------------------------------------------------------------- |
763 // FPU macros. These do not handle special cases like NaN or +- inf. | 771 // FPU macros. These do not handle special cases like NaN or +- inf. |
764 | 772 |
765 // Convert unsigned word to double. | 773 // Convert unsigned word to double. |
766 void Cvt_d_uw(FPURegister fd, FPURegister fs, FPURegister scratch); | 774 void Cvt_d_uw(FPURegister fd, FPURegister fs, FPURegister scratch); |
767 void Cvt_d_uw(FPURegister fd, Register rs, FPURegister scratch); | 775 void Cvt_d_uw(FPURegister fd, Register rs, FPURegister scratch); |
768 | 776 |
769 // Convert double to unsigned long. | 777 // Convert double to unsigned long. |
770 void Trunc_l_ud(FPURegister fd, FPURegister fs, FPURegister scratch); | 778 void Trunc_l_ud(FPURegister fd, FPURegister fs, FPURegister scratch); |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 // Overflow handling functions. | 1169 // Overflow handling functions. |
1162 // Usage: first call the appropriate arithmetic function, then call one of the | 1170 // Usage: first call the appropriate arithmetic function, then call one of the |
1163 // jump functions with the overflow_dst register as the second parameter. | 1171 // jump functions with the overflow_dst register as the second parameter. |
1164 | 1172 |
1165 void AdduAndCheckForOverflow(Register dst, | 1173 void AdduAndCheckForOverflow(Register dst, |
1166 Register left, | 1174 Register left, |
1167 Register right, | 1175 Register right, |
1168 Register overflow_dst, | 1176 Register overflow_dst, |
1169 Register scratch = at); | 1177 Register scratch = at); |
1170 | 1178 |
| 1179 void AdduAndCheckForOverflow(Register dst, Register left, |
| 1180 const Operand& right, Register overflow_dst, |
| 1181 Register scratch = at); |
| 1182 |
1171 void SubuAndCheckForOverflow(Register dst, | 1183 void SubuAndCheckForOverflow(Register dst, |
1172 Register left, | 1184 Register left, |
1173 Register right, | 1185 Register right, |
1174 Register overflow_dst, | 1186 Register overflow_dst, |
1175 Register scratch = at); | 1187 Register scratch = at); |
1176 | 1188 |
| 1189 void SubuAndCheckForOverflow(Register dst, Register left, |
| 1190 const Operand& right, Register overflow_dst, |
| 1191 Register scratch = at); |
| 1192 |
1177 void BranchOnOverflow(Label* label, | 1193 void BranchOnOverflow(Label* label, |
1178 Register overflow_check, | 1194 Register overflow_check, |
1179 BranchDelaySlot bd = PROTECT) { | 1195 BranchDelaySlot bd = PROTECT) { |
1180 Branch(label, lt, overflow_check, Operand(zero_reg), bd); | 1196 Branch(label, lt, overflow_check, Operand(zero_reg), bd); |
1181 } | 1197 } |
1182 | 1198 |
1183 void BranchOnNoOverflow(Label* label, | 1199 void BranchOnNoOverflow(Label* label, |
1184 Register overflow_check, | 1200 Register overflow_check, |
1185 BranchDelaySlot bd = PROTECT) { | 1201 BranchDelaySlot bd = PROTECT) { |
1186 Branch(label, ge, overflow_check, Operand(zero_reg), bd); | 1202 Branch(label, ge, overflow_check, Operand(zero_reg), bd); |
1187 } | 1203 } |
1188 | 1204 |
1189 void RetOnOverflow(Register overflow_check, BranchDelaySlot bd = PROTECT) { | 1205 void RetOnOverflow(Register overflow_check, BranchDelaySlot bd = PROTECT) { |
1190 Ret(lt, overflow_check, Operand(zero_reg), bd); | 1206 Ret(lt, overflow_check, Operand(zero_reg), bd); |
1191 } | 1207 } |
1192 | 1208 |
1193 void RetOnNoOverflow(Register overflow_check, BranchDelaySlot bd = PROTECT) { | 1209 void RetOnNoOverflow(Register overflow_check, BranchDelaySlot bd = PROTECT) { |
1194 Ret(ge, overflow_check, Operand(zero_reg), bd); | 1210 Ret(ge, overflow_check, Operand(zero_reg), bd); |
1195 } | 1211 } |
1196 | 1212 |
1197 // ------------------------------------------------------------------------- | 1213 // ------------------------------------------------------------------------- |
1198 // Runtime calls. | 1214 // Runtime calls. |
1199 | 1215 |
1200 // See comments at the beginning of CEntryStub::Generate. | 1216 // See comments at the beginning of CEntryStub::Generate. |
1201 inline void PrepareCEntryArgs(int num_args) { | 1217 inline void PrepareCEntryArgs(int num_args) { li(a0, num_args); } |
1202 li(s0, num_args); | |
1203 li(s1, (num_args - 1) * kPointerSize); | |
1204 } | |
1205 | 1218 |
1206 inline void PrepareCEntryFunction(const ExternalReference& ref) { | 1219 inline void PrepareCEntryFunction(const ExternalReference& ref) { |
1207 li(s2, Operand(ref)); | 1220 li(a1, Operand(ref)); |
1208 } | 1221 } |
1209 | 1222 |
1210 #define COND_ARGS Condition cond = al, Register rs = zero_reg, \ | 1223 #define COND_ARGS Condition cond = al, Register rs = zero_reg, \ |
1211 const Operand& rt = Operand(zero_reg), BranchDelaySlot bd = PROTECT | 1224 const Operand& rt = Operand(zero_reg), BranchDelaySlot bd = PROTECT |
1212 | 1225 |
1213 // Call a code stub. | 1226 // Call a code stub. |
1214 void CallStub(CodeStub* stub, | 1227 void CallStub(CodeStub* stub, |
1215 TypeFeedbackId ast_id = TypeFeedbackId::None(), | 1228 TypeFeedbackId ast_id = TypeFeedbackId::None(), |
1216 COND_ARGS); | 1229 COND_ARGS); |
1217 | 1230 |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1713 // it. See the implementation for register usage. | 1726 // it. See the implementation for register usage. |
1714 void JumpToHandlerEntry(); | 1727 void JumpToHandlerEntry(); |
1715 | 1728 |
1716 // Compute memory operands for safepoint stack slots. | 1729 // Compute memory operands for safepoint stack slots. |
1717 static int SafepointRegisterStackIndex(int reg_code); | 1730 static int SafepointRegisterStackIndex(int reg_code); |
1718 MemOperand SafepointRegisterSlot(Register reg); | 1731 MemOperand SafepointRegisterSlot(Register reg); |
1719 MemOperand SafepointRegistersAndDoublesSlot(Register reg); | 1732 MemOperand SafepointRegistersAndDoublesSlot(Register reg); |
1720 | 1733 |
1721 bool generating_stub_; | 1734 bool generating_stub_; |
1722 bool has_frame_; | 1735 bool has_frame_; |
| 1736 bool has_double_zero_reg_set_; |
1723 // This handle will be patched with the code object on installation. | 1737 // This handle will be patched with the code object on installation. |
1724 Handle<Object> code_object_; | 1738 Handle<Object> code_object_; |
1725 | 1739 |
1726 // Needs access to SafepointRegisterStackIndex for compiled frame | 1740 // Needs access to SafepointRegisterStackIndex for compiled frame |
1727 // traversal. | 1741 // traversal. |
1728 friend class StandardFrame; | 1742 friend class StandardFrame; |
1729 }; | 1743 }; |
1730 | 1744 |
1731 | 1745 |
1732 // The code patcher is used to patch (typically) small parts of code e.g. for | 1746 // The code patcher is used to patch (typically) small parts of code e.g. for |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1773 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 1787 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
1774 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1788 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
1775 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1789 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
1776 #else | 1790 #else |
1777 #define ACCESS_MASM(masm) masm-> | 1791 #define ACCESS_MASM(masm) masm-> |
1778 #endif | 1792 #endif |
1779 | 1793 |
1780 } } // namespace v8::internal | 1794 } } // namespace v8::internal |
1781 | 1795 |
1782 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 1796 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
OLD | NEW |