| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 4502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4513 Register result = ToRegister32(instr->result()); | 4513 Register result = ToRegister32(instr->result()); |
| 4514 | 4514 |
| 4515 if (right_op->IsRegister()) { | 4515 if (right_op->IsRegister()) { |
| 4516 Register right = ToRegister32(instr->right()); | 4516 Register right = ToRegister32(instr->right()); |
| 4517 switch (instr->op()) { | 4517 switch (instr->op()) { |
| 4518 case Token::ROR: __ Ror(result, left, right); break; | 4518 case Token::ROR: __ Ror(result, left, right); break; |
| 4519 case Token::SAR: __ Asr(result, left, right); break; | 4519 case Token::SAR: __ Asr(result, left, right); break; |
| 4520 case Token::SHL: __ Lsl(result, left, right); break; | 4520 case Token::SHL: __ Lsl(result, left, right); break; |
| 4521 case Token::SHR: | 4521 case Token::SHR: |
| 4522 if (instr->can_deopt()) { | 4522 if (instr->can_deopt()) { |
| 4523 // TODO(all): Using conditional compare may be faster here, eg. | |
| 4524 // Deopt if (right == 0) && (left < 0). | |
| 4525 // __ Cmp(right, 0); | |
| 4526 // __ Ccmp(left, 0, NoFlag, eq); | |
| 4527 Label right_not_zero; | 4523 Label right_not_zero; |
| 4528 __ Cbnz(right, &right_not_zero); | 4524 __ Cbnz(right, &right_not_zero); |
| 4529 DeoptimizeIfNegative(left, instr->environment()); | 4525 DeoptimizeIfNegative(left, instr->environment()); |
| 4530 __ Bind(&right_not_zero); | 4526 __ Bind(&right_not_zero); |
| 4531 } | 4527 } |
| 4532 __ Lsr(result, left, right); | 4528 __ Lsr(result, left, right); |
| 4533 break; | 4529 break; |
| 4534 default: UNREACHABLE(); | 4530 default: UNREACHABLE(); |
| 4535 } | 4531 } |
| 4536 } else { | 4532 } else { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 4547 case Token::SAR: __ Asr(result, left, shift_count); break; | 4543 case Token::SAR: __ Asr(result, left, shift_count); break; |
| 4548 case Token::SHL: __ Lsl(result, left, shift_count); break; | 4544 case Token::SHL: __ Lsl(result, left, shift_count); break; |
| 4549 case Token::SHR: __ Lsr(result, left, shift_count); break; | 4545 case Token::SHR: __ Lsr(result, left, shift_count); break; |
| 4550 default: UNREACHABLE(); | 4546 default: UNREACHABLE(); |
| 4551 } | 4547 } |
| 4552 } | 4548 } |
| 4553 } | 4549 } |
| 4554 } | 4550 } |
| 4555 | 4551 |
| 4556 | 4552 |
| 4553 void LCodeGen::DoShiftS(LShiftS* instr) { |
| 4554 LOperand* right_op = instr->right(); |
| 4555 Register left = ToRegister(instr->left()); |
| 4556 Register result = ToRegister(instr->result()); |
| 4557 |
| 4558 // Only ROR by register needs a temp. |
| 4559 ASSERT(((instr->op() == Token::ROR) && right_op->IsRegister()) || |
| 4560 (instr->temp() == NULL)); |
| 4561 |
| 4562 if (right_op->IsRegister()) { |
| 4563 Register right = ToRegister(instr->right()); |
| 4564 switch (instr->op()) { |
| 4565 case Token::ROR: { |
| 4566 Register temp = ToRegister(instr->temp()); |
| 4567 __ Ubfx(temp, right, kSmiShift, 5); |
| 4568 __ SmiUntag(result, left); |
| 4569 __ Ror(result.W(), result.W(), temp.W()); |
| 4570 __ SmiTag(result); |
| 4571 break; |
| 4572 } |
| 4573 case Token::SAR: |
| 4574 __ Ubfx(result, right, kSmiShift, 5); |
| 4575 __ Asr(result, left, result); |
| 4576 __ Bic(result, result, kSmiShiftMask); |
| 4577 break; |
| 4578 case Token::SHL: |
| 4579 __ Ubfx(result, right, kSmiShift, 5); |
| 4580 __ Lsl(result, left, result); |
| 4581 break; |
| 4582 case Token::SHR: |
| 4583 if (instr->can_deopt()) { |
| 4584 Label right_not_zero; |
| 4585 __ Cbnz(right, &right_not_zero); |
| 4586 DeoptimizeIfNegative(left, instr->environment()); |
| 4587 __ Bind(&right_not_zero); |
| 4588 } |
| 4589 __ Ubfx(result, right, kSmiShift, 5); |
| 4590 __ Lsr(result, left, result); |
| 4591 __ Bic(result, result, kSmiShiftMask); |
| 4592 break; |
| 4593 default: UNREACHABLE(); |
| 4594 } |
| 4595 } else { |
| 4596 ASSERT(right_op->IsConstantOperand()); |
| 4597 int shift_count = ToInteger32(LConstantOperand::cast(right_op)) & 0x1f; |
| 4598 if (shift_count == 0) { |
| 4599 if ((instr->op() == Token::SHR) && instr->can_deopt()) { |
| 4600 DeoptimizeIfNegative(left, instr->environment()); |
| 4601 } |
| 4602 __ Mov(result, left); |
| 4603 } else { |
| 4604 switch (instr->op()) { |
| 4605 case Token::ROR: |
| 4606 __ SmiUntag(result, left); |
| 4607 __ Ror(result.W(), result.W(), shift_count); |
| 4608 __ SmiTag(result); |
| 4609 break; |
| 4610 case Token::SAR: |
| 4611 __ Asr(result, left, shift_count); |
| 4612 __ Bic(result, result, kSmiShiftMask); |
| 4613 break; |
| 4614 case Token::SHL: |
| 4615 __ Lsl(result, left, shift_count); |
| 4616 break; |
| 4617 case Token::SHR: |
| 4618 __ Lsr(result, left, shift_count); |
| 4619 __ Bic(result, result, kSmiShiftMask); |
| 4620 break; |
| 4621 default: UNREACHABLE(); |
| 4622 } |
| 4623 } |
| 4624 } |
| 4625 } |
| 4626 |
| 4627 |
| 4557 void LCodeGen::DoDebugBreak(LDebugBreak* instr) { | 4628 void LCodeGen::DoDebugBreak(LDebugBreak* instr) { |
| 4558 __ Debug("LDebugBreak", 0, BREAK); | 4629 __ Debug("LDebugBreak", 0, BREAK); |
| 4559 } | 4630 } |
| 4560 | 4631 |
| 4561 | 4632 |
| 4562 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) { | 4633 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) { |
| 4563 Register scratch1 = x5; | 4634 Register scratch1 = x5; |
| 4564 Register scratch2 = x6; | 4635 Register scratch2 = x6; |
| 4565 ASSERT(instr->IsMarkedAsCall()); | 4636 ASSERT(instr->IsMarkedAsCall()); |
| 4566 | 4637 |
| (...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5551 __ Bind(&out_of_object); | 5622 __ Bind(&out_of_object); |
| 5552 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5623 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
| 5553 // Index is equal to negated out of object property index plus 1. | 5624 // Index is equal to negated out of object property index plus 1. |
| 5554 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5625 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
| 5555 __ Ldr(result, FieldMemOperand(result, | 5626 __ Ldr(result, FieldMemOperand(result, |
| 5556 FixedArray::kHeaderSize - kPointerSize)); | 5627 FixedArray::kHeaderSize - kPointerSize)); |
| 5557 __ Bind(&done); | 5628 __ Bind(&done); |
| 5558 } | 5629 } |
| 5559 | 5630 |
| 5560 } } // namespace v8::internal | 5631 } } // namespace v8::internal |
| OLD | NEW |