Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 6519051: ARM: Implement DoMathRound in the lithium code generator. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2836 matching lines...) Expand 10 before | Expand all | Expand 10 after
2847 Label done; 2847 Label done;
2848 __ cmp(result, Operand(0)); 2848 __ cmp(result, Operand(0));
2849 __ b(ne, &done); 2849 __ b(ne, &done);
2850 __ vmov(scratch1, input.high()); 2850 __ vmov(scratch1, input.high());
2851 __ tst(scratch1, Operand(HeapNumber::kSignMask)); 2851 __ tst(scratch1, Operand(HeapNumber::kSignMask));
2852 DeoptimizeIf(ne, instr->environment()); 2852 DeoptimizeIf(ne, instr->environment());
2853 __ bind(&done); 2853 __ bind(&done);
2854 } 2854 }
2855 2855
2856 2856
2857 void LCodeGen::DoMathRound(LUnaryMathOperation* instr) {
2858 DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
2859 Register result = ToRegister(instr->result());
2860 Register scratch1 = scratch0();
2861 Register scratch2 = result;
2862 EmitVFPTruncate(kRoundToNearest,
2863 double_scratch0().low(),
2864 input,
2865 scratch1,
2866 scratch2);
2867 DeoptimizeIf(ne, instr->environment());
2868 __ vmov(result, double_scratch0().low());
2869
2870 // Test for -0.
2871 Label done;
2872 __ cmp(result, Operand(0));
2873 __ b(ne, &done);
2874 __ vmov(scratch1, input.high());
2875 __ tst(scratch1, Operand(HeapNumber::kSignMask));
2876 DeoptimizeIf(ne, instr->environment());
2877 __ bind(&done);
2878 }
2879
2880
2857 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { 2881 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) {
2858 DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); 2882 DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
2859 ASSERT(ToDoubleRegister(instr->result()).is(input)); 2883 ASSERT(ToDoubleRegister(instr->result()).is(input));
2860 __ vsqrt(input, input); 2884 __ vsqrt(input, input);
2861 } 2885 }
2862 2886
2863 2887
2864 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) { 2888 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) {
2865 switch (instr->op()) { 2889 switch (instr->op()) {
2866 case kMathAbs: 2890 case kMathAbs:
2867 DoMathAbs(instr); 2891 DoMathAbs(instr);
2868 break; 2892 break;
2869 case kMathFloor: 2893 case kMathFloor:
2870 DoMathFloor(instr); 2894 DoMathFloor(instr);
2871 break; 2895 break;
2896 case kMathRound:
2897 DoMathRound(instr);
2898 break;
2872 case kMathSqrt: 2899 case kMathSqrt:
2873 DoMathSqrt(instr); 2900 DoMathSqrt(instr);
2874 break; 2901 break;
2875 default: 2902 default:
2876 Abort("Unimplemented type of LUnaryMathOperation."); 2903 Abort("Unimplemented type of LUnaryMathOperation.");
2877 UNREACHABLE(); 2904 UNREACHABLE();
2878 } 2905 }
2879 } 2906 }
2880 2907
2881 2908
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
3967 ASSERT(!environment->HasBeenRegistered()); 3994 ASSERT(!environment->HasBeenRegistered());
3968 RegisterEnvironmentForDeoptimization(environment); 3995 RegisterEnvironmentForDeoptimization(environment);
3969 ASSERT(osr_pc_offset_ == -1); 3996 ASSERT(osr_pc_offset_ == -1);
3970 osr_pc_offset_ = masm()->pc_offset(); 3997 osr_pc_offset_ = masm()->pc_offset();
3971 } 3998 }
3972 3999
3973 4000
3974 #undef __ 4001 #undef __
3975 4002
3976 } } // namespace v8::internal 4003 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698