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

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

Issue 91113003: [v8-dev] ARM: Optimize fixed double arguments (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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-arm.cc ('k') | src/arm/macro-assembler-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2157 case Token::SUB: 2157 case Token::SUB:
2158 __ vsub(result, left, right); 2158 __ vsub(result, left, right);
2159 break; 2159 break;
2160 case Token::MUL: 2160 case Token::MUL:
2161 __ vmul(result, left, right); 2161 __ vmul(result, left, right);
2162 break; 2162 break;
2163 case Token::DIV: 2163 case Token::DIV:
2164 __ vdiv(result, left, right); 2164 __ vdiv(result, left, right);
2165 break; 2165 break;
2166 case Token::MOD: { 2166 case Token::MOD: {
2167 // Save r0-r3 on the stack.
2168 __ stm(db_w, sp, r0.bit() | r1.bit() | r2.bit() | r3.bit());
2169
2170 __ PrepareCallCFunction(0, 2, scratch0()); 2167 __ PrepareCallCFunction(0, 2, scratch0());
2171 __ SetCallCDoubleArguments(left, right); 2168 __ SetCallCDoubleArguments(left, right);
2172 __ CallCFunction( 2169 __ CallCFunction(
2173 ExternalReference::double_fp_operation(Token::MOD, isolate()), 2170 ExternalReference::double_fp_operation(Token::MOD, isolate()),
2174 0, 2); 2171 0, 2);
2175 // Move the result in the double result register. 2172 // Move the result in the double result register.
2176 __ GetCFunctionDoubleResult(result); 2173 __ GetCFunctionDoubleResult(result);
2177
2178 // Restore r0-r3.
2179 __ ldm(ia_w, sp, r0.bit() | r1.bit() | r2.bit() | r3.bit());
2180 break; 2174 break;
2181 } 2175 }
2182 default: 2176 default:
2183 UNREACHABLE(); 2177 UNREACHABLE();
2184 break; 2178 break;
2185 } 2179 }
2186 } 2180 }
2187 2181
2188 2182
2189 void LCodeGen::DoArithmeticT(LArithmeticT* instr) { 2183 void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after
3896 void LCodeGen::DoMathSqrt(LMathSqrt* instr) { 3890 void LCodeGen::DoMathSqrt(LMathSqrt* instr) {
3897 DwVfpRegister input = ToDoubleRegister(instr->value()); 3891 DwVfpRegister input = ToDoubleRegister(instr->value());
3898 DwVfpRegister result = ToDoubleRegister(instr->result()); 3892 DwVfpRegister result = ToDoubleRegister(instr->result());
3899 __ vsqrt(result, input); 3893 __ vsqrt(result, input);
3900 } 3894 }
3901 3895
3902 3896
3903 void LCodeGen::DoMathPowHalf(LMathPowHalf* instr) { 3897 void LCodeGen::DoMathPowHalf(LMathPowHalf* instr) {
3904 DwVfpRegister input = ToDoubleRegister(instr->value()); 3898 DwVfpRegister input = ToDoubleRegister(instr->value());
3905 DwVfpRegister result = ToDoubleRegister(instr->result()); 3899 DwVfpRegister result = ToDoubleRegister(instr->result());
3906 DwVfpRegister temp = ToDoubleRegister(instr->temp()); 3900 DwVfpRegister temp = double_scratch0();
3907 3901
3908 // Note that according to ECMA-262 15.8.2.13: 3902 // Note that according to ECMA-262 15.8.2.13:
3909 // Math.pow(-Infinity, 0.5) == Infinity 3903 // Math.pow(-Infinity, 0.5) == Infinity
3910 // Math.sqrt(-Infinity) == NaN 3904 // Math.sqrt(-Infinity) == NaN
3911 Label done; 3905 Label done;
3912 __ vmov(temp, -V8_INFINITY, scratch0()); 3906 __ vmov(temp, -V8_INFINITY, scratch0());
3913 __ VFPCompareAndSetFlags(input, temp); 3907 __ VFPCompareAndSetFlags(input, temp);
3914 __ vneg(result, temp, eq); 3908 __ vneg(result, temp, eq);
3915 __ b(&done, eq); 3909 __ b(&done, eq);
3916 3910
3917 // Add +0 to convert -0 to +0. 3911 // Add +0 to convert -0 to +0.
3918 __ vadd(result, input, kDoubleRegZero); 3912 __ vadd(result, input, kDoubleRegZero);
3919 __ vsqrt(result, result); 3913 __ vsqrt(result, result);
3920 __ bind(&done); 3914 __ bind(&done);
3921 } 3915 }
3922 3916
3923 3917
3924 void LCodeGen::DoPower(LPower* instr) { 3918 void LCodeGen::DoPower(LPower* instr) {
3925 Representation exponent_type = instr->hydrogen()->right()->representation(); 3919 Representation exponent_type = instr->hydrogen()->right()->representation();
3926 // Having marked this as a call, we can use any registers. 3920 // Having marked this as a call, we can use any registers.
3927 // Just make sure that the input/output registers are the expected ones. 3921 // Just make sure that the input/output registers are the expected ones.
3928 ASSERT(!instr->right()->IsDoubleRegister() || 3922 ASSERT(!instr->right()->IsDoubleRegister() ||
3929 ToDoubleRegister(instr->right()).is(d2)); 3923 ToDoubleRegister(instr->right()).is(d1));
3930 ASSERT(!instr->right()->IsRegister() || 3924 ASSERT(!instr->right()->IsRegister() ||
3931 ToRegister(instr->right()).is(r2)); 3925 ToRegister(instr->right()).is(r2));
3932 ASSERT(ToDoubleRegister(instr->left()).is(d1)); 3926 ASSERT(ToDoubleRegister(instr->left()).is(d0));
3933 ASSERT(ToDoubleRegister(instr->result()).is(d3)); 3927 ASSERT(ToDoubleRegister(instr->result()).is(d2));
3934 3928
3935 if (exponent_type.IsSmi()) { 3929 if (exponent_type.IsSmi()) {
3936 MathPowStub stub(MathPowStub::TAGGED); 3930 MathPowStub stub(MathPowStub::TAGGED);
3937 __ CallStub(&stub); 3931 __ CallStub(&stub);
3938 } else if (exponent_type.IsTagged()) { 3932 } else if (exponent_type.IsTagged()) {
3939 Label no_deopt; 3933 Label no_deopt;
3940 __ JumpIfSmi(r2, &no_deopt); 3934 __ JumpIfSmi(r2, &no_deopt);
3941 __ ldr(r6, FieldMemOperand(r2, HeapObject::kMapOffset)); 3935 __ ldr(r6, FieldMemOperand(r2, HeapObject::kMapOffset));
3942 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); 3936 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
3943 __ cmp(r6, Operand(ip)); 3937 __ cmp(r6, Operand(ip));
(...skipping 1938 matching lines...) Expand 10 before | Expand all | Expand 10 after
5882 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5876 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5883 __ ldr(result, FieldMemOperand(scratch, 5877 __ ldr(result, FieldMemOperand(scratch,
5884 FixedArray::kHeaderSize - kPointerSize)); 5878 FixedArray::kHeaderSize - kPointerSize));
5885 __ bind(&done); 5879 __ bind(&done);
5886 } 5880 }
5887 5881
5888 5882
5889 #undef __ 5883 #undef __
5890 5884
5891 } } // namespace v8::internal 5885 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/arm/macro-assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698