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

Side by Side Diff: src/a64/lithium-a64.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 | « no previous file | src/a64/lithium-a64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 V(ConstantD) \ 82 V(ConstantD) \
83 V(ConstantE) \ 83 V(ConstantE) \
84 V(ConstantI) \ 84 V(ConstantI) \
85 V(ConstantS) \ 85 V(ConstantS) \
86 V(ConstantT) \ 86 V(ConstantT) \
87 V(Context) \ 87 V(Context) \
88 V(DateField) \ 88 V(DateField) \
89 V(DebugBreak) \ 89 V(DebugBreak) \
90 V(DeclareGlobals) \ 90 V(DeclareGlobals) \
91 V(Deoptimize) \ 91 V(Deoptimize) \
92 V(DivByPowerOf2I) \
92 V(DivI) \ 93 V(DivI) \
93 V(DoubleToIntOrSmi) \ 94 V(DoubleToIntOrSmi) \
94 V(Drop) \ 95 V(Drop) \
95 V(Dummy) \ 96 V(Dummy) \
96 V(DummyUse) \ 97 V(DummyUse) \
98 V(FlooringDivByPowerOf2I) \
99 V(FlooringDivI) \
97 V(ForInCacheArray) \ 100 V(ForInCacheArray) \
98 V(ForInPrepareMap) \ 101 V(ForInPrepareMap) \
99 V(FunctionLiteral) \ 102 V(FunctionLiteral) \
100 V(GetCachedArrayIndex) \ 103 V(GetCachedArrayIndex) \
101 V(Goto) \ 104 V(Goto) \
102 V(HasCachedArrayIndexAndBranch) \ 105 V(HasCachedArrayIndexAndBranch) \
103 V(HasInstanceTypeAndBranch) \ 106 V(HasInstanceTypeAndBranch) \
104 V(InnerAllocatedObject) \ 107 V(InnerAllocatedObject) \
105 V(InstanceOf) \ 108 V(InstanceOf) \
106 V(InstanceOfKnownGlobal) \ 109 V(InstanceOfKnownGlobal) \
(...skipping 19 matching lines...) Expand all
126 V(LoadKeyedGeneric) \ 129 V(LoadKeyedGeneric) \
127 V(LoadNamedField) \ 130 V(LoadNamedField) \
128 V(LoadNamedGeneric) \ 131 V(LoadNamedGeneric) \
129 V(LoadRoot) \ 132 V(LoadRoot) \
130 V(MapEnumLength) \ 133 V(MapEnumLength) \
131 V(MathAbs) \ 134 V(MathAbs) \
132 V(MathAbsTagged) \ 135 V(MathAbsTagged) \
133 V(MathClz32) \ 136 V(MathClz32) \
134 V(MathExp) \ 137 V(MathExp) \
135 V(MathFloor) \ 138 V(MathFloor) \
136 V(MathFloorOfDiv) \
137 V(MathLog) \ 139 V(MathLog) \
138 V(MathMinMax) \ 140 V(MathMinMax) \
139 V(MathPowHalf) \ 141 V(MathPowHalf) \
140 V(MathRound) \ 142 V(MathRound) \
141 V(MathSqrt) \ 143 V(MathSqrt) \
144 V(ModByPowerOf2I) \
142 V(ModI) \ 145 V(ModI) \
143 V(MulConstIS) \ 146 V(MulConstIS) \
144 V(MulI) \ 147 V(MulI) \
145 V(MulS) \ 148 V(MulS) \
146 V(NumberTagD) \ 149 V(NumberTagD) \
147 V(NumberTagU) \ 150 V(NumberTagU) \
148 V(NumberUntagD) \ 151 V(NumberUntagD) \
149 V(OsrEntry) \ 152 V(OsrEntry) \
150 V(Parameter) \ 153 V(Parameter) \
151 V(Power) \ 154 V(Power) \
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 }; 1244 };
1242 1245
1243 1246
1244 class LDeoptimize V8_FINAL : public LTemplateInstruction<0, 0, 0> { 1247 class LDeoptimize V8_FINAL : public LTemplateInstruction<0, 0, 0> {
1245 public: 1248 public:
1246 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize") 1249 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
1247 DECLARE_HYDROGEN_ACCESSOR(Deoptimize) 1250 DECLARE_HYDROGEN_ACCESSOR(Deoptimize)
1248 }; 1251 };
1249 1252
1250 1253
1254 class LDivByPowerOf2I V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1255 public:
1256 LDivByPowerOf2I(LOperand* dividend, int32_t divisor) {
1257 inputs_[0] = dividend;
1258 divisor_ = divisor;
1259 }
1260
1261 LOperand* dividend() { return inputs_[0]; }
1262 int32_t divisor() const { return divisor_; }
1263
1264 DECLARE_CONCRETE_INSTRUCTION(DivByPowerOf2I, "div-by-power-of-2-i")
1265 DECLARE_HYDROGEN_ACCESSOR(Div)
1266
1267 private:
1268 int32_t divisor_;
1269 };
1270
1271
1251 class LDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> { 1272 class LDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
1252 public: 1273 public:
1253 LDivI(LOperand* left, LOperand* right, LOperand* temp) { 1274 LDivI(LOperand* left, LOperand* right, LOperand* temp) {
1254 inputs_[0] = left; 1275 inputs_[0] = left;
1255 inputs_[1] = right; 1276 inputs_[1] = right;
1256 temps_[0] = temp; 1277 temps_[0] = temp;
1257 } 1278 }
1258 1279
1259 LOperand* left() { return inputs_[0]; } 1280 LOperand* left() { return inputs_[0]; }
1260 LOperand* right() { return inputs_[1]; } 1281 LOperand* right() { return inputs_[1]; }
1261 LOperand* temp() { return temps_[0]; } 1282 LOperand* temp() { return temps_[0]; }
1262 1283
1263 bool is_flooring() { return hydrogen_value()->IsMathFloorOfDiv(); } 1284 bool is_flooring() { return hydrogen_value()->IsMathFloorOfDiv(); }
1264 1285
1265 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i") 1286 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
1266 DECLARE_HYDROGEN_ACCESSOR(Div) 1287 DECLARE_HYDROGEN_ACCESSOR(BinaryOperation)
1267 }; 1288 };
1268 1289
1269 1290
1270 class LDoubleToIntOrSmi V8_FINAL : public LTemplateInstruction<1, 1, 0> { 1291 class LDoubleToIntOrSmi V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1271 public: 1292 public:
1272 explicit LDoubleToIntOrSmi(LOperand* value) { 1293 explicit LDoubleToIntOrSmi(LOperand* value) {
1273 inputs_[0] = value; 1294 inputs_[0] = value;
1274 } 1295 }
1275 1296
1276 LOperand* value() { return inputs_[0]; } 1297 LOperand* value() { return inputs_[0]; }
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
1871 }; 1892 };
1872 1893
1873 1894
1874 class LMathFloor V8_FINAL : public LUnaryMathOperation<0> { 1895 class LMathFloor V8_FINAL : public LUnaryMathOperation<0> {
1875 public: 1896 public:
1876 explicit LMathFloor(LOperand* value) : LUnaryMathOperation<0>(value) { } 1897 explicit LMathFloor(LOperand* value) : LUnaryMathOperation<0>(value) { }
1877 DECLARE_CONCRETE_INSTRUCTION(MathFloor, "math-floor") 1898 DECLARE_CONCRETE_INSTRUCTION(MathFloor, "math-floor")
1878 }; 1899 };
1879 1900
1880 1901
1881 class LMathFloorOfDiv V8_FINAL : public LTemplateInstruction<1, 2, 1> { 1902 class LFlooringDivByPowerOf2I V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1882 public: 1903 public:
1883 LMathFloorOfDiv(LOperand* left, 1904 LFlooringDivByPowerOf2I(LOperand* dividend, int32_t divisor) {
1884 LOperand* right, 1905 inputs_[0] = dividend;
1885 LOperand* temp = NULL) { 1906 divisor_ = divisor;
1886 inputs_[0] = left; 1907 }
1887 inputs_[1] = right; 1908
1909 LOperand* dividend() { return inputs_[0]; }
1910 int32_t divisor() const { return divisor_; }
1911
1912 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByPowerOf2I,
1913 "flooring-div-by-power-of-2-i")
1914 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
1915
1916 private:
1917 int32_t divisor_;
1918 };
1919
1920
1921 class LFlooringDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
1922 public:
1923 LFlooringDivI(LOperand* dividend, LOperand* divisor, LOperand* temp) {
1924 inputs_[0] = dividend;
1925 inputs_[1] = divisor;
1888 temps_[0] = temp; 1926 temps_[0] = temp;
1889 } 1927 }
1890 1928
1891 LOperand* left() { return inputs_[0]; } 1929 LOperand* dividend() { return inputs_[0]; }
1892 LOperand* right() { return inputs_[1]; } 1930 LOperand* divisor() { return inputs_[1]; }
1893 LOperand* temp() { return temps_[0]; } 1931 LOperand* temp() { return temps_[0]; }
1894 1932
1895 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv, "math-floor-of-div") 1933 DECLARE_CONCRETE_INSTRUCTION(FlooringDivI, "flooring-div-i")
1896 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv) 1934 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
1897 }; 1935 };
1898 1936
1899 1937
1900 class LMathLog V8_FINAL : public LUnaryMathOperation<0> { 1938 class LMathLog V8_FINAL : public LUnaryMathOperation<0> {
1901 public: 1939 public:
1902 explicit LMathLog(LOperand* value) : LUnaryMathOperation<0>(value) { } 1940 explicit LMathLog(LOperand* value) : LUnaryMathOperation<0>(value) { }
1903 DECLARE_CONCRETE_INSTRUCTION(MathLog, "math-log") 1941 DECLARE_CONCRETE_INSTRUCTION(MathLog, "math-log")
1904 }; 1942 };
1905 1943
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1946 }; 1984 };
1947 1985
1948 1986
1949 class LMathSqrt V8_FINAL : public LUnaryMathOperation<0> { 1987 class LMathSqrt V8_FINAL : public LUnaryMathOperation<0> {
1950 public: 1988 public:
1951 explicit LMathSqrt(LOperand* value) : LUnaryMathOperation<0>(value) { } 1989 explicit LMathSqrt(LOperand* value) : LUnaryMathOperation<0>(value) { }
1952 DECLARE_CONCRETE_INSTRUCTION(MathSqrt, "math-sqrt") 1990 DECLARE_CONCRETE_INSTRUCTION(MathSqrt, "math-sqrt")
1953 }; 1991 };
1954 1992
1955 1993
1994 class LModByPowerOf2I V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1995 public:
1996 LModByPowerOf2I(LOperand* dividend, int32_t divisor) {
1997 inputs_[0] = dividend;
1998 divisor_ = divisor;
1999 }
2000
2001 LOperand* dividend() { return inputs_[0]; }
2002 int32_t divisor() const { return divisor_; }
2003
2004 DECLARE_CONCRETE_INSTRUCTION(ModByPowerOf2I, "mod-by-power-of-2-i")
2005 DECLARE_HYDROGEN_ACCESSOR(Mod)
2006
2007 private:
2008 int32_t divisor_;
2009 };
2010
2011
1956 class LModI V8_FINAL : public LTemplateInstruction<1, 2, 0> { 2012 class LModI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
1957 public: 2013 public:
1958 LModI(LOperand* left, LOperand* right) { 2014 LModI(LOperand* left, LOperand* right) {
1959 inputs_[0] = left; 2015 inputs_[0] = left;
1960 inputs_[1] = right; 2016 inputs_[1] = right;
1961 } 2017 }
1962 2018
1963 LOperand* left() { return inputs_[0]; } 2019 LOperand* left() { return inputs_[0]; }
1964 LOperand* right() { return inputs_[1]; } 2020 LOperand* right() { return inputs_[1]; }
1965 2021
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
2836 // Build the sequence for the graph. 2892 // Build the sequence for the graph.
2837 LPlatformChunk* Build(); 2893 LPlatformChunk* Build();
2838 2894
2839 LInstruction* CheckElideControlInstruction(HControlInstruction* instr); 2895 LInstruction* CheckElideControlInstruction(HControlInstruction* instr);
2840 2896
2841 // Declare methods that deal with the individual node types. 2897 // Declare methods that deal with the individual node types.
2842 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); 2898 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
2843 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) 2899 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2844 #undef DECLARE_DO 2900 #undef DECLARE_DO
2845 2901
2902 LInstruction* DoDivByPowerOf2I(HDiv* instr);
2903 LInstruction* DoDivI(HBinaryOperation* instr);
2904 LInstruction* DoModByPowerOf2I(HMod* instr);
2905 LInstruction* DoModI(HMod* instr);
2906 LInstruction* DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr);
2907 LInstruction* DoFlooringDivI(HMathFloorOfDiv* instr);
2908
2846 static bool HasMagicNumberForDivision(int32_t divisor); 2909 static bool HasMagicNumberForDivision(int32_t divisor);
2847 2910
2848 private: 2911 private:
2849 enum Status { 2912 enum Status {
2850 UNUSED, 2913 UNUSED,
2851 BUILDING, 2914 BUILDING,
2852 DONE, 2915 DONE,
2853 ABORTED 2916 ABORTED
2854 }; 2917 };
2855 2918
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2963 3026
2964 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 3027 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2965 }; 3028 };
2966 3029
2967 #undef DECLARE_HYDROGEN_ACCESSOR 3030 #undef DECLARE_HYDROGEN_ACCESSOR
2968 #undef DECLARE_CONCRETE_INSTRUCTION 3031 #undef DECLARE_CONCRETE_INSTRUCTION
2969 3032
2970 } } // namespace v8::internal 3033 } } // namespace v8::internal
2971 3034
2972 #endif // V8_A64_LITHIUM_A64_H_ 3035 #endif // V8_A64_LITHIUM_A64_H_
OLDNEW
« no previous file with comments | « no previous file | src/a64/lithium-a64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698