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/mips/assembler-mips.h" | 10 #include "src/mips/assembler-mips.h" |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 void instr(Register rd_hi, Register rd_lo, Register rs, Register rt) { \ | 580 void instr(Register rd_hi, Register rd_lo, Register rs, Register rt) { \ |
581 instr(rd_hi, rd_lo, rs, Operand(rt)); \ | 581 instr(rd_hi, rd_lo, rs, Operand(rt)); \ |
582 } \ | 582 } \ |
583 void instr(Register rd_hi, Register rd_lo, Register rs, int32_t j) { \ | 583 void instr(Register rd_hi, Register rd_lo, Register rs, int32_t j) { \ |
584 instr(rd_hi, rd_lo, rs, Operand(j)); \ | 584 instr(rd_hi, rd_lo, rs, Operand(j)); \ |
585 } | 585 } |
586 | 586 |
587 DEFINE_INSTRUCTION(Addu); | 587 DEFINE_INSTRUCTION(Addu); |
588 DEFINE_INSTRUCTION(Subu); | 588 DEFINE_INSTRUCTION(Subu); |
589 DEFINE_INSTRUCTION(Mul); | 589 DEFINE_INSTRUCTION(Mul); |
| 590 DEFINE_INSTRUCTION(Div); |
| 591 DEFINE_INSTRUCTION(Divu); |
590 DEFINE_INSTRUCTION(Mod); | 592 DEFINE_INSTRUCTION(Mod); |
| 593 DEFINE_INSTRUCTION(Modu); |
591 DEFINE_INSTRUCTION(Mulh); | 594 DEFINE_INSTRUCTION(Mulh); |
592 DEFINE_INSTRUCTION2(Mult); | 595 DEFINE_INSTRUCTION2(Mult); |
593 DEFINE_INSTRUCTION2(Multu); | 596 DEFINE_INSTRUCTION2(Multu); |
594 DEFINE_INSTRUCTION2(Div); | 597 DEFINE_INSTRUCTION2(Div); |
595 DEFINE_INSTRUCTION2(Divu); | 598 DEFINE_INSTRUCTION2(Divu); |
596 | 599 |
597 DEFINE_INSTRUCTION3(Div); | 600 DEFINE_INSTRUCTION3(Div); |
598 DEFINE_INSTRUCTION3(Mul); | 601 DEFINE_INSTRUCTION3(Mul); |
599 | 602 |
600 DEFINE_INSTRUCTION(And); | 603 DEFINE_INSTRUCTION(And); |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 // Overflow handling functions. | 1138 // Overflow handling functions. |
1136 // Usage: first call the appropriate arithmetic function, then call one of the | 1139 // Usage: first call the appropriate arithmetic function, then call one of the |
1137 // jump functions with the overflow_dst register as the second parameter. | 1140 // jump functions with the overflow_dst register as the second parameter. |
1138 | 1141 |
1139 void AdduAndCheckForOverflow(Register dst, | 1142 void AdduAndCheckForOverflow(Register dst, |
1140 Register left, | 1143 Register left, |
1141 Register right, | 1144 Register right, |
1142 Register overflow_dst, | 1145 Register overflow_dst, |
1143 Register scratch = at); | 1146 Register scratch = at); |
1144 | 1147 |
| 1148 void AdduAndCheckForOverflow(Register dst, Register left, |
| 1149 const Operand& right, Register overflow_dst, |
| 1150 Register scratch = at); |
| 1151 |
1145 void SubuAndCheckForOverflow(Register dst, | 1152 void SubuAndCheckForOverflow(Register dst, |
1146 Register left, | 1153 Register left, |
1147 Register right, | 1154 Register right, |
1148 Register overflow_dst, | 1155 Register overflow_dst, |
1149 Register scratch = at); | 1156 Register scratch = at); |
1150 | 1157 |
| 1158 void SubuAndCheckForOverflow(Register dst, Register left, |
| 1159 const Operand& right, Register overflow_dst, |
| 1160 Register scratch = at); |
| 1161 |
1151 void BranchOnOverflow(Label* label, | 1162 void BranchOnOverflow(Label* label, |
1152 Register overflow_check, | 1163 Register overflow_check, |
1153 BranchDelaySlot bd = PROTECT) { | 1164 BranchDelaySlot bd = PROTECT) { |
1154 Branch(label, lt, overflow_check, Operand(zero_reg), bd); | 1165 Branch(label, lt, overflow_check, Operand(zero_reg), bd); |
1155 } | 1166 } |
1156 | 1167 |
1157 void BranchOnNoOverflow(Label* label, | 1168 void BranchOnNoOverflow(Label* label, |
1158 Register overflow_check, | 1169 Register overflow_check, |
1159 BranchDelaySlot bd = PROTECT) { | 1170 BranchDelaySlot bd = PROTECT) { |
1160 Branch(label, ge, overflow_check, Operand(zero_reg), bd); | 1171 Branch(label, ge, overflow_check, Operand(zero_reg), bd); |
1161 } | 1172 } |
1162 | 1173 |
1163 void RetOnOverflow(Register overflow_check, BranchDelaySlot bd = PROTECT) { | 1174 void RetOnOverflow(Register overflow_check, BranchDelaySlot bd = PROTECT) { |
1164 Ret(lt, overflow_check, Operand(zero_reg), bd); | 1175 Ret(lt, overflow_check, Operand(zero_reg), bd); |
1165 } | 1176 } |
1166 | 1177 |
1167 void RetOnNoOverflow(Register overflow_check, BranchDelaySlot bd = PROTECT) { | 1178 void RetOnNoOverflow(Register overflow_check, BranchDelaySlot bd = PROTECT) { |
1168 Ret(ge, overflow_check, Operand(zero_reg), bd); | 1179 Ret(ge, overflow_check, Operand(zero_reg), bd); |
1169 } | 1180 } |
1170 | 1181 |
1171 // ------------------------------------------------------------------------- | 1182 // ------------------------------------------------------------------------- |
1172 // Runtime calls. | 1183 // Runtime calls. |
1173 | 1184 |
1174 // See comments at the beginning of CEntryStub::Generate. | 1185 // See comments at the beginning of CEntryStub::Generate. |
1175 inline void PrepareCEntryArgs(int num_args) { | 1186 inline void PrepareCEntryArgs(int num_args) { li(a0, num_args); } |
1176 li(s0, num_args); | |
1177 li(s1, (num_args - 1) * kPointerSize); | |
1178 } | |
1179 | 1187 |
1180 inline void PrepareCEntryFunction(const ExternalReference& ref) { | 1188 inline void PrepareCEntryFunction(const ExternalReference& ref) { |
1181 li(s2, Operand(ref)); | 1189 li(a1, Operand(ref)); |
1182 } | 1190 } |
1183 | 1191 |
1184 #define COND_ARGS Condition cond = al, Register rs = zero_reg, \ | 1192 #define COND_ARGS Condition cond = al, Register rs = zero_reg, \ |
1185 const Operand& rt = Operand(zero_reg), BranchDelaySlot bd = PROTECT | 1193 const Operand& rt = Operand(zero_reg), BranchDelaySlot bd = PROTECT |
1186 | 1194 |
1187 // Call a code stub. | 1195 // Call a code stub. |
1188 void CallStub(CodeStub* stub, | 1196 void CallStub(CodeStub* stub, |
1189 TypeFeedbackId ast_id = TypeFeedbackId::None(), | 1197 TypeFeedbackId ast_id = TypeFeedbackId::None(), |
1190 COND_ARGS); | 1198 COND_ARGS); |
1191 | 1199 |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1710 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 1718 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
1711 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1719 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
1712 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1720 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
1713 #else | 1721 #else |
1714 #define ACCESS_MASM(masm) masm-> | 1722 #define ACCESS_MASM(masm) masm-> |
1715 #endif | 1723 #endif |
1716 | 1724 |
1717 } } // namespace v8::internal | 1725 } } // namespace v8::internal |
1718 | 1726 |
1719 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 1727 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
OLD | NEW |