| 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_RAW_MACHINE_ASSEMBLER_H_ | 5 #ifndef V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
| 6 #define V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 6 #define V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
| 7 | 7 |
| 8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
| 9 #include "src/code-factory.h" |
| 9 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
| 10 #include "src/compiler/graph.h" | 11 #include "src/compiler/graph.h" |
| 11 #include "src/compiler/linkage.h" | 12 #include "src/compiler/linkage.h" |
| 12 #include "src/compiler/machine-operator.h" | 13 #include "src/compiler/machine-operator.h" |
| 13 #include "src/compiler/node.h" | 14 #include "src/compiler/node.h" |
| 14 #include "src/compiler/operator.h" | 15 #include "src/compiler/operator.h" |
| 15 #include "src/factory.h" | 16 #include "src/factory.h" |
| 16 #include "src/globals.h" | 17 #include "src/globals.h" |
| 17 | 18 |
| 18 namespace v8 { | 19 namespace v8 { |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 } | 699 } |
| 699 Node* StringConstant(const char* string) { | 700 Node* StringConstant(const char* string) { |
| 700 return HeapConstant(isolate()->factory()->InternalizeUtf8String(string)); | 701 return HeapConstant(isolate()->factory()->InternalizeUtf8String(string)); |
| 701 } | 702 } |
| 702 | 703 |
| 703 // Call a given call descriptor and the given arguments. | 704 // Call a given call descriptor and the given arguments. |
| 704 Node* CallN(CallDescriptor* desc, Node* function, Node** args); | 705 Node* CallN(CallDescriptor* desc, Node* function, Node** args); |
| 705 // Call a given call descriptor and the given arguments and frame-state. | 706 // Call a given call descriptor and the given arguments and frame-state. |
| 706 Node* CallNWithFrameState(CallDescriptor* desc, Node* function, Node** args, | 707 Node* CallNWithFrameState(CallDescriptor* desc, Node* function, Node** args, |
| 707 Node* frame_state); | 708 Node* frame_state); |
| 708 // Call to a runtime function with zero arguments. | 709 |
| 709 Node* CallRuntime0(Runtime::FunctionId function, Node* context); | 710 // Call to a runtime function with given arguments. |
| 710 // Call to a runtime function with one arguments. | 711 template <class... TArgs> |
| 711 Node* CallRuntime1(Runtime::FunctionId function, Node* arg0, Node* context); | 712 Node* CallRuntime(Runtime::FunctionId function, Node* context, |
| 712 // Call to a runtime function with two arguments. | 713 TArgs... args) { |
| 713 Node* CallRuntime2(Runtime::FunctionId function, Node* arg1, Node* arg2, | 714 int argc = static_cast<int>(sizeof...(args)); |
| 714 Node* context); | 715 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( |
| 715 // Call to a runtime function with three arguments. | 716 zone(), function, argc, Operator::kNoProperties, |
| 716 Node* CallRuntime3(Runtime::FunctionId function, Node* arg1, Node* arg2, | 717 CallDescriptor::kNoFlags); |
| 717 Node* arg3, Node* context); | 718 int return_count = static_cast<int>(descriptor->ReturnCount()); |
| 718 // Call to a runtime function with four arguments. | 719 |
| 719 Node* CallRuntime4(Runtime::FunctionId function, Node* arg1, Node* arg2, | 720 Node* centry = |
| 720 Node* arg3, Node* arg4, Node* context); | 721 HeapConstant(CodeFactory::RuntimeCEntry(isolate(), return_count)); |
| 721 // Call to a runtime function with five arguments. | 722 Node* ref = AddNode( |
| 722 Node* CallRuntime5(Runtime::FunctionId function, Node* arg1, Node* arg2, | 723 common()->ExternalConstant(ExternalReference(function, isolate()))); |
| 723 Node* arg3, Node* arg4, Node* arg5, Node* context); | 724 Node* arity = Int32Constant(argc); |
| 725 |
| 726 return AddNode(common()->Call(descriptor), centry, args..., ref, arity, |
| 727 context); |
| 728 } |
| 729 |
| 724 // Call to a C function with zero arguments. | 730 // Call to a C function with zero arguments. |
| 725 Node* CallCFunction0(MachineType return_type, Node* function); | 731 Node* CallCFunction0(MachineType return_type, Node* function); |
| 726 // Call to a C function with one parameter. | 732 // Call to a C function with one parameter. |
| 727 Node* CallCFunction1(MachineType return_type, MachineType arg0_type, | 733 Node* CallCFunction1(MachineType return_type, MachineType arg0_type, |
| 728 Node* function, Node* arg0); | 734 Node* function, Node* arg0); |
| 729 // Call to a C function with two arguments. | 735 // Call to a C function with two arguments. |
| 730 Node* CallCFunction2(MachineType return_type, MachineType arg0_type, | 736 Node* CallCFunction2(MachineType return_type, MachineType arg0_type, |
| 731 MachineType arg1_type, Node* function, Node* arg0, | 737 MachineType arg1_type, Node* function, Node* arg0, |
| 732 Node* arg1); | 738 Node* arg1); |
| 733 // Call to a C function with eight arguments. | 739 // Call to a C function with eight arguments. |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 bool deferred_; | 862 bool deferred_; |
| 857 friend class RawMachineAssembler; | 863 friend class RawMachineAssembler; |
| 858 DISALLOW_COPY_AND_ASSIGN(RawMachineLabel); | 864 DISALLOW_COPY_AND_ASSIGN(RawMachineLabel); |
| 859 }; | 865 }; |
| 860 | 866 |
| 861 } // namespace compiler | 867 } // namespace compiler |
| 862 } // namespace internal | 868 } // namespace internal |
| 863 } // namespace v8 | 869 } // namespace v8 |
| 864 | 870 |
| 865 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 871 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
| OLD | NEW |