| 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 4954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4965 __ SmiUntag(result, input, SetCC); | 4965 __ SmiUntag(result, input, SetCC); |
| 4966 DeoptimizeIf(cs, instr->environment()); | 4966 DeoptimizeIf(cs, instr->environment()); |
| 4967 } else { | 4967 } else { |
| 4968 __ SmiUntag(result, input); | 4968 __ SmiUntag(result, input); |
| 4969 } | 4969 } |
| 4970 } | 4970 } |
| 4971 | 4971 |
| 4972 | 4972 |
| 4973 void LCodeGen::EmitNumberUntagD(Register input_reg, | 4973 void LCodeGen::EmitNumberUntagD(Register input_reg, |
| 4974 DwVfpRegister result_reg, | 4974 DwVfpRegister result_reg, |
| 4975 bool deoptimize_on_undefined, | 4975 bool allow_undefined_as_nan, |
| 4976 bool deoptimize_on_minus_zero, | 4976 bool deoptimize_on_minus_zero, |
| 4977 LEnvironment* env, | 4977 LEnvironment* env, |
| 4978 NumberUntagDMode mode) { | 4978 NumberUntagDMode mode) { |
| 4979 Register scratch = scratch0(); | 4979 Register scratch = scratch0(); |
| 4980 SwVfpRegister flt_scratch = double_scratch0().low(); | 4980 SwVfpRegister flt_scratch = double_scratch0().low(); |
| 4981 ASSERT(!result_reg.is(double_scratch0())); | 4981 ASSERT(!result_reg.is(double_scratch0())); |
| 4982 | 4982 |
| 4983 Label load_smi, heap_number, done; | 4983 Label load_smi, heap_number, done; |
| 4984 | 4984 |
| 4985 STATIC_ASSERT(NUMBER_CANDIDATE_IS_ANY_TAGGED_CONVERT_HOLE > | 4985 STATIC_ASSERT(NUMBER_CANDIDATE_IS_ANY_TAGGED_CONVERT_HOLE > |
| 4986 NUMBER_CANDIDATE_IS_ANY_TAGGED); | 4986 NUMBER_CANDIDATE_IS_ANY_TAGGED); |
| 4987 if (mode >= NUMBER_CANDIDATE_IS_ANY_TAGGED) { | 4987 if (mode >= NUMBER_CANDIDATE_IS_ANY_TAGGED) { |
| 4988 // Smi check. | 4988 // Smi check. |
| 4989 __ UntagAndJumpIfSmi(scratch, input_reg, &load_smi); | 4989 __ UntagAndJumpIfSmi(scratch, input_reg, &load_smi); |
| 4990 | 4990 |
| 4991 // Heap number map check. | 4991 // Heap number map check. |
| 4992 __ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); | 4992 __ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); |
| 4993 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 4993 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
| 4994 __ cmp(scratch, Operand(ip)); | 4994 __ cmp(scratch, Operand(ip)); |
| 4995 if (deoptimize_on_undefined) { | 4995 if (!allow_undefined_as_nan) { |
| 4996 DeoptimizeIf(ne, env); | 4996 DeoptimizeIf(ne, env); |
| 4997 } else { | 4997 } else { |
| 4998 Label heap_number, convert; | 4998 Label heap_number, convert; |
| 4999 __ b(eq, &heap_number); | 4999 __ b(eq, &heap_number); |
| 5000 | 5000 |
| 5001 // Convert undefined (and hole) to NaN. | 5001 // Convert undefined (and hole) to NaN. |
| 5002 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 5002 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
| 5003 __ cmp(input_reg, Operand(ip)); | 5003 __ cmp(input_reg, Operand(ip)); |
| 5004 if (mode == NUMBER_CANDIDATE_IS_ANY_TAGGED_CONVERT_HOLE) { | 5004 if (mode == NUMBER_CANDIDATE_IS_ANY_TAGGED_CONVERT_HOLE) { |
| 5005 __ b(eq, &convert); | 5005 __ b(eq, &convert); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5155 } else if (value->IsLoadKeyed()) { | 5155 } else if (value->IsLoadKeyed()) { |
| 5156 HLoadKeyed* load = HLoadKeyed::cast(value); | 5156 HLoadKeyed* load = HLoadKeyed::cast(value); |
| 5157 if (load->UsesMustHandleHole()) { | 5157 if (load->UsesMustHandleHole()) { |
| 5158 if (load->hole_mode() == ALLOW_RETURN_HOLE) { | 5158 if (load->hole_mode() == ALLOW_RETURN_HOLE) { |
| 5159 mode = NUMBER_CANDIDATE_IS_ANY_TAGGED_CONVERT_HOLE; | 5159 mode = NUMBER_CANDIDATE_IS_ANY_TAGGED_CONVERT_HOLE; |
| 5160 } | 5160 } |
| 5161 } | 5161 } |
| 5162 } | 5162 } |
| 5163 | 5163 |
| 5164 EmitNumberUntagD(input_reg, result_reg, | 5164 EmitNumberUntagD(input_reg, result_reg, |
| 5165 instr->hydrogen()->deoptimize_on_undefined(), | 5165 instr->hydrogen()->allow_undefined_as_nan(), |
| 5166 instr->hydrogen()->deoptimize_on_minus_zero(), | 5166 instr->hydrogen()->deoptimize_on_minus_zero(), |
| 5167 instr->environment(), | 5167 instr->environment(), |
| 5168 mode); | 5168 mode); |
| 5169 } | 5169 } |
| 5170 | 5170 |
| 5171 | 5171 |
| 5172 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { | 5172 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { |
| 5173 Register result_reg = ToRegister(instr->result()); | 5173 Register result_reg = ToRegister(instr->result()); |
| 5174 Register scratch1 = scratch0(); | 5174 Register scratch1 = scratch0(); |
| 5175 Register scratch2 = ToRegister(instr->temp()); | 5175 Register scratch2 = ToRegister(instr->temp()); |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5996 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5996 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
| 5997 __ ldr(result, FieldMemOperand(scratch, | 5997 __ ldr(result, FieldMemOperand(scratch, |
| 5998 FixedArray::kHeaderSize - kPointerSize)); | 5998 FixedArray::kHeaderSize - kPointerSize)); |
| 5999 __ bind(&done); | 5999 __ bind(&done); |
| 6000 } | 6000 } |
| 6001 | 6001 |
| 6002 | 6002 |
| 6003 #undef __ | 6003 #undef __ |
| 6004 | 6004 |
| 6005 } } // namespace v8::internal | 6005 } } // namespace v8::internal |
| OLD | NEW |