| 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 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 // untagged value afterwards. | 1178 // untagged value afterwards. |
| 1179 void SmiToDoubleFPURegister(Register smi, | 1179 void SmiToDoubleFPURegister(Register smi, |
| 1180 FPURegister value, | 1180 FPURegister value, |
| 1181 Register scratch1); | 1181 Register scratch1); |
| 1182 | 1182 |
| 1183 // ------------------------------------------------------------------------- | 1183 // ------------------------------------------------------------------------- |
| 1184 // Overflow handling functions. | 1184 // Overflow handling functions. |
| 1185 // Usage: first call the appropriate arithmetic function, then call one of the | 1185 // Usage: first call the appropriate arithmetic function, then call one of the |
| 1186 // jump functions with the overflow_dst register as the second parameter. | 1186 // jump functions with the overflow_dst register as the second parameter. |
| 1187 | 1187 |
| 1188 void AdduAndCheckForOverflow(Register dst, | 1188 inline void AddBranchOvf(Register dst, Register left, const Operand& right, |
| 1189 Register left, | 1189 Label* overflow_label, Register scratch = at) { |
| 1190 Register right, | 1190 AddBranchOvf(dst, left, right, overflow_label, nullptr, scratch); |
| 1191 Register overflow_dst, | |
| 1192 Register scratch = at); | |
| 1193 | |
| 1194 void AdduAndCheckForOverflow(Register dst, Register left, | |
| 1195 const Operand& right, Register overflow_dst, | |
| 1196 Register scratch = at); | |
| 1197 | |
| 1198 void SubuAndCheckForOverflow(Register dst, | |
| 1199 Register left, | |
| 1200 Register right, | |
| 1201 Register overflow_dst, | |
| 1202 Register scratch = at); | |
| 1203 | |
| 1204 void SubuAndCheckForOverflow(Register dst, Register left, | |
| 1205 const Operand& right, Register overflow_dst, | |
| 1206 Register scratch = at); | |
| 1207 | |
| 1208 void BranchOnOverflow(Label* label, | |
| 1209 Register overflow_check, | |
| 1210 BranchDelaySlot bd = PROTECT) { | |
| 1211 Branch(label, lt, overflow_check, Operand(zero_reg), bd); | |
| 1212 } | 1191 } |
| 1213 | 1192 |
| 1214 void BranchOnNoOverflow(Label* label, | 1193 inline void AddBranchNoOvf(Register dst, Register left, const Operand& right, |
| 1215 Register overflow_check, | 1194 Label* no_overflow_label, Register scratch = at) { |
| 1216 BranchDelaySlot bd = PROTECT) { | 1195 AddBranchOvf(dst, left, right, nullptr, no_overflow_label, scratch); |
| 1217 Branch(label, ge, overflow_check, Operand(zero_reg), bd); | |
| 1218 } | 1196 } |
| 1219 | 1197 |
| 1220 void RetOnOverflow(Register overflow_check, BranchDelaySlot bd = PROTECT) { | 1198 void AddBranchOvf(Register dst, Register left, const Operand& right, |
| 1221 Ret(lt, overflow_check, Operand(zero_reg), bd); | 1199 Label* overflow_label, Label* no_overflow_label, |
| 1200 Register scratch = at); |
| 1201 |
| 1202 void AddBranchOvf(Register dst, Register left, Register right, |
| 1203 Label* overflow_label, Label* no_overflow_label, |
| 1204 Register scratch = at); |
| 1205 |
| 1206 |
| 1207 inline void SubBranchOvf(Register dst, Register left, const Operand& right, |
| 1208 Label* overflow_label, Register scratch = at) { |
| 1209 SubBranchOvf(dst, left, right, overflow_label, nullptr, scratch); |
| 1222 } | 1210 } |
| 1223 | 1211 |
| 1224 void RetOnNoOverflow(Register overflow_check, BranchDelaySlot bd = PROTECT) { | 1212 inline void SubBranchNoOvf(Register dst, Register left, const Operand& right, |
| 1225 Ret(ge, overflow_check, Operand(zero_reg), bd); | 1213 Label* no_overflow_label, Register scratch = at) { |
| 1214 SubBranchOvf(dst, left, right, nullptr, no_overflow_label, scratch); |
| 1226 } | 1215 } |
| 1227 | 1216 |
| 1217 void SubBranchOvf(Register dst, Register left, const Operand& right, |
| 1218 Label* overflow_label, Label* no_overflow_label, |
| 1219 Register scratch = at); |
| 1220 |
| 1221 void SubBranchOvf(Register dst, Register left, Register right, |
| 1222 Label* overflow_label, Label* no_overflow_label, |
| 1223 Register scratch = at); |
| 1224 |
| 1228 // ------------------------------------------------------------------------- | 1225 // ------------------------------------------------------------------------- |
| 1229 // Runtime calls. | 1226 // Runtime calls. |
| 1230 | 1227 |
| 1231 // See comments at the beginning of CEntryStub::Generate. | 1228 // See comments at the beginning of CEntryStub::Generate. |
| 1232 inline void PrepareCEntryArgs(int num_args) { li(a0, num_args); } | 1229 inline void PrepareCEntryArgs(int num_args) { li(a0, num_args); } |
| 1233 | 1230 |
| 1234 inline void PrepareCEntryFunction(const ExternalReference& ref) { | 1231 inline void PrepareCEntryFunction(const ExternalReference& ref) { |
| 1235 li(a1, Operand(ref)); | 1232 li(a1, Operand(ref)); |
| 1236 } | 1233 } |
| 1237 | 1234 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1395 Register scratch, | 1392 Register scratch, |
| 1396 Label* not_power_of_two_or_zero); | 1393 Label* not_power_of_two_or_zero); |
| 1397 | 1394 |
| 1398 // ------------------------------------------------------------------------- | 1395 // ------------------------------------------------------------------------- |
| 1399 // Smi utilities. | 1396 // Smi utilities. |
| 1400 | 1397 |
| 1401 void SmiTag(Register reg) { | 1398 void SmiTag(Register reg) { |
| 1402 Addu(reg, reg, reg); | 1399 Addu(reg, reg, reg); |
| 1403 } | 1400 } |
| 1404 | 1401 |
| 1402 void SmiTag(Register dst, Register src) { Addu(dst, src, src); } |
| 1403 |
| 1405 // Test for overflow < 0: use BranchOnOverflow() or BranchOnNoOverflow(). | 1404 // Test for overflow < 0: use BranchOnOverflow() or BranchOnNoOverflow(). |
| 1406 void SmiTagCheckOverflow(Register reg, Register overflow); | 1405 void SmiTagCheckOverflow(Register reg, Register overflow); |
| 1407 void SmiTagCheckOverflow(Register dst, Register src, Register overflow); | 1406 void SmiTagCheckOverflow(Register dst, Register src, Register overflow); |
| 1408 | 1407 |
| 1409 void SmiTag(Register dst, Register src) { | 1408 void BranchOnOverflow(Label* label, Register overflow_check, |
| 1410 Addu(dst, src, src); | 1409 BranchDelaySlot bd = PROTECT) { |
| 1410 Branch(label, lt, overflow_check, Operand(zero_reg), bd); |
| 1411 } | 1411 } |
| 1412 | 1412 |
| 1413 void BranchOnNoOverflow(Label* label, Register overflow_check, |
| 1414 BranchDelaySlot bd = PROTECT) { |
| 1415 Branch(label, ge, overflow_check, Operand(zero_reg), bd); |
| 1416 } |
| 1417 |
| 1418 |
| 1413 // Try to convert int32 to smi. If the value is to large, preserve | 1419 // Try to convert int32 to smi. If the value is to large, preserve |
| 1414 // the original value and jump to not_a_smi. Destroys scratch and | 1420 // the original value and jump to not_a_smi. Destroys scratch and |
| 1415 // sets flags. | 1421 // sets flags. |
| 1416 void TrySmiTag(Register reg, Register scratch, Label* not_a_smi) { | 1422 void TrySmiTag(Register reg, Register scratch, Label* not_a_smi) { |
| 1417 TrySmiTag(reg, reg, scratch, not_a_smi); | 1423 TrySmiTag(reg, reg, scratch, not_a_smi); |
| 1418 } | 1424 } |
| 1419 void TrySmiTag(Register dst, | 1425 void TrySmiTag(Register dst, |
| 1420 Register src, | 1426 Register src, |
| 1421 Register scratch, | 1427 Register scratch, |
| 1422 Label* not_a_smi) { | 1428 Label* not_a_smi) { |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1754 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1760 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
| 1755 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1761 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
| 1756 #else | 1762 #else |
| 1757 #define ACCESS_MASM(masm) masm-> | 1763 #define ACCESS_MASM(masm) masm-> |
| 1758 #endif | 1764 #endif |
| 1759 | 1765 |
| 1760 } // namespace internal | 1766 } // namespace internal |
| 1761 } // namespace v8 | 1767 } // namespace v8 |
| 1762 | 1768 |
| 1763 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 1769 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
| OLD | NEW |