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

Unified Diff: test/cctest/compiler/graph-builder-tester.h

Issue 1164603002: [turbofan] Clean up cctest "framework" for dealing with native calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « test/cctest/compiler/codegen-tester.h ('k') | test/cctest/compiler/test-run-machops.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/graph-builder-tester.h
diff --git a/test/cctest/compiler/graph-builder-tester.h b/test/cctest/compiler/graph-builder-tester.h
index 9a5174c1d744067b017887a56f05ea6a5ba71d2d..848f250fddb6205b5c23a7f4b021d939f8804820 100644
--- a/test/cctest/compiler/graph-builder-tester.h
+++ b/test/cctest/compiler/graph-builder-tester.h
@@ -39,12 +39,10 @@ class GraphAndBuilders {
template <typename ReturnType>
-class GraphBuilderTester
- : public HandleAndZoneScope,
- private GraphAndBuilders,
- public CallHelper,
- public SimplifiedGraphBuilder,
- public CallHelper2<ReturnType, GraphBuilderTester<ReturnType> > {
+class GraphBuilderTester : public HandleAndZoneScope,
+ private GraphAndBuilders,
+ public CallHelper<ReturnType>,
+ public SimplifiedGraphBuilder {
public:
explicit GraphBuilderTester(MachineType p0 = kMachNone,
MachineType p1 = kMachNone,
@@ -52,7 +50,7 @@ class GraphBuilderTester
MachineType p3 = kMachNone,
MachineType p4 = kMachNone)
: GraphAndBuilders(main_zone()),
- CallHelper(
+ CallHelper<ReturnType>(
main_isolate(),
MakeMachineSignature(
main_zone(), ReturnValueTraits<ReturnType>::Representation(),
@@ -79,7 +77,7 @@ class GraphBuilderTester
if (code_.is_null()) {
Zone* zone = graph()->zone();
CallDescriptor* desc =
- Linkage::GetSimplifiedCDescriptor(zone, machine_sig_);
+ Linkage::GetSimplifiedCDescriptor(zone, this->machine_sig_);
code_ = Pipeline::GenerateCodeForTesting(main_isolate(), desc, graph());
}
return code_.ToHandleChecked()->entry();
@@ -92,11 +90,34 @@ class GraphBuilderTester
}
}
- size_t parameter_count() const { return machine_sig_->parameter_count(); }
+ size_t parameter_count() const {
+ return this->machine_sig_->parameter_count();
+ }
private:
Node** parameters_;
MaybeHandle<Code> code_;
+
+ // TODO(titzer): factor me elsewhere.
+ static MachineSignature* MakeMachineSignature(
+ Zone* zone, MachineType return_type, MachineType p0 = kMachNone,
+ MachineType p1 = kMachNone, MachineType p2 = kMachNone,
+ MachineType p3 = kMachNone, MachineType p4 = kMachNone) {
+ // Count the number of parameters.
+ size_t param_count = 5;
+ MachineType types[] = {p0, p1, p2, p3, p4};
+ while (param_count > 0 && types[param_count - 1] == kMachNone)
+ param_count--;
+ size_t return_count = return_type == kMachNone ? 0 : 1;
+
+ // Build the machine signature.
+ MachineSignature::Builder builder(zone, return_count, param_count);
+ if (return_count > 0) builder.AddReturn(return_type);
+ for (size_t i = 0; i < param_count; i++) {
+ builder.AddParam(types[i]);
+ }
+ return builder.Build();
+ }
};
} // namespace compiler
« no previous file with comments | « test/cctest/compiler/codegen-tester.h ('k') | test/cctest/compiler/test-run-machops.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698