| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1198 // Call a runtime routine. | 1198 // Call a runtime routine. |
| 1199 void CallRuntime(const Runtime::Function* f, | 1199 void CallRuntime(const Runtime::Function* f, |
| 1200 int num_arguments, | 1200 int num_arguments, |
| 1201 SaveFPRegsMode save_doubles = kDontSaveFPRegs); | 1201 SaveFPRegsMode save_doubles = kDontSaveFPRegs); |
| 1202 void CallRuntimeSaveDoubles(Runtime::FunctionId id) { | 1202 void CallRuntimeSaveDoubles(Runtime::FunctionId id) { |
| 1203 const Runtime::Function* function = Runtime::FunctionForId(id); | 1203 const Runtime::Function* function = Runtime::FunctionForId(id); |
| 1204 CallRuntime(function, function->nargs, kSaveFPRegs); | 1204 CallRuntime(function, function->nargs, kSaveFPRegs); |
| 1205 } | 1205 } |
| 1206 | 1206 |
| 1207 // Convenience function: Same as above, but takes the fid instead. | 1207 // Convenience function: Same as above, but takes the fid instead. |
| 1208 void CallRuntime(Runtime::FunctionId id, int num_arguments) { | 1208 void CallRuntime(Runtime::FunctionId id, |
| 1209 CallRuntime(Runtime::FunctionForId(id), num_arguments); | 1209 int num_arguments, |
| 1210 SaveFPRegsMode save_doubles = kDontSaveFPRegs) { |
| 1211 CallRuntime(Runtime::FunctionForId(id), num_arguments, save_doubles); |
| 1210 } | 1212 } |
| 1211 | 1213 |
| 1212 // Convenience function: call an external reference. | 1214 // Convenience function: call an external reference. |
| 1213 void CallExternalReference(const ExternalReference& ext, | 1215 void CallExternalReference(const ExternalReference& ext, |
| 1214 int num_arguments, | 1216 int num_arguments, |
| 1215 BranchDelaySlot bd = PROTECT); | 1217 BranchDelaySlot bd = PROTECT); |
| 1216 | 1218 |
| 1217 // Tail call of a runtime routine (jump). | 1219 // Tail call of a runtime routine (jump). |
| 1218 // Like JumpToExternalReference, but also takes care of passing the number | 1220 // Like JumpToExternalReference, but also takes care of passing the number |
| 1219 // of parameters. | 1221 // of parameters. |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 } | 1366 } |
| 1365 | 1367 |
| 1366 // Test for overflow < 0: use BranchOnOverflow() or BranchOnNoOverflow(). | 1368 // Test for overflow < 0: use BranchOnOverflow() or BranchOnNoOverflow(). |
| 1367 void SmiTagCheckOverflow(Register reg, Register overflow); | 1369 void SmiTagCheckOverflow(Register reg, Register overflow); |
| 1368 void SmiTagCheckOverflow(Register dst, Register src, Register overflow); | 1370 void SmiTagCheckOverflow(Register dst, Register src, Register overflow); |
| 1369 | 1371 |
| 1370 void SmiTag(Register dst, Register src) { | 1372 void SmiTag(Register dst, Register src) { |
| 1371 Addu(dst, src, src); | 1373 Addu(dst, src, src); |
| 1372 } | 1374 } |
| 1373 | 1375 |
| 1376 // Try to convert int32 to smi. If the value is to large, preserve |
| 1377 // the original value and jump to not_a_smi. Destroys scratch and |
| 1378 // sets flags. |
| 1379 void TrySmiTag(Register reg, Register scratch, Label* not_a_smi) { |
| 1380 TrySmiTag(reg, reg, scratch, not_a_smi); |
| 1381 } |
| 1382 void TrySmiTag(Register dst, |
| 1383 Register src, |
| 1384 Register scratch, |
| 1385 Label* not_a_smi) { |
| 1386 SmiTagCheckOverflow(at, src, scratch); |
| 1387 BranchOnOverflow(not_a_smi, scratch); |
| 1388 mov(dst, at); |
| 1389 } |
| 1390 |
| 1374 void SmiUntag(Register reg) { | 1391 void SmiUntag(Register reg) { |
| 1375 sra(reg, reg, kSmiTagSize); | 1392 sra(reg, reg, kSmiTagSize); |
| 1376 } | 1393 } |
| 1377 | 1394 |
| 1378 void SmiUntag(Register dst, Register src) { | 1395 void SmiUntag(Register dst, Register src) { |
| 1379 sra(dst, src, kSmiTagSize); | 1396 sra(dst, src, kSmiTagSize); |
| 1380 } | 1397 } |
| 1381 | 1398 |
| 1399 // Test if the register contains a smi. |
| 1400 inline void SmiTst(Register value, Register scratch) { |
| 1401 And(scratch, value, Operand(kSmiTagMask)); |
| 1402 } |
| 1403 inline void NonNegativeSmiTst(Register value, Register scratch) { |
| 1404 And(scratch, value, Operand(kSmiTagMask | kSmiSignMask)); |
| 1405 } |
| 1406 |
| 1382 // Untag the source value into destination and jump if source is a smi. | 1407 // Untag the source value into destination and jump if source is a smi. |
| 1383 // Souce and destination can be the same register. | 1408 // Souce and destination can be the same register. |
| 1384 void UntagAndJumpIfSmi(Register dst, Register src, Label* smi_case); | 1409 void UntagAndJumpIfSmi(Register dst, Register src, Label* smi_case); |
| 1385 | 1410 |
| 1386 // Untag the source value into destination and jump if source is not a smi. | 1411 // Untag the source value into destination and jump if source is not a smi. |
| 1387 // Souce and destination can be the same register. | 1412 // Souce and destination can be the same register. |
| 1388 void UntagAndJumpIfNotSmi(Register dst, Register src, Label* non_smi_case); | 1413 void UntagAndJumpIfNotSmi(Register dst, Register src, Label* non_smi_case); |
| 1389 | 1414 |
| 1390 // Jump the register contains a smi. | 1415 // Jump the register contains a smi. |
| 1391 void JumpIfSmi(Register value, | 1416 void JumpIfSmi(Register value, |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1661 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 1686 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
| 1662 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1687 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
| 1663 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1688 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
| 1664 #else | 1689 #else |
| 1665 #define ACCESS_MASM(masm) masm-> | 1690 #define ACCESS_MASM(masm) masm-> |
| 1666 #endif | 1691 #endif |
| 1667 | 1692 |
| 1668 } } // namespace v8::internal | 1693 } } // namespace v8::internal |
| 1669 | 1694 |
| 1670 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 1695 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
| OLD | NEW |