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 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 } | 1364 } |
1365 | 1365 |
1366 // Test for overflow < 0: use BranchOnOverflow() or BranchOnNoOverflow(). | 1366 // Test for overflow < 0: use BranchOnOverflow() or BranchOnNoOverflow(). |
1367 void SmiTagCheckOverflow(Register reg, Register overflow); | 1367 void SmiTagCheckOverflow(Register reg, Register overflow); |
1368 void SmiTagCheckOverflow(Register dst, Register src, Register overflow); | 1368 void SmiTagCheckOverflow(Register dst, Register src, Register overflow); |
1369 | 1369 |
1370 void SmiTag(Register dst, Register src) { | 1370 void SmiTag(Register dst, Register src) { |
1371 Addu(dst, src, src); | 1371 Addu(dst, src, src); |
1372 } | 1372 } |
1373 | 1373 |
| 1374 // Try to convert int32 to smi. If the value is to large, preserve |
| 1375 // the original value and jump to not_a_smi. Destroys scratch and |
| 1376 // sets flags. |
| 1377 void TrySmiTag(Register reg, Register scratch, Label* not_a_smi) { |
| 1378 TrySmiTag(reg, reg, scratch, not_a_smi); |
| 1379 } |
| 1380 void TrySmiTag(Register dst, |
| 1381 Register src, |
| 1382 Register scratch, |
| 1383 Label* not_a_smi) { |
| 1384 SmiTagCheckOverflow(at, src, scratch); |
| 1385 BranchOnOverflow(not_a_smi, scratch); |
| 1386 mov(dst, at); |
| 1387 } |
| 1388 |
1374 void SmiUntag(Register reg) { | 1389 void SmiUntag(Register reg) { |
1375 sra(reg, reg, kSmiTagSize); | 1390 sra(reg, reg, kSmiTagSize); |
1376 } | 1391 } |
1377 | 1392 |
1378 void SmiUntag(Register dst, Register src) { | 1393 void SmiUntag(Register dst, Register src) { |
1379 sra(dst, src, kSmiTagSize); | 1394 sra(dst, src, kSmiTagSize); |
1380 } | 1395 } |
1381 | 1396 |
| 1397 // Test if the register contains a smi. |
| 1398 inline void SmiTst(Register value, Register scratch) { |
| 1399 And(scratch, value, Operand(kSmiTagMask)); |
| 1400 } |
| 1401 inline void NonNegativeSmiTst(Register value, Register scratch) { |
| 1402 And(scratch, value, Operand(kSmiTagMask | kSmiSignMask)); |
| 1403 } |
| 1404 |
1382 // Untag the source value into destination and jump if source is a smi. | 1405 // Untag the source value into destination and jump if source is a smi. |
1383 // Souce and destination can be the same register. | 1406 // Souce and destination can be the same register. |
1384 void UntagAndJumpIfSmi(Register dst, Register src, Label* smi_case); | 1407 void UntagAndJumpIfSmi(Register dst, Register src, Label* smi_case); |
1385 | 1408 |
1386 // Untag the source value into destination and jump if source is not a smi. | 1409 // Untag the source value into destination and jump if source is not a smi. |
1387 // Souce and destination can be the same register. | 1410 // Souce and destination can be the same register. |
1388 void UntagAndJumpIfNotSmi(Register dst, Register src, Label* non_smi_case); | 1411 void UntagAndJumpIfNotSmi(Register dst, Register src, Label* non_smi_case); |
1389 | 1412 |
1390 // Jump the register contains a smi. | 1413 // Jump the register contains a smi. |
1391 void JumpIfSmi(Register value, | 1414 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) | 1684 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
1662 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1685 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
1663 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1686 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
1664 #else | 1687 #else |
1665 #define ACCESS_MASM(masm) masm-> | 1688 #define ACCESS_MASM(masm) masm-> |
1666 #endif | 1689 #endif |
1667 | 1690 |
1668 } } // namespace v8::internal | 1691 } } // namespace v8::internal |
1669 | 1692 |
1670 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 1693 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
OLD | NEW |