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 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1973 Abort("DoDeferredMathAbsTaggedHeapNumber unimplemented."); | 1973 Abort("DoDeferredMathAbsTaggedHeapNumber unimplemented."); |
1974 } | 1974 } |
1975 | 1975 |
1976 | 1976 |
1977 void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) { | 1977 void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) { |
1978 Abort("DoMathAbs unimplemented."); | 1978 Abort("DoMathAbs unimplemented."); |
1979 } | 1979 } |
1980 | 1980 |
1981 | 1981 |
1982 void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) { | 1982 void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) { |
1983 Abort("DoMathFloor unimplemented."); | 1983 DoubleRegister input = ToDoubleRegister(instr->input()); |
| 1984 Register result = ToRegister(instr->result()); |
| 1985 Register prev_fpscr = ToRegister(instr->temp()); |
| 1986 SwVfpRegister single_scratch = single_scratch0(); |
| 1987 Register scratch = scratch0(); |
| 1988 |
| 1989 // Set custom FPCSR: |
| 1990 // - Set rounding mode to "Round towards Minus Infinity". |
| 1991 // - Clear vfp cumulative exception flags. |
| 1992 // - Make sure Flush-to-zero mode control bit is unset. |
| 1993 __ vmrs(prev_fpscr); |
| 1994 __ bic(scratch, prev_fpscr, |
| 1995 Operand(kVFPExceptionMask | kVFPRoundingModeMask | kVFPFlushToZeroMask)); |
| 1996 __ orr(scratch, scratch, Operand(kVFPRoundToMinusInfinityBits)); |
| 1997 __ vmsr(scratch); |
| 1998 |
| 1999 // Convert the argument to an integer. |
| 2000 __ vcvt_s32_f64(single_scratch, |
| 2001 input, |
| 2002 Assembler::FPSCRRounding, |
| 2003 al); |
| 2004 |
| 2005 // Retrieve FPSCR and check for vfp exceptions. |
| 2006 __ vmrs(scratch); |
| 2007 // Restore FPSCR |
| 2008 __ vmsr(prev_fpscr); |
| 2009 __ tst(scratch, Operand(kVFPExceptionMask)); |
| 2010 DeoptimizeIf(ne, instr->environment()); |
| 2011 |
| 2012 // Move the result back to general purpose register r0. |
| 2013 __ vmov(result, single_scratch); |
1984 } | 2014 } |
1985 | 2015 |
1986 | 2016 |
1987 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { | 2017 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { |
1988 Abort("DoMathSqrt unimplemented."); | 2018 DoubleRegister input = ToDoubleRegister(instr->input()); |
| 2019 ASSERT(ToDoubleRegister(instr->result()).is(input)); |
| 2020 __ vsqrt(input, input); |
1989 } | 2021 } |
1990 | 2022 |
1991 | 2023 |
1992 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) { | 2024 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) { |
1993 switch (instr->op()) { | 2025 switch (instr->op()) { |
1994 case kMathAbs: | 2026 case kMathAbs: |
1995 DoMathAbs(instr); | 2027 DoMathAbs(instr); |
1996 break; | 2028 break; |
1997 case kMathFloor: | 2029 case kMathFloor: |
1998 DoMathFloor(instr); | 2030 DoMathFloor(instr); |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2830 | 2862 |
2831 | 2863 |
2832 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 2864 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
2833 Abort("DoOsrEntry unimplemented."); | 2865 Abort("DoOsrEntry unimplemented."); |
2834 } | 2866 } |
2835 | 2867 |
2836 | 2868 |
2837 #undef __ | 2869 #undef __ |
2838 | 2870 |
2839 } } // namespace v8::internal | 2871 } } // namespace v8::internal |
OLD | NEW |