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 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 // Both 'left' and 'right' are "used at start" (see LCodeGen::DoShift), so | 1457 // Both 'left' and 'right' are "used at start" (see LCodeGen::DoShift), so |
1458 // result may alias either of them. | 1458 // result may alias either of them. |
1459 LOperand* right_op = instr->right(); | 1459 LOperand* right_op = instr->right(); |
1460 Register left = ToRegister(instr->left()); | 1460 Register left = ToRegister(instr->left()); |
1461 Register result = ToRegister(instr->result()); | 1461 Register result = ToRegister(instr->result()); |
1462 Register scratch = scratch0(); | 1462 Register scratch = scratch0(); |
1463 if (right_op->IsRegister()) { | 1463 if (right_op->IsRegister()) { |
1464 // Mask the right_op operand. | 1464 // Mask the right_op operand. |
1465 __ and_(scratch, ToRegister(right_op), Operand(0x1F)); | 1465 __ and_(scratch, ToRegister(right_op), Operand(0x1F)); |
1466 switch (instr->op()) { | 1466 switch (instr->op()) { |
| 1467 case Token::ROR: |
| 1468 __ mov(result, Operand(left, ROR, scratch)); |
| 1469 break; |
1467 case Token::SAR: | 1470 case Token::SAR: |
1468 __ mov(result, Operand(left, ASR, scratch)); | 1471 __ mov(result, Operand(left, ASR, scratch)); |
1469 break; | 1472 break; |
1470 case Token::SHR: | 1473 case Token::SHR: |
1471 if (instr->can_deopt()) { | 1474 if (instr->can_deopt()) { |
1472 __ mov(result, Operand(left, LSR, scratch), SetCC); | 1475 __ mov(result, Operand(left, LSR, scratch), SetCC); |
1473 DeoptimizeIf(mi, instr->environment()); | 1476 DeoptimizeIf(mi, instr->environment()); |
1474 } else { | 1477 } else { |
1475 __ mov(result, Operand(left, LSR, scratch)); | 1478 __ mov(result, Operand(left, LSR, scratch)); |
1476 } | 1479 } |
1477 break; | 1480 break; |
1478 case Token::SHL: | 1481 case Token::SHL: |
1479 __ mov(result, Operand(left, LSL, scratch)); | 1482 __ mov(result, Operand(left, LSL, scratch)); |
1480 break; | 1483 break; |
1481 default: | 1484 default: |
1482 UNREACHABLE(); | 1485 UNREACHABLE(); |
1483 break; | 1486 break; |
1484 } | 1487 } |
1485 } else { | 1488 } else { |
1486 // Mask the right_op operand. | 1489 // Mask the right_op operand. |
1487 int value = ToInteger32(LConstantOperand::cast(right_op)); | 1490 int value = ToInteger32(LConstantOperand::cast(right_op)); |
1488 uint8_t shift_count = static_cast<uint8_t>(value & 0x1F); | 1491 uint8_t shift_count = static_cast<uint8_t>(value & 0x1F); |
1489 switch (instr->op()) { | 1492 switch (instr->op()) { |
| 1493 case Token::ROR: |
| 1494 if (shift_count != 0) { |
| 1495 __ mov(result, Operand(left, ROR, shift_count)); |
| 1496 } else { |
| 1497 __ Move(result, left); |
| 1498 } |
| 1499 break; |
1490 case Token::SAR: | 1500 case Token::SAR: |
1491 if (shift_count != 0) { | 1501 if (shift_count != 0) { |
1492 __ mov(result, Operand(left, ASR, shift_count)); | 1502 __ mov(result, Operand(left, ASR, shift_count)); |
1493 } else { | 1503 } else { |
1494 __ Move(result, left); | 1504 __ Move(result, left); |
1495 } | 1505 } |
1496 break; | 1506 break; |
1497 case Token::SHR: | 1507 case Token::SHR: |
1498 if (shift_count != 0) { | 1508 if (shift_count != 0) { |
1499 __ mov(result, Operand(left, LSR, shift_count)); | 1509 __ mov(result, Operand(left, LSR, shift_count)); |
(...skipping 4160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5660 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 5670 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
5661 __ ldr(result, FieldMemOperand(scratch, | 5671 __ ldr(result, FieldMemOperand(scratch, |
5662 FixedArray::kHeaderSize - kPointerSize)); | 5672 FixedArray::kHeaderSize - kPointerSize)); |
5663 __ bind(&done); | 5673 __ bind(&done); |
5664 } | 5674 } |
5665 | 5675 |
5666 | 5676 |
5667 #undef __ | 5677 #undef __ |
5668 | 5678 |
5669 } } // namespace v8::internal | 5679 } } // namespace v8::internal |
OLD | NEW |