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

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

Issue 190383002: Handle non-power-of-2 divisors in division-like operations (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 6 years, 9 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/ia32/lithium-codegen-ia32.cc ('k') | src/ia32/lithium-ia32.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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 V(ConstantD) \ 80 V(ConstantD) \
81 V(ConstantE) \ 81 V(ConstantE) \
82 V(ConstantI) \ 82 V(ConstantI) \
83 V(ConstantS) \ 83 V(ConstantS) \
84 V(ConstantT) \ 84 V(ConstantT) \
85 V(Context) \ 85 V(Context) \
86 V(DateField) \ 86 V(DateField) \
87 V(DebugBreak) \ 87 V(DebugBreak) \
88 V(DeclareGlobals) \ 88 V(DeclareGlobals) \
89 V(Deoptimize) \ 89 V(Deoptimize) \
90 V(DivByConstI) \
90 V(DivByPowerOf2I) \ 91 V(DivByPowerOf2I) \
91 V(DivI) \ 92 V(DivI) \
92 V(DoubleToI) \ 93 V(DoubleToI) \
93 V(DoubleToSmi) \ 94 V(DoubleToSmi) \
94 V(Drop) \ 95 V(Drop) \
95 V(Dummy) \ 96 V(Dummy) \
96 V(DummyUse) \ 97 V(DummyUse) \
97 V(FlooringDivByConstI) \ 98 V(FlooringDivByConstI) \
98 V(FlooringDivByPowerOf2I) \ 99 V(FlooringDivByPowerOf2I) \
99 V(ForInCacheArray) \ 100 V(ForInCacheArray) \
(...skipping 30 matching lines...) Expand all
130 V(MapEnumLength) \ 131 V(MapEnumLength) \
131 V(MathAbs) \ 132 V(MathAbs) \
132 V(MathClz32) \ 133 V(MathClz32) \
133 V(MathExp) \ 134 V(MathExp) \
134 V(MathFloor) \ 135 V(MathFloor) \
135 V(MathLog) \ 136 V(MathLog) \
136 V(MathMinMax) \ 137 V(MathMinMax) \
137 V(MathPowHalf) \ 138 V(MathPowHalf) \
138 V(MathRound) \ 139 V(MathRound) \
139 V(MathSqrt) \ 140 V(MathSqrt) \
141 V(ModByConstI) \
140 V(ModByPowerOf2I) \ 142 V(ModByPowerOf2I) \
141 V(ModI) \ 143 V(ModI) \
142 V(MulI) \ 144 V(MulI) \
143 V(NumberTagD) \ 145 V(NumberTagD) \
144 V(NumberTagI) \ 146 V(NumberTagI) \
145 V(NumberTagU) \ 147 V(NumberTagU) \
146 V(NumberUntagD) \ 148 V(NumberUntagD) \
147 V(OsrEntry) \ 149 V(OsrEntry) \
148 V(Parameter) \ 150 V(Parameter) \
149 V(Power) \ 151 V(Power) \
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 int32_t divisor() const { return divisor_; } 650 int32_t divisor() const { return divisor_; }
649 651
650 DECLARE_CONCRETE_INSTRUCTION(ModByPowerOf2I, "mod-by-power-of-2-i") 652 DECLARE_CONCRETE_INSTRUCTION(ModByPowerOf2I, "mod-by-power-of-2-i")
651 DECLARE_HYDROGEN_ACCESSOR(Mod) 653 DECLARE_HYDROGEN_ACCESSOR(Mod)
652 654
653 private: 655 private:
654 int32_t divisor_; 656 int32_t divisor_;
655 }; 657 };
656 658
657 659
660 class LModByConstI V8_FINAL : public LTemplateInstruction<1, 1, 2> {
661 public:
662 LModByConstI(LOperand* dividend,
663 int32_t divisor,
664 LOperand* temp1,
665 LOperand* temp2) {
666 inputs_[0] = dividend;
667 divisor_ = divisor;
668 temps_[0] = temp1;
669 temps_[1] = temp2;
670 }
671
672 LOperand* dividend() { return inputs_[0]; }
673 int32_t divisor() const { return divisor_; }
674 LOperand* temp1() { return temps_[0]; }
675 LOperand* temp2() { return temps_[1]; }
676
677 DECLARE_CONCRETE_INSTRUCTION(ModByConstI, "mod-by-const-i")
678 DECLARE_HYDROGEN_ACCESSOR(Mod)
679
680 private:
681 int32_t divisor_;
682 };
683
684
658 class LModI V8_FINAL : public LTemplateInstruction<1, 2, 1> { 685 class LModI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
659 public: 686 public:
660 LModI(LOperand* left, LOperand* right, LOperand* temp) { 687 LModI(LOperand* left, LOperand* right, LOperand* temp) {
661 inputs_[0] = left; 688 inputs_[0] = left;
662 inputs_[1] = right; 689 inputs_[1] = right;
663 temps_[0] = temp; 690 temps_[0] = temp;
664 } 691 }
665 692
666 LOperand* left() { return inputs_[0]; } 693 LOperand* left() { return inputs_[0]; }
667 LOperand* right() { return inputs_[1]; } 694 LOperand* right() { return inputs_[1]; }
(...skipping 15 matching lines...) Expand all
683 int32_t divisor() const { return divisor_; } 710 int32_t divisor() const { return divisor_; }
684 711
685 DECLARE_CONCRETE_INSTRUCTION(DivByPowerOf2I, "div-by-power-of-2-i") 712 DECLARE_CONCRETE_INSTRUCTION(DivByPowerOf2I, "div-by-power-of-2-i")
686 DECLARE_HYDROGEN_ACCESSOR(Div) 713 DECLARE_HYDROGEN_ACCESSOR(Div)
687 714
688 private: 715 private:
689 int32_t divisor_; 716 int32_t divisor_;
690 }; 717 };
691 718
692 719
720 class LDivByConstI V8_FINAL : public LTemplateInstruction<1, 1, 2> {
721 public:
722 LDivByConstI(LOperand* dividend,
723 int32_t divisor,
724 LOperand* temp1,
725 LOperand* temp2) {
726 inputs_[0] = dividend;
727 divisor_ = divisor;
728 temps_[0] = temp1;
729 temps_[1] = temp2;
730 }
731
732 LOperand* dividend() { return inputs_[0]; }
733 int32_t divisor() const { return divisor_; }
734 LOperand* temp1() { return temps_[0]; }
735 LOperand* temp2() { return temps_[1]; }
736
737 DECLARE_CONCRETE_INSTRUCTION(DivByConstI, "div-by-const-i")
738 DECLARE_HYDROGEN_ACCESSOR(Div)
739
740 private:
741 int32_t divisor_;
742 };
743
744
693 class LDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> { 745 class LDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
694 public: 746 public:
695 LDivI(LOperand* left, LOperand* right, LOperand* temp) { 747 LDivI(LOperand* left, LOperand* right, LOperand* temp) {
696 inputs_[0] = left; 748 inputs_[0] = left;
697 inputs_[1] = right; 749 inputs_[1] = right;
698 temps_[0] = temp; 750 temps_[0] = temp;
699 } 751 }
700 752
701 LOperand* left() { return inputs_[0]; } 753 LOperand* left() { return inputs_[0]; }
702 LOperand* right() { return inputs_[1]; } 754 LOperand* right() { return inputs_[1]; }
(...skipping 18 matching lines...) Expand all
721 773
722 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByPowerOf2I, 774 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByPowerOf2I,
723 "flooring-div-by-power-of-2-i") 775 "flooring-div-by-power-of-2-i")
724 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv) 776 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
725 777
726 private: 778 private:
727 int32_t divisor_; 779 int32_t divisor_;
728 }; 780 };
729 781
730 782
731 class LFlooringDivByConstI V8_FINAL : public LTemplateInstruction<1, 1, 1> { 783 class LFlooringDivByConstI V8_FINAL : public LTemplateInstruction<1, 1, 2> {
732 public: 784 public:
733 LFlooringDivByConstI(LOperand* dividend, int32_t divisor, LOperand* temp) { 785 LFlooringDivByConstI(LOperand* dividend,
786 int32_t divisor,
787 LOperand* temp1,
788 LOperand* temp2) {
734 inputs_[0] = dividend; 789 inputs_[0] = dividend;
735 divisor_ = divisor; 790 divisor_ = divisor;
736 temps_[0] = temp; 791 temps_[0] = temp1;
792 temps_[1] = temp2;
737 } 793 }
738 794
739 LOperand* dividend() { return inputs_[0]; } 795 LOperand* dividend() { return inputs_[0]; }
740 int32_t divisor() const { return divisor_; } 796 int32_t divisor() const { return divisor_; }
741 LOperand* temp() { return temps_[0]; } 797 LOperand* temp1() { return temps_[0]; }
798 LOperand* temp2() { return temps_[1]; }
742 799
743 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByConstI, "flooring-div-by-const-i") 800 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByConstI, "flooring-div-by-const-i")
744 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv) 801 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
745 802
746 private: 803 private:
747 int32_t divisor_; 804 int32_t divisor_;
748 }; 805 };
749 806
750 807
751 class LMulI V8_FINAL : public LTemplateInstruction<1, 2, 1> { 808 class LMulI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
(...skipping 1932 matching lines...) Expand 10 before | Expand all | Expand 10 after
2684 2741
2685 LInstruction* DoMathFloor(HUnaryMathOperation* instr); 2742 LInstruction* DoMathFloor(HUnaryMathOperation* instr);
2686 LInstruction* DoMathRound(HUnaryMathOperation* instr); 2743 LInstruction* DoMathRound(HUnaryMathOperation* instr);
2687 LInstruction* DoMathAbs(HUnaryMathOperation* instr); 2744 LInstruction* DoMathAbs(HUnaryMathOperation* instr);
2688 LInstruction* DoMathLog(HUnaryMathOperation* instr); 2745 LInstruction* DoMathLog(HUnaryMathOperation* instr);
2689 LInstruction* DoMathExp(HUnaryMathOperation* instr); 2746 LInstruction* DoMathExp(HUnaryMathOperation* instr);
2690 LInstruction* DoMathSqrt(HUnaryMathOperation* instr); 2747 LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
2691 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr); 2748 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
2692 LInstruction* DoMathClz32(HUnaryMathOperation* instr); 2749 LInstruction* DoMathClz32(HUnaryMathOperation* instr);
2693 LInstruction* DoDivByPowerOf2I(HDiv* instr); 2750 LInstruction* DoDivByPowerOf2I(HDiv* instr);
2751 LInstruction* DoDivByConstI(HDiv* instr);
2694 LInstruction* DoDivI(HBinaryOperation* instr); 2752 LInstruction* DoDivI(HBinaryOperation* instr);
2695 LInstruction* DoModByPowerOf2I(HMod* instr); 2753 LInstruction* DoModByPowerOf2I(HMod* instr);
2754 LInstruction* DoModByConstI(HMod* instr);
2696 LInstruction* DoModI(HMod* instr); 2755 LInstruction* DoModI(HMod* instr);
2697 LInstruction* DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr); 2756 LInstruction* DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr);
2698 LInstruction* DoFlooringDivByConstI(HMathFloorOfDiv* instr); 2757 LInstruction* DoFlooringDivByConstI(HMathFloorOfDiv* instr);
2699 2758
2700 private: 2759 private:
2701 enum Status { 2760 enum Status {
2702 UNUSED, 2761 UNUSED,
2703 BUILDING, 2762 BUILDING,
2704 DONE, 2763 DONE,
2705 ABORTED 2764 ABORTED
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2825 2884
2826 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2885 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2827 }; 2886 };
2828 2887
2829 #undef DECLARE_HYDROGEN_ACCESSOR 2888 #undef DECLARE_HYDROGEN_ACCESSOR
2830 #undef DECLARE_CONCRETE_INSTRUCTION 2889 #undef DECLARE_CONCRETE_INSTRUCTION
2831 2890
2832 } } // namespace v8::internal 2891 } } // namespace v8::internal
2833 2892
2834 #endif // V8_IA32_LITHIUM_IA32_H_ 2893 #endif // V8_IA32_LITHIUM_IA32_H_
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/ia32/lithium-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698