Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Unified Diff: test/unittests/compiler/raw-machine-assembler.cc

Issue 1205023002: [turbofan] Add basic support for calling to (a subset of) C functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/unittests/compiler/raw-machine-assembler.cc
diff --git a/test/unittests/compiler/raw-machine-assembler.cc b/test/unittests/compiler/raw-machine-assembler.cc
index 20948108aaa4dd17073bd52f4f6a0e5884a7a9a3..5bae30e63e2bd3a16a42d469cc49233e44fd73e8 100644
--- a/test/unittests/compiler/raw-machine-assembler.cc
+++ b/test/unittests/compiler/raw-machine-assembler.cc
@@ -144,6 +144,52 @@ Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function,
}
+Node* RawMachineAssembler::CallCFunction0(MachineType return_type,
+ Node* function) {
+ MachineSignature::Builder builder(zone(), 1, 0);
+ builder.AddReturn(return_type);
+ const CallDescriptor* descriptor =
+ Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
+
+ Node* call = graph()->NewNode(common()->Call(descriptor), function);
+ schedule()->AddNode(CurrentBlock(), call);
+ return call;
+}
+
+
+Node* RawMachineAssembler::CallCFunction1(MachineType return_type,
+ MachineType arg0_type, Node* function,
+ Node* arg0) {
+ MachineSignature::Builder builder(zone(), 1, 1);
+ builder.AddReturn(return_type);
+ builder.AddParam(arg0_type);
+ const CallDescriptor* descriptor =
+ Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
+
+ Node* call = graph()->NewNode(common()->Call(descriptor), function, arg0);
+ schedule()->AddNode(CurrentBlock(), call);
+ return call;
+}
+
+
+Node* RawMachineAssembler::CallCFunction2(MachineType return_type,
+ MachineType arg0_type,
+ MachineType arg1_type, Node* function,
+ Node* arg0, Node* arg1) {
+ MachineSignature::Builder builder(zone(), 1, 2);
+ builder.AddReturn(return_type);
+ builder.AddParam(arg0_type);
+ builder.AddParam(arg1_type);
+ const CallDescriptor* descriptor =
+ Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
+
+ Node* call =
+ graph()->NewNode(common()->Call(descriptor), function, arg0, arg1);
+ schedule()->AddNode(CurrentBlock(), call);
+ return call;
+}
+
+
void RawMachineAssembler::Bind(Label* label) {
DCHECK(current_block_ == NULL);
DCHECK(!label->bound_);
« test/cctest/compiler/test-run-machops.cc ('K') | « test/unittests/compiler/raw-machine-assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698