| 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 3910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3921 bool deoptimize_on_undefined, | 3921 bool deoptimize_on_undefined, |
| 3922 bool deoptimize_on_minus_zero, | 3922 bool deoptimize_on_minus_zero, |
| 3923 LEnvironment* env) { | 3923 LEnvironment* env) { |
| 3924 Register scratch = scratch0(); | 3924 Register scratch = scratch0(); |
| 3925 SwVfpRegister flt_scratch = double_scratch0().low(); | 3925 SwVfpRegister flt_scratch = double_scratch0().low(); |
| 3926 ASSERT(!result_reg.is(double_scratch0())); | 3926 ASSERT(!result_reg.is(double_scratch0())); |
| 3927 | 3927 |
| 3928 Label load_smi, heap_number, done; | 3928 Label load_smi, heap_number, done; |
| 3929 | 3929 |
| 3930 // Smi check. | 3930 // Smi check. |
| 3931 __ JumpIfSmi(input_reg, &load_smi); | 3931 __ UntagAndJumpIfSmi(scratch, input_reg, &load_smi); |
| 3932 | 3932 |
| 3933 // Heap number map check. | 3933 // Heap number map check. |
| 3934 __ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); | 3934 __ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); |
| 3935 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 3935 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
| 3936 __ cmp(scratch, Operand(ip)); | 3936 __ cmp(scratch, Operand(ip)); |
| 3937 if (deoptimize_on_undefined) { | 3937 if (deoptimize_on_undefined) { |
| 3938 DeoptimizeIf(ne, env); | 3938 DeoptimizeIf(ne, env); |
| 3939 } else { | 3939 } else { |
| 3940 Label heap_number; | 3940 Label heap_number; |
| 3941 __ b(eq, &heap_number); | 3941 __ b(eq, &heap_number); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3960 __ cmp(ip, Operand(0)); | 3960 __ cmp(ip, Operand(0)); |
| 3961 __ b(ne, &done); | 3961 __ b(ne, &done); |
| 3962 __ vmov(ip, result_reg.high()); | 3962 __ vmov(ip, result_reg.high()); |
| 3963 __ cmp(ip, Operand(HeapNumber::kSignMask)); | 3963 __ cmp(ip, Operand(HeapNumber::kSignMask)); |
| 3964 DeoptimizeIf(eq, env); | 3964 DeoptimizeIf(eq, env); |
| 3965 } | 3965 } |
| 3966 __ jmp(&done); | 3966 __ jmp(&done); |
| 3967 | 3967 |
| 3968 // Smi to double register conversion | 3968 // Smi to double register conversion |
| 3969 __ bind(&load_smi); | 3969 __ bind(&load_smi); |
| 3970 __ SmiUntag(input_reg); // Untag smi before converting to float. | 3970 // scratch: untagged value of input_reg |
| 3971 __ vmov(flt_scratch, input_reg); | 3971 __ vmov(flt_scratch, scratch); |
| 3972 __ vcvt_f64_s32(result_reg, flt_scratch); | 3972 __ vcvt_f64_s32(result_reg, flt_scratch); |
| 3973 __ SmiTag(input_reg); // Retag smi. | |
| 3974 __ bind(&done); | 3973 __ bind(&done); |
| 3975 } | 3974 } |
| 3976 | 3975 |
| 3977 | 3976 |
| 3978 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { | 3977 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { |
| 3979 Register input_reg = ToRegister(instr->InputAt(0)); | 3978 Register input_reg = ToRegister(instr->InputAt(0)); |
| 3980 Register scratch1 = scratch0(); | 3979 Register scratch1 = scratch0(); |
| 3981 Register scratch2 = ToRegister(instr->TempAt(0)); | 3980 Register scratch2 = ToRegister(instr->TempAt(0)); |
| 3982 DwVfpRegister double_scratch = double_scratch0(); | 3981 DwVfpRegister double_scratch = double_scratch0(); |
| 3983 SwVfpRegister single_scratch = double_scratch.low(); | 3982 SwVfpRegister single_scratch = double_scratch.low(); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4249 | 4248 |
| 4250 | 4249 |
| 4251 void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) { | 4250 void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) { |
| 4252 Register scratch = scratch0(); | 4251 Register scratch = scratch0(); |
| 4253 Register input_reg = ToRegister(instr->unclamped()); | 4252 Register input_reg = ToRegister(instr->unclamped()); |
| 4254 Register result_reg = ToRegister(instr->result()); | 4253 Register result_reg = ToRegister(instr->result()); |
| 4255 DoubleRegister temp_reg = ToDoubleRegister(instr->TempAt(0)); | 4254 DoubleRegister temp_reg = ToDoubleRegister(instr->TempAt(0)); |
| 4256 Label is_smi, done, heap_number; | 4255 Label is_smi, done, heap_number; |
| 4257 | 4256 |
| 4258 // Both smi and heap number cases are handled. | 4257 // Both smi and heap number cases are handled. |
| 4259 __ JumpIfSmi(input_reg, &is_smi); | 4258 __ UntagAndJumpIfSmi(result_reg, input_reg, &is_smi); |
| 4260 | 4259 |
| 4261 // Check for heap number | 4260 // Check for heap number |
| 4262 __ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); | 4261 __ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); |
| 4263 __ cmp(scratch, Operand(factory()->heap_number_map())); | 4262 __ cmp(scratch, Operand(factory()->heap_number_map())); |
| 4264 __ b(eq, &heap_number); | 4263 __ b(eq, &heap_number); |
| 4265 | 4264 |
| 4266 // Check for undefined. Undefined is converted to zero for clamping | 4265 // Check for undefined. Undefined is converted to zero for clamping |
| 4267 // conversions. | 4266 // conversions. |
| 4268 __ cmp(input_reg, Operand(factory()->undefined_value())); | 4267 __ cmp(input_reg, Operand(factory()->undefined_value())); |
| 4269 DeoptimizeIf(ne, instr->environment()); | 4268 DeoptimizeIf(ne, instr->environment()); |
| 4270 __ mov(result_reg, Operand(0)); | 4269 __ mov(result_reg, Operand(0)); |
| 4271 __ jmp(&done); | 4270 __ jmp(&done); |
| 4272 | 4271 |
| 4273 // Heap number | 4272 // Heap number |
| 4274 __ bind(&heap_number); | 4273 __ bind(&heap_number); |
| 4275 __ vldr(double_scratch0(), FieldMemOperand(input_reg, | 4274 __ vldr(double_scratch0(), FieldMemOperand(input_reg, |
| 4276 HeapNumber::kValueOffset)); | 4275 HeapNumber::kValueOffset)); |
| 4277 __ ClampDoubleToUint8(result_reg, double_scratch0(), temp_reg); | 4276 __ ClampDoubleToUint8(result_reg, double_scratch0(), temp_reg); |
| 4278 __ jmp(&done); | 4277 __ jmp(&done); |
| 4279 | 4278 |
| 4280 // smi | 4279 // smi |
| 4281 __ bind(&is_smi); | 4280 __ bind(&is_smi); |
| 4282 __ SmiUntag(result_reg, input_reg); | |
| 4283 __ ClampUint8(result_reg, result_reg); | 4281 __ ClampUint8(result_reg, result_reg); |
| 4284 | 4282 |
| 4285 __ bind(&done); | 4283 __ bind(&done); |
| 4286 } | 4284 } |
| 4287 | 4285 |
| 4288 | 4286 |
| 4289 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { | 4287 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { |
| 4290 Register temp1 = ToRegister(instr->TempAt(0)); | 4288 Register temp1 = ToRegister(instr->TempAt(0)); |
| 4291 Register temp2 = ToRegister(instr->TempAt(1)); | 4289 Register temp2 = ToRegister(instr->TempAt(1)); |
| 4292 | 4290 |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4800 ASSERT(osr_pc_offset_ == -1); | 4798 ASSERT(osr_pc_offset_ == -1); |
| 4801 osr_pc_offset_ = masm()->pc_offset(); | 4799 osr_pc_offset_ = masm()->pc_offset(); |
| 4802 } | 4800 } |
| 4803 | 4801 |
| 4804 | 4802 |
| 4805 | 4803 |
| 4806 | 4804 |
| 4807 #undef __ | 4805 #undef __ |
| 4808 | 4806 |
| 4809 } } // namespace v8::internal | 4807 } } // namespace v8::internal |
| OLD | NEW |