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

Side by Side Diff: src/x64/lithium-x64.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/x64/lithium-codegen-x64.cc ('k') | src/x64/lithium-x64.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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 V(ConstantD) \ 78 V(ConstantD) \
79 V(ConstantE) \ 79 V(ConstantE) \
80 V(ConstantI) \ 80 V(ConstantI) \
81 V(ConstantS) \ 81 V(ConstantS) \
82 V(ConstantT) \ 82 V(ConstantT) \
83 V(Context) \ 83 V(Context) \
84 V(DateField) \ 84 V(DateField) \
85 V(DebugBreak) \ 85 V(DebugBreak) \
86 V(DeclareGlobals) \ 86 V(DeclareGlobals) \
87 V(Deoptimize) \ 87 V(Deoptimize) \
88 V(DivByConstI) \
88 V(DivByPowerOf2I) \ 89 V(DivByPowerOf2I) \
89 V(DivI) \ 90 V(DivI) \
90 V(DoubleToI) \ 91 V(DoubleToI) \
91 V(DoubleToSmi) \ 92 V(DoubleToSmi) \
92 V(Drop) \ 93 V(Drop) \
93 V(DummyUse) \ 94 V(DummyUse) \
94 V(Dummy) \ 95 V(Dummy) \
95 V(FlooringDivByConstI) \ 96 V(FlooringDivByConstI) \
96 V(FlooringDivByPowerOf2I) \ 97 V(FlooringDivByPowerOf2I) \
97 V(ForInCacheArray) \ 98 V(ForInCacheArray) \
(...skipping 30 matching lines...) Expand all
128 V(MapEnumLength) \ 129 V(MapEnumLength) \
129 V(MathAbs) \ 130 V(MathAbs) \
130 V(MathClz32) \ 131 V(MathClz32) \
131 V(MathExp) \ 132 V(MathExp) \
132 V(MathFloor) \ 133 V(MathFloor) \
133 V(MathLog) \ 134 V(MathLog) \
134 V(MathMinMax) \ 135 V(MathMinMax) \
135 V(MathPowHalf) \ 136 V(MathPowHalf) \
136 V(MathRound) \ 137 V(MathRound) \
137 V(MathSqrt) \ 138 V(MathSqrt) \
139 V(ModByConstI) \
138 V(ModByPowerOf2I) \ 140 V(ModByPowerOf2I) \
139 V(ModI) \ 141 V(ModI) \
140 V(MulI) \ 142 V(MulI) \
141 V(NumberTagD) \ 143 V(NumberTagD) \
142 V(NumberTagI) \ 144 V(NumberTagI) \
143 V(NumberTagU) \ 145 V(NumberTagU) \
144 V(NumberUntagD) \ 146 V(NumberUntagD) \
145 V(OsrEntry) \ 147 V(OsrEntry) \
146 V(Parameter) \ 148 V(Parameter) \
147 V(Power) \ 149 V(Power) \
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 int32_t divisor() const { return divisor_; } 631 int32_t divisor() const { return divisor_; }
630 632
631 DECLARE_CONCRETE_INSTRUCTION(ModByPowerOf2I, "mod-by-power-of-2-i") 633 DECLARE_CONCRETE_INSTRUCTION(ModByPowerOf2I, "mod-by-power-of-2-i")
632 DECLARE_HYDROGEN_ACCESSOR(Mod) 634 DECLARE_HYDROGEN_ACCESSOR(Mod)
633 635
634 private: 636 private:
635 int32_t divisor_; 637 int32_t divisor_;
636 }; 638 };
637 639
638 640
641 class LModByConstI V8_FINAL : public LTemplateInstruction<1, 1, 2> {
642 public:
643 LModByConstI(LOperand* dividend,
644 int32_t divisor,
645 LOperand* temp1,
646 LOperand* temp2) {
647 inputs_[0] = dividend;
648 divisor_ = divisor;
649 temps_[0] = temp1;
650 temps_[1] = temp2;
651 }
652
653 LOperand* dividend() { return inputs_[0]; }
654 int32_t divisor() const { return divisor_; }
655 LOperand* temp1() { return temps_[0]; }
656 LOperand* temp2() { return temps_[1]; }
657
658 DECLARE_CONCRETE_INSTRUCTION(ModByConstI, "mod-by-const-i")
659 DECLARE_HYDROGEN_ACCESSOR(Mod)
660
661 private:
662 int32_t divisor_;
663 };
664
665
639 class LModI V8_FINAL : public LTemplateInstruction<1, 2, 1> { 666 class LModI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
640 public: 667 public:
641 LModI(LOperand* left, LOperand* right, LOperand* temp) { 668 LModI(LOperand* left, LOperand* right, LOperand* temp) {
642 inputs_[0] = left; 669 inputs_[0] = left;
643 inputs_[1] = right; 670 inputs_[1] = right;
644 temps_[0] = temp; 671 temps_[0] = temp;
645 } 672 }
646 673
647 LOperand* left() { return inputs_[0]; } 674 LOperand* left() { return inputs_[0]; }
648 LOperand* right() { return inputs_[1]; } 675 LOperand* right() { return inputs_[1]; }
(...skipping 15 matching lines...) Expand all
664 int32_t divisor() const { return divisor_; } 691 int32_t divisor() const { return divisor_; }
665 692
666 DECLARE_CONCRETE_INSTRUCTION(DivByPowerOf2I, "div-by-power-of-2-i") 693 DECLARE_CONCRETE_INSTRUCTION(DivByPowerOf2I, "div-by-power-of-2-i")
667 DECLARE_HYDROGEN_ACCESSOR(Div) 694 DECLARE_HYDROGEN_ACCESSOR(Div)
668 695
669 private: 696 private:
670 int32_t divisor_; 697 int32_t divisor_;
671 }; 698 };
672 699
673 700
701 class LDivByConstI V8_FINAL : public LTemplateInstruction<1, 1, 2> {
702 public:
703 LDivByConstI(LOperand* dividend,
704 int32_t divisor,
705 LOperand* temp1,
706 LOperand* temp2) {
707 inputs_[0] = dividend;
708 divisor_ = divisor;
709 temps_[0] = temp1;
710 temps_[1] = temp2;
711 }
712
713 LOperand* dividend() { return inputs_[0]; }
714 int32_t divisor() const { return divisor_; }
715 LOperand* temp1() { return temps_[0]; }
716 LOperand* temp2() { return temps_[1]; }
717
718 DECLARE_CONCRETE_INSTRUCTION(DivByConstI, "div-by-const-i")
719 DECLARE_HYDROGEN_ACCESSOR(Div)
720
721 private:
722 int32_t divisor_;
723 };
724
725
674 class LDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> { 726 class LDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
675 public: 727 public:
676 LDivI(LOperand* left, LOperand* right, LOperand* temp) { 728 LDivI(LOperand* left, LOperand* right, LOperand* temp) {
677 inputs_[0] = left; 729 inputs_[0] = left;
678 inputs_[1] = right; 730 inputs_[1] = right;
679 temps_[0] = temp; 731 temps_[0] = temp;
680 } 732 }
681 733
682 LOperand* left() { return inputs_[0]; } 734 LOperand* left() { return inputs_[0]; }
683 LOperand* right() { return inputs_[1]; } 735 LOperand* right() { return inputs_[1]; }
(...skipping 18 matching lines...) Expand all
702 754
703 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByPowerOf2I, 755 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByPowerOf2I,
704 "flooring-div-by-power-of-2-i") 756 "flooring-div-by-power-of-2-i")
705 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv) 757 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
706 758
707 private: 759 private:
708 int32_t divisor_; 760 int32_t divisor_;
709 }; 761 };
710 762
711 763
712 class LFlooringDivByConstI V8_FINAL : public LTemplateInstruction<1, 1, 1> { 764 class LFlooringDivByConstI V8_FINAL : public LTemplateInstruction<1, 1, 2> {
713 public: 765 public:
714 LFlooringDivByConstI(LOperand* dividend, int32_t divisor, LOperand* temp) { 766 LFlooringDivByConstI(LOperand* dividend,
767 int32_t divisor,
768 LOperand* temp1,
769 LOperand* temp2) {
715 inputs_[0] = dividend; 770 inputs_[0] = dividend;
716 divisor_ = divisor; 771 divisor_ = divisor;
717 temps_[0] = temp; 772 temps_[0] = temp1;
773 temps_[1] = temp2;
718 } 774 }
719 775
720 LOperand* dividend() { return inputs_[0]; } 776 LOperand* dividend() { return inputs_[0]; }
721 int32_t divisor() const { return divisor_; } 777 int32_t divisor() const { return divisor_; }
722 LOperand* temp() { return temps_[0]; } 778 LOperand* temp1() { return temps_[0]; }
779 LOperand* temp2() { return temps_[0]; }
723 780
724 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByConstI, "flooring-div-by-const-i") 781 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByConstI, "flooring-div-by-const-i")
725 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv) 782 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
726 783
727 private: 784 private:
728 int32_t divisor_; 785 int32_t divisor_;
729 }; 786 };
730 787
731 788
732 class LMulI V8_FINAL : public LTemplateInstruction<1, 2, 0> { 789 class LMulI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
(...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after
2598 2655
2599 LInstruction* DoMathFloor(HUnaryMathOperation* instr); 2656 LInstruction* DoMathFloor(HUnaryMathOperation* instr);
2600 LInstruction* DoMathRound(HUnaryMathOperation* instr); 2657 LInstruction* DoMathRound(HUnaryMathOperation* instr);
2601 LInstruction* DoMathAbs(HUnaryMathOperation* instr); 2658 LInstruction* DoMathAbs(HUnaryMathOperation* instr);
2602 LInstruction* DoMathLog(HUnaryMathOperation* instr); 2659 LInstruction* DoMathLog(HUnaryMathOperation* instr);
2603 LInstruction* DoMathExp(HUnaryMathOperation* instr); 2660 LInstruction* DoMathExp(HUnaryMathOperation* instr);
2604 LInstruction* DoMathSqrt(HUnaryMathOperation* instr); 2661 LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
2605 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr); 2662 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
2606 LInstruction* DoMathClz32(HUnaryMathOperation* instr); 2663 LInstruction* DoMathClz32(HUnaryMathOperation* instr);
2607 LInstruction* DoDivByPowerOf2I(HDiv* instr); 2664 LInstruction* DoDivByPowerOf2I(HDiv* instr);
2665 LInstruction* DoDivByConstI(HDiv* instr);
2608 LInstruction* DoDivI(HBinaryOperation* instr); 2666 LInstruction* DoDivI(HBinaryOperation* instr);
2609 LInstruction* DoModByPowerOf2I(HMod* instr); 2667 LInstruction* DoModByPowerOf2I(HMod* instr);
2668 LInstruction* DoModByConstI(HMod* instr);
2610 LInstruction* DoModI(HMod* instr); 2669 LInstruction* DoModI(HMod* instr);
2611 LInstruction* DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr); 2670 LInstruction* DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr);
2612 LInstruction* DoFlooringDivByConstI(HMathFloorOfDiv* instr); 2671 LInstruction* DoFlooringDivByConstI(HMathFloorOfDiv* instr);
2613 2672
2614 private: 2673 private:
2615 enum Status { 2674 enum Status {
2616 UNUSED, 2675 UNUSED,
2617 BUILDING, 2676 BUILDING,
2618 DONE, 2677 DONE,
2619 ABORTED 2678 ABORTED
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2732 2791
2733 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2792 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2734 }; 2793 };
2735 2794
2736 #undef DECLARE_HYDROGEN_ACCESSOR 2795 #undef DECLARE_HYDROGEN_ACCESSOR
2737 #undef DECLARE_CONCRETE_INSTRUCTION 2796 #undef DECLARE_CONCRETE_INSTRUCTION
2738 2797
2739 } } // namespace v8::int 2798 } } // namespace v8::int
2740 2799
2741 #endif // V8_X64_LITHIUM_X64_H_ 2800 #endif // V8_X64_LITHIUM_X64_H_
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698