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

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

Issue 175143002: Consistenly handle 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(DivByPowerOf2I) \
90 V(DivI) \ 91 V(DivI) \
91 V(DoubleToI) \ 92 V(DoubleToI) \
92 V(DoubleToSmi) \ 93 V(DoubleToSmi) \
93 V(Drop) \ 94 V(Drop) \
94 V(Dummy) \ 95 V(Dummy) \
95 V(DummyUse) \ 96 V(DummyUse) \
97 V(FlooringDivByConstI) \
98 V(FlooringDivByPowerOf2I) \
96 V(ForInCacheArray) \ 99 V(ForInCacheArray) \
97 V(ForInPrepareMap) \ 100 V(ForInPrepareMap) \
98 V(FunctionLiteral) \ 101 V(FunctionLiteral) \
99 V(GetCachedArrayIndex) \ 102 V(GetCachedArrayIndex) \
100 V(Goto) \ 103 V(Goto) \
101 V(HasCachedArrayIndexAndBranch) \ 104 V(HasCachedArrayIndexAndBranch) \
102 V(HasInstanceTypeAndBranch) \ 105 V(HasInstanceTypeAndBranch) \
103 V(InnerAllocatedObject) \ 106 V(InnerAllocatedObject) \
104 V(InstanceOf) \ 107 V(InstanceOf) \
105 V(InstanceOfKnownGlobal) \ 108 V(InstanceOfKnownGlobal) \
(...skipping 16 matching lines...) Expand all
122 V(LoadKeyed) \ 125 V(LoadKeyed) \
123 V(LoadKeyedGeneric) \ 126 V(LoadKeyedGeneric) \
124 V(LoadNamedField) \ 127 V(LoadNamedField) \
125 V(LoadNamedGeneric) \ 128 V(LoadNamedGeneric) \
126 V(LoadRoot) \ 129 V(LoadRoot) \
127 V(MapEnumLength) \ 130 V(MapEnumLength) \
128 V(MathAbs) \ 131 V(MathAbs) \
129 V(MathClz32) \ 132 V(MathClz32) \
130 V(MathExp) \ 133 V(MathExp) \
131 V(MathFloor) \ 134 V(MathFloor) \
132 V(MathFloorOfDiv) \
133 V(MathLog) \ 135 V(MathLog) \
134 V(MathMinMax) \ 136 V(MathMinMax) \
135 V(MathPowHalf) \ 137 V(MathPowHalf) \
136 V(MathRound) \ 138 V(MathRound) \
137 V(MathSqrt) \ 139 V(MathSqrt) \
140 V(ModByPowerOf2I) \
138 V(ModI) \ 141 V(ModI) \
139 V(MulI) \ 142 V(MulI) \
140 V(NumberTagD) \ 143 V(NumberTagD) \
141 V(NumberTagI) \ 144 V(NumberTagI) \
142 V(NumberTagU) \ 145 V(NumberTagU) \
143 V(NumberUntagD) \ 146 V(NumberUntagD) \
144 V(OsrEntry) \ 147 V(OsrEntry) \
145 V(Parameter) \ 148 V(Parameter) \
146 V(Power) \ 149 V(Power) \
147 V(PushArgument) \ 150 V(PushArgument) \
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements) 630 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
628 }; 631 };
629 632
630 633
631 class LDebugBreak V8_FINAL : public LTemplateInstruction<0, 0, 0> { 634 class LDebugBreak V8_FINAL : public LTemplateInstruction<0, 0, 0> {
632 public: 635 public:
633 DECLARE_CONCRETE_INSTRUCTION(DebugBreak, "break") 636 DECLARE_CONCRETE_INSTRUCTION(DebugBreak, "break")
634 }; 637 };
635 638
636 639
640 class LModByPowerOf2I V8_FINAL : public LTemplateInstruction<1, 1, 0> {
641 public:
642 LModByPowerOf2I(LOperand* dividend, int32_t divisor) {
643 inputs_[0] = dividend;
644 divisor_ = divisor;
645 }
646
647 LOperand* dividend() { return inputs_[0]; }
648 int32_t divisor() const { return divisor_; }
649
650 DECLARE_CONCRETE_INSTRUCTION(ModByPowerOf2I, "mod-by-power-of-2-i")
651 DECLARE_HYDROGEN_ACCESSOR(Mod)
652
653 private:
654 int32_t divisor_;
655 };
656
657
637 class LModI V8_FINAL : public LTemplateInstruction<1, 2, 1> { 658 class LModI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
638 public: 659 public:
639 LModI(LOperand* left, LOperand* right, LOperand* temp) { 660 LModI(LOperand* left, LOperand* right, LOperand* temp) {
640 inputs_[0] = left; 661 inputs_[0] = left;
641 inputs_[1] = right; 662 inputs_[1] = right;
642 temps_[0] = temp; 663 temps_[0] = temp;
643 } 664 }
644 665
645 LOperand* left() { return inputs_[0]; } 666 LOperand* left() { return inputs_[0]; }
646 LOperand* right() { return inputs_[1]; } 667 LOperand* right() { return inputs_[1]; }
647 LOperand* temp() { return temps_[0]; } 668 LOperand* temp() { return temps_[0]; }
648 669
649 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i") 670 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
650 DECLARE_HYDROGEN_ACCESSOR(Mod) 671 DECLARE_HYDROGEN_ACCESSOR(Mod)
651 }; 672 };
652 673
653 674
675 class LDivByPowerOf2I V8_FINAL : public LTemplateInstruction<1, 1, 0> {
676 public:
677 LDivByPowerOf2I(LOperand* dividend, int32_t divisor) {
678 inputs_[0] = dividend;
679 divisor_ = divisor;
680 }
681
682 LOperand* dividend() { return inputs_[0]; }
683 int32_t divisor() const { return divisor_; }
684
685 DECLARE_CONCRETE_INSTRUCTION(DivByPowerOf2I, "div-by-power-of-2-i")
686 DECLARE_HYDROGEN_ACCESSOR(Div)
687
688 private:
689 int32_t divisor_;
690 };
691
692
654 class LDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> { 693 class LDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
655 public: 694 public:
656 LDivI(LOperand* left, LOperand* right, LOperand* temp) { 695 LDivI(LOperand* left, LOperand* right, LOperand* temp) {
657 inputs_[0] = left; 696 inputs_[0] = left;
658 inputs_[1] = right; 697 inputs_[1] = right;
659 temps_[0] = temp; 698 temps_[0] = temp;
660 } 699 }
661 700
662 LOperand* left() { return inputs_[0]; } 701 LOperand* left() { return inputs_[0]; }
663 LOperand* right() { return inputs_[1]; } 702 LOperand* right() { return inputs_[1]; }
664
665 bool is_flooring() { return hydrogen_value()->IsMathFloorOfDiv(); }
666
667 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
668 DECLARE_HYDROGEN_ACCESSOR(Div)
669 };
670
671
672 class LMathFloorOfDiv V8_FINAL : public LTemplateInstruction<1, 2, 1> {
673 public:
674 LMathFloorOfDiv(LOperand* left,
675 LOperand* right,
676 LOperand* temp = NULL) {
677 inputs_[0] = left;
678 inputs_[1] = right;
679 temps_[0] = temp;
680 }
681
682 LOperand* left() { return inputs_[0]; }
683 LOperand* right() { return inputs_[1]; }
684 LOperand* temp() { return temps_[0]; } 703 LOperand* temp() { return temps_[0]; }
685 704
686 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv, "math-floor-of-div") 705 bool is_flooring() { return hydrogen_value()->IsMathFloorOfDiv(); }
687 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv) 706
707 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
708 DECLARE_HYDROGEN_ACCESSOR(BinaryOperation)
688 }; 709 };
689 710
690 711
712 class LFlooringDivByPowerOf2I V8_FINAL : public LTemplateInstruction<1, 1, 0> {
713 public:
714 LFlooringDivByPowerOf2I(LOperand* dividend, int32_t divisor) {
715 inputs_[0] = dividend;
716 divisor_ = divisor;
717 }
718
719 LOperand* dividend() { return inputs_[0]; }
720 int32_t divisor() const { return divisor_; }
721
722 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByPowerOf2I,
723 "flooring-div-by-power-of-2-i")
724 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
725
726 private:
727 int32_t divisor_;
728 };
729
730
731 class LFlooringDivByConstI V8_FINAL : public LTemplateInstruction<1, 1, 1> {
732 public:
733 LFlooringDivByConstI(LOperand* dividend, int32_t divisor, LOperand* temp) {
734 inputs_[0] = dividend;
735 divisor_ = divisor;
736 temps_[0] = temp;
737 }
738
739 LOperand* dividend() { return inputs_[0]; }
740 int32_t divisor() const { return divisor_; }
741 LOperand* temp() { return temps_[0]; }
742
743 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByConstI, "flooring-div-by-const-i")
744 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
745
746 private:
747 int32_t divisor_;
748 };
749
750
691 class LMulI V8_FINAL : public LTemplateInstruction<1, 2, 1> { 751 class LMulI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
692 public: 752 public:
693 LMulI(LOperand* left, LOperand* right, LOperand* temp) { 753 LMulI(LOperand* left, LOperand* right, LOperand* temp) {
694 inputs_[0] = left; 754 inputs_[0] = left;
695 inputs_[1] = right; 755 inputs_[1] = right;
696 temps_[0] = temp; 756 temps_[0] = temp;
697 } 757 }
698 758
699 LOperand* left() { return inputs_[0]; } 759 LOperand* left() { return inputs_[0]; }
700 LOperand* right() { return inputs_[1]; } 760 LOperand* right() { return inputs_[1]; }
(...skipping 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after
2623 #undef DECLARE_DO 2683 #undef DECLARE_DO
2624 2684
2625 LInstruction* DoMathFloor(HUnaryMathOperation* instr); 2685 LInstruction* DoMathFloor(HUnaryMathOperation* instr);
2626 LInstruction* DoMathRound(HUnaryMathOperation* instr); 2686 LInstruction* DoMathRound(HUnaryMathOperation* instr);
2627 LInstruction* DoMathAbs(HUnaryMathOperation* instr); 2687 LInstruction* DoMathAbs(HUnaryMathOperation* instr);
2628 LInstruction* DoMathLog(HUnaryMathOperation* instr); 2688 LInstruction* DoMathLog(HUnaryMathOperation* instr);
2629 LInstruction* DoMathExp(HUnaryMathOperation* instr); 2689 LInstruction* DoMathExp(HUnaryMathOperation* instr);
2630 LInstruction* DoMathSqrt(HUnaryMathOperation* instr); 2690 LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
2631 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr); 2691 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
2632 LInstruction* DoMathClz32(HUnaryMathOperation* instr); 2692 LInstruction* DoMathClz32(HUnaryMathOperation* instr);
2693 LInstruction* DoDivByPowerOf2I(HDiv* instr);
2694 LInstruction* DoDivI(HBinaryOperation* instr);
2695 LInstruction* DoModByPowerOf2I(HMod* instr);
2696 LInstruction* DoModI(HMod* instr);
2697 LInstruction* DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr);
2698 LInstruction* DoFlooringDivByConstI(HMathFloorOfDiv* instr);
2633 2699
2634 private: 2700 private:
2635 enum Status { 2701 enum Status {
2636 UNUSED, 2702 UNUSED,
2637 BUILDING, 2703 BUILDING,
2638 DONE, 2704 DONE,
2639 ABORTED 2705 ABORTED
2640 }; 2706 };
2641 2707
2642 LPlatformChunk* chunk() const { return chunk_; } 2708 LPlatformChunk* chunk() const { return chunk_; }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
2759 2825
2760 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2826 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2761 }; 2827 };
2762 2828
2763 #undef DECLARE_HYDROGEN_ACCESSOR 2829 #undef DECLARE_HYDROGEN_ACCESSOR
2764 #undef DECLARE_CONCRETE_INSTRUCTION 2830 #undef DECLARE_CONCRETE_INSTRUCTION
2765 2831
2766 } } // namespace v8::internal 2832 } } // namespace v8::internal
2767 2833
2768 #endif // V8_IA32_LITHIUM_IA32_H_ 2834 #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