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 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 } | 1514 } |
1515 } | 1515 } |
1516 | 1516 |
1517 | 1517 |
1518 void LCodeGen::DoShiftI(LShiftI* instr) { | 1518 void LCodeGen::DoShiftI(LShiftI* instr) { |
1519 // Both 'left' and 'right' are "used at start" (see LCodeGen::DoShift), so | 1519 // Both 'left' and 'right' are "used at start" (see LCodeGen::DoShift), so |
1520 // result may alias either of them. | 1520 // result may alias either of them. |
1521 LOperand* right_op = instr->right(); | 1521 LOperand* right_op = instr->right(); |
1522 Register left = ToRegister(instr->left()); | 1522 Register left = ToRegister(instr->left()); |
1523 Register result = ToRegister(instr->result()); | 1523 Register result = ToRegister(instr->result()); |
| 1524 Register scratch = scratch0(); |
1524 | 1525 |
1525 if (right_op->IsRegister()) { | 1526 if (right_op->IsRegister()) { |
1526 // No need to mask the right operand on MIPS, it is built into the variable | 1527 // No need to mask the right operand on MIPS, it is built into the variable |
1527 // shift instructions. | 1528 // shift instructions. |
1528 switch (instr->op()) { | 1529 switch (instr->op()) { |
1529 case Token::ROR: | 1530 case Token::ROR: |
1530 __ Ror(result, left, Operand(ToRegister(right_op))); | 1531 __ Ror(result, left, Operand(ToRegister(right_op))); |
1531 break; | 1532 break; |
1532 case Token::SAR: | 1533 case Token::SAR: |
1533 __ srav(result, left, ToRegister(right_op)); | 1534 __ srav(result, left, ToRegister(right_op)); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1570 } else { | 1571 } else { |
1571 if (instr->can_deopt()) { | 1572 if (instr->can_deopt()) { |
1572 __ And(at, left, Operand(0x80000000)); | 1573 __ And(at, left, Operand(0x80000000)); |
1573 DeoptimizeIf(ne, instr->environment(), at, Operand(zero_reg)); | 1574 DeoptimizeIf(ne, instr->environment(), at, Operand(zero_reg)); |
1574 } | 1575 } |
1575 __ Move(result, left); | 1576 __ Move(result, left); |
1576 } | 1577 } |
1577 break; | 1578 break; |
1578 case Token::SHL: | 1579 case Token::SHL: |
1579 if (shift_count != 0) { | 1580 if (shift_count != 0) { |
1580 __ sll(result, left, shift_count); | 1581 if (instr->hydrogen_value()->representation().IsSmi() && |
| 1582 instr->can_deopt()) { |
| 1583 __ sll(result, left, shift_count - 1); |
| 1584 __ SmiTagCheckOverflow(result, result, scratch); |
| 1585 DeoptimizeIf(lt, instr->environment(), scratch, Operand(zero_reg)); |
| 1586 } else { |
| 1587 __ sll(result, left, shift_count); |
| 1588 } |
1581 } else { | 1589 } else { |
1582 __ Move(result, left); | 1590 __ Move(result, left); |
1583 } | 1591 } |
1584 break; | 1592 break; |
1585 default: | 1593 default: |
1586 UNREACHABLE(); | 1594 UNREACHABLE(); |
1587 break; | 1595 break; |
1588 } | 1596 } |
1589 } | 1597 } |
1590 } | 1598 } |
(...skipping 4256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5847 __ Subu(scratch, result, scratch); | 5855 __ Subu(scratch, result, scratch); |
5848 __ lw(result, FieldMemOperand(scratch, | 5856 __ lw(result, FieldMemOperand(scratch, |
5849 FixedArray::kHeaderSize - kPointerSize)); | 5857 FixedArray::kHeaderSize - kPointerSize)); |
5850 __ bind(&done); | 5858 __ bind(&done); |
5851 } | 5859 } |
5852 | 5860 |
5853 | 5861 |
5854 #undef __ | 5862 #undef __ |
5855 | 5863 |
5856 } } // namespace v8::internal | 5864 } } // namespace v8::internal |
OLD | NEW |