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

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

Issue 6532020: ARM: Implement DoPower in the lithium code generator. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/src
Patch Set: Disable crankshaft on non ARM EABI platforms. 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-arm.cc ('k') | src/arm/macro-assembler-arm.h » ('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 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 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 break; 1219 break;
1220 case Token::MOD: { 1220 case Token::MOD: {
1221 // Save r0-r3 on the stack. 1221 // Save r0-r3 on the stack.
1222 __ stm(db_w, sp, r0.bit() | r1.bit() | r2.bit() | r3.bit()); 1222 __ stm(db_w, sp, r0.bit() | r1.bit() | r2.bit() | r3.bit());
1223 1223
1224 __ PrepareCallCFunction(4, scratch0()); 1224 __ PrepareCallCFunction(4, scratch0());
1225 __ vmov(r0, r1, left); 1225 __ vmov(r0, r1, left);
1226 __ vmov(r2, r3, right); 1226 __ vmov(r2, r3, right);
1227 __ CallCFunction(ExternalReference::double_fp_operation(Token::MOD), 4); 1227 __ CallCFunction(ExternalReference::double_fp_operation(Token::MOD), 4);
1228 // Move the result in the double result register. 1228 // Move the result in the double result register.
1229 __ vmov(ToDoubleRegister(instr->result()), r0, r1); 1229 __ GetCFunctionDoubleResult(ToDoubleRegister(instr->result()));
1230 1230
1231 // Restore r0-r3. 1231 // Restore r0-r3.
1232 __ ldm(ia_w, sp, r0.bit() | r1.bit() | r2.bit() | r3.bit()); 1232 __ ldm(ia_w, sp, r0.bit() | r1.bit() | r2.bit() | r3.bit());
1233 break; 1233 break;
1234 } 1234 }
1235 default: 1235 default:
1236 UNREACHABLE(); 1236 UNREACHABLE();
1237 break; 1237 break;
1238 } 1238 }
1239 } 1239 }
(...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after
2677 } 2677 }
2678 2678
2679 2679
2680 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { 2680 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) {
2681 DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); 2681 DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
2682 ASSERT(ToDoubleRegister(instr->result()).is(input)); 2682 ASSERT(ToDoubleRegister(instr->result()).is(input));
2683 __ vsqrt(input, input); 2683 __ vsqrt(input, input);
2684 } 2684 }
2685 2685
2686 2686
2687 void LCodeGen::DoPower(LPower* instr) {
2688 LOperand* left = instr->InputAt(0);
2689 LOperand* right = instr->InputAt(1);
2690 Register scratch = scratch0();
2691 DoubleRegister result_reg = ToDoubleRegister(instr->result());
2692 Representation exponent_type = instr->hydrogen()->right()->representation();
2693 if (exponent_type.IsDouble()) {
2694 // Prepare arguments and call C function.
2695 __ PrepareCallCFunction(4, scratch);
2696 __ vmov(r0, r1, ToDoubleRegister(left));
2697 __ vmov(r2, r3, ToDoubleRegister(right));
2698 __ CallCFunction(ExternalReference::power_double_double_function(), 4);
2699 } else if (exponent_type.IsInteger32()) {
2700 ASSERT(ToRegister(right).is(r0));
2701 // Prepare arguments and call C function.
2702 __ PrepareCallCFunction(4, scratch);
2703 __ mov(r2, ToRegister(right));
2704 __ vmov(r0, r1, ToDoubleRegister(left));
2705 __ CallCFunction(ExternalReference::power_double_int_function(), 4);
2706 } else {
2707 ASSERT(exponent_type.IsTagged());
2708 ASSERT(instr->hydrogen()->left()->representation().IsDouble());
2709
2710 Register right_reg = ToRegister(right);
2711
2712 // Check for smi on the right hand side.
2713 Label non_smi, call;
2714 __ JumpIfNotSmi(right_reg, &non_smi);
2715
2716 // Untag smi and convert it to a double.
2717 __ SmiUntag(right_reg);
2718 SwVfpRegister single_scratch = double_scratch0().low();
2719 __ vmov(single_scratch, right_reg);
2720 __ vcvt_f64_s32(result_reg, single_scratch);
2721 __ jmp(&call);
2722
2723 // Heap number map check.
2724 __ bind(&non_smi);
2725 __ ldr(scratch, FieldMemOperand(right_reg, HeapObject::kMapOffset));
2726 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
2727 __ cmp(scratch, Operand(ip));
2728 DeoptimizeIf(ne, instr->environment());
2729 int32_t value_offset = HeapNumber::kValueOffset - kHeapObjectTag;
2730 __ add(scratch, right_reg, Operand(value_offset));
2731 __ vldr(result_reg, scratch, 0);
2732
2733 // Prepare arguments and call C function.
2734 __ bind(&call);
2735 __ PrepareCallCFunction(4, scratch);
2736 __ vmov(r0, r1, ToDoubleRegister(left));
2737 __ vmov(r2, r3, result_reg);
2738 __ CallCFunction(ExternalReference::power_double_double_function(), 4);
2739 }
2740 // Store the result in the result register.
2741 __ GetCFunctionDoubleResult(result_reg);
2742 }
2743
2744
2687 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) { 2745 void LCodeGen::DoUnaryMathOperation(LUnaryMathOperation* instr) {
2688 switch (instr->op()) { 2746 switch (instr->op()) {
2689 case kMathAbs: 2747 case kMathAbs:
2690 DoMathAbs(instr); 2748 DoMathAbs(instr);
2691 break; 2749 break;
2692 case kMathFloor: 2750 case kMathFloor:
2693 DoMathFloor(instr); 2751 DoMathFloor(instr);
2694 break; 2752 break;
2695 case kMathRound: 2753 case kMathRound:
2696 DoMathRound(instr); 2754 DoMathRound(instr);
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
3789 ASSERT(!environment->HasBeenRegistered()); 3847 ASSERT(!environment->HasBeenRegistered());
3790 RegisterEnvironmentForDeoptimization(environment); 3848 RegisterEnvironmentForDeoptimization(environment);
3791 ASSERT(osr_pc_offset_ == -1); 3849 ASSERT(osr_pc_offset_ == -1);
3792 osr_pc_offset_ = masm()->pc_offset(); 3850 osr_pc_offset_ = masm()->pc_offset();
3793 } 3851 }
3794 3852
3795 3853
3796 #undef __ 3854 #undef __
3797 3855
3798 } } // namespace v8::internal 3856 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698