| 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 4853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4864 | 4864 |
| 4865 void LCodeGen::EmitNumberUntagD(Register input_reg, | 4865 void LCodeGen::EmitNumberUntagD(Register input_reg, |
| 4866 DwVfpRegister result_reg, | 4866 DwVfpRegister result_reg, |
| 4867 bool can_convert_undefined_to_nan, | 4867 bool can_convert_undefined_to_nan, |
| 4868 bool deoptimize_on_minus_zero, | 4868 bool deoptimize_on_minus_zero, |
| 4869 LEnvironment* env, | 4869 LEnvironment* env, |
| 4870 NumberUntagDMode mode) { | 4870 NumberUntagDMode mode) { |
| 4871 Register scratch = scratch0(); | 4871 Register scratch = scratch0(); |
| 4872 SwVfpRegister flt_scratch = double_scratch0().low(); | 4872 SwVfpRegister flt_scratch = double_scratch0().low(); |
| 4873 ASSERT(!result_reg.is(double_scratch0())); | 4873 ASSERT(!result_reg.is(double_scratch0())); |
| 4874 | 4874 Label convert, load_smi, done; |
| 4875 Label load_smi, heap_number, done; | |
| 4876 | |
| 4877 if (mode == NUMBER_CANDIDATE_IS_ANY_TAGGED) { | 4875 if (mode == NUMBER_CANDIDATE_IS_ANY_TAGGED) { |
| 4878 // Smi check. | 4876 // Smi check. |
| 4879 __ UntagAndJumpIfSmi(scratch, input_reg, &load_smi); | 4877 __ UntagAndJumpIfSmi(scratch, input_reg, &load_smi); |
| 4880 | |
| 4881 // Heap number map check. | 4878 // Heap number map check. |
| 4882 __ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); | 4879 __ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); |
| 4883 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 4880 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
| 4884 __ cmp(scratch, Operand(ip)); | 4881 __ cmp(scratch, Operand(ip)); |
| 4885 if (!can_convert_undefined_to_nan) { | 4882 if (can_convert_undefined_to_nan) { |
| 4883 __ b(ne, &convert); |
| 4884 } else { |
| 4886 DeoptimizeIf(ne, env); | 4885 DeoptimizeIf(ne, env); |
| 4887 } else { | |
| 4888 Label heap_number, convert; | |
| 4889 __ b(eq, &heap_number); | |
| 4890 | |
| 4891 // Convert undefined (and hole) to NaN. | |
| 4892 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | |
| 4893 __ cmp(input_reg, Operand(ip)); | |
| 4894 DeoptimizeIf(ne, env); | |
| 4895 | |
| 4896 __ bind(&convert); | |
| 4897 __ LoadRoot(scratch, Heap::kNanValueRootIndex); | |
| 4898 __ vldr(result_reg, scratch, HeapNumber::kValueOffset - kHeapObjectTag); | |
| 4899 __ jmp(&done); | |
| 4900 | |
| 4901 __ bind(&heap_number); | |
| 4902 } | 4886 } |
| 4903 // Heap number to double register conversion. | 4887 // load heap number |
| 4904 __ vldr(result_reg, input_reg, HeapNumber::kValueOffset - kHeapObjectTag); | 4888 __ vldr(result_reg, input_reg, HeapNumber::kValueOffset - kHeapObjectTag); |
| 4905 if (deoptimize_on_minus_zero) { | 4889 if (deoptimize_on_minus_zero) { |
| 4906 __ VmovLow(scratch, result_reg); | 4890 __ VmovLow(scratch, result_reg); |
| 4907 __ cmp(scratch, Operand::Zero()); | 4891 __ cmp(scratch, Operand::Zero()); |
| 4908 __ b(ne, &done); | 4892 __ b(ne, &done); |
| 4909 __ VmovHigh(scratch, result_reg); | 4893 __ VmovHigh(scratch, result_reg); |
| 4910 __ cmp(scratch, Operand(HeapNumber::kSignMask)); | 4894 __ cmp(scratch, Operand(HeapNumber::kSignMask)); |
| 4911 DeoptimizeIf(eq, env); | 4895 DeoptimizeIf(eq, env); |
| 4912 } | 4896 } |
| 4913 __ jmp(&done); | 4897 __ jmp(&done); |
| 4898 if (can_convert_undefined_to_nan) { |
| 4899 __ bind(&convert); |
| 4900 // Convert undefined (and hole) to NaN. |
| 4901 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
| 4902 __ cmp(input_reg, Operand(ip)); |
| 4903 DeoptimizeIf(ne, env); |
| 4904 __ LoadRoot(scratch, Heap::kNanValueRootIndex); |
| 4905 __ vldr(result_reg, scratch, HeapNumber::kValueOffset - kHeapObjectTag); |
| 4906 __ jmp(&done); |
| 4907 } |
| 4914 } else { | 4908 } else { |
| 4915 __ SmiUntag(scratch, input_reg); | 4909 __ SmiUntag(scratch, input_reg); |
| 4916 ASSERT(mode == NUMBER_CANDIDATE_IS_SMI); | 4910 ASSERT(mode == NUMBER_CANDIDATE_IS_SMI); |
| 4917 } | 4911 } |
| 4918 | |
| 4919 // Smi to double register conversion | 4912 // Smi to double register conversion |
| 4920 __ bind(&load_smi); | 4913 __ bind(&load_smi); |
| 4921 // scratch: untagged value of input_reg | 4914 // scratch: untagged value of input_reg |
| 4922 __ vmov(flt_scratch, scratch); | 4915 __ vmov(flt_scratch, scratch); |
| 4923 __ vcvt_f64_s32(result_reg, flt_scratch); | 4916 __ vcvt_f64_s32(result_reg, flt_scratch); |
| 4924 __ bind(&done); | 4917 __ bind(&done); |
| 4925 } | 4918 } |
| 4926 | 4919 |
| 4927 | 4920 |
| 4928 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { | 4921 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5793 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5786 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
| 5794 __ ldr(result, FieldMemOperand(scratch, | 5787 __ ldr(result, FieldMemOperand(scratch, |
| 5795 FixedArray::kHeaderSize - kPointerSize)); | 5788 FixedArray::kHeaderSize - kPointerSize)); |
| 5796 __ bind(&done); | 5789 __ bind(&done); |
| 5797 } | 5790 } |
| 5798 | 5791 |
| 5799 | 5792 |
| 5800 #undef __ | 5793 #undef __ |
| 5801 | 5794 |
| 5802 } } // namespace v8::internal | 5795 } } // namespace v8::internal |
| OLD | NEW |