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 |