| 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 3826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3837 void LCodeGen::EmitNumberUntagD(Register input_reg, | 3837 void LCodeGen::EmitNumberUntagD(Register input_reg, |
| 3838 DoubleRegister result_reg, | 3838 DoubleRegister result_reg, |
| 3839 bool deoptimize_on_undefined, | 3839 bool deoptimize_on_undefined, |
| 3840 bool deoptimize_on_minus_zero, | 3840 bool deoptimize_on_minus_zero, |
| 3841 LEnvironment* env) { | 3841 LEnvironment* env) { |
| 3842 Register scratch = scratch0(); | 3842 Register scratch = scratch0(); |
| 3843 | 3843 |
| 3844 Label load_smi, heap_number, done; | 3844 Label load_smi, heap_number, done; |
| 3845 | 3845 |
| 3846 // Smi check. | 3846 // Smi check. |
| 3847 __ JumpIfSmi(input_reg, &load_smi); | 3847 __ UntagAndJumpIfSmi(scratch, input_reg, &load_smi); |
| 3848 | 3848 |
| 3849 // Heap number map check. | 3849 // Heap number map check. |
| 3850 __ lw(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); | 3850 __ lw(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); |
| 3851 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); | 3851 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); |
| 3852 if (deoptimize_on_undefined) { | 3852 if (deoptimize_on_undefined) { |
| 3853 DeoptimizeIf(ne, env, scratch, Operand(at)); | 3853 DeoptimizeIf(ne, env, scratch, Operand(at)); |
| 3854 } else { | 3854 } else { |
| 3855 Label heap_number; | 3855 Label heap_number; |
| 3856 __ Branch(&heap_number, eq, scratch, Operand(at)); | 3856 __ Branch(&heap_number, eq, scratch, Operand(at)); |
| 3857 | 3857 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 3870 if (deoptimize_on_minus_zero) { | 3870 if (deoptimize_on_minus_zero) { |
| 3871 __ mfc1(at, result_reg.low()); | 3871 __ mfc1(at, result_reg.low()); |
| 3872 __ Branch(&done, ne, at, Operand(zero_reg)); | 3872 __ Branch(&done, ne, at, Operand(zero_reg)); |
| 3873 __ mfc1(scratch, result_reg.high()); | 3873 __ mfc1(scratch, result_reg.high()); |
| 3874 DeoptimizeIf(eq, env, scratch, Operand(HeapNumber::kSignMask)); | 3874 DeoptimizeIf(eq, env, scratch, Operand(HeapNumber::kSignMask)); |
| 3875 } | 3875 } |
| 3876 __ Branch(&done); | 3876 __ Branch(&done); |
| 3877 | 3877 |
| 3878 // Smi to double register conversion | 3878 // Smi to double register conversion |
| 3879 __ bind(&load_smi); | 3879 __ bind(&load_smi); |
| 3880 __ SmiUntag(scratch, input_reg); // Untag smi before converting to float. | 3880 // scratch: untagged value of input_reg |
| 3881 __ mtc1(scratch, result_reg); | 3881 __ mtc1(scratch, result_reg); |
| 3882 __ cvt_d_w(result_reg, result_reg); | 3882 __ cvt_d_w(result_reg, result_reg); |
| 3883 __ bind(&done); | 3883 __ bind(&done); |
| 3884 } | 3884 } |
| 3885 | 3885 |
| 3886 | 3886 |
| 3887 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { | 3887 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { |
| 3888 Register input_reg = ToRegister(instr->InputAt(0)); | 3888 Register input_reg = ToRegister(instr->InputAt(0)); |
| 3889 Register scratch1 = scratch0(); | 3889 Register scratch1 = scratch0(); |
| 3890 Register scratch2 = ToRegister(instr->TempAt(0)); | 3890 Register scratch2 = ToRegister(instr->TempAt(0)); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4153 | 4153 |
| 4154 | 4154 |
| 4155 void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) { | 4155 void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) { |
| 4156 Register scratch = scratch0(); | 4156 Register scratch = scratch0(); |
| 4157 Register input_reg = ToRegister(instr->unclamped()); | 4157 Register input_reg = ToRegister(instr->unclamped()); |
| 4158 Register result_reg = ToRegister(instr->result()); | 4158 Register result_reg = ToRegister(instr->result()); |
| 4159 DoubleRegister temp_reg = ToDoubleRegister(instr->TempAt(0)); | 4159 DoubleRegister temp_reg = ToDoubleRegister(instr->TempAt(0)); |
| 4160 Label is_smi, done, heap_number; | 4160 Label is_smi, done, heap_number; |
| 4161 | 4161 |
| 4162 // Both smi and heap number cases are handled. | 4162 // Both smi and heap number cases are handled. |
| 4163 __ JumpIfSmi(input_reg, &is_smi); | 4163 __ UntagAndJumpIfSmi(scratch, input_reg, &is_smi); |
| 4164 | 4164 |
| 4165 // Check for heap number | 4165 // Check for heap number |
| 4166 __ lw(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); | 4166 __ lw(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); |
| 4167 __ Branch(&heap_number, eq, scratch, Operand(factory()->heap_number_map())); | 4167 __ Branch(&heap_number, eq, scratch, Operand(factory()->heap_number_map())); |
| 4168 | 4168 |
| 4169 // Check for undefined. Undefined is converted to zero for clamping | 4169 // Check for undefined. Undefined is converted to zero for clamping |
| 4170 // conversions. | 4170 // conversions. |
| 4171 DeoptimizeIf(ne, instr->environment(), input_reg, | 4171 DeoptimizeIf(ne, instr->environment(), input_reg, |
| 4172 Operand(factory()->undefined_value())); | 4172 Operand(factory()->undefined_value())); |
| 4173 __ mov(result_reg, zero_reg); | 4173 __ mov(result_reg, zero_reg); |
| 4174 __ jmp(&done); | 4174 __ jmp(&done); |
| 4175 | 4175 |
| 4176 // Heap number | 4176 // Heap number |
| 4177 __ bind(&heap_number); | 4177 __ bind(&heap_number); |
| 4178 __ ldc1(double_scratch0(), FieldMemOperand(input_reg, | 4178 __ ldc1(double_scratch0(), FieldMemOperand(input_reg, |
| 4179 HeapNumber::kValueOffset)); | 4179 HeapNumber::kValueOffset)); |
| 4180 __ ClampDoubleToUint8(result_reg, double_scratch0(), temp_reg); | 4180 __ ClampDoubleToUint8(result_reg, double_scratch0(), temp_reg); |
| 4181 __ jmp(&done); | 4181 __ jmp(&done); |
| 4182 | 4182 |
| 4183 // smi | |
| 4184 __ bind(&is_smi); | 4183 __ bind(&is_smi); |
| 4185 __ SmiUntag(scratch, input_reg); | |
| 4186 __ ClampUint8(result_reg, scratch); | 4184 __ ClampUint8(result_reg, scratch); |
| 4187 | 4185 |
| 4188 __ bind(&done); | 4186 __ bind(&done); |
| 4189 } | 4187 } |
| 4190 | 4188 |
| 4191 | 4189 |
| 4192 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { | 4190 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { |
| 4193 Register temp1 = ToRegister(instr->TempAt(0)); | 4191 Register temp1 = ToRegister(instr->TempAt(0)); |
| 4194 Register temp2 = ToRegister(instr->TempAt(1)); | 4192 Register temp2 = ToRegister(instr->TempAt(1)); |
| 4195 | 4193 |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4740 ASSERT(!environment->HasBeenRegistered()); | 4738 ASSERT(!environment->HasBeenRegistered()); |
| 4741 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 4739 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
| 4742 ASSERT(osr_pc_offset_ == -1); | 4740 ASSERT(osr_pc_offset_ == -1); |
| 4743 osr_pc_offset_ = masm()->pc_offset(); | 4741 osr_pc_offset_ = masm()->pc_offset(); |
| 4744 } | 4742 } |
| 4745 | 4743 |
| 4746 | 4744 |
| 4747 #undef __ | 4745 #undef __ |
| 4748 | 4746 |
| 4749 } } // namespace v8::internal | 4747 } } // namespace v8::internal |
| OLD | NEW |