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