| 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 3121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3132 | 3132 |
| 3133 CompareMap(obj, map); | 3133 CompareMap(obj, map); |
| 3134 j(not_equal, fail); | 3134 j(not_equal, fail); |
| 3135 } | 3135 } |
| 3136 | 3136 |
| 3137 | 3137 |
| 3138 void MacroAssembler::ClampUint8(Register reg) { | 3138 void MacroAssembler::ClampUint8(Register reg) { |
| 3139 Label done; | 3139 Label done; |
| 3140 testl(reg, Immediate(0xFFFFFF00)); | 3140 testl(reg, Immediate(0xFFFFFF00)); |
| 3141 j(zero, &done, Label::kNear); | 3141 j(zero, &done, Label::kNear); |
| 3142 setcc(negative, reg); // 1 if negative, 0 if positive. | 3142 sarl(reg, Immediate(31)); |
| 3143 decb(reg); // 0 if negative, 255 if positive. | 3143 notl(reg); // No zero extension seems to be safe here. |
| 3144 bind(&done); | 3144 bind(&done); |
| 3145 } | 3145 } |
| 3146 | 3146 |
| 3147 | 3147 |
| 3148 void MacroAssembler::ClampDoubleToUint8(XMMRegister input_reg, | 3148 void MacroAssembler::ClampDoubleToUint8(XMMRegister input_reg, |
| 3149 XMMRegister temp_xmm_reg, | 3149 XMMRegister temp_xmm_reg, |
| 3150 Register result_reg) { | 3150 Register result_reg) { |
| 3151 Label done; | 3151 Label done; |
| 3152 Label conv_failure; | 3152 Label conv_failure; |
| 3153 xorps(temp_xmm_reg, temp_xmm_reg); | 3153 xorps(temp_xmm_reg, temp_xmm_reg); |
| 3154 cvtsd2si(result_reg, input_reg); | 3154 cvtsd2si(result_reg, input_reg); |
| 3155 testl(result_reg, Immediate(0xFFFFFF00)); | 3155 testl(result_reg, Immediate(0xFFFFFF00)); |
| 3156 j(zero, &done, Label::kNear); | 3156 j(zero, &done, Label::kNear); |
| 3157 cmpl(result_reg, Immediate(1)); | 3157 cmpl(result_reg, Immediate(1)); |
| 3158 j(overflow, &conv_failure, Label::kNear); | 3158 j(overflow, &conv_failure, Label::kNear); |
| 3159 movl(result_reg, Immediate(0)); | 3159 sarl(result_reg, Immediate(31)); |
| 3160 setcc(sign, result_reg); | 3160 notl(result_reg); // No zero extension seems to be safe here. |
| 3161 subl(result_reg, Immediate(1)); | |
| 3162 andl(result_reg, Immediate(255)); | |
| 3163 jmp(&done, Label::kNear); | 3161 jmp(&done, Label::kNear); |
| 3164 bind(&conv_failure); | 3162 bind(&conv_failure); |
| 3163 sarl(result_reg, Immediate(31)); |
| 3164 ucomisd(input_reg, temp_xmm_reg); |
| 3165 j(above_equal, &done, Label::kNear); |
| 3165 Set(result_reg, 0); | 3166 Set(result_reg, 0); |
| 3166 ucomisd(input_reg, temp_xmm_reg); | |
| 3167 j(below, &done, Label::kNear); | |
| 3168 Set(result_reg, 255); | |
| 3169 bind(&done); | 3167 bind(&done); |
| 3170 } | 3168 } |
| 3171 | 3169 |
| 3172 | 3170 |
| 3173 void MacroAssembler::LoadUint32(XMMRegister dst, | 3171 void MacroAssembler::LoadUint32(XMMRegister dst, |
| 3174 Register src, | 3172 Register src, |
| 3175 XMMRegister scratch) { | 3173 XMMRegister scratch) { |
| 3176 if (FLAG_debug_code) { | 3174 if (FLAG_debug_code) { |
| 3177 cmpq(src, Immediate(0xffffffff)); | 3175 cmpq(src, Immediate(0xffffffff)); |
| 3178 Assert(below_equal, kInputGPRIsExpectedToHaveUpper32Cleared); | 3176 Assert(below_equal, kInputGPRIsExpectedToHaveUpper32Cleared); |
| (...skipping 1902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5081 if (ms.shift() > 0) sarl(rdx, Immediate(ms.shift())); | 5079 if (ms.shift() > 0) sarl(rdx, Immediate(ms.shift())); |
| 5082 movl(rax, dividend); | 5080 movl(rax, dividend); |
| 5083 shrl(rax, Immediate(31)); | 5081 shrl(rax, Immediate(31)); |
| 5084 addl(rdx, rax); | 5082 addl(rdx, rax); |
| 5085 } | 5083 } |
| 5086 | 5084 |
| 5087 | 5085 |
| 5088 } } // namespace v8::internal | 5086 } } // namespace v8::internal |
| 5089 | 5087 |
| 5090 #endif // V8_TARGET_ARCH_X64 | 5088 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |