OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3778 void LCodeGen::DoCheckMap(LCheckMap* instr) { | 3778 void LCodeGen::DoCheckMap(LCheckMap* instr) { |
3779 LOperand* input = instr->InputAt(0); | 3779 LOperand* input = instr->InputAt(0); |
3780 ASSERT(input->IsRegister()); | 3780 ASSERT(input->IsRegister()); |
3781 Register reg = ToRegister(input); | 3781 Register reg = ToRegister(input); |
3782 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), | 3782 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), |
3783 instr->hydrogen()->map()); | 3783 instr->hydrogen()->map()); |
3784 DeoptimizeIf(not_equal, instr->environment()); | 3784 DeoptimizeIf(not_equal, instr->environment()); |
3785 } | 3785 } |
3786 | 3786 |
3787 | 3787 |
| 3788 void LCodeGen::DoClampDoubleToUint8(LClampDoubleToUint8* instr) { |
| 3789 XMMRegister value_reg = ToDoubleRegister(instr->unclamped()); |
| 3790 Register result_reg = ToRegister(instr->result()); |
| 3791 Register temp_reg = ToRegister(instr->TempAt(0)); |
| 3792 __ ClampDoubleToUint8(value_reg, xmm0, result_reg, temp_reg); |
| 3793 } |
| 3794 |
| 3795 |
| 3796 void LCodeGen::DoClampIToUint8(LClampIToUint8* instr) { |
| 3797 ASSERT(instr->unclamped()->Equals(instr->result())); |
| 3798 Register value_reg = ToRegister(instr->result()); |
| 3799 __ ClampUint8(value_reg); |
| 3800 } |
| 3801 |
| 3802 |
| 3803 void LCodeGen::DoClampTaggedToUint8(LClampTaggedToUint8* instr) { |
| 3804 ASSERT(instr->unclamped()->Equals(instr->result())); |
| 3805 Register input_reg = ToRegister(instr->unclamped()); |
| 3806 Register temp_reg = ToRegister(instr->TempAt(0)); |
| 3807 XMMRegister temp_xmm_reg = ToDoubleRegister(instr->TempAt(1)); |
| 3808 Label is_smi, done, heap_number; |
| 3809 |
| 3810 __ JumpIfSmi(input_reg, &is_smi); |
| 3811 |
| 3812 // Check for heap number |
| 3813 __ Cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
| 3814 factory()->heap_number_map()); |
| 3815 __ j(equal, &heap_number, Label::kNear); |
| 3816 |
| 3817 // Check for undefined. Undefined is converted to zero for clamping |
| 3818 // conversions. |
| 3819 __ Cmp(input_reg, factory()->undefined_value()); |
| 3820 DeoptimizeIf(not_equal, instr->environment()); |
| 3821 __ movq(input_reg, Immediate(0)); |
| 3822 __ jmp(&done, Label::kNear); |
| 3823 |
| 3824 // Heap number |
| 3825 __ bind(&heap_number); |
| 3826 __ movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); |
| 3827 __ ClampDoubleToUint8(xmm0, temp_xmm_reg, input_reg, temp_reg); |
| 3828 __ jmp(&done, Label::kNear); |
| 3829 |
| 3830 // smi |
| 3831 __ bind(&is_smi); |
| 3832 __ SmiToInteger32(input_reg, input_reg); |
| 3833 __ ClampUint8(input_reg); |
| 3834 |
| 3835 __ bind(&done); |
| 3836 } |
| 3837 |
| 3838 |
3788 void LCodeGen::LoadHeapObject(Register result, Handle<HeapObject> object) { | 3839 void LCodeGen::LoadHeapObject(Register result, Handle<HeapObject> object) { |
3789 if (heap()->InNewSpace(*object)) { | 3840 if (heap()->InNewSpace(*object)) { |
3790 Handle<JSGlobalPropertyCell> cell = | 3841 Handle<JSGlobalPropertyCell> cell = |
3791 factory()->NewJSGlobalPropertyCell(object); | 3842 factory()->NewJSGlobalPropertyCell(object); |
3792 __ movq(result, cell, RelocInfo::GLOBAL_PROPERTY_CELL); | 3843 __ movq(result, cell, RelocInfo::GLOBAL_PROPERTY_CELL); |
3793 __ movq(result, Operand(result, 0)); | 3844 __ movq(result, Operand(result, 0)); |
3794 } else { | 3845 } else { |
3795 __ Move(result, object); | 3846 __ Move(result, object); |
3796 } | 3847 } |
3797 } | 3848 } |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4195 RegisterEnvironmentForDeoptimization(environment); | 4246 RegisterEnvironmentForDeoptimization(environment); |
4196 ASSERT(osr_pc_offset_ == -1); | 4247 ASSERT(osr_pc_offset_ == -1); |
4197 osr_pc_offset_ = masm()->pc_offset(); | 4248 osr_pc_offset_ = masm()->pc_offset(); |
4198 } | 4249 } |
4199 | 4250 |
4200 #undef __ | 4251 #undef __ |
4201 | 4252 |
4202 } } // namespace v8::internal | 4253 } } // namespace v8::internal |
4203 | 4254 |
4204 #endif // V8_TARGET_ARCH_X64 | 4255 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |