| 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 3885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3896 DeoptimizeIf(cs, instr->environment()); | 3896 DeoptimizeIf(cs, instr->environment()); |
| 3897 } else { | 3897 } else { |
| 3898 __ SmiUntag(ToRegister(input)); | 3898 __ SmiUntag(ToRegister(input)); |
| 3899 } | 3899 } |
| 3900 } | 3900 } |
| 3901 | 3901 |
| 3902 | 3902 |
| 3903 void LCodeGen::EmitNumberUntagD(Register input_reg, | 3903 void LCodeGen::EmitNumberUntagD(Register input_reg, |
| 3904 DoubleRegister result_reg, | 3904 DoubleRegister result_reg, |
| 3905 bool deoptimize_on_undefined, | 3905 bool deoptimize_on_undefined, |
| 3906 bool deoptimize_on_minus_zero, |
| 3906 LEnvironment* env) { | 3907 LEnvironment* env) { |
| 3907 Register scratch = scratch0(); | 3908 Register scratch = scratch0(); |
| 3908 SwVfpRegister flt_scratch = double_scratch0().low(); | 3909 SwVfpRegister flt_scratch = double_scratch0().low(); |
| 3909 ASSERT(!result_reg.is(double_scratch0())); | 3910 ASSERT(!result_reg.is(double_scratch0())); |
| 3910 | 3911 |
| 3911 Label load_smi, heap_number, done; | 3912 Label load_smi, heap_number, done; |
| 3912 | 3913 |
| 3913 // Smi check. | 3914 // Smi check. |
| 3914 __ JumpIfSmi(input_reg, &load_smi); | 3915 __ JumpIfSmi(input_reg, &load_smi); |
| 3915 | 3916 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3931 __ LoadRoot(ip, Heap::kNanValueRootIndex); | 3932 __ LoadRoot(ip, Heap::kNanValueRootIndex); |
| 3932 __ sub(ip, ip, Operand(kHeapObjectTag)); | 3933 __ sub(ip, ip, Operand(kHeapObjectTag)); |
| 3933 __ vldr(result_reg, ip, HeapNumber::kValueOffset); | 3934 __ vldr(result_reg, ip, HeapNumber::kValueOffset); |
| 3934 __ jmp(&done); | 3935 __ jmp(&done); |
| 3935 | 3936 |
| 3936 __ bind(&heap_number); | 3937 __ bind(&heap_number); |
| 3937 } | 3938 } |
| 3938 // Heap number to double register conversion. | 3939 // Heap number to double register conversion. |
| 3939 __ sub(ip, input_reg, Operand(kHeapObjectTag)); | 3940 __ sub(ip, input_reg, Operand(kHeapObjectTag)); |
| 3940 __ vldr(result_reg, ip, HeapNumber::kValueOffset); | 3941 __ vldr(result_reg, ip, HeapNumber::kValueOffset); |
| 3942 if (deoptimize_on_minus_zero) { |
| 3943 __ vmov(ip, result_reg.low()); |
| 3944 __ cmp(ip, Operand(0)); |
| 3945 __ b(ne, &done); |
| 3946 __ vmov(ip, result_reg.high()); |
| 3947 __ cmp(ip, Operand(HeapNumber::kSignMask)); |
| 3948 DeoptimizeIf(eq, env); |
| 3949 } |
| 3941 __ jmp(&done); | 3950 __ jmp(&done); |
| 3942 | 3951 |
| 3943 // Smi to double register conversion | 3952 // Smi to double register conversion |
| 3944 __ bind(&load_smi); | 3953 __ bind(&load_smi); |
| 3945 __ SmiUntag(input_reg); // Untag smi before converting to float. | 3954 __ SmiUntag(input_reg); // Untag smi before converting to float. |
| 3946 __ vmov(flt_scratch, input_reg); | 3955 __ vmov(flt_scratch, input_reg); |
| 3947 __ vcvt_f64_s32(result_reg, flt_scratch); | 3956 __ vcvt_f64_s32(result_reg, flt_scratch); |
| 3948 __ SmiTag(input_reg); // Retag smi. | 3957 __ SmiTag(input_reg); // Retag smi. |
| 3949 __ bind(&done); | 3958 __ bind(&done); |
| 3950 } | 3959 } |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4064 LOperand* input = instr->InputAt(0); | 4073 LOperand* input = instr->InputAt(0); |
| 4065 ASSERT(input->IsRegister()); | 4074 ASSERT(input->IsRegister()); |
| 4066 LOperand* result = instr->result(); | 4075 LOperand* result = instr->result(); |
| 4067 ASSERT(result->IsDoubleRegister()); | 4076 ASSERT(result->IsDoubleRegister()); |
| 4068 | 4077 |
| 4069 Register input_reg = ToRegister(input); | 4078 Register input_reg = ToRegister(input); |
| 4070 DoubleRegister result_reg = ToDoubleRegister(result); | 4079 DoubleRegister result_reg = ToDoubleRegister(result); |
| 4071 | 4080 |
| 4072 EmitNumberUntagD(input_reg, result_reg, | 4081 EmitNumberUntagD(input_reg, result_reg, |
| 4073 instr->hydrogen()->deoptimize_on_undefined(), | 4082 instr->hydrogen()->deoptimize_on_undefined(), |
| 4083 instr->hydrogen()->deoptimize_on_minus_zero(), |
| 4074 instr->environment()); | 4084 instr->environment()); |
| 4075 } | 4085 } |
| 4076 | 4086 |
| 4077 | 4087 |
| 4078 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { | 4088 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { |
| 4079 Register result_reg = ToRegister(instr->result()); | 4089 Register result_reg = ToRegister(instr->result()); |
| 4080 Register scratch1 = scratch0(); | 4090 Register scratch1 = scratch0(); |
| 4081 Register scratch2 = ToRegister(instr->TempAt(0)); | 4091 Register scratch2 = ToRegister(instr->TempAt(0)); |
| 4082 DwVfpRegister double_input = ToDoubleRegister(instr->InputAt(0)); | 4092 DwVfpRegister double_input = ToDoubleRegister(instr->InputAt(0)); |
| 4083 SwVfpRegister single_scratch = double_scratch0().low(); | 4093 SwVfpRegister single_scratch = double_scratch0().low(); |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4774 ASSERT(osr_pc_offset_ == -1); | 4784 ASSERT(osr_pc_offset_ == -1); |
| 4775 osr_pc_offset_ = masm()->pc_offset(); | 4785 osr_pc_offset_ = masm()->pc_offset(); |
| 4776 } | 4786 } |
| 4777 | 4787 |
| 4778 | 4788 |
| 4779 | 4789 |
| 4780 | 4790 |
| 4781 #undef __ | 4791 #undef __ |
| 4782 | 4792 |
| 4783 } } // namespace v8::internal | 4793 } } // namespace v8::internal |
| OLD | NEW |