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 5714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5725 Register value_reg = ToRegister(instr->result()); | 5725 Register value_reg = ToRegister(instr->result()); |
5726 __ ClampUint8(value_reg); | 5726 __ ClampUint8(value_reg); |
5727 } | 5727 } |
5728 | 5728 |
5729 | 5729 |
5730 void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) { | 5730 void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) { |
5731 CpuFeatureScope scope(masm(), SSE2); | 5731 CpuFeatureScope scope(masm(), SSE2); |
5732 | 5732 |
5733 ASSERT(instr->unclamped()->Equals(instr->result())); | 5733 ASSERT(instr->unclamped()->Equals(instr->result())); |
5734 Register input_reg = ToRegister(instr->unclamped()); | 5734 Register input_reg = ToRegister(instr->unclamped()); |
| 5735 XMMRegister temp_xmm_reg = ToDoubleRegister(instr->temp_xmm()); |
5735 XMMRegister xmm_scratch = double_scratch0(); | 5736 XMMRegister xmm_scratch = double_scratch0(); |
5736 Label is_smi, done, heap_number; | 5737 Label is_smi, done, heap_number; |
5737 | 5738 |
5738 __ JumpIfSmi(input_reg, &is_smi); | 5739 __ JumpIfSmi(input_reg, &is_smi); |
5739 | 5740 |
5740 // Check for heap number | 5741 // Check for heap number |
5741 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), | 5742 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
5742 factory()->heap_number_map()); | 5743 factory()->heap_number_map()); |
5743 __ j(equal, &heap_number, Label::kNear); | 5744 __ j(equal, &heap_number, Label::kNear); |
5744 | 5745 |
5745 // Check for undefined. Undefined is converted to zero for clamping | 5746 // Check for undefined. Undefined is converted to zero for clamping |
5746 // conversions. | 5747 // conversions. |
5747 __ cmp(input_reg, factory()->undefined_value()); | 5748 __ cmp(input_reg, factory()->undefined_value()); |
5748 DeoptimizeIf(not_equal, instr->environment()); | 5749 DeoptimizeIf(not_equal, instr->environment()); |
5749 __ mov(input_reg, 0); | 5750 __ mov(input_reg, 0); |
5750 __ jmp(&done, Label::kNear); | 5751 __ jmp(&done, Label::kNear); |
5751 | 5752 |
5752 // Heap number | 5753 // Heap number |
5753 __ bind(&heap_number); | 5754 __ bind(&heap_number); |
5754 __ movdbl(xmm_scratch, FieldOperand(input_reg, HeapNumber::kValueOffset)); | 5755 __ movdbl(xmm_scratch, FieldOperand(input_reg, HeapNumber::kValueOffset)); |
5755 __ ClampDoubleToUint8(xmm_scratch, xmm1, input_reg); | 5756 __ ClampDoubleToUint8(xmm_scratch, temp_xmm_reg, input_reg); |
5756 __ jmp(&done, Label::kNear); | 5757 __ jmp(&done, Label::kNear); |
5757 | 5758 |
5758 // smi | 5759 // smi |
5759 __ bind(&is_smi); | 5760 __ bind(&is_smi); |
5760 __ SmiUntag(input_reg); | 5761 __ SmiUntag(input_reg); |
5761 __ ClampUint8(input_reg); | 5762 __ ClampUint8(input_reg); |
5762 __ bind(&done); | 5763 __ bind(&done); |
5763 } | 5764 } |
5764 | 5765 |
5765 | 5766 |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6394 FixedArray::kHeaderSize - kPointerSize)); | 6395 FixedArray::kHeaderSize - kPointerSize)); |
6395 __ bind(&done); | 6396 __ bind(&done); |
6396 } | 6397 } |
6397 | 6398 |
6398 | 6399 |
6399 #undef __ | 6400 #undef __ |
6400 | 6401 |
6401 } } // namespace v8::internal | 6402 } } // namespace v8::internal |
6402 | 6403 |
6403 #endif // V8_TARGET_ARCH_IA32 | 6404 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |