| 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 5723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5734 Register value_reg = ToRegister(instr->result()); | 5734 Register value_reg = ToRegister(instr->result()); |
| 5735 __ ClampUint8(value_reg); | 5735 __ ClampUint8(value_reg); |
| 5736 } | 5736 } |
| 5737 | 5737 |
| 5738 | 5738 |
| 5739 void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) { | 5739 void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) { |
| 5740 CpuFeatureScope scope(masm(), SSE2); | 5740 CpuFeatureScope scope(masm(), SSE2); |
| 5741 | 5741 |
| 5742 ASSERT(instr->unclamped()->Equals(instr->result())); | 5742 ASSERT(instr->unclamped()->Equals(instr->result())); |
| 5743 Register input_reg = ToRegister(instr->unclamped()); | 5743 Register input_reg = ToRegister(instr->unclamped()); |
| 5744 XMMRegister temp_xmm_reg = ToDoubleRegister(instr->temp_xmm()); |
| 5744 XMMRegister xmm_scratch = double_scratch0(); | 5745 XMMRegister xmm_scratch = double_scratch0(); |
| 5745 Label is_smi, done, heap_number; | 5746 Label is_smi, done, heap_number; |
| 5746 | 5747 |
| 5747 __ JumpIfSmi(input_reg, &is_smi); | 5748 __ JumpIfSmi(input_reg, &is_smi); |
| 5748 | 5749 |
| 5749 // Check for heap number | 5750 // Check for heap number |
| 5750 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), | 5751 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
| 5751 factory()->heap_number_map()); | 5752 factory()->heap_number_map()); |
| 5752 __ j(equal, &heap_number, Label::kNear); | 5753 __ j(equal, &heap_number, Label::kNear); |
| 5753 | 5754 |
| 5754 // Check for undefined. Undefined is converted to zero for clamping | 5755 // Check for undefined. Undefined is converted to zero for clamping |
| 5755 // conversions. | 5756 // conversions. |
| 5756 __ cmp(input_reg, factory()->undefined_value()); | 5757 __ cmp(input_reg, factory()->undefined_value()); |
| 5757 DeoptimizeIf(not_equal, instr->environment()); | 5758 DeoptimizeIf(not_equal, instr->environment()); |
| 5758 __ mov(input_reg, 0); | 5759 __ mov(input_reg, 0); |
| 5759 __ jmp(&done, Label::kNear); | 5760 __ jmp(&done, Label::kNear); |
| 5760 | 5761 |
| 5761 // Heap number | 5762 // Heap number |
| 5762 __ bind(&heap_number); | 5763 __ bind(&heap_number); |
| 5763 __ movdbl(xmm_scratch, FieldOperand(input_reg, HeapNumber::kValueOffset)); | 5764 __ movdbl(xmm_scratch, FieldOperand(input_reg, HeapNumber::kValueOffset)); |
| 5764 __ ClampDoubleToUint8(xmm_scratch, xmm1, input_reg); | 5765 __ ClampDoubleToUint8(xmm_scratch, temp_xmm_reg, input_reg); |
| 5765 __ jmp(&done, Label::kNear); | 5766 __ jmp(&done, Label::kNear); |
| 5766 | 5767 |
| 5767 // smi | 5768 // smi |
| 5768 __ bind(&is_smi); | 5769 __ bind(&is_smi); |
| 5769 __ SmiUntag(input_reg); | 5770 __ SmiUntag(input_reg); |
| 5770 __ ClampUint8(input_reg); | 5771 __ ClampUint8(input_reg); |
| 5771 __ bind(&done); | 5772 __ bind(&done); |
| 5772 } | 5773 } |
| 5773 | 5774 |
| 5774 | 5775 |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6403 FixedArray::kHeaderSize - kPointerSize)); | 6404 FixedArray::kHeaderSize - kPointerSize)); |
| 6404 __ bind(&done); | 6405 __ bind(&done); |
| 6405 } | 6406 } |
| 6406 | 6407 |
| 6407 | 6408 |
| 6408 #undef __ | 6409 #undef __ |
| 6409 | 6410 |
| 6410 } } // namespace v8::internal | 6411 } } // namespace v8::internal |
| 6411 | 6412 |
| 6412 #endif // V8_TARGET_ARCH_IA32 | 6413 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |