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

Side by Side Diff: src/arm/lithium-arm.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/a64/lithium-codegen-a64.cc ('k') | src/arm/lithium-arm.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(DivByPowerOf2I) \
88 V(DivI) \ 89 V(DivI) \
89 V(DoubleToI) \ 90 V(DoubleToI) \
90 V(DoubleToSmi) \ 91 V(DoubleToSmi) \
91 V(Drop) \ 92 V(Drop) \
92 V(Dummy) \ 93 V(Dummy) \
93 V(DummyUse) \ 94 V(DummyUse) \
95 V(FlooringDivByConstI) \
96 V(FlooringDivByPowerOf2I) \
94 V(ForInCacheArray) \ 97 V(ForInCacheArray) \
95 V(ForInPrepareMap) \ 98 V(ForInPrepareMap) \
96 V(FunctionLiteral) \ 99 V(FunctionLiteral) \
97 V(GetCachedArrayIndex) \ 100 V(GetCachedArrayIndex) \
98 V(Goto) \ 101 V(Goto) \
99 V(HasCachedArrayIndexAndBranch) \ 102 V(HasCachedArrayIndexAndBranch) \
100 V(HasInstanceTypeAndBranch) \ 103 V(HasInstanceTypeAndBranch) \
101 V(InnerAllocatedObject) \ 104 V(InnerAllocatedObject) \
102 V(InstanceOf) \ 105 V(InstanceOf) \
103 V(InstanceOfKnownGlobal) \ 106 V(InstanceOfKnownGlobal) \
(...skipping 16 matching lines...) Expand all
120 V(LoadGlobalGeneric) \ 123 V(LoadGlobalGeneric) \
121 V(LoadKeyed) \ 124 V(LoadKeyed) \
122 V(LoadKeyedGeneric) \ 125 V(LoadKeyedGeneric) \
123 V(LoadNamedField) \ 126 V(LoadNamedField) \
124 V(LoadNamedGeneric) \ 127 V(LoadNamedGeneric) \
125 V(MapEnumLength) \ 128 V(MapEnumLength) \
126 V(MathAbs) \ 129 V(MathAbs) \
127 V(MathClz32) \ 130 V(MathClz32) \
128 V(MathExp) \ 131 V(MathExp) \
129 V(MathFloor) \ 132 V(MathFloor) \
130 V(MathFloorOfDiv) \
131 V(MathLog) \ 133 V(MathLog) \
132 V(MathMinMax) \ 134 V(MathMinMax) \
133 V(MathPowHalf) \ 135 V(MathPowHalf) \
134 V(MathRound) \ 136 V(MathRound) \
135 V(MathSqrt) \ 137 V(MathSqrt) \
138 V(ModByPowerOf2I) \
136 V(ModI) \ 139 V(ModI) \
137 V(MulI) \ 140 V(MulI) \
138 V(MultiplyAddD) \ 141 V(MultiplyAddD) \
139 V(MultiplySubD) \ 142 V(MultiplySubD) \
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) \
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 }; 611 };
609 612
610 613
611 class LArgumentsElements V8_FINAL : public LTemplateInstruction<1, 0, 0> { 614 class LArgumentsElements V8_FINAL : public LTemplateInstruction<1, 0, 0> {
612 public: 615 public:
613 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements") 616 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
614 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements) 617 DECLARE_HYDROGEN_ACCESSOR(ArgumentsElements)
615 }; 618 };
616 619
617 620
621 class LModByPowerOf2I V8_FINAL : public LTemplateInstruction<1, 1, 0> {
622 public:
623 LModByPowerOf2I(LOperand* dividend, int32_t divisor) {
624 inputs_[0] = dividend;
625 divisor_ = divisor;
626 }
627
628 LOperand* dividend() { return inputs_[0]; }
629 int32_t divisor() const { return divisor_; }
630
631 DECLARE_CONCRETE_INSTRUCTION(ModByPowerOf2I, "mod-by-power-of-2-i")
632 DECLARE_HYDROGEN_ACCESSOR(Mod)
633
634 private:
635 int32_t divisor_;
636 };
637
638
618 class LModI V8_FINAL : public LTemplateInstruction<1, 2, 2> { 639 class LModI V8_FINAL : public LTemplateInstruction<1, 2, 2> {
619 public: 640 public:
620 LModI(LOperand* left, 641 LModI(LOperand* left, LOperand* right, LOperand* temp, LOperand* temp2) {
621 LOperand* right,
622 LOperand* temp = NULL,
623 LOperand* temp2 = NULL) {
624 inputs_[0] = left; 642 inputs_[0] = left;
625 inputs_[1] = right; 643 inputs_[1] = right;
626 temps_[0] = temp; 644 temps_[0] = temp;
627 temps_[1] = temp2; 645 temps_[1] = temp2;
628 } 646 }
629 647
630 LOperand* left() { return inputs_[0]; } 648 LOperand* left() { return inputs_[0]; }
631 LOperand* right() { return inputs_[1]; } 649 LOperand* right() { return inputs_[1]; }
632 LOperand* temp() { return temps_[0]; } 650 LOperand* temp() { return temps_[0]; }
633 LOperand* temp2() { return temps_[1]; } 651 LOperand* temp2() { return temps_[1]; }
634 652
635 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i") 653 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
636 DECLARE_HYDROGEN_ACCESSOR(Mod) 654 DECLARE_HYDROGEN_ACCESSOR(Mod)
637 }; 655 };
638 656
639 657
658 class LDivByPowerOf2I V8_FINAL : public LTemplateInstruction<1, 1, 0> {
659 public:
660 LDivByPowerOf2I(LOperand* dividend, int32_t divisor) {
661 inputs_[0] = dividend;
662 divisor_ = divisor;
663 }
664
665 LOperand* dividend() { return inputs_[0]; }
666 int32_t divisor() const { return divisor_; }
667
668 DECLARE_CONCRETE_INSTRUCTION(DivByPowerOf2I, "div-by-power-of-2-i")
669 DECLARE_HYDROGEN_ACCESSOR(Div)
670
671 private:
672 int32_t divisor_;
673 };
674
675
640 class LDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> { 676 class LDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
641 public: 677 public:
642 LDivI(LOperand* left, LOperand* right, LOperand* temp) { 678 LDivI(LOperand* left, LOperand* right, LOperand* temp) {
643 inputs_[0] = left; 679 inputs_[0] = left;
644 inputs_[1] = right; 680 inputs_[1] = right;
645 temps_[0] = temp; 681 temps_[0] = temp;
646 } 682 }
647 683
648 LOperand* left() { return inputs_[0]; } 684 LOperand* left() { return inputs_[0]; }
649 LOperand* right() { return inputs_[1]; } 685 LOperand* right() { return inputs_[1]; }
650 LOperand* temp() { return temps_[0]; } 686 LOperand* temp() { return temps_[0]; }
651 687
652 bool is_flooring() { return hydrogen_value()->IsMathFloorOfDiv(); } 688 bool is_flooring() { return hydrogen_value()->IsMathFloorOfDiv(); }
653 689
654 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i") 690 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
655 DECLARE_HYDROGEN_ACCESSOR(Div) 691 DECLARE_HYDROGEN_ACCESSOR(BinaryOperation)
656 }; 692 };
657 693
658 694
659 class LMathFloorOfDiv V8_FINAL : public LTemplateInstruction<1, 2, 1> { 695 class LFlooringDivByPowerOf2I V8_FINAL : public LTemplateInstruction<1, 1, 0> {
660 public: 696 public:
661 LMathFloorOfDiv(LOperand* left, 697 LFlooringDivByPowerOf2I(LOperand* dividend, int32_t divisor) {
662 LOperand* right, 698 inputs_[0] = dividend;
663 LOperand* temp = NULL) { 699 divisor_ = divisor;
664 inputs_[0] = left; 700 }
665 inputs_[1] = right; 701
702 LOperand* dividend() { return inputs_[0]; }
703 int32_t divisor() { return divisor_; }
704
705 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByPowerOf2I,
706 "flooring-div-by-power-of-2-i")
707 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
708
709 private:
710 int32_t divisor_;
711 };
712
713
714 class LFlooringDivByConstI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
715 public:
716 LFlooringDivByConstI(LOperand* dividend, LOperand* divisor, LOperand* temp) {
717 inputs_[0] = dividend;
718 inputs_[1] = divisor;
666 temps_[0] = temp; 719 temps_[0] = temp;
667 } 720 }
668 721
669 LOperand* left() { return inputs_[0]; } 722 LOperand* dividend() { return inputs_[0]; }
670 LOperand* right() { return inputs_[1]; } 723 LOperand* divisor() { return inputs_[1]; }
671 LOperand* temp() { return temps_[0]; } 724 LOperand* temp() { return temps_[0]; }
672 725
673 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv, "math-floor-of-div") 726 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByConstI, "flooring-div-by-const-i")
674 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv) 727 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
675 }; 728 };
676 729
677 730
678 class LMulI V8_FINAL : public LTemplateInstruction<1, 2, 0> { 731 class LMulI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
679 public: 732 public:
680 LMulI(LOperand* left, LOperand* right) { 733 LMulI(LOperand* left, LOperand* right) {
681 inputs_[0] = left; 734 inputs_[0] = left;
682 inputs_[1] = right; 735 inputs_[1] = right;
683 } 736 }
(...skipping 1937 matching lines...) Expand 10 before | Expand all | Expand 10 after
2621 static bool HasMagicNumberForDivisor(int32_t divisor); 2674 static bool HasMagicNumberForDivisor(int32_t divisor);
2622 2675
2623 LInstruction* DoMathFloor(HUnaryMathOperation* instr); 2676 LInstruction* DoMathFloor(HUnaryMathOperation* instr);
2624 LInstruction* DoMathRound(HUnaryMathOperation* instr); 2677 LInstruction* DoMathRound(HUnaryMathOperation* instr);
2625 LInstruction* DoMathAbs(HUnaryMathOperation* instr); 2678 LInstruction* DoMathAbs(HUnaryMathOperation* instr);
2626 LInstruction* DoMathLog(HUnaryMathOperation* instr); 2679 LInstruction* DoMathLog(HUnaryMathOperation* instr);
2627 LInstruction* DoMathExp(HUnaryMathOperation* instr); 2680 LInstruction* DoMathExp(HUnaryMathOperation* instr);
2628 LInstruction* DoMathSqrt(HUnaryMathOperation* instr); 2681 LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
2629 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr); 2682 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
2630 LInstruction* DoMathClz32(HUnaryMathOperation* instr); 2683 LInstruction* DoMathClz32(HUnaryMathOperation* instr);
2684 LInstruction* DoDivByPowerOf2I(HDiv* instr);
2685 LInstruction* DoDivI(HBinaryOperation* instr);
2686 LInstruction* DoModByPowerOf2I(HMod* instr);
2687 LInstruction* DoModI(HMod* instr);
2688 LInstruction* DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr);
2689 LInstruction* DoFlooringDivByConstI(HMathFloorOfDiv* instr);
2631 2690
2632 private: 2691 private:
2633 enum Status { 2692 enum Status {
2634 UNUSED, 2693 UNUSED,
2635 BUILDING, 2694 BUILDING,
2636 DONE, 2695 DONE,
2637 ABORTED 2696 ABORTED
2638 }; 2697 };
2639 2698
2640 LPlatformChunk* chunk() const { return chunk_; } 2699 LPlatformChunk* chunk() const { return chunk_; }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2743 2802
2744 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2803 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2745 }; 2804 };
2746 2805
2747 #undef DECLARE_HYDROGEN_ACCESSOR 2806 #undef DECLARE_HYDROGEN_ACCESSOR
2748 #undef DECLARE_CONCRETE_INSTRUCTION 2807 #undef DECLARE_CONCRETE_INSTRUCTION
2749 2808
2750 } } // namespace v8::internal 2809 } } // namespace v8::internal
2751 2810
2752 #endif // V8_ARM_LITHIUM_ARM_H_ 2811 #endif // V8_ARM_LITHIUM_ARM_H_
OLDNEW
« no previous file with comments | « src/a64/lithium-codegen-a64.cc ('k') | src/arm/lithium-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698