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 4499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4510 Register scratch, | 4510 Register scratch, |
4511 Label* not_power_of_two_or_zero) { | 4511 Label* not_power_of_two_or_zero) { |
4512 Subu(scratch, reg, Operand(1)); | 4512 Subu(scratch, reg, Operand(1)); |
4513 Branch(USE_DELAY_SLOT, not_power_of_two_or_zero, lt, | 4513 Branch(USE_DELAY_SLOT, not_power_of_two_or_zero, lt, |
4514 scratch, Operand(zero_reg)); | 4514 scratch, Operand(zero_reg)); |
4515 and_(at, scratch, reg); // In the delay slot. | 4515 and_(at, scratch, reg); // In the delay slot. |
4516 Branch(not_power_of_two_or_zero, ne, at, Operand(zero_reg)); | 4516 Branch(not_power_of_two_or_zero, ne, at, Operand(zero_reg)); |
4517 } | 4517 } |
4518 | 4518 |
4519 | 4519 |
| 4520 void MacroAssembler::SmiTagCheckOverflow(Register reg, Register overflow) { |
| 4521 ASSERT(!reg.is(overflow)); |
| 4522 mov(overflow, reg); // Save original value. |
| 4523 SmiTag(reg); |
| 4524 xor_(overflow, overflow, reg); // Overflow if (value ^ 2 * value) < 0. |
| 4525 } |
| 4526 |
| 4527 |
| 4528 void MacroAssembler::SmiTagCheckOverflow(Register dst, |
| 4529 Register src, |
| 4530 Register overflow) { |
| 4531 if (dst.is(src)) { |
| 4532 // Fall back to slower case. |
| 4533 SmiTagCheckOverflow(dst, overflow); |
| 4534 } else { |
| 4535 ASSERT(!dst.is(src)); |
| 4536 ASSERT(!dst.is(overflow)); |
| 4537 ASSERT(!src.is(overflow)); |
| 4538 SmiTag(dst, src); |
| 4539 xor_(overflow, dst, src); // Overflow if (value ^ 2 * value) < 0. |
| 4540 } |
| 4541 } |
| 4542 |
| 4543 |
4520 void MacroAssembler::JumpIfNotBothSmi(Register reg1, | 4544 void MacroAssembler::JumpIfNotBothSmi(Register reg1, |
4521 Register reg2, | 4545 Register reg2, |
4522 Label* on_not_both_smi) { | 4546 Label* on_not_both_smi) { |
4523 STATIC_ASSERT(kSmiTag == 0); | 4547 STATIC_ASSERT(kSmiTag == 0); |
4524 ASSERT_EQ(1, kSmiTagMask); | 4548 ASSERT_EQ(1, kSmiTagMask); |
4525 or_(at, reg1, reg2); | 4549 or_(at, reg1, reg2); |
4526 JumpIfNotSmi(at, on_not_both_smi); | 4550 JumpIfNotSmi(at, on_not_both_smi); |
4527 } | 4551 } |
4528 | 4552 |
4529 | 4553 |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5148 opcode == BGTZL); | 5172 opcode == BGTZL); |
5149 opcode = (cond == eq) ? BEQ : BNE; | 5173 opcode = (cond == eq) ? BEQ : BNE; |
5150 instr = (instr & ~kOpcodeMask) | opcode; | 5174 instr = (instr & ~kOpcodeMask) | opcode; |
5151 masm_.emit(instr); | 5175 masm_.emit(instr); |
5152 } | 5176 } |
5153 | 5177 |
5154 | 5178 |
5155 } } // namespace v8::internal | 5179 } } // namespace v8::internal |
5156 | 5180 |
5157 #endif // V8_TARGET_ARCH_MIPS | 5181 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |