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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 return NEW_NODE_2(MACHINE()->Int64LessThan(), a, b); | 273 return NEW_NODE_2(MACHINE()->Int64LessThan(), a, b); |
274 } | 274 } |
275 Node* Int64LessThanOrEqual(Node* a, Node* b) { | 275 Node* Int64LessThanOrEqual(Node* a, Node* b) { |
276 return NEW_NODE_2(MACHINE()->Int64LessThanOrEqual(), a, b); | 276 return NEW_NODE_2(MACHINE()->Int64LessThanOrEqual(), a, b); |
277 } | 277 } |
278 Node* Int64GreaterThan(Node* a, Node* b) { return Int64LessThan(b, a); } | 278 Node* Int64GreaterThan(Node* a, Node* b) { return Int64LessThan(b, a); } |
279 Node* Int64GreaterThanOrEqual(Node* a, Node* b) { | 279 Node* Int64GreaterThanOrEqual(Node* a, Node* b) { |
280 return Int64LessThanOrEqual(b, a); | 280 return Int64LessThanOrEqual(b, a); |
281 } | 281 } |
282 | 282 |
| 283 // TODO(turbofan): What is this used for? |
283 Node* ConvertIntPtrToInt32(Node* a) { | 284 Node* ConvertIntPtrToInt32(Node* a) { |
284 return kPointerSize == 8 ? NEW_NODE_1(MACHINE()->ConvertInt64ToInt32(), a) | 285 return kPointerSize == 8 ? NEW_NODE_1(MACHINE()->TruncateInt64ToInt32(), a) |
285 : a; | 286 : a; |
286 } | 287 } |
287 Node* ConvertInt32ToIntPtr(Node* a) { | 288 Node* ConvertInt32ToIntPtr(Node* a) { |
288 return kPointerSize == 8 ? NEW_NODE_1(MACHINE()->ConvertInt32ToInt64(), a) | 289 return kPointerSize == 8 ? NEW_NODE_1(MACHINE()->ChangeInt32ToInt64(), a) |
289 : a; | 290 : a; |
290 } | 291 } |
291 | 292 |
292 #define INTPTR_BINOP(prefix, name) \ | 293 #define INTPTR_BINOP(prefix, name) \ |
293 Node* IntPtr##name(Node* a, Node* b) { \ | 294 Node* IntPtr##name(Node* a, Node* b) { \ |
294 return kPointerSize == 8 ? prefix##64##name(a, b) \ | 295 return kPointerSize == 8 ? prefix##64##name(a, b) \ |
295 : prefix##32##name(a, b); \ | 296 : prefix##32##name(a, b); \ |
296 } | 297 } |
297 | 298 |
298 INTPTR_BINOP(Int, Add); | 299 INTPTR_BINOP(Int, Add); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 } | 333 } |
333 Node* Float64LessThanOrEqual(Node* a, Node* b) { | 334 Node* Float64LessThanOrEqual(Node* a, Node* b) { |
334 return NEW_NODE_2(MACHINE()->Float64LessThanOrEqual(), a, b); | 335 return NEW_NODE_2(MACHINE()->Float64LessThanOrEqual(), a, b); |
335 } | 336 } |
336 Node* Float64GreaterThan(Node* a, Node* b) { return Float64LessThan(b, a); } | 337 Node* Float64GreaterThan(Node* a, Node* b) { return Float64LessThan(b, a); } |
337 Node* Float64GreaterThanOrEqual(Node* a, Node* b) { | 338 Node* Float64GreaterThanOrEqual(Node* a, Node* b) { |
338 return Float64LessThanOrEqual(b, a); | 339 return Float64LessThanOrEqual(b, a); |
339 } | 340 } |
340 | 341 |
341 // Conversions. | 342 // Conversions. |
342 Node* ConvertInt32ToInt64(Node* a) { | |
343 return NEW_NODE_1(MACHINE()->ConvertInt32ToInt64(), a); | |
344 } | |
345 Node* ConvertInt64ToInt32(Node* a) { | |
346 return NEW_NODE_1(MACHINE()->ConvertInt64ToInt32(), a); | |
347 } | |
348 Node* ChangeInt32ToFloat64(Node* a) { | 343 Node* ChangeInt32ToFloat64(Node* a) { |
349 return NEW_NODE_1(MACHINE()->ChangeInt32ToFloat64(), a); | 344 return NEW_NODE_1(MACHINE()->ChangeInt32ToFloat64(), a); |
350 } | 345 } |
351 Node* ChangeUint32ToFloat64(Node* a) { | 346 Node* ChangeUint32ToFloat64(Node* a) { |
352 return NEW_NODE_1(MACHINE()->ChangeUint32ToFloat64(), a); | 347 return NEW_NODE_1(MACHINE()->ChangeUint32ToFloat64(), a); |
353 } | 348 } |
354 Node* ChangeFloat64ToInt32(Node* a) { | 349 Node* ChangeFloat64ToInt32(Node* a) { |
355 return NEW_NODE_1(MACHINE()->ChangeFloat64ToInt32(), a); | 350 return NEW_NODE_1(MACHINE()->ChangeFloat64ToInt32(), a); |
356 } | 351 } |
357 Node* ChangeFloat64ToUint32(Node* a) { | 352 Node* ChangeFloat64ToUint32(Node* a) { |
358 return NEW_NODE_1(MACHINE()->ChangeFloat64ToUint32(), a); | 353 return NEW_NODE_1(MACHINE()->ChangeFloat64ToUint32(), a); |
359 } | 354 } |
| 355 Node* ChangeInt32ToInt64(Node* a) { |
| 356 return NEW_NODE_1(MACHINE()->ChangeInt32ToInt64(), a); |
| 357 } |
| 358 Node* ChangeUint32ToUint64(Node* a) { |
| 359 return NEW_NODE_1(MACHINE()->ChangeUint32ToUint64(), a); |
| 360 } |
| 361 Node* TruncateInt64ToInt32(Node* a) { |
| 362 return NEW_NODE_1(MACHINE()->TruncateInt64ToInt32(), a); |
| 363 } |
360 | 364 |
361 #ifdef MACHINE_ASSEMBLER_SUPPORTS_CALL_C | 365 #ifdef MACHINE_ASSEMBLER_SUPPORTS_CALL_C |
362 // Call to C. | 366 // Call to C. |
363 Node* CallC(Node* function_address, MachineType return_type, | 367 Node* CallC(Node* function_address, MachineType return_type, |
364 MachineType* arg_types, Node** args, int n_args) { | 368 MachineType* arg_types, Node** args, int n_args) { |
365 CallDescriptor* descriptor = Linkage::GetSimplifiedCDescriptor( | 369 CallDescriptor* descriptor = Linkage::GetSimplifiedCDescriptor( |
366 ZONE(), n_args, return_type, arg_types); | 370 ZONE(), n_args, return_type, arg_types); |
367 Node** passed_args = | 371 Node** passed_args = |
368 static_cast<Node**>(alloca((n_args + 1) * sizeof(args[0]))); | 372 static_cast<Node**>(alloca((n_args + 1) * sizeof(args[0]))); |
369 passed_args[0] = function_address; | 373 passed_args[0] = function_address; |
(...skipping 11 matching lines...) Expand all Loading... |
381 #undef NEW_NODE_3 | 385 #undef NEW_NODE_3 |
382 #undef MACHINE | 386 #undef MACHINE |
383 #undef COMMON | 387 #undef COMMON |
384 #undef ZONE | 388 #undef ZONE |
385 | 389 |
386 } // namespace compiler | 390 } // namespace compiler |
387 } // namespace internal | 391 } // namespace internal |
388 } // namespace v8 | 392 } // namespace v8 |
389 | 393 |
390 #endif // V8_COMPILER_MACHINE_NODE_FACTORY_H_ | 394 #endif // V8_COMPILER_MACHINE_NODE_FACTORY_H_ |
OLD | NEW |