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