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

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

Issue 8840008: Port Math.pow inlining to ARM. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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') | 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 3104 matching lines...) Expand 10 before | Expand all | Expand 10 after
3115 __ b(&done, eq); 3115 __ b(&done, eq);
3116 3116
3117 // Add +0 to convert -0 to +0. 3117 // Add +0 to convert -0 to +0.
3118 __ vadd(result, input, kDoubleRegZero); 3118 __ vadd(result, input, kDoubleRegZero);
3119 __ vsqrt(result, result); 3119 __ vsqrt(result, result);
3120 __ bind(&done); 3120 __ bind(&done);
3121 } 3121 }
3122 3122
3123 3123
3124 void LCodeGen::DoPower(LPower* instr) { 3124 void LCodeGen::DoPower(LPower* instr) {
3125 LOperand* left = instr->InputAt(0);
3126 LOperand* right = instr->InputAt(1);
3127 Register scratch = scratch0();
3128 DoubleRegister result_reg = ToDoubleRegister(instr->result());
3129 Representation exponent_type = instr->hydrogen()->right()->representation(); 3125 Representation exponent_type = instr->hydrogen()->right()->representation();
3130 if (exponent_type.IsDouble()) { 3126 // Having marked this as a call, we can use any registers.
3131 // Prepare arguments and call C function. 3127 // Just make sure that the input/output registers are the expected ones.
3132 __ PrepareCallCFunction(0, 2, scratch); 3128 ASSERT(!instr->InputAt(1)->IsDoubleRegister() ||
3133 __ SetCallCDoubleArguments(ToDoubleRegister(left), 3129 ToDoubleRegister(instr->InputAt(1)).is(d2));
3134 ToDoubleRegister(right)); 3130 ASSERT(!instr->InputAt(1)->IsRegister() ||
3135 __ CallCFunction( 3131 ToRegister(instr->InputAt(1)).is(r2));
3136 ExternalReference::power_double_double_function(isolate()), 0, 2); 3132 ASSERT(ToDoubleRegister(instr->InputAt(0)).is(d1));
3133 ASSERT(ToDoubleRegister(instr->result()).is(d3));
3134
3135 if (exponent_type.IsTagged()) {
3136 Label no_deopt;
3137 __ JumpIfSmi(r2, &no_deopt);
3138 __ ldr(r7, FieldMemOperand(r2, HeapObject::kMapOffset));
3139 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
3140 __ cmp(r7, Operand(ip));
3141 DeoptimizeIf(ne, instr->environment());
3142 __ bind(&no_deopt);
3143 MathPowStub stub(MathPowStub::TAGGED);
3144 __ CallStub(&stub);
3137 } else if (exponent_type.IsInteger32()) { 3145 } else if (exponent_type.IsInteger32()) {
3138 ASSERT(ToRegister(right).is(r0)); 3146 MathPowStub stub(MathPowStub::INTEGER);
3139 // Prepare arguments and call C function. 3147 __ CallStub(&stub);
3140 __ PrepareCallCFunction(1, 1, scratch);
3141 __ SetCallCDoubleArguments(ToDoubleRegister(left), ToRegister(right));
3142 __ CallCFunction(
3143 ExternalReference::power_double_int_function(isolate()), 1, 1);
3144 } else { 3148 } else {
3145 ASSERT(exponent_type.IsTagged()); 3149 ASSERT(exponent_type.IsDouble());
3146 ASSERT(instr->hydrogen()->left()->representation().IsDouble()); 3150 MathPowStub stub(MathPowStub::DOUBLE);
3147 3151 __ CallStub(&stub);
3148 Register right_reg = ToRegister(right);
3149
3150 // Check for smi on the right hand side.
3151 Label non_smi, call;
3152 __ JumpIfNotSmi(right_reg, &non_smi);
3153
3154 // Untag smi and convert it to a double.
3155 __ SmiUntag(right_reg);
3156 SwVfpRegister single_scratch = double_scratch0().low();
3157 __ vmov(single_scratch, right_reg);
3158 __ vcvt_f64_s32(result_reg, single_scratch);
3159 __ jmp(&call);
3160
3161 // Heap number map check.
3162 __ bind(&non_smi);
3163 __ ldr(scratch, FieldMemOperand(right_reg, HeapObject::kMapOffset));
3164 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
3165 __ cmp(scratch, Operand(ip));
3166 DeoptimizeIf(ne, instr->environment());
3167 int32_t value_offset = HeapNumber::kValueOffset - kHeapObjectTag;
3168 __ add(scratch, right_reg, Operand(value_offset));
3169 __ vldr(result_reg, scratch, 0);
3170
3171 // Prepare arguments and call C function.
3172 __ bind(&call);
3173 __ PrepareCallCFunction(0, 2, scratch);
3174 __ SetCallCDoubleArguments(ToDoubleRegister(left), result_reg);
3175 __ CallCFunction(
3176 ExternalReference::power_double_double_function(isolate()), 0, 2);
3177 } 3152 }
3178 // Store the result in the result register.
3179 __ GetCFunctionDoubleResult(result_reg);
3180 } 3153 }
3181 3154
3182 3155
3183 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { 3156 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) {
3184 ASSERT(ToDoubleRegister(instr->result()).is(d2)); 3157 ASSERT(ToDoubleRegister(instr->result()).is(d2));
3185 TranscendentalCacheStub stub(TranscendentalCache::LOG, 3158 TranscendentalCacheStub stub(TranscendentalCache::LOG,
3186 TranscendentalCacheStub::UNTAGGED); 3159 TranscendentalCacheStub::UNTAGGED);
3187 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 3160 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
3188 } 3161 }
3189 3162
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after
4729 ASSERT(osr_pc_offset_ == -1); 4702 ASSERT(osr_pc_offset_ == -1);
4730 osr_pc_offset_ = masm()->pc_offset(); 4703 osr_pc_offset_ = masm()->pc_offset();
4731 } 4704 }
4732 4705
4733 4706
4734 4707
4735 4708
4736 #undef __ 4709 #undef __
4737 4710
4738 } } // namespace v8::internal 4711 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698