OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 2179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2190 // conversions. | 2190 // conversions. |
2191 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 2191 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
2192 __ cmp(input_reg, Operand(ip)); | 2192 __ cmp(input_reg, Operand(ip)); |
2193 DeoptimizeIf(ne, instr->environment()); | 2193 DeoptimizeIf(ne, instr->environment()); |
2194 __ mov(input_reg, Operand(0)); | 2194 __ mov(input_reg, Operand(0)); |
2195 __ b(&done); | 2195 __ b(&done); |
2196 | 2196 |
2197 __ bind(&heap_number); | 2197 __ bind(&heap_number); |
2198 __ sub(ip, input_reg, Operand(kHeapObjectTag)); | 2198 __ sub(ip, input_reg, Operand(kHeapObjectTag)); |
2199 __ vldr(dbl_tmp, ip, HeapNumber::kValueOffset); | 2199 __ vldr(dbl_tmp, ip, HeapNumber::kValueOffset); |
2200 __ vcmp(dbl_tmp, 0.0); // Sets overflow bit if NaN. | 2200 __ vcmp(dbl_tmp, 0.0); // Sets overflow bit in FPSCR flags if NaN. |
2201 __ vcvt_s32_f64(flt_scratch, dbl_tmp); | 2201 __ vcvt_s32_f64(flt_scratch, dbl_tmp); |
2202 __ vmov(input_reg, flt_scratch); // 32-bit result of conversion. | 2202 __ vmov(input_reg, flt_scratch); // 32-bit result of conversion. |
2203 __ vmrs(pc); // Move vector status bits to normal status bits. | 2203 __ vmrs(pc); // Move vector status bits to normal status bits. |
2204 // Overflow bit is set if dbl_tmp is Nan. | 2204 // Overflow bit is set if dbl_tmp is Nan. |
2205 __ cmn(input_reg, Operand(1), vc); // 0x7fffffff + 1 -> overflow. | 2205 __ cmn(input_reg, Operand(1), vc); // 0x7fffffff + 1 -> overflow. |
2206 __ cmp(input_reg, Operand(1), vc); // 0x80000000 - 1 -> overflow. | 2206 __ cmp(input_reg, Operand(1), vc); // 0x80000000 - 1 -> overflow. |
2207 DeoptimizeIf(vs, instr->environment()); // Saturation may have occured. | 2207 DeoptimizeIf(vs, instr->environment()); // Saturation may have occured. |
2208 | 2208 |
2209 } else { | 2209 } else { |
2210 // Deoptimize if we don't have a heap number. | 2210 // Deoptimize if we don't have a heap number. |
2211 DeoptimizeIf(ne, instr->environment()); | 2211 DeoptimizeIf(ne, instr->environment()); |
2212 | 2212 |
2213 __ sub(ip, input_reg, Operand(kHeapObjectTag)); | 2213 __ sub(ip, input_reg, Operand(kHeapObjectTag)); |
2214 __ vldr(dbl_tmp, ip, HeapNumber::kValueOffset); | 2214 __ vldr(dbl_tmp, ip, HeapNumber::kValueOffset); |
2215 __ vcvt_s32_f64(flt_scratch, dbl_tmp); | 2215 __ vcvt_s32_f64(flt_scratch, dbl_tmp); |
2216 __ vmov(input_reg, flt_scratch); // 32-bit result of conversion. | 2216 __ vmov(input_reg, flt_scratch); // 32-bit result of conversion. |
2217 // Non-truncating conversion means that we cannot lose bits, so we convert | 2217 // Non-truncating conversion means that we cannot lose bits, so we convert |
2218 // back to check; note that using non-overlapping s and d regs would be | 2218 // back to check; note that using non-overlapping s and d regs would be |
2219 // slightly faster. | 2219 // slightly faster. |
2220 __ vcvt_f64_s32(dbl_scratch, flt_scratch); | 2220 __ vcvt_f64_s32(dbl_scratch, flt_scratch); |
2221 __ vcmp(dbl_scratch, dbl_tmp); | 2221 __ VFPCompareAndSetFlags(dbl_scratch, dbl_tmp); |
2222 __ vmrs(pc); // Move vector status bits to normal status bits. | |
2223 DeoptimizeIf(ne, instr->environment()); // Not equal or unordered. | 2222 DeoptimizeIf(ne, instr->environment()); // Not equal or unordered. |
2224 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 2223 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
2225 __ tst(input_reg, Operand(input_reg)); | 2224 __ tst(input_reg, Operand(input_reg)); |
2226 __ b(ne, &done); | 2225 __ b(ne, &done); |
2227 __ vmov(lr, ip, dbl_tmp); | 2226 __ vmov(lr, ip, dbl_tmp); |
2228 __ tst(ip, Operand(1 << 31)); // Test sign bit. | 2227 __ tst(ip, Operand(1 << 31)); // Test sign bit. |
2229 DeoptimizeIf(ne, instr->environment()); | 2228 DeoptimizeIf(ne, instr->environment()); |
2230 } | 2229 } |
2231 } | 2230 } |
2232 __ bind(&done); | 2231 __ bind(&done); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2641 | 2640 |
2642 | 2641 |
2643 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 2642 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
2644 Abort("DoOsrEntry unimplemented."); | 2643 Abort("DoOsrEntry unimplemented."); |
2645 } | 2644 } |
2646 | 2645 |
2647 | 2646 |
2648 #undef __ | 2647 #undef __ |
2649 | 2648 |
2650 } } // namespace v8::internal | 2649 } } // namespace v8::internal |
OLD | NEW |