Chromium Code Reviews| 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 3167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3178 if (array_type == kExternalFloatArray) { | 3178 if (array_type == kExternalFloatArray) { |
| 3179 XMMRegister value(ToDoubleRegister(instr->value())); | 3179 XMMRegister value(ToDoubleRegister(instr->value())); |
| 3180 __ cvtsd2ss(value, value); | 3180 __ cvtsd2ss(value, value); |
| 3181 __ movss(operand, value); | 3181 __ movss(operand, value); |
| 3182 } else if (array_type == kExternalDoubleArray) { | 3182 } else if (array_type == kExternalDoubleArray) { |
| 3183 __ movsd(operand, ToDoubleRegister(instr->value())); | 3183 __ movsd(operand, ToDoubleRegister(instr->value())); |
| 3184 } else { | 3184 } else { |
| 3185 Register value(ToRegister(instr->value())); | 3185 Register value(ToRegister(instr->value())); |
| 3186 switch (array_type) { | 3186 switch (array_type) { |
| 3187 case kExternalPixelArray: | 3187 case kExternalPixelArray: |
| 3188 { // Clamp the value to [0..255]. | 3188 { // Clamp the value to [0..255]. |
|
Kevin Millikin (Chromium)
2011/05/16 07:06:35
Can we remove this clamping?
danno
2011/05/16 14:13:43
Done.
| |
| 3189 Label done; | 3189 Label done; |
| 3190 __ testl(value, Immediate(0xFFFFFF00)); | 3190 __ testl(value, Immediate(0xFFFFFF00)); |
| 3191 __ j(zero, &done, Label::kNear); | 3191 __ j(zero, &done, Label::kNear); |
| 3192 __ setcc(negative, value); // 1 if negative, 0 if positive. | 3192 __ setcc(negative, value); // 1 if negative, 0 if positive. |
| 3193 __ decb(value); // 0 if negative, 255 if positive. | 3193 __ decb(value); // 0 if negative, 255 if positive. |
| 3194 __ bind(&done); | 3194 __ bind(&done); |
| 3195 __ movb(operand, value); | 3195 __ movb(operand, value); |
| 3196 } | 3196 } |
| 3197 break; | 3197 break; |
| 3198 case kExternalByteArray: | 3198 case kExternalByteArray: |
| (...skipping 579 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 |