OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_COMPILER_MACHINE_NODE_FACTORY_H_ | 5 #ifndef V8_COMPILER_MACHINE_NODE_FACTORY_H_ |
6 #define V8_COMPILER_MACHINE_NODE_FACTORY_H_ | 6 #define V8_COMPILER_MACHINE_NODE_FACTORY_H_ |
7 | 7 |
8 #ifdef USE_SIMULATOR | 8 #ifdef USE_SIMULATOR |
9 #define MACHINE_ASSEMBLER_SUPPORTS_CALL_C 0 | 9 #define MACHINE_ASSEMBLER_SUPPORTS_CALL_C 0 |
10 #else | 10 #else |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 Node* WordShl(Node* a, Node* b) { | 112 Node* WordShl(Node* a, Node* b) { |
113 return NEW_NODE_2(MACHINE()->WordShl(), a, b); | 113 return NEW_NODE_2(MACHINE()->WordShl(), a, b); |
114 } | 114 } |
115 Node* WordShr(Node* a, Node* b) { | 115 Node* WordShr(Node* a, Node* b) { |
116 return NEW_NODE_2(MACHINE()->WordShr(), a, b); | 116 return NEW_NODE_2(MACHINE()->WordShr(), a, b); |
117 } | 117 } |
118 Node* WordSar(Node* a, Node* b) { | 118 Node* WordSar(Node* a, Node* b) { |
119 return NEW_NODE_2(MACHINE()->WordSar(), a, b); | 119 return NEW_NODE_2(MACHINE()->WordSar(), a, b); |
120 } | 120 } |
121 Node* WordRor(Node* a, Node* b) { | 121 Node* WordRor(Node* a, Node* b) { |
122 if (MACHINE()->is32()) { | 122 return NEW_NODE_2(MACHINE()->WordRor(), a, b); |
123 return Word32Ror(a, b); | |
124 } else { | |
125 return Word64Ror(a, b); | |
126 } | |
127 } | 123 } |
128 Node* WordEqual(Node* a, Node* b) { | 124 Node* WordEqual(Node* a, Node* b) { |
129 return NEW_NODE_2(MACHINE()->WordEqual(), a, b); | 125 return NEW_NODE_2(MACHINE()->WordEqual(), a, b); |
130 } | 126 } |
131 Node* WordNotEqual(Node* a, Node* b) { | 127 Node* WordNotEqual(Node* a, Node* b) { |
132 return WordBinaryNot(WordEqual(a, b)); | 128 return WordBinaryNot(WordEqual(a, b)); |
133 } | 129 } |
134 Node* WordNot(Node* a) { | 130 Node* WordNot(Node* a) { |
135 if (MACHINE()->is32()) { | 131 if (MACHINE()->is32()) { |
136 return Word32Not(a); | 132 return Word32Not(a); |
(...skipping 21 matching lines...) Expand all Loading... |
158 Node* Word32Shl(Node* a, Node* b) { | 154 Node* Word32Shl(Node* a, Node* b) { |
159 return NEW_NODE_2(MACHINE()->Word32Shl(), a, b); | 155 return NEW_NODE_2(MACHINE()->Word32Shl(), a, b); |
160 } | 156 } |
161 Node* Word32Shr(Node* a, Node* b) { | 157 Node* Word32Shr(Node* a, Node* b) { |
162 return NEW_NODE_2(MACHINE()->Word32Shr(), a, b); | 158 return NEW_NODE_2(MACHINE()->Word32Shr(), a, b); |
163 } | 159 } |
164 Node* Word32Sar(Node* a, Node* b) { | 160 Node* Word32Sar(Node* a, Node* b) { |
165 return NEW_NODE_2(MACHINE()->Word32Sar(), a, b); | 161 return NEW_NODE_2(MACHINE()->Word32Sar(), a, b); |
166 } | 162 } |
167 Node* Word32Ror(Node* a, Node* b) { | 163 Node* Word32Ror(Node* a, Node* b) { |
168 return Word32Or(Word32Shl(a, Int32Sub(Int32Constant(32), b)), | 164 return NEW_NODE_2(MACHINE()->Word32Ror(), a, b); |
169 Word32Shr(a, b)); | |
170 } | 165 } |
171 Node* Word32Equal(Node* a, Node* b) { | 166 Node* Word32Equal(Node* a, Node* b) { |
172 return NEW_NODE_2(MACHINE()->Word32Equal(), a, b); | 167 return NEW_NODE_2(MACHINE()->Word32Equal(), a, b); |
173 } | 168 } |
174 Node* Word32NotEqual(Node* a, Node* b) { | 169 Node* Word32NotEqual(Node* a, Node* b) { |
175 return Word32BinaryNot(Word32Equal(a, b)); | 170 return Word32BinaryNot(Word32Equal(a, b)); |
176 } | 171 } |
177 Node* Word32Not(Node* a) { return Word32Xor(a, Int32Constant(-1)); } | 172 Node* Word32Not(Node* a) { return Word32Xor(a, Int32Constant(-1)); } |
178 Node* Word32BinaryNot(Node* a) { return Word32Equal(a, Int32Constant(0)); } | 173 Node* Word32BinaryNot(Node* a) { return Word32Equal(a, Int32Constant(0)); } |
179 | 174 |
180 Node* Word64And(Node* a, Node* b) { | 175 Node* Word64And(Node* a, Node* b) { |
181 return NEW_NODE_2(MACHINE()->Word64And(), a, b); | 176 return NEW_NODE_2(MACHINE()->Word64And(), a, b); |
182 } | 177 } |
183 Node* Word64Or(Node* a, Node* b) { | 178 Node* Word64Or(Node* a, Node* b) { |
184 return NEW_NODE_2(MACHINE()->Word64Or(), a, b); | 179 return NEW_NODE_2(MACHINE()->Word64Or(), a, b); |
185 } | 180 } |
186 Node* Word64Xor(Node* a, Node* b) { | 181 Node* Word64Xor(Node* a, Node* b) { |
187 return NEW_NODE_2(MACHINE()->Word64Xor(), a, b); | 182 return NEW_NODE_2(MACHINE()->Word64Xor(), a, b); |
188 } | 183 } |
189 Node* Word64Shl(Node* a, Node* b) { | 184 Node* Word64Shl(Node* a, Node* b) { |
190 return NEW_NODE_2(MACHINE()->Word64Shl(), a, b); | 185 return NEW_NODE_2(MACHINE()->Word64Shl(), a, b); |
191 } | 186 } |
192 Node* Word64Shr(Node* a, Node* b) { | 187 Node* Word64Shr(Node* a, Node* b) { |
193 return NEW_NODE_2(MACHINE()->Word64Shr(), a, b); | 188 return NEW_NODE_2(MACHINE()->Word64Shr(), a, b); |
194 } | 189 } |
195 Node* Word64Sar(Node* a, Node* b) { | 190 Node* Word64Sar(Node* a, Node* b) { |
196 return NEW_NODE_2(MACHINE()->Word64Sar(), a, b); | 191 return NEW_NODE_2(MACHINE()->Word64Sar(), a, b); |
197 } | 192 } |
198 Node* Word64Ror(Node* a, Node* b) { | 193 Node* Word64Ror(Node* a, Node* b) { |
199 return Word64Or(Word64Shl(a, Int64Sub(Int64Constant(64), b)), | 194 return NEW_NODE_2(MACHINE()->Word64Ror(), a, b); |
200 Word64Shr(a, b)); | |
201 } | 195 } |
202 Node* Word64Equal(Node* a, Node* b) { | 196 Node* Word64Equal(Node* a, Node* b) { |
203 return NEW_NODE_2(MACHINE()->Word64Equal(), a, b); | 197 return NEW_NODE_2(MACHINE()->Word64Equal(), a, b); |
204 } | 198 } |
205 Node* Word64NotEqual(Node* a, Node* b) { | 199 Node* Word64NotEqual(Node* a, Node* b) { |
206 return Word64BinaryNot(Word64Equal(a, b)); | 200 return Word64BinaryNot(Word64Equal(a, b)); |
207 } | 201 } |
208 Node* Word64Not(Node* a) { return Word64Xor(a, Int64Constant(-1)); } | 202 Node* Word64Not(Node* a) { return Word64Xor(a, Int64Constant(-1)); } |
209 Node* Word64BinaryNot(Node* a) { return Word64Equal(a, Int64Constant(0)); } | 203 Node* Word64BinaryNot(Node* a) { return Word64Equal(a, Int64Constant(0)); } |
210 | 204 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 #undef NEW_NODE_3 | 381 #undef NEW_NODE_3 |
388 #undef MACHINE | 382 #undef MACHINE |
389 #undef COMMON | 383 #undef COMMON |
390 #undef ZONE | 384 #undef ZONE |
391 | 385 |
392 } // namespace compiler | 386 } // namespace compiler |
393 } // namespace internal | 387 } // namespace internal |
394 } // namespace v8 | 388 } // namespace v8 |
395 | 389 |
396 #endif // V8_COMPILER_MACHINE_NODE_FACTORY_H_ | 390 #endif // V8_COMPILER_MACHINE_NODE_FACTORY_H_ |
OLD | NEW |