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

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

Issue 190383002: Handle non-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(DivByConstI) \
92 V(DivByPowerOf2I) \ 93 V(DivByPowerOf2I) \
93 V(DivI) \ 94 V(DivI) \
94 V(DoubleToIntOrSmi) \ 95 V(DoubleToIntOrSmi) \
95 V(Drop) \ 96 V(Drop) \
96 V(Dummy) \ 97 V(Dummy) \
97 V(DummyUse) \ 98 V(DummyUse) \
99 V(FlooringDivByConstI) \
98 V(FlooringDivByPowerOf2I) \ 100 V(FlooringDivByPowerOf2I) \
99 V(FlooringDivI) \ 101 V(FlooringDivI) \
100 V(ForInCacheArray) \ 102 V(ForInCacheArray) \
101 V(ForInPrepareMap) \ 103 V(ForInPrepareMap) \
102 V(FunctionLiteral) \ 104 V(FunctionLiteral) \
103 V(GetCachedArrayIndex) \ 105 V(GetCachedArrayIndex) \
104 V(Goto) \ 106 V(Goto) \
105 V(HasCachedArrayIndexAndBranch) \ 107 V(HasCachedArrayIndexAndBranch) \
106 V(HasInstanceTypeAndBranch) \ 108 V(HasInstanceTypeAndBranch) \
107 V(InnerAllocatedObject) \ 109 V(InnerAllocatedObject) \
(...skipping 26 matching lines...) Expand all
134 V(MathAbs) \ 136 V(MathAbs) \
135 V(MathAbsTagged) \ 137 V(MathAbsTagged) \
136 V(MathClz32) \ 138 V(MathClz32) \
137 V(MathExp) \ 139 V(MathExp) \
138 V(MathFloor) \ 140 V(MathFloor) \
139 V(MathLog) \ 141 V(MathLog) \
140 V(MathMinMax) \ 142 V(MathMinMax) \
141 V(MathPowHalf) \ 143 V(MathPowHalf) \
142 V(MathRound) \ 144 V(MathRound) \
143 V(MathSqrt) \ 145 V(MathSqrt) \
146 V(ModByConstI) \
144 V(ModByPowerOf2I) \ 147 V(ModByPowerOf2I) \
145 V(ModI) \ 148 V(ModI) \
146 V(MulConstIS) \ 149 V(MulConstIS) \
147 V(MulI) \ 150 V(MulI) \
148 V(MulS) \ 151 V(MulS) \
149 V(NumberTagD) \ 152 V(NumberTagD) \
150 V(NumberTagU) \ 153 V(NumberTagU) \
151 V(NumberUntagD) \ 154 V(NumberUntagD) \
152 V(OsrEntry) \ 155 V(OsrEntry) \
153 V(Parameter) \ 156 V(Parameter) \
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 int32_t divisor() const { return divisor_; } 1265 int32_t divisor() const { return divisor_; }
1263 1266
1264 DECLARE_CONCRETE_INSTRUCTION(DivByPowerOf2I, "div-by-power-of-2-i") 1267 DECLARE_CONCRETE_INSTRUCTION(DivByPowerOf2I, "div-by-power-of-2-i")
1265 DECLARE_HYDROGEN_ACCESSOR(Div) 1268 DECLARE_HYDROGEN_ACCESSOR(Div)
1266 1269
1267 private: 1270 private:
1268 int32_t divisor_; 1271 int32_t divisor_;
1269 }; 1272 };
1270 1273
1271 1274
1275 class LDivByConstI V8_FINAL : public LTemplateInstruction<1, 1, 1> {
1276 public:
1277 LDivByConstI(LOperand* dividend, int32_t divisor, LOperand* temp) {
1278 inputs_[0] = dividend;
1279 divisor_ = divisor;
1280 temps_[0] = temp;
1281 }
1282
1283 LOperand* dividend() { return inputs_[0]; }
1284 int32_t divisor() const { return divisor_; }
1285 LOperand* temp() { return temps_[0]; }
1286
1287 DECLARE_CONCRETE_INSTRUCTION(DivByConstI, "div-by-const-i")
1288 DECLARE_HYDROGEN_ACCESSOR(Div)
1289
1290 private:
1291 int32_t divisor_;
1292 };
1293
1294
1272 class LDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> { 1295 class LDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
1273 public: 1296 public:
1274 LDivI(LOperand* left, LOperand* right, LOperand* temp) { 1297 LDivI(LOperand* left, LOperand* right, LOperand* temp) {
1275 inputs_[0] = left; 1298 inputs_[0] = left;
1276 inputs_[1] = right; 1299 inputs_[1] = right;
1277 temps_[0] = temp; 1300 temps_[0] = temp;
1278 } 1301 }
1279 1302
1280 LOperand* left() { return inputs_[0]; } 1303 LOperand* left() { return inputs_[0]; }
1281 LOperand* right() { return inputs_[1]; } 1304 LOperand* right() { return inputs_[1]; }
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 1934
1912 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByPowerOf2I, 1935 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByPowerOf2I,
1913 "flooring-div-by-power-of-2-i") 1936 "flooring-div-by-power-of-2-i")
1914 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv) 1937 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
1915 1938
1916 private: 1939 private:
1917 int32_t divisor_; 1940 int32_t divisor_;
1918 }; 1941 };
1919 1942
1920 1943
1944 class LFlooringDivByConstI V8_FINAL : public LTemplateInstruction<1, 1, 0> {
1945 public:
1946 LFlooringDivByConstI(LOperand* dividend, int32_t divisor) {
1947 inputs_[0] = dividend;
1948 divisor_ = divisor;
1949 }
1950
1951 LOperand* dividend() { return inputs_[0]; }
1952 int32_t divisor() const { return divisor_; }
1953 LOperand* temp1() { return temps_[0]; }
1954
1955 DECLARE_CONCRETE_INSTRUCTION(FlooringDivByConstI, "flooring-div-by-const-i")
1956 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv)
1957
1958 private:
1959 int32_t divisor_;
1960 };
1961
1962
1921 class LFlooringDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> { 1963 class LFlooringDivI V8_FINAL : public LTemplateInstruction<1, 2, 1> {
1922 public: 1964 public:
1923 LFlooringDivI(LOperand* dividend, LOperand* divisor, LOperand* temp) { 1965 LFlooringDivI(LOperand* dividend, LOperand* divisor, LOperand* temp) {
1924 inputs_[0] = dividend; 1966 inputs_[0] = dividend;
1925 inputs_[1] = divisor; 1967 inputs_[1] = divisor;
1926 temps_[0] = temp; 1968 temps_[0] = temp;
1927 } 1969 }
1928 1970
1929 LOperand* dividend() { return inputs_[0]; } 1971 LOperand* dividend() { return inputs_[0]; }
1930 LOperand* divisor() { return inputs_[1]; } 1972 LOperand* divisor() { return inputs_[1]; }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2002 int32_t divisor() const { return divisor_; } 2044 int32_t divisor() const { return divisor_; }
2003 2045
2004 DECLARE_CONCRETE_INSTRUCTION(ModByPowerOf2I, "mod-by-power-of-2-i") 2046 DECLARE_CONCRETE_INSTRUCTION(ModByPowerOf2I, "mod-by-power-of-2-i")
2005 DECLARE_HYDROGEN_ACCESSOR(Mod) 2047 DECLARE_HYDROGEN_ACCESSOR(Mod)
2006 2048
2007 private: 2049 private:
2008 int32_t divisor_; 2050 int32_t divisor_;
2009 }; 2051 };
2010 2052
2011 2053
2054 class LModByConstI V8_FINAL : public LTemplateInstruction<1, 1, 1> {
2055 public:
2056 LModByConstI(LOperand* dividend, int32_t divisor, LOperand* temp) {
2057 inputs_[0] = dividend;
2058 divisor_ = divisor;
2059 temps_[0] = temp;
2060 }
2061
2062 LOperand* dividend() { return inputs_[0]; }
2063 int32_t divisor() const { return divisor_; }
2064 LOperand* temp() { return temps_[0]; }
2065
2066 DECLARE_CONCRETE_INSTRUCTION(ModByConstI, "mod-by-const-i")
2067 DECLARE_HYDROGEN_ACCESSOR(Mod)
2068
2069 private:
2070 int32_t divisor_;
2071 };
2072
2073
2012 class LModI V8_FINAL : public LTemplateInstruction<1, 2, 0> { 2074 class LModI V8_FINAL : public LTemplateInstruction<1, 2, 0> {
2013 public: 2075 public:
2014 LModI(LOperand* left, LOperand* right) { 2076 LModI(LOperand* left, LOperand* right) {
2015 inputs_[0] = left; 2077 inputs_[0] = left;
2016 inputs_[1] = right; 2078 inputs_[1] = right;
2017 } 2079 }
2018 2080
2019 LOperand* left() { return inputs_[0]; } 2081 LOperand* left() { return inputs_[0]; }
2020 LOperand* right() { return inputs_[1]; } 2082 LOperand* right() { return inputs_[1]; }
2021 2083
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
2893 LPlatformChunk* Build(); 2955 LPlatformChunk* Build();
2894 2956
2895 LInstruction* CheckElideControlInstruction(HControlInstruction* instr); 2957 LInstruction* CheckElideControlInstruction(HControlInstruction* instr);
2896 2958
2897 // Declare methods that deal with the individual node types. 2959 // Declare methods that deal with the individual node types.
2898 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); 2960 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
2899 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) 2961 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
2900 #undef DECLARE_DO 2962 #undef DECLARE_DO
2901 2963
2902 LInstruction* DoDivByPowerOf2I(HDiv* instr); 2964 LInstruction* DoDivByPowerOf2I(HDiv* instr);
2965 LInstruction* DoDivByConstI(HDiv* instr);
2903 LInstruction* DoDivI(HBinaryOperation* instr); 2966 LInstruction* DoDivI(HBinaryOperation* instr);
2904 LInstruction* DoModByPowerOf2I(HMod* instr); 2967 LInstruction* DoModByPowerOf2I(HMod* instr);
2968 LInstruction* DoModByConstI(HMod* instr);
2905 LInstruction* DoModI(HMod* instr); 2969 LInstruction* DoModI(HMod* instr);
2906 LInstruction* DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr); 2970 LInstruction* DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr);
2971 LInstruction* DoFlooringDivByConstI(HMathFloorOfDiv* instr);
2907 LInstruction* DoFlooringDivI(HMathFloorOfDiv* instr); 2972 LInstruction* DoFlooringDivI(HMathFloorOfDiv* instr);
2908 2973
2909 static bool HasMagicNumberForDivision(int32_t divisor); 2974 static bool HasMagicNumberForDivision(int32_t divisor);
2910 2975
2911 private: 2976 private:
2912 enum Status { 2977 enum Status {
2913 UNUSED, 2978 UNUSED,
2914 BUILDING, 2979 BUILDING,
2915 DONE, 2980 DONE,
2916 ABORTED 2981 ABORTED
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
3026 3091
3027 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 3092 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
3028 }; 3093 };
3029 3094
3030 #undef DECLARE_HYDROGEN_ACCESSOR 3095 #undef DECLARE_HYDROGEN_ACCESSOR
3031 #undef DECLARE_CONCRETE_INSTRUCTION 3096 #undef DECLARE_CONCRETE_INSTRUCTION
3032 3097
3033 } } // namespace v8::internal 3098 } } // namespace v8::internal
3034 3099
3035 #endif // V8_A64_LITHIUM_A64_H_ 3100 #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