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

Side by Side Diff: src/crankshaft/x64/lithium-x64.h

Issue 1841513003: [crankshaft] Address the deoptimization loops of Math.floor, Math.round and Math.ceil. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Register constraints in Crankshaft are fun Created 4 years, 8 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/crankshaft/x64/lithium-codegen-x64.cc ('k') | src/crankshaft/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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_CRANKSHAFT_X64_LITHIUM_X64_H_ 5 #ifndef V8_CRANKSHAFT_X64_LITHIUM_X64_H_
6 #define V8_CRANKSHAFT_X64_LITHIUM_X64_H_ 6 #define V8_CRANKSHAFT_X64_LITHIUM_X64_H_
7 7
8 #include "src/crankshaft/hydrogen.h" 8 #include "src/crankshaft/hydrogen.h"
9 #include "src/crankshaft/lithium.h" 9 #include "src/crankshaft/lithium.h"
10 #include "src/crankshaft/lithium-allocator.h" 10 #include "src/crankshaft/lithium-allocator.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 V(LoadFieldByIndex) \ 92 V(LoadFieldByIndex) \
93 V(LoadFunctionPrototype) \ 93 V(LoadFunctionPrototype) \
94 V(LoadGlobalGeneric) \ 94 V(LoadGlobalGeneric) \
95 V(LoadKeyed) \ 95 V(LoadKeyed) \
96 V(LoadKeyedGeneric) \ 96 V(LoadKeyedGeneric) \
97 V(LoadNamedField) \ 97 V(LoadNamedField) \
98 V(LoadNamedGeneric) \ 98 V(LoadNamedGeneric) \
99 V(MathAbs) \ 99 V(MathAbs) \
100 V(MathClz32) \ 100 V(MathClz32) \
101 V(MathExp) \ 101 V(MathExp) \
102 V(MathFloor) \ 102 V(MathFloorD) \
103 V(MathFloorI) \
103 V(MathFround) \ 104 V(MathFround) \
104 V(MathLog) \ 105 V(MathLog) \
105 V(MathMinMax) \ 106 V(MathMinMax) \
106 V(MathPowHalf) \ 107 V(MathPowHalf) \
107 V(MathRound) \ 108 V(MathRoundD) \
109 V(MathRoundI) \
108 V(MathSqrt) \ 110 V(MathSqrt) \
109 V(MaybeGrowElements) \ 111 V(MaybeGrowElements) \
110 V(ModByConstI) \ 112 V(ModByConstI) \
111 V(ModByPowerOf2I) \ 113 V(ModByPowerOf2I) \
112 V(ModI) \ 114 V(ModI) \
113 V(MulI) \ 115 V(MulI) \
114 V(NumberTagD) \ 116 V(NumberTagD) \
115 V(NumberTagI) \ 117 V(NumberTagI) \
116 V(NumberTagU) \ 118 V(NumberTagU) \
117 V(NumberUntagD) \ 119 V(NumberUntagD) \
(...skipping 24 matching lines...) Expand all
142 V(TaggedToI) \ 144 V(TaggedToI) \
143 V(ThisFunction) \ 145 V(ThisFunction) \
144 V(TransitionElementsKind) \ 146 V(TransitionElementsKind) \
145 V(TrapAllocationMemento) \ 147 V(TrapAllocationMemento) \
146 V(Typeof) \ 148 V(Typeof) \
147 V(TypeofIsAndBranch) \ 149 V(TypeofIsAndBranch) \
148 V(Uint32ToDouble) \ 150 V(Uint32ToDouble) \
149 V(UnknownOSRValue) \ 151 V(UnknownOSRValue) \
150 V(WrapReceiver) 152 V(WrapReceiver)
151 153
152
153 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \ 154 #define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
154 Opcode opcode() const final { return LInstruction::k##type; } \ 155 Opcode opcode() const final { return LInstruction::k##type; } \
155 void CompileToNative(LCodeGen* generator) final; \ 156 void CompileToNative(LCodeGen* generator) final; \
156 const char* Mnemonic() const final { return mnemonic; } \ 157 const char* Mnemonic() const final { return mnemonic; } \
157 static L##type* cast(LInstruction* instr) { \ 158 static L##type* cast(LInstruction* instr) { \
158 DCHECK(instr->Is##type()); \ 159 DCHECK(instr->Is##type()); \
159 return reinterpret_cast<L##type*>(instr); \ 160 return reinterpret_cast<L##type*>(instr); \
160 } 161 }
161 162
162 163
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 DECLARE_HYDROGEN_ACCESSOR(CompareNumericAndBranch) 806 DECLARE_HYDROGEN_ACCESSOR(CompareNumericAndBranch)
806 807
807 Token::Value op() const { return hydrogen()->token(); } 808 Token::Value op() const { return hydrogen()->token(); }
808 bool is_double() const { 809 bool is_double() const {
809 return hydrogen()->representation().IsDouble(); 810 return hydrogen()->representation().IsDouble();
810 } 811 }
811 812
812 void PrintDataTo(StringStream* stream) override; 813 void PrintDataTo(StringStream* stream) override;
813 }; 814 };
814 815
815 816 // Math.floor with a double result.
816 class LMathFloor final : public LTemplateInstruction<1, 1, 0> { 817 class LMathFloorD final : public LTemplateInstruction<1, 1, 0> {
817 public: 818 public:
818 explicit LMathFloor(LOperand* value) { 819 explicit LMathFloorD(LOperand* value) { inputs_[0] = value; }
819 inputs_[0] = value;
820 }
821 820
822 LOperand* value() { return inputs_[0]; } 821 LOperand* value() { return inputs_[0]; }
823 822
824 DECLARE_CONCRETE_INSTRUCTION(MathFloor, "math-floor") 823 DECLARE_CONCRETE_INSTRUCTION(MathFloorD, "math-floor-d")
825 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) 824 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
826 }; 825 };
827 826
827 // Math.floor with an integer result.
828 class LMathFloorI final : public LTemplateInstruction<1, 1, 0> {
829 public:
830 explicit LMathFloorI(LOperand* value) { inputs_[0] = value; }
828 831
829 class LMathRound final : public LTemplateInstruction<1, 1, 1> { 832 LOperand* value() { return inputs_[0]; }
833
834 DECLARE_CONCRETE_INSTRUCTION(MathFloorI, "math-floor-i")
835 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
836 };
837
838 // Math.round with a double result.
839 class LMathRoundD final : public LTemplateInstruction<1, 1, 0> {
830 public: 840 public:
831 LMathRound(LOperand* value, LOperand* temp) { 841 explicit LMathRoundD(LOperand* value) { inputs_[0] = value; }
842
843 LOperand* value() { return inputs_[0]; }
844
845 DECLARE_CONCRETE_INSTRUCTION(MathRoundD, "math-round-d")
846 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
847 };
848
849 // Math.round with an integer result.
850 class LMathRoundI final : public LTemplateInstruction<1, 1, 1> {
851 public:
852 LMathRoundI(LOperand* value, LOperand* temp) {
832 inputs_[0] = value; 853 inputs_[0] = value;
833 temps_[0] = temp; 854 temps_[0] = temp;
834 } 855 }
835 856
836 LOperand* value() { return inputs_[0]; } 857 LOperand* value() { return inputs_[0]; }
837 LOperand* temp() { return temps_[0]; } 858 LOperand* temp() { return temps_[0]; }
838 859
839 DECLARE_CONCRETE_INSTRUCTION(MathRound, "math-round") 860 DECLARE_CONCRETE_INSTRUCTION(MathRoundI, "math-round-i")
840 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) 861 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
841 }; 862 };
842 863
843 864
844 class LMathFround final : public LTemplateInstruction<1, 1, 0> { 865 class LMathFround final : public LTemplateInstruction<1, 1, 0> {
845 public: 866 public:
846 explicit LMathFround(LOperand* value) { inputs_[0] = value; } 867 explicit LMathFround(LOperand* value) { inputs_[0] = value; }
847 868
848 LOperand* value() { return inputs_[0]; } 869 LOperand* value() { return inputs_[0]; }
849 870
(...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after
2649 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2670 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2650 }; 2671 };
2651 2672
2652 #undef DECLARE_HYDROGEN_ACCESSOR 2673 #undef DECLARE_HYDROGEN_ACCESSOR
2653 #undef DECLARE_CONCRETE_INSTRUCTION 2674 #undef DECLARE_CONCRETE_INSTRUCTION
2654 2675
2655 } // namespace internal 2676 } // namespace internal
2656 } // namespace v8 2677 } // namespace v8
2657 2678
2658 #endif // V8_CRANKSHAFT_X64_LITHIUM_X64_H_ 2679 #endif // V8_CRANKSHAFT_X64_LITHIUM_X64_H_
OLDNEW
« no previous file with comments | « src/crankshaft/x64/lithium-codegen-x64.cc ('k') | src/crankshaft/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698