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

Side by Side Diff: src/mips/lithium-mips.h

Issue 16951016: MIPS: Optimise Math.floor(x/y) to use integer division for MIPS. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Generic MathFloorOfDiv. Created 7 years, 6 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/mips/lithium-codegen-mips.cc ('k') | src/mips/lithium-mips.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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 V(LoadKeyed) \ 130 V(LoadKeyed) \
131 V(LoadKeyedGeneric) \ 131 V(LoadKeyedGeneric) \
132 V(LoadNamedField) \ 132 V(LoadNamedField) \
133 V(LoadNamedFieldPolymorphic) \ 133 V(LoadNamedFieldPolymorphic) \
134 V(LoadNamedGeneric) \ 134 V(LoadNamedGeneric) \
135 V(MapEnumLength) \ 135 V(MapEnumLength) \
136 V(MathAbs) \ 136 V(MathAbs) \
137 V(MathCos) \ 137 V(MathCos) \
138 V(MathExp) \ 138 V(MathExp) \
139 V(MathFloor) \ 139 V(MathFloor) \
140 V(MathFloorOfDiv) \
140 V(MathLog) \ 141 V(MathLog) \
141 V(MathMinMax) \ 142 V(MathMinMax) \
142 V(MathPowHalf) \ 143 V(MathPowHalf) \
143 V(MathRound) \ 144 V(MathRound) \
144 V(MathSin) \ 145 V(MathSin) \
145 V(MathSqrt) \ 146 V(MathSqrt) \
146 V(MathTan) \ 147 V(MathTan) \
147 V(ModI) \ 148 V(ModI) \
148 V(MulI) \ 149 V(MulI) \
149 V(MultiplyAddD) \ 150 V(MultiplyAddD) \
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 } 617 }
617 618
618 LOperand* left() { return inputs_[0]; } 619 LOperand* left() { return inputs_[0]; }
619 LOperand* right() { return inputs_[1]; } 620 LOperand* right() { return inputs_[1]; }
620 621
621 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i") 622 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
622 DECLARE_HYDROGEN_ACCESSOR(Div) 623 DECLARE_HYDROGEN_ACCESSOR(Div)
623 }; 624 };
624 625
625 626
627 class LMathFloorOfDiv: public LTemplateInstruction<1, 2, 1> {
628 public:
629 LMathFloorOfDiv(LOperand* left,
630 LOperand* right,
631 LOperand* temp = NULL) {
632 inputs_[0] = left;
633 inputs_[1] = right;
634 temps_[0] = temp;
635 }
636
637 LOperand* left() { return inputs_[0]; }
638 LOperand* right() { return inputs_[1]; }
639 LOperand* temp() { return temps_[0]; }
640
641 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv, "math-floor-of-div")
642 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
643 };
644
645
626 class LMulI: public LTemplateInstruction<1, 2, 1> { 646 class LMulI: public LTemplateInstruction<1, 2, 1> {
627 public: 647 public:
628 LMulI(LOperand* left, LOperand* right, LOperand* temp) { 648 LMulI(LOperand* left, LOperand* right, LOperand* temp) {
629 inputs_[0] = left; 649 inputs_[0] = left;
630 inputs_[1] = right; 650 inputs_[1] = right;
631 temps_[0] = temp; 651 temps_[0] = temp;
632 } 652 }
633 653
634 LOperand* left() { return inputs_[0]; } 654 LOperand* left() { return inputs_[0]; }
635 LOperand* right() { return inputs_[1]; } 655 LOperand* right() { return inputs_[1]; }
(...skipping 1999 matching lines...) Expand 10 before | Expand all | Expand 10 after
2635 // Build the sequence for the graph. 2655 // Build the sequence for the graph.
2636 LPlatformChunk* Build(); 2656 LPlatformChunk* Build();
2637 2657
2638 // Declare methods that deal with the individual node types. 2658 // Declare methods that deal with the individual node types.
2639 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); 2659 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
2640 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) 2660 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2641 #undef DECLARE_DO 2661 #undef DECLARE_DO
2642 2662
2643 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend); 2663 LInstruction* DoMultiplyAdd(HMul* mul, HValue* addend);
2644 2664
2665 static bool HasMagicNumberForDivisor(int32_t divisor);
2666 static HValue* SimplifiedDivisorForMathFloorOfDiv(HValue* val);
2667
2645 LInstruction* DoMathFloor(HUnaryMathOperation* instr); 2668 LInstruction* DoMathFloor(HUnaryMathOperation* instr);
2646 LInstruction* DoMathRound(HUnaryMathOperation* instr); 2669 LInstruction* DoMathRound(HUnaryMathOperation* instr);
2647 LInstruction* DoMathAbs(HUnaryMathOperation* instr); 2670 LInstruction* DoMathAbs(HUnaryMathOperation* instr);
2648 LInstruction* DoMathLog(HUnaryMathOperation* instr); 2671 LInstruction* DoMathLog(HUnaryMathOperation* instr);
2649 LInstruction* DoMathSin(HUnaryMathOperation* instr); 2672 LInstruction* DoMathSin(HUnaryMathOperation* instr);
2650 LInstruction* DoMathCos(HUnaryMathOperation* instr); 2673 LInstruction* DoMathCos(HUnaryMathOperation* instr);
2651 LInstruction* DoMathTan(HUnaryMathOperation* instr); 2674 LInstruction* DoMathTan(HUnaryMathOperation* instr);
2652 LInstruction* DoMathExp(HUnaryMathOperation* instr); 2675 LInstruction* DoMathExp(HUnaryMathOperation* instr);
2653 LInstruction* DoMathSqrt(HUnaryMathOperation* instr); 2676 LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
2654 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr); 2677 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2781 2804
2782 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2805 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2783 }; 2806 };
2784 2807
2785 #undef DECLARE_HYDROGEN_ACCESSOR 2808 #undef DECLARE_HYDROGEN_ACCESSOR
2786 #undef DECLARE_CONCRETE_INSTRUCTION 2809 #undef DECLARE_CONCRETE_INSTRUCTION
2787 2810
2788 } } // namespace v8::internal 2811 } } // namespace v8::internal
2789 2812
2790 #endif // V8_MIPS_LITHIUM_MIPS_H_ 2813 #endif // V8_MIPS_LITHIUM_MIPS_H_
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.cc ('k') | src/mips/lithium-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698