| 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 4573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4584 __ mtc1(scratch, single_scratch); | 4584 __ mtc1(scratch, single_scratch); |
| 4585 } else { | 4585 } else { |
| 4586 __ mtc1(ToRegister(input), single_scratch); | 4586 __ mtc1(ToRegister(input), single_scratch); |
| 4587 } | 4587 } |
| 4588 __ cvt_d_w(ToDoubleRegister(output), single_scratch); | 4588 __ cvt_d_w(ToDoubleRegister(output), single_scratch); |
| 4589 } | 4589 } |
| 4590 | 4590 |
| 4591 | 4591 |
| 4592 void LCodeGen::DoInteger32ToSmi(LInteger32ToSmi* instr) { | 4592 void LCodeGen::DoInteger32ToSmi(LInteger32ToSmi* instr) { |
| 4593 LOperand* input = instr->value(); | 4593 LOperand* input = instr->value(); |
| 4594 ASSERT(input->IsRegister()); | |
| 4595 LOperand* output = instr->result(); | 4594 LOperand* output = instr->result(); |
| 4596 ASSERT(output->IsRegister()); | |
| 4597 Register scratch = scratch0(); | 4595 Register scratch = scratch0(); |
| 4598 | 4596 |
| 4599 __ SmiTagCheckOverflow(ToRegister(output), ToRegister(input), scratch); | 4597 __ SmiTagCheckOverflow(ToRegister(output), ToRegister(input), scratch); |
| 4600 if (!instr->hydrogen()->value()->HasRange() || | 4598 if (!instr->hydrogen()->value()->HasRange() || |
| 4601 !instr->hydrogen()->value()->range()->IsInSmiRange()) { | 4599 !instr->hydrogen()->value()->range()->IsInSmiRange()) { |
| 4602 DeoptimizeIf(lt, instr->environment(), scratch, Operand(zero_reg)); | 4600 DeoptimizeIf(lt, instr->environment(), scratch, Operand(zero_reg)); |
| 4603 } | 4601 } |
| 4604 } | 4602 } |
| 4605 | 4603 |
| 4606 | 4604 |
| 4607 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { | 4605 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { |
| 4608 LOperand* input = instr->value(); | 4606 LOperand* input = instr->value(); |
| 4609 LOperand* output = instr->result(); | 4607 LOperand* output = instr->result(); |
| 4610 | 4608 |
| 4611 FPURegister dbl_scratch = double_scratch0(); | 4609 FPURegister dbl_scratch = double_scratch0(); |
| 4612 __ mtc1(ToRegister(input), dbl_scratch); | 4610 __ mtc1(ToRegister(input), dbl_scratch); |
| 4613 __ Cvt_d_uw(ToDoubleRegister(output), dbl_scratch, f22); | 4611 __ Cvt_d_uw(ToDoubleRegister(output), dbl_scratch, f22); |
| 4614 } | 4612 } |
| 4615 | 4613 |
| 4616 | 4614 |
| 4615 void LCodeGen::DoUint32ToSmi(LUint32ToSmi* instr) { |
| 4616 LOperand* input = instr->value(); |
| 4617 LOperand* output = instr->result(); |
| 4618 if (!instr->hydrogen()->value()->HasRange() || |
| 4619 !instr->hydrogen()->value()->range()->IsInSmiRange()) { |
| 4620 Register scratch = scratch0(); |
| 4621 __ And(scratch, ToRegister(input), Operand(0xc0000000)); |
| 4622 DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg)); |
| 4623 } |
| 4624 __ SmiTag(ToRegister(output), ToRegister(input)); |
| 4625 } |
| 4626 |
| 4627 |
| 4617 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { | 4628 void LCodeGen::DoNumberTagI(LNumberTagI* instr) { |
| 4618 class DeferredNumberTagI V8_FINAL : public LDeferredCode { | 4629 class DeferredNumberTagI V8_FINAL : public LDeferredCode { |
| 4619 public: | 4630 public: |
| 4620 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) | 4631 DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr) |
| 4621 : LDeferredCode(codegen), instr_(instr) { } | 4632 : LDeferredCode(codegen), instr_(instr) { } |
| 4622 virtual void Generate() V8_OVERRIDE { | 4633 virtual void Generate() V8_OVERRIDE { |
| 4623 codegen()->DoDeferredNumberTagI(instr_, | 4634 codegen()->DoDeferredNumberTagI(instr_, |
| 4624 instr_->value(), | 4635 instr_->value(), |
| 4625 SIGNED_INT32); | 4636 SIGNED_INT32); |
| 4626 } | 4637 } |
| (...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5773 __ Subu(scratch, result, scratch); | 5784 __ Subu(scratch, result, scratch); |
| 5774 __ lw(result, FieldMemOperand(scratch, | 5785 __ lw(result, FieldMemOperand(scratch, |
| 5775 FixedArray::kHeaderSize - kPointerSize)); | 5786 FixedArray::kHeaderSize - kPointerSize)); |
| 5776 __ bind(&done); | 5787 __ bind(&done); |
| 5777 } | 5788 } |
| 5778 | 5789 |
| 5779 | 5790 |
| 5780 #undef __ | 5791 #undef __ |
| 5781 | 5792 |
| 5782 } } // namespace v8::internal | 5793 } } // namespace v8::internal |
| OLD | NEW |