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

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

Issue 192743006: MIPS: Reland "Handle non-power-of-2 divisors in division-like operations". (Closed) Base URL: https://github.com/v8/v8.git@gbl
Patch Set: 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
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 V(DeclareGlobals) \ 87 V(DeclareGlobals) \
88 V(Deoptimize) \ 88 V(Deoptimize) \
89 V(DivI) \ 89 V(DivI) \
90 V(DoubleToI) \ 90 V(DoubleToI) \
91 V(DoubleBits) \ 91 V(DoubleBits) \
92 V(DoubleToSmi) \ 92 V(DoubleToSmi) \
93 V(Drop) \ 93 V(Drop) \
94 V(Dummy) \ 94 V(Dummy) \
95 V(DummyUse) \ 95 V(DummyUse) \
96 V(FlooringDivByConstI) \ 96 V(FlooringDivByConstI) \
97 V(FlooringDivByPowerOf2I) \
97 V(ForInCacheArray) \ 98 V(ForInCacheArray) \
98 V(ForInPrepareMap) \ 99 V(ForInPrepareMap) \
99 V(FunctionLiteral) \ 100 V(FunctionLiteral) \
100 V(GetCachedArrayIndex) \ 101 V(GetCachedArrayIndex) \
101 V(Goto) \ 102 V(Goto) \
102 V(HasCachedArrayIndexAndBranch) \ 103 V(HasCachedArrayIndexAndBranch) \
103 V(HasInstanceTypeAndBranch) \ 104 V(HasInstanceTypeAndBranch) \
104 V(InnerAllocatedObject) \ 105 V(InnerAllocatedObject) \
105 V(InstanceOf) \ 106 V(InstanceOf) \
106 V(InstanceOfKnownGlobal) \ 107 V(InstanceOfKnownGlobal) \
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 } 661 }
661 662
662 LOperand* left() { return inputs_[0]; } 663 LOperand* left() { return inputs_[0]; }
663 LOperand* right() { return inputs_[1]; } 664 LOperand* right() { return inputs_[1]; }
664 665
665 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i") 666 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
666 DECLARE_HYDROGEN_ACCESSOR(BinaryOperation) 667 DECLARE_HYDROGEN_ACCESSOR(BinaryOperation)
667 }; 668 };
668 669
669 670
670 class LFlooringDivByConstI V8_FINAL : public LTemplateInstruction<1, 2, 1> { 671 class LFlooringDivByPowerOf2I V8_FINAL : public LTemplateInstruction<1, 1, 0> {
671 public: 672 public:
672 LFlooringDivByConstI(LOperand* dividend, LOperand* divisor, LOperand* temp) { 673 LFlooringDivByPowerOf2I(LOperand* dividend, int32_t divisor) {
673 inputs_[0] = dividend; 674 inputs_[0] = dividend;
674 inputs_[1] = divisor; 675 divisor_ = divisor;
675 temps_[0] = temp;
676 } 676 }
677 677
678 LOperand* dividend() { return inputs_[0]; } 678 LOperand* dividend() { return inputs_[0]; }
679 LOperand* divisor() { return inputs_[1]; } 679 int32_t divisor() { return divisor_; }
680 LOperand* temp() { return temps_[0]; } 680
681 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByPowerOf2I,
682 "flooring-div-by-power-of-2-i")
683 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
684
685 private:
686 int32_t divisor_;
687 };
688
689
690 class LFlooringDivByConstI V8_FINAL : public LTemplateInstruction<1, 1, 0> {
691 public:
692 LFlooringDivByConstI(LOperand* dividend, int32_t divisor) {
693 inputs_[0] = dividend;
694 divisor_ = divisor;
695 }
696
697 LOperand* dividend() { return inputs_[0]; }
698 int32_t divisor() const { return divisor_; }
699 LOperand* temp1() { return temps_[0]; }
681 700
682 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByConstI, "flooring-div-by-const-i") 701 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByConstI, "flooring-div-by-const-i")
683 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv) 702 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
703
704 private:
705 int32_t divisor_;
684 }; 706 };
685 707
686 708
687 class LMathFloorOfDiv V8_FINAL : public LTemplateInstruction<1, 2, 1> { 709 class LMathFloorOfDiv V8_FINAL : public LTemplateInstruction<1, 2, 1> {
688 public: 710 public:
689 LMathFloorOfDiv(LOperand* left, 711 LMathFloorOfDiv(LOperand* left,
690 LOperand* right, 712 LOperand* right,
691 LOperand* temp = NULL) { 713 LOperand* temp = NULL) {
692 inputs_[0] = left; 714 inputs_[0] = left;
693 inputs_[1] = right; 715 inputs_[1] = right;
(...skipping 1948 matching lines...) Expand 10 before | Expand all | Expand 10 after
2642 LInstruction* DoMathRound(HUnaryMathOperation* instr); 2664 LInstruction* DoMathRound(HUnaryMathOperation* instr);
2643 LInstruction* DoMathAbs(HUnaryMathOperation* instr); 2665 LInstruction* DoMathAbs(HUnaryMathOperation* instr);
2644 LInstruction* DoMathLog(HUnaryMathOperation* instr); 2666 LInstruction* DoMathLog(HUnaryMathOperation* instr);
2645 LInstruction* DoMathExp(HUnaryMathOperation* instr); 2667 LInstruction* DoMathExp(HUnaryMathOperation* instr);
2646 LInstruction* DoMathSqrt(HUnaryMathOperation* instr); 2668 LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
2647 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr); 2669 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
2648 LInstruction* DoMathClz32(HUnaryMathOperation* instr); 2670 LInstruction* DoMathClz32(HUnaryMathOperation* instr);
2649 LInstruction* DoDivI(HBinaryOperation* instr); 2671 LInstruction* DoDivI(HBinaryOperation* instr);
2650 LInstruction* DoModByPowerOf2I(HMod* instr); 2672 LInstruction* DoModByPowerOf2I(HMod* instr);
2651 LInstruction* DoModI(HMod* instr); 2673 LInstruction* DoModI(HMod* instr);
2674 LInstruction* DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr);
2652 LInstruction* DoFlooringDivByConstI(HMathFloorOfDiv* instr); 2675 LInstruction* DoFlooringDivByConstI(HMathFloorOfDiv* instr);
2653 2676
2654 private: 2677 private:
2655 enum Status { 2678 enum Status {
2656 UNUSED, 2679 UNUSED,
2657 BUILDING, 2680 BUILDING,
2658 DONE, 2681 DONE,
2659 ABORTED 2682 ABORTED
2660 }; 2683 };
2661 2684
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
2766 2789
2767 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2790 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2768 }; 2791 };
2769 2792
2770 #undef DECLARE_HYDROGEN_ACCESSOR 2793 #undef DECLARE_HYDROGEN_ACCESSOR
2771 #undef DECLARE_CONCRETE_INSTRUCTION 2794 #undef DECLARE_CONCRETE_INSTRUCTION
2772 2795
2773 } } // namespace v8::internal 2796 } } // namespace v8::internal
2774 2797
2775 #endif // V8_MIPS_LITHIUM_MIPS_H_ 2798 #endif // V8_MIPS_LITHIUM_MIPS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698