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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 Node* TruncateInt64ToInt32(Node* a) { | 342 Node* TruncateInt64ToInt32(Node* a) { |
343 return NEW_NODE_1(MACHINE()->TruncateInt64ToInt32(), a); | 343 return NEW_NODE_1(MACHINE()->TruncateInt64ToInt32(), a); |
344 } | 344 } |
345 | 345 |
346 #ifdef MACHINE_ASSEMBLER_SUPPORTS_CALL_C | 346 #ifdef MACHINE_ASSEMBLER_SUPPORTS_CALL_C |
347 // Call to C. | 347 // Call to C. |
348 Node* CallC(Node* function_address, MachineType return_type, | 348 Node* CallC(Node* function_address, MachineType return_type, |
349 MachineType* arg_types, Node** args, int n_args) { | 349 MachineType* arg_types, Node** args, int n_args) { |
350 CallDescriptor* descriptor = | 350 CallDescriptor* descriptor = |
351 Linkage::GetSimplifiedCDescriptor(ZONE(), MACHINE_SIG()); | 351 Linkage::GetSimplifiedCDescriptor(ZONE(), MACHINE_SIG()); |
352 Node** passed_args = | 352 Node** passed_args = ZONE()->NewArray<Node*>(n_args + 1); |
353 static_cast<Node**>(alloca((n_args + 1) * sizeof(args[0]))); | |
354 passed_args[0] = function_address; | 353 passed_args[0] = function_address; |
355 for (int i = 0; i < n_args; ++i) { | 354 for (int i = 0; i < n_args; ++i) { |
356 passed_args[i + 1] = args[i]; | 355 passed_args[i + 1] = args[i]; |
357 } | 356 } |
358 return NEW_NODE_2(COMMON()->Call(descriptor), n_args + 1, passed_args); | 357 return NEW_NODE_2(COMMON()->Call(descriptor), n_args + 1, passed_args); |
359 } | 358 } |
360 #endif | 359 #endif |
361 }; | 360 }; |
362 | 361 |
363 #undef NEW_NODE_0 | 362 #undef NEW_NODE_0 |
364 #undef NEW_NODE_1 | 363 #undef NEW_NODE_1 |
365 #undef NEW_NODE_2 | 364 #undef NEW_NODE_2 |
366 #undef NEW_NODE_3 | 365 #undef NEW_NODE_3 |
367 #undef MACHINE | 366 #undef MACHINE |
368 #undef COMMON | 367 #undef COMMON |
369 #undef ZONE | 368 #undef ZONE |
370 | 369 |
371 } // namespace compiler | 370 } // namespace compiler |
372 } // namespace internal | 371 } // namespace internal |
373 } // namespace v8 | 372 } // namespace v8 |
374 | 373 |
375 #endif // V8_COMPILER_MACHINE_NODE_FACTORY_H_ | 374 #endif // V8_COMPILER_MACHINE_NODE_FACTORY_H_ |
OLD | NEW |