| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3783 __ SmiUntag(ToRegister(input), SetCC); | 3783 __ SmiUntag(ToRegister(input), SetCC); |
| 3784 DeoptimizeIf(cs, instr->environment()); | 3784 DeoptimizeIf(cs, instr->environment()); |
| 3785 } else { | 3785 } else { |
| 3786 __ SmiUntag(ToRegister(input)); | 3786 __ SmiUntag(ToRegister(input)); |
| 3787 } | 3787 } |
| 3788 } | 3788 } |
| 3789 | 3789 |
| 3790 | 3790 |
| 3791 void LCodeGen::EmitNumberUntagD(Register input_reg, | 3791 void LCodeGen::EmitNumberUntagD(Register input_reg, |
| 3792 DoubleRegister result_reg, | 3792 DoubleRegister result_reg, |
| 3793 bool deoptimize_on_undefined, |
| 3793 LEnvironment* env) { | 3794 LEnvironment* env) { |
| 3794 Register scratch = scratch0(); | 3795 Register scratch = scratch0(); |
| 3795 SwVfpRegister flt_scratch = s0; | 3796 SwVfpRegister flt_scratch = s0; |
| 3796 ASSERT(!result_reg.is(d0)); | 3797 ASSERT(!result_reg.is(d0)); |
| 3797 | 3798 |
| 3798 Label load_smi, heap_number, done; | 3799 Label load_smi, heap_number, done; |
| 3799 | 3800 |
| 3800 // Smi check. | 3801 // Smi check. |
| 3801 __ tst(input_reg, Operand(kSmiTagMask)); | 3802 __ tst(input_reg, Operand(kSmiTagMask)); |
| 3802 __ b(eq, &load_smi); | 3803 __ b(eq, &load_smi); |
| 3803 | 3804 |
| 3804 // Heap number map check. | 3805 // Heap number map check. |
| 3805 __ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); | 3806 __ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); |
| 3806 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 3807 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
| 3807 __ cmp(scratch, Operand(ip)); | 3808 __ cmp(scratch, Operand(ip)); |
| 3808 __ b(eq, &heap_number); | 3809 if (deoptimize_on_undefined) { |
| 3810 DeoptimizeIf(ne, env); |
| 3811 } else { |
| 3812 Label heap_number; |
| 3813 __ b(eq, &heap_number); |
| 3809 | 3814 |
| 3810 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 3815 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
| 3811 __ cmp(input_reg, Operand(ip)); | 3816 __ cmp(input_reg, Operand(ip)); |
| 3812 DeoptimizeIf(ne, env); | 3817 DeoptimizeIf(ne, env); |
| 3813 | 3818 |
| 3814 // Convert undefined to NaN. | 3819 // Convert undefined to NaN. |
| 3815 __ LoadRoot(ip, Heap::kNanValueRootIndex); | 3820 __ LoadRoot(ip, Heap::kNanValueRootIndex); |
| 3816 __ sub(ip, ip, Operand(kHeapObjectTag)); | 3821 __ sub(ip, ip, Operand(kHeapObjectTag)); |
| 3817 __ vldr(result_reg, ip, HeapNumber::kValueOffset); | 3822 __ vldr(result_reg, ip, HeapNumber::kValueOffset); |
| 3818 __ jmp(&done); | 3823 __ jmp(&done); |
| 3819 | 3824 |
| 3825 __ bind(&heap_number); |
| 3826 } |
| 3820 // Heap number to double register conversion. | 3827 // Heap number to double register conversion. |
| 3821 __ bind(&heap_number); | |
| 3822 __ sub(ip, input_reg, Operand(kHeapObjectTag)); | 3828 __ sub(ip, input_reg, Operand(kHeapObjectTag)); |
| 3823 __ vldr(result_reg, ip, HeapNumber::kValueOffset); | 3829 __ vldr(result_reg, ip, HeapNumber::kValueOffset); |
| 3824 __ jmp(&done); | 3830 __ jmp(&done); |
| 3825 | 3831 |
| 3826 // Smi to double register conversion | 3832 // Smi to double register conversion |
| 3827 __ bind(&load_smi); | 3833 __ bind(&load_smi); |
| 3828 __ SmiUntag(input_reg); // Untag smi before converting to float. | 3834 __ SmiUntag(input_reg); // Untag smi before converting to float. |
| 3829 __ vmov(flt_scratch, input_reg); | 3835 __ vmov(flt_scratch, input_reg); |
| 3830 __ vcvt_f64_s32(result_reg, flt_scratch); | 3836 __ vcvt_f64_s32(result_reg, flt_scratch); |
| 3831 __ SmiTag(input_reg); // Retag smi. | 3837 __ SmiTag(input_reg); // Retag smi. |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3945 | 3951 |
| 3946 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { | 3952 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { |
| 3947 LOperand* input = instr->InputAt(0); | 3953 LOperand* input = instr->InputAt(0); |
| 3948 ASSERT(input->IsRegister()); | 3954 ASSERT(input->IsRegister()); |
| 3949 LOperand* result = instr->result(); | 3955 LOperand* result = instr->result(); |
| 3950 ASSERT(result->IsDoubleRegister()); | 3956 ASSERT(result->IsDoubleRegister()); |
| 3951 | 3957 |
| 3952 Register input_reg = ToRegister(input); | 3958 Register input_reg = ToRegister(input); |
| 3953 DoubleRegister result_reg = ToDoubleRegister(result); | 3959 DoubleRegister result_reg = ToDoubleRegister(result); |
| 3954 | 3960 |
| 3955 EmitNumberUntagD(input_reg, result_reg, instr->environment()); | 3961 EmitNumberUntagD(input_reg, result_reg, |
| 3962 instr->hydrogen()->deoptimize_on_undefined(), |
| 3963 instr->environment()); |
| 3956 } | 3964 } |
| 3957 | 3965 |
| 3958 | 3966 |
| 3959 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { | 3967 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { |
| 3960 Register result_reg = ToRegister(instr->result()); | 3968 Register result_reg = ToRegister(instr->result()); |
| 3961 Register scratch1 = scratch0(); | 3969 Register scratch1 = scratch0(); |
| 3962 Register scratch2 = ToRegister(instr->TempAt(0)); | 3970 Register scratch2 = ToRegister(instr->TempAt(0)); |
| 3963 DwVfpRegister double_input = ToDoubleRegister(instr->InputAt(0)); | 3971 DwVfpRegister double_input = ToDoubleRegister(instr->InputAt(0)); |
| 3964 DwVfpRegister double_scratch = double_scratch0(); | 3972 DwVfpRegister double_scratch = double_scratch0(); |
| 3965 SwVfpRegister single_scratch = double_scratch0().low(); | 3973 SwVfpRegister single_scratch = double_scratch0().low(); |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4523 ASSERT(osr_pc_offset_ == -1); | 4531 ASSERT(osr_pc_offset_ == -1); |
| 4524 osr_pc_offset_ = masm()->pc_offset(); | 4532 osr_pc_offset_ = masm()->pc_offset(); |
| 4525 } | 4533 } |
| 4526 | 4534 |
| 4527 | 4535 |
| 4528 | 4536 |
| 4529 | 4537 |
| 4530 #undef __ | 4538 #undef __ |
| 4531 | 4539 |
| 4532 } } // namespace v8::internal | 4540 } } // namespace v8::internal |
| OLD | NEW |