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 2488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2499 // Nothing can go wrong now, so move the heap number to v0, which is the | 2499 // Nothing can go wrong now, so move the heap number to v0, which is the |
2500 // result. | 2500 // result. |
2501 __ mov(v0, t1); | 2501 __ mov(v0, t1); |
2502 | 2502 |
2503 if (CpuFeatures::IsSupported(FPU)) { | 2503 if (CpuFeatures::IsSupported(FPU)) { |
2504 // Convert the int32 in a2 to the heap number in a0. As | 2504 // Convert the int32 in a2 to the heap number in a0. As |
2505 // mentioned above SHR needs to always produce a positive result. | 2505 // mentioned above SHR needs to always produce a positive result. |
2506 CpuFeatures::Scope scope(FPU); | 2506 CpuFeatures::Scope scope(FPU); |
2507 __ mtc1(a2, f0); | 2507 __ mtc1(a2, f0); |
2508 if (op_ == Token::SHR) { | 2508 if (op_ == Token::SHR) { |
2509 __ Cvt_d_uw(f0, f0); | 2509 __ Cvt_d_uw(f0, f0, f22); |
2510 } else { | 2510 } else { |
2511 __ cvt_d_w(f0, f0); | 2511 __ cvt_d_w(f0, f0); |
2512 } | 2512 } |
2513 // ARM uses a workaround here because of the unaligned HeapNumber | 2513 // ARM uses a workaround here because of the unaligned HeapNumber |
2514 // kValueOffset. On MIPS this workaround is built into sdc1 so | 2514 // kValueOffset. On MIPS this workaround is built into sdc1 so |
2515 // there's no point in generating even more instructions. | 2515 // there's no point in generating even more instructions. |
2516 __ sdc1(f0, FieldMemOperand(v0, HeapNumber::kValueOffset)); | 2516 __ sdc1(f0, FieldMemOperand(v0, HeapNumber::kValueOffset)); |
2517 __ Ret(); | 2517 __ Ret(); |
2518 } else { | 2518 } else { |
2519 // Tail call that writes the int32 in a2 to the heap number in v0, using | 2519 // Tail call that writes the int32 in a2 to the heap number in v0, using |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2913 if (CpuFeatures::IsSupported(FPU)) { | 2913 if (CpuFeatures::IsSupported(FPU)) { |
2914 CpuFeatures::Scope scope(FPU); | 2914 CpuFeatures::Scope scope(FPU); |
2915 | 2915 |
2916 if (op_ != Token::SHR) { | 2916 if (op_ != Token::SHR) { |
2917 // Convert the result to a floating point value. | 2917 // Convert the result to a floating point value. |
2918 __ mtc1(a2, double_scratch); | 2918 __ mtc1(a2, double_scratch); |
2919 __ cvt_d_w(double_scratch, double_scratch); | 2919 __ cvt_d_w(double_scratch, double_scratch); |
2920 } else { | 2920 } else { |
2921 // The result must be interpreted as an unsigned 32-bit integer. | 2921 // The result must be interpreted as an unsigned 32-bit integer. |
2922 __ mtc1(a2, double_scratch); | 2922 __ mtc1(a2, double_scratch); |
2923 __ Cvt_d_uw(double_scratch, double_scratch); | 2923 __ Cvt_d_uw(double_scratch, double_scratch, single_scratch); |
2924 } | 2924 } |
2925 | 2925 |
2926 // Store the result. | 2926 // Store the result. |
2927 __ mov(v0, heap_number_result); | 2927 __ mov(v0, heap_number_result); |
2928 __ sdc1(double_scratch, FieldMemOperand(v0, HeapNumber::kValueOffset)); | 2928 __ sdc1(double_scratch, FieldMemOperand(v0, HeapNumber::kValueOffset)); |
2929 __ Ret(); | 2929 __ Ret(); |
2930 } else { | 2930 } else { |
2931 // Tail call that writes the int32 in a2 to the heap number in v0, using | 2931 // Tail call that writes the int32 in a2 to the heap number in v0, using |
2932 // a3 and a1 as scratch. v0 is preserved and returned. | 2932 // a3 and a1 as scratch. v0 is preserved and returned. |
2933 __ mov(a0, t1); | 2933 __ mov(a0, t1); |
(...skipping 3887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6821 __ mov(result, zero_reg); | 6821 __ mov(result, zero_reg); |
6822 __ Ret(); | 6822 __ Ret(); |
6823 } | 6823 } |
6824 | 6824 |
6825 | 6825 |
6826 #undef __ | 6826 #undef __ |
6827 | 6827 |
6828 } } // namespace v8::internal | 6828 } } // namespace v8::internal |
6829 | 6829 |
6830 #endif // V8_TARGET_ARCH_MIPS | 6830 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |