OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include "src/compiler/code-assembler.h" | 5 #include "src/compiler/code-assembler.h" |
6 | 6 |
7 #include <ostream> | 7 #include <ostream> |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 Node* return_value = raw_assembler()->CallN(descriptor, code_target, args); | 402 Node* return_value = raw_assembler()->CallN(descriptor, code_target, args); |
403 CallEpilogue(); | 403 CallEpilogue(); |
404 return return_value; | 404 return return_value; |
405 } | 405 } |
406 | 406 |
407 Node* CodeAssembler::TailCallN(CallDescriptor* descriptor, Node* code_target, | 407 Node* CodeAssembler::TailCallN(CallDescriptor* descriptor, Node* code_target, |
408 Node** args) { | 408 Node** args) { |
409 return raw_assembler()->TailCallN(descriptor, code_target, args); | 409 return raw_assembler()->TailCallN(descriptor, code_target, args); |
410 } | 410 } |
411 | 411 |
412 Node* CodeAssembler::CallRuntime(Runtime::FunctionId function_id, | 412 template <class... TArgs> |
413 Node* context) { | 413 Node* CodeAssembler::CallRuntime(Runtime::FunctionId function, Node* context, |
| 414 TArgs... args) { |
414 CallPrologue(); | 415 CallPrologue(); |
415 Node* return_value = raw_assembler()->CallRuntime0(function_id, context); | 416 Node* return_value = raw_assembler()->CallRuntime(function, context, args...); |
416 CallEpilogue(); | 417 CallEpilogue(); |
417 return return_value; | 418 return return_value; |
418 } | 419 } |
419 | 420 |
420 Node* CodeAssembler::CallRuntime(Runtime::FunctionId function_id, Node* context, | 421 // Instantiate CallRuntime template with different number of arguments. |
421 Node* arg1) { | 422 template Node* CodeAssembler::CallRuntime(Runtime::FunctionId, Node* context); |
422 CallPrologue(); | 423 template Node* CodeAssembler::CallRuntime(Runtime::FunctionId, Node* context, |
423 Node* return_value = | 424 Node*); |
424 raw_assembler()->CallRuntime1(function_id, arg1, context); | 425 template Node* CodeAssembler::CallRuntime(Runtime::FunctionId, Node* context, |
425 CallEpilogue(); | 426 Node*, Node*); |
426 return return_value; | 427 template Node* CodeAssembler::CallRuntime(Runtime::FunctionId, Node* context, |
427 } | 428 Node*, Node*, Node*); |
428 | 429 template Node* CodeAssembler::CallRuntime(Runtime::FunctionId, Node* context, |
429 Node* CodeAssembler::CallRuntime(Runtime::FunctionId function_id, Node* context, | 430 Node*, Node*, Node*, Node*); |
430 Node* arg1, Node* arg2) { | 431 template Node* CodeAssembler::CallRuntime(Runtime::FunctionId, Node* context, |
431 CallPrologue(); | 432 Node*, Node*, Node*, Node*, Node*); |
432 Node* return_value = | |
433 raw_assembler()->CallRuntime2(function_id, arg1, arg2, context); | |
434 CallEpilogue(); | |
435 return return_value; | |
436 } | |
437 | |
438 Node* CodeAssembler::CallRuntime(Runtime::FunctionId function_id, Node* context, | |
439 Node* arg1, Node* arg2, Node* arg3) { | |
440 CallPrologue(); | |
441 Node* return_value = | |
442 raw_assembler()->CallRuntime3(function_id, arg1, arg2, arg3, context); | |
443 CallEpilogue(); | |
444 return return_value; | |
445 } | |
446 | |
447 Node* CodeAssembler::CallRuntime(Runtime::FunctionId function_id, Node* context, | |
448 Node* arg1, Node* arg2, Node* arg3, | |
449 Node* arg4) { | |
450 CallPrologue(); | |
451 Node* return_value = raw_assembler()->CallRuntime4(function_id, arg1, arg2, | |
452 arg3, arg4, context); | |
453 CallEpilogue(); | |
454 return return_value; | |
455 } | |
456 | |
457 Node* CodeAssembler::CallRuntime(Runtime::FunctionId function_id, Node* context, | |
458 Node* arg1, Node* arg2, Node* arg3, Node* arg4, | |
459 Node* arg5) { | |
460 CallPrologue(); | |
461 Node* return_value = raw_assembler()->CallRuntime5(function_id, arg1, arg2, | |
462 arg3, arg4, arg5, context); | |
463 CallEpilogue(); | |
464 return return_value; | |
465 } | |
466 | 433 |
467 Node* CodeAssembler::TailCallRuntime(Runtime::FunctionId function_id, | 434 Node* CodeAssembler::TailCallRuntime(Runtime::FunctionId function_id, |
468 Node* context) { | 435 Node* context) { |
469 return raw_assembler()->TailCallRuntime0(function_id, context); | 436 return raw_assembler()->TailCallRuntime0(function_id, context); |
470 } | 437 } |
471 | 438 |
472 Node* CodeAssembler::TailCallRuntime(Runtime::FunctionId function_id, | 439 Node* CodeAssembler::TailCallRuntime(Runtime::FunctionId function_id, |
473 Node* context, Node* arg1) { | 440 Node* context, Node* arg1) { |
474 return raw_assembler()->TailCallRuntime1(function_id, arg1, context); | 441 return raw_assembler()->TailCallRuntime1(function_id, arg1, context); |
475 } | 442 } |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 } | 1180 } |
1214 } | 1181 } |
1215 } | 1182 } |
1216 | 1183 |
1217 bound_ = true; | 1184 bound_ = true; |
1218 } | 1185 } |
1219 | 1186 |
1220 } // namespace compiler | 1187 } // namespace compiler |
1221 } // namespace internal | 1188 } // namespace internal |
1222 } // namespace v8 | 1189 } // namespace v8 |
OLD | NEW |