| 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 4572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4583 __ mtc1(scratch, single_scratch); | 4583 __ mtc1(scratch, single_scratch); |
| 4584 } else { | 4584 } else { |
| 4585 __ mtc1(ToRegister(input), single_scratch); | 4585 __ mtc1(ToRegister(input), single_scratch); |
| 4586 } | 4586 } |
| 4587 __ cvt_d_w(ToDoubleRegister(output), single_scratch); | 4587 __ cvt_d_w(ToDoubleRegister(output), single_scratch); |
| 4588 } | 4588 } |
| 4589 | 4589 |
| 4590 | 4590 |
| 4591 void LCodeGen::DoInteger32ToSmi(LInteger32ToSmi* instr) { | 4591 void LCodeGen::DoInteger32ToSmi(LInteger32ToSmi* instr) { |
| 4592 LOperand* input = instr->value(); | 4592 LOperand* input = instr->value(); |
| 4593 ASSERT(input->IsRegister()); | |
| 4594 LOperand* output = instr->result(); | 4593 LOperand* output = instr->result(); |
| 4595 ASSERT(output->IsRegister()); | |
| 4596 Register scratch = scratch0(); | 4594 Register scratch = scratch0(); |
| 4597 | 4595 |
| 4598 __ SmiTagCheckOverflow(ToRegister(output), ToRegister(input), scratch); | 4596 __ SmiTagCheckOverflow(ToRegister(output), ToRegister(input), scratch); |
| 4599 if (!instr->hydrogen()->value()->HasRange() || | 4597 if (!instr->hydrogen()->value()->HasRange() || |
| 4600 !instr->hydrogen()->value()->range()->IsInSmiRange()) { | 4598 !instr->hydrogen()->value()->range()->IsInSmiRange()) { |
| 4601 DeoptimizeIf(lt, instr->environment(), scratch, Operand(zero_reg)); | 4599 DeoptimizeIf(lt, instr->environment(), scratch, Operand(zero_reg)); |
| 4602 } | 4600 } |
| 4603 } | 4601 } |
| 4604 | 4602 |
| 4605 | 4603 |
| 4606 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { | 4604 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { |
| 4607 LOperand* input = instr->value(); | 4605 LOperand* input = instr->value(); |
| 4608 LOperand* output = instr->result(); | 4606 LOperand* output = instr->result(); |
| 4609 | 4607 |
| 4610 FPURegister dbl_scratch = double_scratch0(); | 4608 FPURegister dbl_scratch = double_scratch0(); |
| 4611 __ mtc1(ToRegister(input), dbl_scratch); | 4609 __ mtc1(ToRegister(input), dbl_scratch); |
| 4612 __ Cvt_d_uw(ToDoubleRegister(output), dbl_scratch, f22); | 4610 __ Cvt_d_uw(ToDoubleRegister(output), dbl_scratch, f22); |
| 4613 } | 4611 } |
| 4614 | 4612 |
| 4615 | 4613 |
| 4614 void LCodeGen::DoUint32ToSmi(LUint32ToSmi* instr) { |
| 4615 LOperand* input = instr->value(); |
| 4616 LOperand* output = instr->result(); |
| 4617 if (!instr->hydrogen()->value()->HasRange() || |
| 4618 !instr->hydrogen()->value()->range()->IsInSmiRange()) { |
| 4619 Register scratch = scratch0(); |
| 4620 __ And(scratch, ToRegister(input), Operand(0xc0000000)); |
| 4621 DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg)); |
| 4622 } |
| 4623 __ SmiTag(ToRegister(output), ToRegister(input)); |
| 4624 } |
| 4625 |
| 4626 |
| 4616 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4627 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
| 4617 class DeferredNumberTagI: public LDeferredCode { | 4628 class DeferredNumberTagI: public LDeferredCode { |
| 4618 public: | 4629 public: |
| 4619 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) | 4630 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) |
| 4620 : LDeferredCode(codegen), instr_(instr) { } | 4631 : LDeferredCode(codegen), instr_(instr) { } |
| 4621 virtual void Generate() { | 4632 virtual void Generate() { |
| 4622 codegen()->DoDeferredNumberTagI(instr_, | 4633 codegen()->DoDeferredNumberTagI(instr_, |
| 4623 instr_->value(), | 4634 instr_->value(), |
| 4624 SIGNED_INT32); | 4635 SIGNED_INT32); |
| 4625 } | 4636 } |
| (...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5793 __ Subu(scratch, result, scratch); | 5804 __ Subu(scratch, result, scratch); |
| 5794 __ lw(result, FieldMemOperand(scratch, | 5805 __ lw(result, FieldMemOperand(scratch, |
| 5795 FixedArray::kHeaderSize - kPointerSize)); | 5806 FixedArray::kHeaderSize - kPointerSize)); |
| 5796 __ bind(&done); | 5807 __ bind(&done); |
| 5797 } | 5808 } |
| 5798 | 5809 |
| 5799 | 5810 |
| 5800 #undef __ | 5811 #undef __ |
| 5801 | 5812 |
| 5802 } } // namespace v8::internal | 5813 } } // namespace v8::internal |
| OLD | NEW |