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

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

Issue 189433008: MIPS: Consistenly handle 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
« 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(DivI) \ 88 V(DivI) \
89 V(DoubleToI) \ 89 V(DoubleToI) \
90 V(DoubleToSmi) \ 90 V(DoubleToSmi) \
91 V(Drop) \ 91 V(Drop) \
92 V(Dummy) \ 92 V(Dummy) \
93 V(DummyUse) \ 93 V(DummyUse) \
94 V(FlooringDivByConstI) \
94 V(ForInCacheArray) \ 95 V(ForInCacheArray) \
95 V(ForInPrepareMap) \ 96 V(ForInPrepareMap) \
96 V(FunctionLiteral) \ 97 V(FunctionLiteral) \
97 V(GetCachedArrayIndex) \ 98 V(GetCachedArrayIndex) \
98 V(Goto) \ 99 V(Goto) \
99 V(HasCachedArrayIndexAndBranch) \ 100 V(HasCachedArrayIndexAndBranch) \
100 V(HasInstanceTypeAndBranch) \ 101 V(HasInstanceTypeAndBranch) \
101 V(InnerAllocatedObject) \ 102 V(InnerAllocatedObject) \
102 V(InstanceOf) \ 103 V(InstanceOf) \
103 V(InstanceOfKnownGlobal) \ 104 V(InstanceOfKnownGlobal) \
(...skipping 22 matching lines...) Expand all
126 V(MathAbs) \ 127 V(MathAbs) \
127 V(MathExp) \ 128 V(MathExp) \
128 V(MathClz32) \ 129 V(MathClz32) \
129 V(MathFloor) \ 130 V(MathFloor) \
130 V(MathFloorOfDiv) \ 131 V(MathFloorOfDiv) \
131 V(MathLog) \ 132 V(MathLog) \
132 V(MathMinMax) \ 133 V(MathMinMax) \
133 V(MathPowHalf) \ 134 V(MathPowHalf) \
134 V(MathRound) \ 135 V(MathRound) \
135 V(MathSqrt) \ 136 V(MathSqrt) \
137 V(ModByPowerOf2I) \
136 V(ModI) \ 138 V(ModI) \
137 V(MulI) \ 139 V(MulI) \
138 V(MultiplyAddD) \ 140 V(MultiplyAddD) \
139 V(NumberTagD) \ 141 V(NumberTagD) \
140 V(NumberTagI) \ 142 V(NumberTagI) \
141 V(NumberTagU) \ 143 V(NumberTagU) \
142 V(NumberUntagD) \ 144 V(NumberUntagD) \
143 V(OsrEntry) \ 145 V(OsrEntry) \
144 V(Parameter) \ 146 V(Parameter) \
145 V(Power) \ 147 V(Power) \
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 }; 609 };
608 610
609 611
610 class LArgumentsElements V8_FINAL : public LTemplateInstruction<1, 0, 0> { 612 class LArgumentsElements V8_FINAL : public LTemplateInstruction<1, 0, 0> {
611 public: 613 public:
612 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements") 614 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
613 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements) 615 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
614 }; 616 };
615 617
616 618
619 class LModByPowerOf2I V8_FINAL : public LTemplateInstruction<1, 1, 0> {
620 public:
621 LModByPowerOf2I(LOperand* dividend, int32_t divisor) {
622 inputs_[0] = dividend;
623 divisor_ = divisor;
624 }
625
626 LOperand* dividend() { return inputs_[0]; }
627 int32_t divisor() const { return divisor_; }
628
629 DECLARE_CONCRETE_INSTRUCTION(ModByPowerOf2I, "mod-by-power-of-2-i")
630 DECLARE_HYDROGEN_ACCESSOR(Mod)
631
632 private:
633 int32_t divisor_;
634 };
635
636
617 class LModI V8_FINAL : public LTemplateInstruction<1, 2, 3> { 637 class LModI V8_FINAL : public LTemplateInstruction<1, 2, 3> {
618 public: 638 public:
619 // Used when the right hand is a constant power of 2.
620 LModI(LOperand* left, 639 LModI(LOperand* left,
621 LOperand* right) { 640 LOperand* right) {
622 inputs_[0] = left; 641 inputs_[0] = left;
623 inputs_[1] = right; 642 inputs_[1] = right;
624 temps_[0] = NULL;
625 temps_[1] = NULL;
626 temps_[2] = NULL;
627 }
628
629 // Used for the standard case.
630 LModI(LOperand* left,
631 LOperand* right,
632 LOperand* temp,
633 LOperand* temp2,
634 LOperand* temp3) {
635 inputs_[0] = left;
636 inputs_[1] = right;
637 temps_[0] = temp;
638 temps_[1] = temp2;
639 temps_[2] = temp3;
640 } 643 }
641 644
642 LOperand* left() { return inputs_[0]; } 645 LOperand* left() { return inputs_[0]; }
643 LOperand* right() { return inputs_[1]; } 646 LOperand* right() { return inputs_[1]; }
644 LOperand* temp() { return temps_[0]; }
645 LOperand* temp2() { return temps_[1]; }
646 LOperand* temp3() { return temps_[2]; }
647 647
648 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i") 648 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
649 DECLARE_HYDROGEN_ACCESSOR(Mod) 649 DECLARE_HYDROGEN_ACCESSOR(Mod)
650 }; 650 };
651 651
652 652
653 class LDivI V8_FINAL : public LTemplateInstruction<1, 2, 0> { 653 class LDivI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
654 public: 654 public:
655 LDivI(LOperand* left, LOperand* right) { 655 LDivI(LOperand* left, LOperand* right) {
656 inputs_[0] = left; 656 inputs_[0] = left;
657 inputs_[1] = right; 657 inputs_[1] = right;
658 } 658 }
659 659
660 LOperand* left() { return inputs_[0]; } 660 LOperand* left() { return inputs_[0]; }
661 LOperand* right() { return inputs_[1]; } 661 LOperand* right() { return inputs_[1]; }
662 662
663 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i") 663 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
664 DECLARE_HYDROGEN_ACCESSOR(Div) 664 DECLARE_HYDROGEN_ACCESSOR(BinaryOperation)
665 }; 665 };
666 666
667 667
668 class LFlooringDivByConstI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
669 public:
670 LFlooringDivByConstI(LOperand* dividend, LOperand* divisor, LOperand* temp) {
671 inputs_[0] = dividend;
672 inputs_[1] = divisor;
673 temps_[0] = temp;
674 }
675
676 LOperand* dividend() { return inputs_[0]; }
677 LOperand* divisor() { return inputs_[1]; }
678 LOperand* temp() { return temps_[0]; }
679
680 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByConstI, "flooring-div-by-const-i")
681 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
682 };
683
684
668 class LMathFloorOfDiv V8_FINAL : public LTemplateInstruction<1, 2, 1> { 685 class LMathFloorOfDiv V8_FINAL : public LTemplateInstruction<1, 2, 1> {
669 public: 686 public:
670 LMathFloorOfDiv(LOperand* left, 687 LMathFloorOfDiv(LOperand* left,
671 LOperand* right, 688 LOperand* right,
672 LOperand* temp = NULL) { 689 LOperand* temp = NULL) {
673 inputs_[0] = left; 690 inputs_[0] = left;
674 inputs_[1] = right; 691 inputs_[1] = right;
675 temps_[0] = temp; 692 temps_[0] = temp;
676 } 693 }
677 694
(...skipping 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after
2593 static bool HasMagicNumberForDivisor(int32_t divisor); 2610 static bool HasMagicNumberForDivisor(int32_t divisor);
2594 2611
2595 LInstruction* DoMathFloor(HUnaryMathOperation* instr); 2612 LInstruction* DoMathFloor(HUnaryMathOperation* instr);
2596 LInstruction* DoMathRound(HUnaryMathOperation* instr); 2613 LInstruction* DoMathRound(HUnaryMathOperation* instr);
2597 LInstruction* DoMathAbs(HUnaryMathOperation* instr); 2614 LInstruction* DoMathAbs(HUnaryMathOperation* instr);
2598 LInstruction* DoMathLog(HUnaryMathOperation* instr); 2615 LInstruction* DoMathLog(HUnaryMathOperation* instr);
2599 LInstruction* DoMathExp(HUnaryMathOperation* instr); 2616 LInstruction* DoMathExp(HUnaryMathOperation* instr);
2600 LInstruction* DoMathSqrt(HUnaryMathOperation* instr); 2617 LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
2601 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr); 2618 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
2602 LInstruction* DoMathClz32(HUnaryMathOperation* instr); 2619 LInstruction* DoMathClz32(HUnaryMathOperation* instr);
2620 LInstruction* DoDivI(HBinaryOperation* instr);
2621 LInstruction* DoModByPowerOf2I(HMod* instr);
2622 LInstruction* DoModI(HMod* instr);
2623 LInstruction* DoFlooringDivByConstI(HMathFloorOfDiv* instr);
2603 2624
2604 private: 2625 private:
2605 enum Status { 2626 enum Status {
2606 UNUSED, 2627 UNUSED,
2607 BUILDING, 2628 BUILDING,
2608 DONE, 2629 DONE,
2609 ABORTED 2630 ABORTED
2610 }; 2631 };
2611 2632
2612 LPlatformChunk* chunk() const { return chunk_; } 2633 LPlatformChunk* chunk() const { return chunk_; }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
2716 2737
2717 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2738 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2718 }; 2739 };
2719 2740
2720 #undef DECLARE_HYDROGEN_ACCESSOR 2741 #undef DECLARE_HYDROGEN_ACCESSOR
2721 #undef DECLARE_CONCRETE_INSTRUCTION 2742 #undef DECLARE_CONCRETE_INSTRUCTION
2722 2743
2723 } } // namespace v8::internal 2744 } } // namespace v8::internal
2724 2745
2725 #endif // V8_MIPS_LITHIUM_MIPS_H_ 2746 #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