Changed the constructor of BufferedRawMachineAssemblerTester.

This change does not change how the BufferedRawMachineAssemblerTester is
used in tests, but it makes its construction in other constructors (e.g.
in the WasmRunner) cleaner.

R=titzer@chromium.org

Review URL: https://codereview.chromium.org/1414203009

Cr-Commit-Position: refs/heads/master@{#31850}
This commit is contained in:
ahaas 2015-11-05 23:22:27 -08:00 committed by Commit bot
parent da72ba0b3e
commit 2c74ec3fec

View File

@ -77,28 +77,12 @@ template <typename ReturnType>
class BufferedRawMachineAssemblerTester
: public RawMachineAssemblerTester<int32_t> {
public:
BufferedRawMachineAssemblerTester()
: BufferedRawMachineAssemblerTester(0, kMachNone, kMachNone, kMachNone,
kMachNone) {}
explicit BufferedRawMachineAssemblerTester(MachineType p0)
: BufferedRawMachineAssemblerTester(1, p0, kMachNone, kMachNone,
kMachNone) {}
BufferedRawMachineAssemblerTester(MachineType p0, MachineType p1)
: BufferedRawMachineAssemblerTester(2, p0, p1, kMachNone, kMachNone) {}
BufferedRawMachineAssemblerTester(MachineType p0, MachineType p1,
MachineType p2)
: BufferedRawMachineAssemblerTester(3, p0, p1, p2, kMachNone) {}
BufferedRawMachineAssemblerTester(MachineType p0, MachineType p1,
MachineType p2, MachineType p3)
: BufferedRawMachineAssemblerTester(4, p0, p1, p2, p3) {}
BufferedRawMachineAssemblerTester(MachineType p0 = kMachNone,
MachineType p1 = kMachNone,
MachineType p2 = kMachNone,
MachineType p3 = kMachNone)
: BufferedRawMachineAssemblerTester(ComputeParameterCount(p0, p1, p2, p3),
p0, p1, p2, p3) {}
// The BufferedRawMachineAssemblerTester does not pass parameters directly
@ -193,6 +177,24 @@ class BufferedRawMachineAssemblerTester
}
static uint32_t ComputeParameterCount(MachineType p0, MachineType p1,
MachineType p2, MachineType p3) {
if (p0 == kMachNone) {
return 0;
}
if (p1 == kMachNone) {
return 1;
}
if (p2 == kMachNone) {
return 2;
}
if (p3 == kMachNone) {
return 3;
}
return 4;
}
CSignature* test_graph_signature_;
Node* parameter_nodes_[4];
uint32_t return_parameter_index_;