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 4868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4879 __ UntagAndJumpIfSmi(scratch, input_reg, &load_smi); | 4879 __ UntagAndJumpIfSmi(scratch, input_reg, &load_smi); |
4880 | 4880 |
4881 // Heap number map check. | 4881 // Heap number map check. |
4882 __ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); | 4882 __ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); |
4883 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 4883 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
4884 __ cmp(scratch, Operand(ip)); | 4884 __ cmp(scratch, Operand(ip)); |
4885 if (!can_convert_undefined_to_nan) { | 4885 if (!can_convert_undefined_to_nan) { |
4886 DeoptimizeIf(ne, env); | 4886 DeoptimizeIf(ne, env); |
4887 } else { | 4887 } else { |
4888 Label heap_number, convert; | 4888 Label heap_number, convert; |
4889 if (!deoptimize_on_minus_zero) { | |
4890 __ vldr(result_reg, input_reg, | |
4891 HeapNumber::kValueOffset - kHeapObjectTag, eq); | |
4892 __ b(eq, &done); | |
4893 } else { | |
4889 __ b(eq, &heap_number); | 4894 __ b(eq, &heap_number); |
Benedikt Meurer
2013/09/12 07:23:41
Nit: indentation.
| |
4895 } | |
4890 | 4896 |
4891 // Convert undefined (and hole) to NaN. | 4897 // Convert undefined (and hole) to NaN. |
4892 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 4898 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
4893 __ cmp(input_reg, Operand(ip)); | 4899 __ cmp(input_reg, Operand(ip)); |
4894 DeoptimizeIf(ne, env); | 4900 DeoptimizeIf(ne, env); |
4895 | 4901 |
4896 __ bind(&convert); | 4902 __ bind(&convert); |
4897 __ LoadRoot(scratch, Heap::kNanValueRootIndex); | 4903 __ LoadRoot(scratch, Heap::kNanValueRootIndex); |
4898 __ vldr(result_reg, scratch, HeapNumber::kValueOffset - kHeapObjectTag); | 4904 __ vldr(result_reg, scratch, HeapNumber::kValueOffset - kHeapObjectTag); |
4899 __ jmp(&done); | 4905 __ jmp(&done); |
4900 | 4906 |
4901 __ bind(&heap_number); | 4907 __ bind(&heap_number); |
4902 } | 4908 } |
4909 | |
4903 // Heap number to double register conversion. | 4910 // Heap number to double register conversion. |
4904 __ vldr(result_reg, input_reg, HeapNumber::kValueOffset - kHeapObjectTag); | 4911 if (!can_convert_undefined_to_nan || deoptimize_on_minus_zero) { |
4912 __ vldr(result_reg, input_reg, HeapNumber::kValueOffset - kHeapObjectTag); | |
4913 } | |
4905 if (deoptimize_on_minus_zero) { | 4914 if (deoptimize_on_minus_zero) { |
4906 __ VmovLow(scratch, result_reg); | 4915 __ VmovLow(scratch, result_reg); |
4907 __ cmp(scratch, Operand::Zero()); | 4916 __ cmp(scratch, Operand::Zero()); |
4908 __ b(ne, &done); | 4917 __ b(ne, &done); |
4909 __ VmovHigh(scratch, result_reg); | 4918 __ VmovHigh(scratch, result_reg); |
4910 __ cmp(scratch, Operand(HeapNumber::kSignMask)); | 4919 __ cmp(scratch, Operand(HeapNumber::kSignMask)); |
4911 DeoptimizeIf(eq, env); | 4920 DeoptimizeIf(eq, env); |
4912 } | 4921 } |
4913 __ jmp(&done); | 4922 __ jmp(&done); |
4914 } else { | 4923 } else { |
4915 __ SmiUntag(scratch, input_reg); | 4924 __ SmiUntag(scratch, input_reg); |
4916 ASSERT(mode == NUMBER_CANDIDATE_IS_SMI); | 4925 ASSERT(mode == NUMBER_CANDIDATE_IS_SMI); |
4917 } | 4926 } |
4918 | 4927 |
4919 // Smi to double register conversion | 4928 // Smi to double register conversion |
4920 __ bind(&load_smi); | 4929 __ bind(&load_smi); |
4921 // scratch: untagged value of input_reg | 4930 // scratch: untagged value of input_reg |
4922 __ vmov(flt_scratch, scratch); | 4931 __ vmov(flt_scratch, scratch); |
4923 __ vcvt_f64_s32(result_reg, flt_scratch); | 4932 __ vcvt_f64_s32(result_reg, flt_scratch); |
4924 __ bind(&done); | 4933 __ bind(&done); |
4925 } | 4934 } |
4926 | 4935 |
4927 | 4936 |
4937 | |
Benedikt Meurer
2013/09/12 07:23:41
Nit: new line.
| |
4928 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { | 4938 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { |
4929 Register input_reg = ToRegister(instr->value()); | 4939 Register input_reg = ToRegister(instr->value()); |
4930 Register scratch1 = scratch0(); | 4940 Register scratch1 = scratch0(); |
4931 Register scratch2 = ToRegister(instr->temp()); | 4941 Register scratch2 = ToRegister(instr->temp()); |
4932 LowDwVfpRegister double_scratch = double_scratch0(); | 4942 LowDwVfpRegister double_scratch = double_scratch0(); |
4933 DwVfpRegister double_scratch2 = ToDoubleRegister(instr->temp2()); | 4943 DwVfpRegister double_scratch2 = ToDoubleRegister(instr->temp2()); |
4934 | 4944 |
4935 ASSERT(!scratch1.is(input_reg) && !scratch1.is(scratch2)); | 4945 ASSERT(!scratch1.is(input_reg) && !scratch1.is(scratch2)); |
4936 ASSERT(!scratch2.is(input_reg) && !scratch2.is(scratch1)); | 4946 ASSERT(!scratch2.is(input_reg) && !scratch2.is(scratch1)); |
4937 | 4947 |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5793 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5803 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5794 __ ldr(result, FieldMemOperand(scratch, | 5804 __ ldr(result, FieldMemOperand(scratch, |
5795 FixedArray::kHeaderSize - kPointerSize)); | 5805 FixedArray::kHeaderSize - kPointerSize)); |
5796 __ bind(&done); | 5806 __ bind(&done); |
5797 } | 5807 } |
5798 | 5808 |
5799 | 5809 |
5800 #undef __ | 5810 #undef __ |
5801 | 5811 |
5802 } } // namespace v8::internal | 5812 } } // namespace v8::internal |
OLD | NEW |