 Chromium Code Reviews
 Chromium Code Reviews Issue 6613015:
  ARM: Implement MathPowStub and DoMathPowHalf.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
    
  
    Issue 6613015:
  ARM: Implement MathPowStub and DoMathPowHalf.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge| 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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 738 case CodeStub::SubString: { | 738 case CodeStub::SubString: { | 
| 739 SubStringStub stub; | 739 SubStringStub stub; | 
| 740 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 740 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 
| 741 break; | 741 break; | 
| 742 } | 742 } | 
| 743 case CodeStub::StringCharAt: { | 743 case CodeStub::StringCharAt: { | 
| 744 StringCharAtStub stub; | 744 StringCharAtStub stub; | 
| 745 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 745 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 
| 746 break; | 746 break; | 
| 747 } | 747 } | 
| 748 case CodeStub::MathPow: { | |
| 749 Abort("MathPowStub unimplemented."); | |
| 750 break; | |
| 751 } | |
| 752 case CodeStub::NumberToString: { | 748 case CodeStub::NumberToString: { | 
| 753 NumberToStringStub stub; | 749 NumberToStringStub stub; | 
| 754 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 750 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 
| 755 break; | 751 break; | 
| 756 } | 752 } | 
| 757 case CodeStub::StringAdd: { | 753 case CodeStub::StringAdd: { | 
| 758 StringAddStub stub(NO_STRING_ADD_FLAGS); | 754 StringAddStub stub(NO_STRING_ADD_FLAGS); | 
| 759 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 755 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 
| 760 break; | 756 break; | 
| 761 } | 757 } | 
| (...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2639 } | 2635 } | 
| 2640 | 2636 | 
| 2641 | 2637 | 
| 2642 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { | 2638 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { | 
| 2643 DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); | 2639 DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); | 
| 2644 ASSERT(ToDoubleRegister(instr->result()).is(input)); | 2640 ASSERT(ToDoubleRegister(instr->result()).is(input)); | 
| 2645 __ vsqrt(input, input); | 2641 __ vsqrt(input, input); | 
| 2646 } | 2642 } | 
| 2647 | 2643 | 
| 2648 | 2644 | 
| 2645 void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) { | |
| 2646 DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); | |
| 2647 Register scratch = scratch0(); | |
| 2648 SwVfpRegister single_scratch = double_scratch0().low(); | |
| 2649 DoubleRegister double_scratch = double_scratch0(); | |
| 2650 ASSERT(ToDoubleRegister(instr->result()).is(input)); | |
| 2651 | |
| 2652 // Add +0 to convert -0 to +0. | |
| 2653 __ eor(scratch, scratch, Operand(scratch)); | |
| 
Søren Thygesen Gjesse
2011/03/08 10:05:12
On ARM just using mov(scratch, Operand(0)) should
 
Karl Klose
2011/03/08 10:29:00
Done.
 | |
| 2654 __ vmov(single_scratch, scratch); | |
| 2655 __ vcvt_f64_s32(double_scratch, single_scratch); | |
| 2656 __ vadd(input, input, double_scratch); | |
| 2657 __ vsqrt(input, input); | |
| 2658 } | |
| 2659 | |
| 2660 | |
| 2649 void LCodeGen::DoPower(LPower* instr) { | 2661 void LCodeGen::DoPower(LPower* instr) { | 
| 2650 LOperand* left = instr->InputAt(0); | 2662 LOperand* left = instr->InputAt(0); | 
| 2651 LOperand* right = instr->InputAt(1); | 2663 LOperand* right = instr->InputAt(1); | 
| 2652 Register scratch = scratch0(); | 2664 Register scratch = scratch0(); | 
| 2653 DoubleRegister result_reg = ToDoubleRegister(instr->result()); | 2665 DoubleRegister result_reg = ToDoubleRegister(instr->result()); | 
| 2654 Representation exponent_type = instr->hydrogen()->right()->representation(); | 2666 Representation exponent_type = instr->hydrogen()->right()->representation(); | 
| 2655 if (exponent_type.IsDouble()) { | 2667 if (exponent_type.IsDouble()) { | 
| 2656 // Prepare arguments and call C function. | 2668 // Prepare arguments and call C function. | 
| 2657 __ PrepareCallCFunction(4, scratch); | 2669 __ PrepareCallCFunction(4, scratch); | 
| 2658 __ vmov(r0, r1, ToDoubleRegister(left)); | 2670 __ vmov(r0, r1, ToDoubleRegister(left)); | 
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2735 break; | 2747 break; | 
| 2736 case kMathFloor: | 2748 case kMathFloor: | 
| 2737 DoMathFloor(instr); | 2749 DoMathFloor(instr); | 
| 2738 break; | 2750 break; | 
| 2739 case kMathRound: | 2751 case kMathRound: | 
| 2740 DoMathRound(instr); | 2752 DoMathRound(instr); | 
| 2741 break; | 2753 break; | 
| 2742 case kMathSqrt: | 2754 case kMathSqrt: | 
| 2743 DoMathSqrt(instr); | 2755 DoMathSqrt(instr); | 
| 2744 break; | 2756 break; | 
| 2757 case kMathPowHalf: | |
| 2758 DoMathPowHalf(instr); | |
| 2759 break; | |
| 2745 case kMathCos: | 2760 case kMathCos: | 
| 2746 DoMathCos(instr); | 2761 DoMathCos(instr); | 
| 2747 break; | 2762 break; | 
| 2748 case kMathSin: | 2763 case kMathSin: | 
| 2749 DoMathSin(instr); | 2764 DoMathSin(instr); | 
| 2750 break; | 2765 break; | 
| 2751 case kMathLog: | 2766 case kMathLog: | 
| 2752 DoMathLog(instr); | 2767 DoMathLog(instr); | 
| 2753 break; | 2768 break; | 
| 2754 default: | 2769 default: | 
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3833 ASSERT(!environment->HasBeenRegistered()); | 3848 ASSERT(!environment->HasBeenRegistered()); | 
| 3834 RegisterEnvironmentForDeoptimization(environment); | 3849 RegisterEnvironmentForDeoptimization(environment); | 
| 3835 ASSERT(osr_pc_offset_ == -1); | 3850 ASSERT(osr_pc_offset_ == -1); | 
| 3836 osr_pc_offset_ = masm()->pc_offset(); | 3851 osr_pc_offset_ = masm()->pc_offset(); | 
| 3837 } | 3852 } | 
| 3838 | 3853 | 
| 3839 | 3854 | 
| 3840 #undef __ | 3855 #undef __ | 
| 3841 | 3856 | 
| 3842 } } // namespace v8::internal | 3857 } } // namespace v8::internal | 
| OLD | NEW |