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

Side by Side Diff: src/x64/lithium-x64.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/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(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(DummyUse) \ 93 V(DummyUse) \
93 V(Dummy) \ 94 V(Dummy) \
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(NumberTagD) \ 141 V(NumberTagD) \
139 V(NumberTagI) \ 142 V(NumberTagI) \
140 V(NumberTagU) \ 143 V(NumberTagU) \
141 V(NumberUntagD) \ 144 V(NumberUntagD) \
142 V(OsrEntry) \ 145 V(OsrEntry) \
143 V(Parameter) \ 146 V(Parameter) \
144 V(Power) \ 147 V(Power) \
145 V(PushArgument) \ 148 V(PushArgument) \
(...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, 1> { 639 class LModI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
619 public: 640 public:
620 LModI(LOperand* left, LOperand* right, LOperand* temp) { 641 LModI(LOperand* left, LOperand* right, LOperand* temp) {
621 inputs_[0] = left; 642 inputs_[0] = left;
622 inputs_[1] = right; 643 inputs_[1] = right;
623 temps_[0] = temp; 644 temps_[0] = temp;
624 } 645 }
625 646
626 LOperand* left() { return inputs_[0]; } 647 LOperand* left() { return inputs_[0]; }
627 LOperand* right() { return inputs_[1]; } 648 LOperand* right() { return inputs_[1]; }
628 LOperand* temp() { return temps_[0]; } 649 LOperand* temp() { return temps_[0]; }
629 650
630 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i") 651 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
631 DECLARE_HYDROGEN_ACCESSOR(Mod) 652 DECLARE_HYDROGEN_ACCESSOR(Mod)
632 }; 653 };
633 654
634 655
656 class LDivByPowerOf2I V8_FINAL : public LTemplateInstruction<1, 1, 0> {
657 public:
658 LDivByPowerOf2I(LOperand* dividend, int32_t divisor) {
659 inputs_[0] = dividend;
660 divisor_ = divisor;
661 }
662
663 LOperand* dividend() { return inputs_[0]; }
664 int32_t divisor() const { return divisor_; }
665
666 DECLARE_CONCRETE_INSTRUCTION(DivByPowerOf2I, "div-by-power-of-2-i")
667 DECLARE_HYDROGEN_ACCESSOR(Div)
668
669 private:
670 int32_t divisor_;
671 };
672
673
635 class LDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> { 674 class LDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
636 public: 675 public:
637 LDivI(LOperand* left, LOperand* right, LOperand* temp) { 676 LDivI(LOperand* left, LOperand* right, LOperand* temp) {
638 inputs_[0] = left; 677 inputs_[0] = left;
639 inputs_[1] = right; 678 inputs_[1] = right;
640 temps_[0] = temp; 679 temps_[0] = temp;
641 } 680 }
642 681
643 LOperand* left() { return inputs_[0]; } 682 LOperand* left() { return inputs_[0]; }
644 LOperand* right() { return inputs_[1]; } 683 LOperand* right() { return inputs_[1]; }
645 LOperand* temp() { return temps_[0]; } 684 LOperand* temp() { return temps_[0]; }
646 685
647 bool is_flooring() { return hydrogen_value()->IsMathFloorOfDiv(); } 686 bool is_flooring() { return hydrogen_value()->IsMathFloorOfDiv(); }
648 687
649 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i") 688 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
650 DECLARE_HYDROGEN_ACCESSOR(Div) 689 DECLARE_HYDROGEN_ACCESSOR(BinaryOperation)
651 }; 690 };
652 691
653 692
654 class LMathFloorOfDiv V8_FINAL : public LTemplateInstruction<1, 2, 1> { 693 class LFlooringDivByPowerOf2I V8_FINAL : public LTemplateInstruction<1, 1, 0> {
655 public: 694 public:
656 LMathFloorOfDiv(LOperand* left, 695 LFlooringDivByPowerOf2I(LOperand* dividend, int32_t divisor) {
657 LOperand* right, 696 inputs_[0] = dividend;
658 LOperand* temp = NULL) { 697 divisor_ = divisor;
659 inputs_[0] = left; 698 }
660 inputs_[1] = right; 699
700 LOperand* dividend() { return inputs_[0]; }
701 int32_t divisor() const { return divisor_; }
702
703 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByPowerOf2I,
704 "flooring-div-by-power-of-2-i")
705 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
706
707 private:
708 int32_t divisor_;
709 };
710
711
712 class LFlooringDivByConstI V8_FINAL : public LTemplateInstruction<1, 1, 1> {
713 public:
714 LFlooringDivByConstI(LOperand* dividend, int32_t divisor, LOperand* temp) {
715 inputs_[0] = dividend;
716 divisor_ = divisor;
661 temps_[0] = temp; 717 temps_[0] = temp;
662 } 718 }
663 719
664 LOperand* left() { return inputs_[0]; } 720 LOperand* dividend() { return inputs_[0]; }
665 LOperand* right() { return inputs_[1]; } 721 int32_t divisor() const { return divisor_; }
666 LOperand* temp() { return temps_[0]; } 722 LOperand* temp() { return temps_[0]; }
667 723
668 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv, "math-floor-of-div") 724 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByConstI, "flooring-div-by-const-i")
669 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv) 725 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
726
727 private:
728 int32_t divisor_;
670 }; 729 };
671 730
672 731
673 class LMulI V8_FINAL : public LTemplateInstruction<1, 2, 0> { 732 class LMulI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
674 public: 733 public:
675 LMulI(LOperand* left, LOperand* right) { 734 LMulI(LOperand* left, LOperand* right) {
676 inputs_[0] = left; 735 inputs_[0] = left;
677 inputs_[1] = right; 736 inputs_[1] = right;
678 } 737 }
679 738
(...skipping 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after
2538 #undef DECLARE_DO 2597 #undef DECLARE_DO
2539 2598
2540 LInstruction* DoMathFloor(HUnaryMathOperation* instr); 2599 LInstruction* DoMathFloor(HUnaryMathOperation* instr);
2541 LInstruction* DoMathRound(HUnaryMathOperation* instr); 2600 LInstruction* DoMathRound(HUnaryMathOperation* instr);
2542 LInstruction* DoMathAbs(HUnaryMathOperation* instr); 2601 LInstruction* DoMathAbs(HUnaryMathOperation* instr);
2543 LInstruction* DoMathLog(HUnaryMathOperation* instr); 2602 LInstruction* DoMathLog(HUnaryMathOperation* instr);
2544 LInstruction* DoMathExp(HUnaryMathOperation* instr); 2603 LInstruction* DoMathExp(HUnaryMathOperation* instr);
2545 LInstruction* DoMathSqrt(HUnaryMathOperation* instr); 2604 LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
2546 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr); 2605 LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
2547 LInstruction* DoMathClz32(HUnaryMathOperation* instr); 2606 LInstruction* DoMathClz32(HUnaryMathOperation* instr);
2607 LInstruction* DoDivByPowerOf2I(HDiv* instr);
2608 LInstruction* DoDivI(HBinaryOperation* instr);
2609 LInstruction* DoModByPowerOf2I(HMod* instr);
2610 LInstruction* DoModI(HMod* instr);
2611 LInstruction* DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr);
2612 LInstruction* DoFlooringDivByConstI(HMathFloorOfDiv* instr);
2548 2613
2549 private: 2614 private:
2550 enum Status { 2615 enum Status {
2551 UNUSED, 2616 UNUSED,
2552 BUILDING, 2617 BUILDING,
2553 DONE, 2618 DONE,
2554 ABORTED 2619 ABORTED
2555 }; 2620 };
2556 2621
2557 LPlatformChunk* chunk() const { return chunk_; } 2622 LPlatformChunk* chunk() const { return chunk_; }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2667 2732
2668 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2733 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2669 }; 2734 };
2670 2735
2671 #undef DECLARE_HYDROGEN_ACCESSOR 2736 #undef DECLARE_HYDROGEN_ACCESSOR
2672 #undef DECLARE_CONCRETE_INSTRUCTION 2737 #undef DECLARE_CONCRETE_INSTRUCTION
2673 2738
2674 } } // namespace v8::int 2739 } } // namespace v8::int
2675 2740
2676 #endif // V8_X64_LITHIUM_X64_H_ 2741 #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