Commit f0d69fc9 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[test] Modernize value helpers

This CL changes the usage pattern from
FOR_XXX_VALUES(i) { Use(*i); }
to
FOR_XXX_VALUES(i) { Use(i); }
which is way more intuitive.

Note that the replacement in the uses was done via regular expression,
so it's purely mechanical. In two locations I removed unneeded braces
around the macro, because they confused clang-format.
I plan to do more cleanups (remove redundant assignments within the
FOR_XXX_VALUES body) in a follow-up CL.

R=mstarzinger@chromium.org

Bug: v8:8562
Change-Id: I4329bfcf34e5b077d19b50f4204ceb3b4340fe61
Reviewed-on: https://chromium-review.googlesource.com/c/1449615
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59287}
parent 7ab09b39
......@@ -22,27 +22,23 @@ TEST(CompareWrapper) {
CompareWrapper wUint32LessThan(IrOpcode::kUint32LessThan);
CompareWrapper wUint32LessThanOrEqual(IrOpcode::kUint32LessThanOrEqual);
{
FOR_INT32_INPUTS(pl) {
FOR_INT32_INPUTS(pr) {
int32_t a = *pl;
int32_t b = *pr;
CHECK_EQ(a == b, wWord32Equal.Int32Compare(a, b));
CHECK_EQ(a < b, wInt32LessThan.Int32Compare(a, b));
CHECK_EQ(a <= b, wInt32LessThanOrEqual.Int32Compare(a, b));
}
FOR_INT32_INPUTS(pl) {
FOR_INT32_INPUTS(pr) {
int32_t a = pl;
int32_t b = pr;
CHECK_EQ(a == b, wWord32Equal.Int32Compare(a, b));
CHECK_EQ(a < b, wInt32LessThan.Int32Compare(a, b));
CHECK_EQ(a <= b, wInt32LessThanOrEqual.Int32Compare(a, b));
}
}
{
FOR_UINT32_INPUTS(pl) {
FOR_UINT32_INPUTS(pr) {
uint32_t a = *pl;
uint32_t b = *pr;
CHECK_EQ(a == b, wWord32Equal.Int32Compare(a, b));
CHECK_EQ(a < b, wUint32LessThan.Int32Compare(a, b));
CHECK_EQ(a <= b, wUint32LessThanOrEqual.Int32Compare(a, b));
}
FOR_UINT32_INPUTS(pl) {
FOR_UINT32_INPUTS(pr) {
uint32_t a = pl;
uint32_t b = pr;
CHECK_EQ(a == b, wWord32Equal.Int32Compare(a, b));
CHECK_EQ(a < b, wUint32LessThan.Int32Compare(a, b));
CHECK_EQ(a <= b, wUint32LessThanOrEqual.Int32Compare(a, b));
}
}
......@@ -338,8 +334,8 @@ void Int32BinopInputShapeTester::TestAllInputShapes() {
void Int32BinopInputShapeTester::Run(RawMachineAssemblerTester<int32_t>* m) {
FOR_INT32_INPUTS(pl) {
FOR_INT32_INPUTS(pr) {
input_a = *pl;
input_b = *pr;
input_a = pl;
input_b = pr;
int32_t expect = gen->expected(input_a, input_b);
CHECK_EQ(expect, m->Call(input_a, input_b));
}
......@@ -350,7 +346,7 @@ void Int32BinopInputShapeTester::Run(RawMachineAssemblerTester<int32_t>* m) {
void Int32BinopInputShapeTester::RunLeft(
RawMachineAssemblerTester<int32_t>* m) {
FOR_UINT32_INPUTS(i) {
input_a = *i;
input_a = i;
int32_t expect = gen->expected(input_a, input_b);
CHECK_EQ(expect, m->Call(input_a, input_b));
}
......@@ -360,7 +356,7 @@ void Int32BinopInputShapeTester::RunLeft(
void Int32BinopInputShapeTester::RunRight(
RawMachineAssemblerTester<int32_t>* m) {
FOR_UINT32_INPUTS(i) {
input_b = *i;
input_b = i;
int32_t expect = gen->expected(input_a, input_b);
CHECK_EQ(expect, m->Call(input_a, input_b));
}
......@@ -414,8 +410,8 @@ TEST(RunEmpty) {
TEST(RunInt32Constants) {
FOR_INT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m;
m.Return(m.Int32Constant(*i));
CHECK_EQ(*i, m.Call());
m.Return(m.Int32Constant(i));
CHECK_EQ(i, m.Call());
}
}
......@@ -435,17 +431,12 @@ TEST(RunSmiConstants) {
RunSmiConstant(Smi::kMinValue);
RunSmiConstant(Smi::kMinValue + 1);
FOR_INT32_INPUTS(i) { RunSmiConstant(*i); }
FOR_INT32_INPUTS(i) { RunSmiConstant(i); }
}
TEST(RunNumberConstants) {
{
FOR_FLOAT64_INPUTS(i) { RunNumberConstant(*i); }
}
{
FOR_INT32_INPUTS(i) { RunNumberConstant(*i); }
}
FOR_FLOAT64_INPUTS(i) { RunNumberConstant(i); }
FOR_INT32_INPUTS(i) { RunNumberConstant(i); }
for (int32_t i = 1; i < Smi::kMaxValue && i != 0;
i = base::ShlWithWraparound(i, 1)) {
......@@ -460,7 +451,6 @@ TEST(RunNumberConstants) {
RunNumberConstant(Smi::kMinValue + 1);
}
TEST(RunEmptyString) {
RawMachineAssemblerTester<Object> m;
m.Return(m.StringConstant("empty"));
......@@ -490,8 +480,8 @@ TEST(RunParam1) {
m.Return(m.Parameter(0));
FOR_INT32_INPUTS(i) {
int32_t result = m.Call(*i);
CHECK_EQ(*i, result);
int32_t result = m.Call(i);
CHECK_EQ(i, result);
}
}
......@@ -505,8 +495,8 @@ TEST(RunParam2_1) {
USE(p1);
FOR_INT32_INPUTS(i) {
int32_t result = m.Call(*i, -9999);
CHECK_EQ(*i, result);
int32_t result = m.Call(i, -9999);
CHECK_EQ(i, result);
}
}
......@@ -520,8 +510,8 @@ TEST(RunParam2_2) {
USE(p0);
FOR_INT32_INPUTS(i) {
int32_t result = m.Call(-7777, *i);
CHECK_EQ(*i, result);
int32_t result = m.Call(-7777, i);
CHECK_EQ(i, result);
}
}
......@@ -535,9 +525,9 @@ TEST(RunParam3) {
int p[] = {-99, -77, -88};
FOR_INT32_INPUTS(j) {
p[i] = *j;
p[i] = j;
int32_t result = m.Call(p[0], p[1], p[2]);
CHECK_EQ(*j, result);
CHECK_EQ(j, result);
}
}
}
......@@ -549,7 +539,7 @@ TEST(RunBinopTester) {
Int32BinopTester bt(&m);
bt.AddReturn(bt.param0);
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, bt.call(*i, 777)); }
FOR_INT32_INPUTS(i) { CHECK_EQ(i, bt.call(i, 777)); }
}
{
......@@ -557,7 +547,7 @@ TEST(RunBinopTester) {
Int32BinopTester bt(&m);
bt.AddReturn(bt.param1);
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, bt.call(666, *i)); }
FOR_INT32_INPUTS(i) { CHECK_EQ(i, bt.call(666, i)); }
}
{
......@@ -565,7 +555,7 @@ TEST(RunBinopTester) {
Float64BinopTester bt(&m);
bt.AddReturn(bt.param0);
FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(*i, bt.call(*i, 9.0)); }
FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(i, bt.call(i, 9.0)); }
}
{
......@@ -573,7 +563,7 @@ TEST(RunBinopTester) {
Float64BinopTester bt(&m);
bt.AddReturn(bt.param1);
FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(*i, bt.call(-11.25, *i)); }
FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(i, bt.call(-11.25, i)); }
}
}
......@@ -603,7 +593,7 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
{
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
m.Return(m.Parameter(0));
FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(*i, m.Call(*i)); }
FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(i, m.Call(i)); }
}
{
BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Int64(),
......@@ -611,8 +601,8 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.Return(m.Int64Add(m.Parameter(0), m.Parameter(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
CHECK_EQ(base::AddWithWraparound(*i, *j), m.Call(*i, *j));
CHECK_EQ(base::AddWithWraparound(*j, *i), m.Call(*j, *i));
CHECK_EQ(base::AddWithWraparound(i, j), m.Call(i, j));
CHECK_EQ(base::AddWithWraparound(j, i), m.Call(j, i));
}
}
}
......@@ -623,9 +613,9 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.Int64Add(m.Int64Add(m.Parameter(0), m.Parameter(1)), m.Parameter(2)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
CHECK_EQ(Add3(*i, *i, *j), m.Call(*i, *i, *j));
CHECK_EQ(Add3(*i, *j, *i), m.Call(*i, *j, *i));
CHECK_EQ(Add3(*j, *i, *i), m.Call(*j, *i, *i));
CHECK_EQ(Add3(i, i, j), m.Call(i, i, j));
CHECK_EQ(Add3(i, j, i), m.Call(i, j, i));
CHECK_EQ(Add3(j, i, i), m.Call(j, i, i));
}
}
}
......@@ -638,10 +628,10 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.Parameter(3)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
CHECK_EQ(Add4(*i, *i, *i, *j), m.Call(*i, *i, *i, *j));
CHECK_EQ(Add4(*i, *i, *j, *i), m.Call(*i, *i, *j, *i));
CHECK_EQ(Add4(*i, *j, *i, *i), m.Call(*i, *j, *i, *i));
CHECK_EQ(Add4(*j, *i, *i, *i), m.Call(*j, *i, *i, *i));
CHECK_EQ(Add4(i, i, i, j), m.Call(i, i, i, j));
CHECK_EQ(Add4(i, i, j, i), m.Call(i, i, j, i));
CHECK_EQ(Add4(i, j, i, i), m.Call(i, j, i, i));
CHECK_EQ(Add4(j, i, i, i), m.Call(j, i, i, i));
}
}
}
......@@ -662,8 +652,8 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.PointerConstant(&result), m.Parameter(0), kNoWriteBarrier);
m.Return(m.Int32Constant(0));
FOR_FLOAT64_INPUTS(i) {
m.Call(*i);
CHECK_DOUBLE_EQ(*i, result);
m.Call(i);
CHECK_DOUBLE_EQ(i, result);
}
}
{
......@@ -676,11 +666,11 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.Return(m.Int32Constant(0));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
m.Call(*i, *j);
CHECK_EQ(base::AddWithWraparound(*i, *j), result);
m.Call(i, j);
CHECK_EQ(base::AddWithWraparound(i, j), result);
m.Call(*j, *i);
CHECK_EQ(base::AddWithWraparound(*j, *i), result);
m.Call(j, i);
CHECK_EQ(base::AddWithWraparound(j, i), result);
}
}
}
......@@ -695,14 +685,14 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.Return(m.Int32Constant(0));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
m.Call(*i, *i, *j);
CHECK_EQ(Add3(*i, *i, *j), result);
m.Call(i, i, j);
CHECK_EQ(Add3(i, i, j), result);
m.Call(*i, *j, *i);
CHECK_EQ(Add3(*i, *j, *i), result);
m.Call(i, j, i);
CHECK_EQ(Add3(i, j, i), result);
m.Call(*j, *i, *i);
CHECK_EQ(Add3(*j, *i, *i), result);
m.Call(j, i, i);
CHECK_EQ(Add3(j, i, i), result);
}
}
}
......@@ -720,17 +710,17 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.Return(m.Int32Constant(0));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
m.Call(*i, *i, *i, *j);
CHECK_EQ(Add4(*i, *i, *i, *j), result);
m.Call(i, i, i, j);
CHECK_EQ(Add4(i, i, i, j), result);
m.Call(*i, *i, *j, *i);
CHECK_EQ(Add4(*i, *i, *j, *i), result);
m.Call(i, i, j, i);
CHECK_EQ(Add4(i, i, j, i), result);
m.Call(*i, *j, *i, *i);
CHECK_EQ(Add4(*i, *j, *i, *i), result);
m.Call(i, j, i, i);
CHECK_EQ(Add4(i, j, i, i), result);
m.Call(*j, *i, *i, *i);
CHECK_EQ(Add4(*j, *i, *i, *i), result);
m.Call(j, i, i, i);
CHECK_EQ(Add4(j, i, i, i), result);
}
}
}
......
......@@ -33,7 +33,7 @@ TEST(BranchCombineWord32EqualZero_1) {
m.Return(m.Int32Constant(ne_constant));
FOR_INT32_INPUTS(i) {
int32_t a = *i;
int32_t a = i;
int32_t expect = a == 0 ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a));
}
......@@ -60,7 +60,7 @@ TEST(BranchCombineWord32EqualZero_chain) {
m.Return(m.Int32Constant(ne_constant));
FOR_INT32_INPUTS(i) {
int32_t a = *i;
int32_t a = i;
int32_t expect = (k & 1) == 1 ? (a == 0 ? eq_constant : ne_constant)
: (a == 0 ? ne_constant : eq_constant);
CHECK_EQ(expect, m.Call(a));
......@@ -84,7 +84,7 @@ TEST(BranchCombineInt32LessThanZero_1) {
m.Return(m.Int32Constant(ne_constant));
FOR_INT32_INPUTS(i) {
int32_t a = *i;
int32_t a = i;
int32_t expect = a < 0 ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a));
}
......@@ -106,7 +106,7 @@ TEST(BranchCombineUint32LessThan100_1) {
m.Return(m.Int32Constant(ne_constant));
FOR_UINT32_INPUTS(i) {
uint32_t a = *i;
uint32_t a = i;
int32_t expect = a < 100 ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a));
}
......@@ -128,7 +128,7 @@ TEST(BranchCombineUint32LessThanOrEqual100_1) {
m.Return(m.Int32Constant(ne_constant));
FOR_UINT32_INPUTS(i) {
uint32_t a = *i;
uint32_t a = i;
int32_t expect = a <= 100 ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a));
}
......@@ -150,7 +150,7 @@ TEST(BranchCombineZeroLessThanInt32_1) {
m.Return(m.Int32Constant(ne_constant));
FOR_INT32_INPUTS(i) {
int32_t a = *i;
int32_t a = i;
int32_t expect = 0 < a ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a));
}
......@@ -172,7 +172,7 @@ TEST(BranchCombineInt32GreaterThanZero_1) {
m.Return(m.Int32Constant(ne_constant));
FOR_INT32_INPUTS(i) {
int32_t a = *i;
int32_t a = i;
int32_t expect = a > 0 ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a));
}
......@@ -197,8 +197,8 @@ TEST(BranchCombineWord32EqualP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t a = *i;
int32_t b = *j;
int32_t a = i;
int32_t b = j;
int32_t expect = a == b ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a, b));
}
......@@ -213,7 +213,7 @@ TEST(BranchCombineWord32EqualI) {
for (int left = 0; left < 2; left++) {
FOR_INT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
int32_t a = *i;
int32_t a = i;
Node* p0 = m.Int32Constant(a);
Node* p1 = m.Parameter(0);
......@@ -227,7 +227,7 @@ TEST(BranchCombineWord32EqualI) {
m.Return(m.Int32Constant(ne_constant));
FOR_INT32_INPUTS(j) {
int32_t b = *j;
int32_t b = j;
int32_t expect = a == b ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(b));
}
......@@ -256,8 +256,8 @@ TEST(BranchCombineInt32CmpP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t a = *i;
int32_t b = *j;
int32_t a = i;
int32_t b = j;
int32_t expect = 0;
if (op == 0) expect = a < b ? eq_constant : ne_constant;
if (op == 1) expect = a <= b ? eq_constant : ne_constant;
......@@ -275,7 +275,7 @@ TEST(BranchCombineInt32CmpI) {
for (int op = 0; op < 2; op++) {
FOR_INT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
int32_t a = *i;
int32_t a = i;
Node* p0 = m.Int32Constant(a);
Node* p1 = m.Parameter(0);
......@@ -288,7 +288,7 @@ TEST(BranchCombineInt32CmpI) {
m.Return(m.Int32Constant(ne_constant));
FOR_INT32_INPUTS(j) {
int32_t b = *j;
int32_t b = j;
int32_t expect = 0;
if (op == 0) expect = a < b ? eq_constant : ne_constant;
if (op == 1) expect = a <= b ? eq_constant : ne_constant;
......@@ -500,8 +500,8 @@ TEST(BranchCombineInt32AddLessThanZero) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t a = *i;
int32_t b = *j;
int32_t a = i;
int32_t b = j;
int32_t expect =
(base::AddWithWraparound(a, b) < 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
......@@ -529,8 +529,8 @@ TEST(BranchCombineInt32AddGreaterThanOrEqualZero) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t a = *i;
int32_t b = *j;
int32_t a = i;
int32_t b = j;
int32_t expect =
(base::AddWithWraparound(a, b) >= 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
......@@ -558,8 +558,8 @@ TEST(BranchCombineInt32ZeroGreaterThanAdd) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t a = *i;
int32_t b = *j;
int32_t a = i;
int32_t b = j;
int32_t expect =
(0 > base::AddWithWraparound(a, b)) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
......@@ -587,8 +587,8 @@ TEST(BranchCombineInt32ZeroLessThanOrEqualAdd) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t a = *i;
int32_t b = *j;
int32_t a = i;
int32_t b = j;
int32_t expect =
(0 <= base::AddWithWraparound(a, b)) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
......@@ -616,8 +616,8 @@ TEST(BranchCombineUint32AddLessThanOrEqualZero) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t a = *i;
uint32_t b = *j;
uint32_t a = i;
uint32_t b = j;
int32_t expect = (a + b <= 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
......@@ -644,8 +644,8 @@ TEST(BranchCombineUint32AddGreaterThanZero) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t a = *i;
uint32_t b = *j;
uint32_t a = i;
uint32_t b = j;
int32_t expect = (a + b > 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
......@@ -672,8 +672,8 @@ TEST(BranchCombineUint32ZeroGreaterThanOrEqualAdd) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t a = *i;
uint32_t b = *j;
uint32_t a = i;
uint32_t b = j;
int32_t expect = (0 >= a + b) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
......@@ -700,8 +700,8 @@ TEST(BranchCombineUint32ZeroLessThanAdd) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t a = *i;
uint32_t b = *j;
uint32_t a = i;
uint32_t b = j;
int32_t expect = (0 < a + b) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
......@@ -728,8 +728,8 @@ TEST(BranchCombineWord32AndLessThanZero) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t a = *i;
int32_t b = *j;
int32_t a = i;
int32_t b = j;
int32_t expect = ((a & b) < 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
......@@ -756,8 +756,8 @@ TEST(BranchCombineWord32AndGreaterThanOrEqualZero) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t a = *i;
int32_t b = *j;
int32_t a = i;
int32_t b = j;
int32_t expect = ((a & b) >= 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
......@@ -784,8 +784,8 @@ TEST(BranchCombineInt32ZeroGreaterThanAnd) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t a = *i;
int32_t b = *j;
int32_t a = i;
int32_t b = j;
int32_t expect = (0 > (a & b)) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
......@@ -812,8 +812,8 @@ TEST(BranchCombineInt32ZeroLessThanOrEqualAnd) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t a = *i;
int32_t b = *j;
int32_t a = i;
int32_t b = j;
int32_t expect = (0 <= (a & b)) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
......@@ -840,8 +840,8 @@ TEST(BranchCombineUint32AndLessThanOrEqualZero) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
uint32_t a = *i;
uint32_t b = *j;
uint32_t a = i;
uint32_t b = j;
int32_t expect = ((a & b) <= 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
......@@ -868,8 +868,8 @@ TEST(BranchCombineUint32AndGreaterThanZero) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
uint32_t a = *i;
uint32_t b = *j;
uint32_t a = i;
uint32_t b = j;
int32_t expect = ((a & b) > 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
......@@ -896,8 +896,8 @@ TEST(BranchCombineUint32ZeroGreaterThanOrEqualAnd) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
uint32_t a = *i;
uint32_t b = *j;
uint32_t a = i;
uint32_t b = j;
int32_t expect = (0 >= (a & b)) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
......@@ -924,8 +924,8 @@ TEST(BranchCombineUint32ZeroLessThanAnd) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
uint32_t a = *i;
uint32_t b = *j;
uint32_t a = i;
uint32_t b = j;
int32_t expect = (0 < (a & b)) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
......
......@@ -167,9 +167,9 @@ TEST(CanonicalizingNumbers) {
JSConstantCacheTester T;
FOR_FLOAT64_INPUTS(i) {
Node* node = T.Constant(*i);
Node* node = T.Constant(i);
for (int j = 0; j < 5; j++) {
CHECK_EQ(node, T.Constant(*i));
CHECK_EQ(node, T.Constant(i));
}
}
}
......@@ -179,7 +179,7 @@ TEST(HeapNumbers) {
JSConstantCacheTester T;
FOR_FLOAT64_INPUTS(i) {
double value = *i;
double value = i;
Handle<Object> num = T.factory()->NewNumber(value);
Handle<HeapNumber> heap = T.factory()->NewHeapNumber(value);
Node* node1 = T.Constant(value);
......
......@@ -258,7 +258,7 @@ TEST(ReduceWord32And) {
FOR_INT32_INPUTS(pl) {
FOR_INT32_INPUTS(pr) {
int32_t x = *pl, y = *pr;
int32_t x = pl, y = pr;
R.CheckFoldBinop<int32_t>(x & y, x, y);
}
}
......@@ -284,7 +284,7 @@ TEST(ReduceWord32Or) {
FOR_INT32_INPUTS(pl) {
FOR_INT32_INPUTS(pr) {
int32_t x = *pl, y = *pr;
int32_t x = pl, y = pr;
R.CheckFoldBinop<int32_t>(x | y, x, y);
}
}
......@@ -310,7 +310,7 @@ TEST(ReduceWord32Xor) {
FOR_INT32_INPUTS(pl) {
FOR_INT32_INPUTS(pr) {
int32_t x = *pl, y = *pr;
int32_t x = pl, y = pr;
R.CheckFoldBinop<int32_t>(x ^ y, x, y);
}
}
......@@ -334,7 +334,7 @@ TEST(ReduceWord32Shl) {
// TODO(titzer): out of range shifts
FOR_INT32_INPUTS(i) {
for (int y = 0; y < 32; y++) {
int32_t x = *i;
int32_t x = i;
R.CheckFoldBinop<int32_t>(base::ShlWithWraparound(x, y), x, y);
}
}
......@@ -353,7 +353,7 @@ TEST(ReduceWord64Shl) {
FOR_INT64_INPUTS(i) {
for (int64_t y = 0; y < 64; y++) {
int64_t x = *i;
int64_t x = i;
R.CheckFoldBinop<int64_t>(base::ShlWithWraparound(x, y), x, y);
}
}
......@@ -373,7 +373,7 @@ TEST(ReduceWord32Shr) {
// TODO(titzer): test out of range shifts
FOR_UINT32_INPUTS(i) {
for (uint32_t y = 0; y < 32; y++) {
uint32_t x = *i;
uint32_t x = i;
R.CheckFoldBinop<int32_t>(x >> y, x, y);
}
}
......@@ -392,7 +392,7 @@ TEST(ReduceWord64Shr) {
FOR_UINT64_INPUTS(i) {
for (uint64_t y = 0; y < 64; y++) {
uint64_t x = *i;
uint64_t x = i;
R.CheckFoldBinop<int64_t>(x >> y, x, y);
}
}
......@@ -412,7 +412,7 @@ TEST(ReduceWord32Sar) {
// TODO(titzer): test out of range shifts
FOR_INT32_INPUTS(i) {
for (int32_t y = 0; y < 32; y++) {
int32_t x = *i;
int32_t x = i;
R.CheckFoldBinop<int32_t>(x >> y, x, y);
}
}
......@@ -431,7 +431,7 @@ TEST(ReduceWord64Sar) {
FOR_INT64_INPUTS(i) {
for (int64_t y = 0; y < 64; y++) {
int64_t x = *i;
int64_t x = i;
R.CheckFoldBinop<int64_t>(x >> y, x, y);
}
}
......@@ -479,7 +479,7 @@ TEST(Word32Equal) {
FOR_INT32_INPUTS(pl) {
FOR_INT32_INPUTS(pr) {
int32_t x = *pl, y = *pr;
int32_t x = pl, y = pr;
R.CheckFoldBinop<int32_t>(x == y ? 1 : 0, x, y);
}
}
......@@ -504,7 +504,7 @@ TEST(ReduceInt32Add) {
FOR_INT32_INPUTS(pl) {
FOR_INT32_INPUTS(pr) {
int32_t x = *pl, y = *pr;
int32_t x = pl, y = pr;
R.CheckFoldBinop<int32_t>(base::AddWithWraparound(x, y), x, y);
}
}
......@@ -525,7 +525,7 @@ TEST(ReduceInt64Add) {
FOR_INT64_INPUTS(pl) {
FOR_INT64_INPUTS(pr) {
int64_t x = *pl, y = *pr;
int64_t x = pl, y = pr;
R.CheckFoldBinop<int64_t>(base::AddWithWraparound(x, y), x, y);
}
}
......@@ -544,7 +544,7 @@ TEST(ReduceInt32Sub) {
FOR_INT32_INPUTS(pl) {
FOR_INT32_INPUTS(pr) {
int32_t x = *pl, y = *pr;
int32_t x = pl, y = pr;
R.CheckFoldBinop<int32_t>(base::SubWithWraparound(x, y), x, y);
}
}
......@@ -563,7 +563,7 @@ TEST(ReduceInt64Sub) {
FOR_INT64_INPUTS(pl) {
FOR_INT64_INPUTS(pr) {
int64_t x = *pl, y = *pr;
int64_t x = pl, y = pr;
R.CheckFoldBinop<int64_t>(base::SubWithWraparound(x, y), x, y);
}
}
......@@ -588,7 +588,7 @@ TEST(ReduceInt32Mul) {
FOR_INT32_INPUTS(pl) {
FOR_INT32_INPUTS(pr) {
int32_t x = *pl, y = *pr;
int32_t x = pl, y = pr;
R.CheckFoldBinop<int32_t>(base::MulWithWraparound(x, y), x, y);
}
}
......@@ -626,7 +626,7 @@ TEST(ReduceInt32Div) {
FOR_INT32_INPUTS(pl) {
FOR_INT32_INPUTS(pr) {
int32_t x = *pl, y = *pr;
int32_t x = pl, y = pr;
if (y == 0) continue; // TODO(titzer): test / 0
int32_t r = y == -1 ? base::NegateWithWraparound(x)
: x / y; // INT_MIN / -1 may explode in C
......@@ -655,7 +655,7 @@ TEST(ReduceUint32Div) {
FOR_UINT32_INPUTS(pl) {
FOR_UINT32_INPUTS(pr) {
uint32_t x = *pl, y = *pr;
uint32_t x = pl, y = pr;
if (y == 0) continue; // TODO(titzer): test / 0
R.CheckFoldBinop<int32_t>(x / y, x, y);
}
......@@ -684,7 +684,7 @@ TEST(ReduceInt32Mod) {
FOR_INT32_INPUTS(pl) {
FOR_INT32_INPUTS(pr) {
int32_t x = *pl, y = *pr;
int32_t x = pl, y = pr;
if (y == 0) continue; // TODO(titzer): test % 0
int32_t r = y == -1 ? 0 : x % y; // INT_MIN % -1 may explode in C
R.CheckFoldBinop<int32_t>(r, x, y);
......@@ -708,7 +708,7 @@ TEST(ReduceUint32Mod) {
FOR_INT32_INPUTS(pl) {
FOR_INT32_INPUTS(pr) {
uint32_t x = *pl, y = *pr;
uint32_t x = pl, y = pr;
if (y == 0) continue; // TODO(titzer): test x % 0
R.CheckFoldBinop<int32_t>(x % y, x, y);
}
......@@ -736,7 +736,7 @@ TEST(ReduceInt32LessThan) {
FOR_INT32_INPUTS(pl) {
FOR_INT32_INPUTS(pr) {
int32_t x = *pl, y = *pr;
int32_t x = pl, y = pr;
R.CheckFoldBinop<int32_t>(x < y ? 1 : 0, x, y);
}
}
......@@ -756,12 +756,12 @@ TEST(ReduceInt32LessThanOrEqual) {
FOR_INT32_INPUTS(pl) {
FOR_INT32_INPUTS(pr) {
int32_t x = *pl, y = *pr;
int32_t x = pl, y = pr;
R.CheckFoldBinop<int32_t>(x <= y ? 1 : 0, x, y);
}
}
FOR_INT32_INPUTS(i) { R.CheckDontPutConstantOnRight<int32_t>(*i); }
FOR_INT32_INPUTS(i) { R.CheckDontPutConstantOnRight<int32_t>(i); }
Node* x = R.Parameter(0);
......@@ -775,7 +775,7 @@ TEST(ReduceUint32LessThan) {
FOR_UINT32_INPUTS(pl) {
FOR_UINT32_INPUTS(pr) {
uint32_t x = *pl, y = *pr;
uint32_t x = pl, y = pr;
R.CheckFoldBinop<int32_t>(x < y ? 1 : 0, x, y);
}
}
......@@ -799,7 +799,7 @@ TEST(ReduceUint32LessThanOrEqual) {
FOR_UINT32_INPUTS(pl) {
FOR_UINT32_INPUTS(pr) {
uint32_t x = *pl, y = *pr;
uint32_t x = pl, y = pr;
R.CheckFoldBinop<int32_t>(x <= y ? 1 : 0, x, y);
}
}
......@@ -848,7 +848,7 @@ TEST(ReduceFloat32Sub) {
FOR_FLOAT32_INPUTS(pl) {
FOR_FLOAT32_INPUTS(pr) {
float x = *pl, y = *pr;
float x = pl, y = pr;
R.CheckFoldBinop<float>(x - y, x, y);
}
}
......@@ -868,7 +868,7 @@ TEST(ReduceFloat64Sub) {
FOR_FLOAT64_INPUTS(pl) {
FOR_FLOAT64_INPUTS(pr) {
double x = *pl, y = *pr;
double x = pl, y = pr;
R.CheckFoldBinop<double>(x - y, x, y);
}
}
......
......@@ -261,12 +261,12 @@ TEST(ToInt32_constant) {
RepresentationChangerTester r;
{
FOR_INT32_INPUTS(i) {
Node* n = r.jsgraph()->Constant(*i);
Node* n = r.jsgraph()->Constant(i);
Node* use = r.Return(n);
Node* c = r.changer()->GetRepresentationFor(
n, MachineRepresentation::kTagged, Type::Signed32(), use,
UseInfo(MachineRepresentation::kWord32, Truncation::None()));
r.CheckInt32Constant(c, *i);
r.CheckInt32Constant(c, i);
}
}
}
......@@ -274,24 +274,24 @@ TEST(ToInt32_constant) {
TEST(ToUint32_constant) {
RepresentationChangerTester r;
FOR_UINT32_INPUTS(i) {
Node* n = r.jsgraph()->Constant(static_cast<double>(*i));
Node* n = r.jsgraph()->Constant(static_cast<double>(i));
Node* use = r.Return(n);
Node* c = r.changer()->GetRepresentationFor(
n, MachineRepresentation::kTagged, Type::Unsigned32(), use,
UseInfo(MachineRepresentation::kWord32, Truncation::None()));
r.CheckUint32Constant(c, *i);
r.CheckUint32Constant(c, i);
}
}
TEST(ToInt64_constant) {
RepresentationChangerTester r;
FOR_INT32_INPUTS(i) {
Node* n = r.jsgraph()->Constant(*i);
Node* n = r.jsgraph()->Constant(i);
Node* use = r.Return(n);
Node* c = r.changer()->GetRepresentationFor(
n, MachineRepresentation::kTagged, TypeCache::Get()->kSafeInteger, use,
UseInfo(MachineRepresentation::kWord64, Truncation::None()));
r.CheckInt64Constant(c, *i);
r.CheckInt64Constant(c, i);
}
}
......
......@@ -52,7 +52,7 @@ void RunLoadInt32(const TestAlignment t) {
}
FOR_INT32_INPUTS(i) {
p1 = *i;
p1 = i;
CHECK_EQ(p1, m.Call());
}
}
......@@ -79,7 +79,7 @@ void RunLoadInt32Offset(TestAlignment t) {
}
FOR_INT32_INPUTS(j) {
p1 = *j;
p1 = j;
CHECK_EQ(p1, m.Call());
}
}
......@@ -91,9 +91,9 @@ void RunLoadStoreFloat32Offset(TestAlignment t) {
FOR_INT32_INPUTS(i) {
int32_t magic =
base::AddWithWraparound(0x2342AABB, base::MulWithWraparound(*i, 3));
base::AddWithWraparound(0x2342AABB, base::MulWithWraparound(i, 3));
RawMachineAssemblerTester<int32_t> m;
int32_t offset = *i;
int32_t offset = i;
byte* from = reinterpret_cast<byte*>(&p1) - offset;
byte* to = reinterpret_cast<byte*>(&p2) - offset;
// generate load [#base + #index]
......@@ -115,8 +115,8 @@ void RunLoadStoreFloat32Offset(TestAlignment t) {
m.Return(m.Int32Constant(magic));
FOR_FLOAT32_INPUTS(j) {
p1 = *j;
p2 = *j - 5;
p1 = j;
p2 = j - 5;
CHECK_EQ(magic, m.Call());
CHECK_DOUBLE_EQ(p1, p2);
}
......@@ -129,9 +129,9 @@ void RunLoadStoreFloat64Offset(TestAlignment t) {
FOR_INT32_INPUTS(i) {
int32_t magic =
base::AddWithWraparound(0x2342AABB, base::MulWithWraparound(*i, 3));
base::AddWithWraparound(0x2342AABB, base::MulWithWraparound(i, 3));
RawMachineAssemblerTester<int32_t> m;
int32_t offset = *i;
int32_t offset = i;
byte* from = reinterpret_cast<byte*>(&p1) - offset;
byte* to = reinterpret_cast<byte*>(&p2) - offset;
// generate load [#base + #index]
......@@ -152,8 +152,8 @@ void RunLoadStoreFloat64Offset(TestAlignment t) {
m.Return(m.Int32Constant(magic));
FOR_FLOAT64_INPUTS(j) {
p1 = *j;
p2 = *j - 5;
p1 = j;
p2 = j - 5;
CHECK_EQ(magic, m.Call());
CHECK_DOUBLE_EQ(p1, p2);
}
......@@ -458,12 +458,12 @@ void RunLoadStoreSignExtend32(TestAlignment t) {
m.Return(load8);
FOR_INT32_INPUTS(i) {
buffer[0] = *i;
buffer[0] = i;
CHECK_EQ(static_cast<int8_t>(*i & 0xFF), m.Call());
CHECK_EQ(static_cast<int8_t>(*i & 0xFF), buffer[1]);
CHECK_EQ(static_cast<int16_t>(*i & 0xFFFF), buffer[2]);
CHECK_EQ(*i, buffer[3]);
CHECK_EQ(static_cast<int8_t>(i & 0xFF), m.Call());
CHECK_EQ(static_cast<int8_t>(i & 0xFF), buffer[1]);
CHECK_EQ(static_cast<int16_t>(i & 0xFFFF), buffer[2]);
CHECK_EQ(i, buffer[3]);
}
}
......@@ -491,12 +491,12 @@ void RunLoadStoreZeroExtend32(TestAlignment t) {
m.Return(load8);
FOR_UINT32_INPUTS(i) {
buffer[0] = *i;
buffer[0] = i;
CHECK_EQ((*i & 0xFF), m.Call());
CHECK_EQ((*i & 0xFF), buffer[1]);
CHECK_EQ((*i & 0xFFFF), buffer[2]);
CHECK_EQ(*i, buffer[3]);
CHECK_EQ((i & 0xFF), m.Call());
CHECK_EQ((i & 0xFF), buffer[1]);
CHECK_EQ((i & 0xFFFF), buffer[2]);
CHECK_EQ(i, buffer[3]);
}
}
} // namespace
......@@ -552,13 +552,13 @@ void RunLoadStoreSignExtend64(TestAlignment t) {
m.Return(load8);
FOR_INT64_INPUTS(i) {
buffer[0] = *i;
buffer[0] = i;
CHECK_EQ(static_cast<int8_t>(*i & 0xFF), m.Call());
CHECK_EQ(static_cast<int8_t>(*i & 0xFF), buffer[1]);
CHECK_EQ(static_cast<int16_t>(*i & 0xFFFF), buffer[2]);
CHECK_EQ(static_cast<int32_t>(*i & 0xFFFFFFFF), buffer[3]);
CHECK_EQ(*i, buffer[4]);
CHECK_EQ(static_cast<int8_t>(i & 0xFF), m.Call());
CHECK_EQ(static_cast<int8_t>(i & 0xFF), buffer[1]);
CHECK_EQ(static_cast<int16_t>(i & 0xFFFF), buffer[2]);
CHECK_EQ(static_cast<int32_t>(i & 0xFFFFFFFF), buffer[3]);
CHECK_EQ(i, buffer[4]);
}
}
......@@ -595,13 +595,13 @@ void RunLoadStoreZeroExtend64(TestAlignment t) {
m.Return(load8);
FOR_UINT64_INPUTS(i) {
buffer[0] = *i;
buffer[0] = i;
CHECK_EQ((*i & 0xFF), m.Call());
CHECK_EQ((*i & 0xFF), buffer[1]);
CHECK_EQ((*i & 0xFFFF), buffer[2]);
CHECK_EQ((*i & 0xFFFFFFFF), buffer[3]);
CHECK_EQ(*i, buffer[4]);
CHECK_EQ((i & 0xFF), m.Call());
CHECK_EQ((i & 0xFF), buffer[1]);
CHECK_EQ((i & 0xFFFF), buffer[2]);
CHECK_EQ((i & 0xFFFFFFFF), buffer[3]);
CHECK_EQ(i, buffer[4]);
}
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -542,9 +542,9 @@ static void TestInt32Sub(CallDescriptor* desc) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(*i) -
static_cast<uint32_t>(*j));
int32_t result = runnable.Call(*i, *j);
int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(i) -
static_cast<uint32_t>(j));
int32_t result = runnable.Call(i, j);
CHECK_EQ(expected, result);
}
}
......
......@@ -317,14 +317,9 @@ class ValueHelper {
}
};
// Helper macros that can be used in FOR_INT32_INPUTS(i) { ... *i ... }
// Watch out, these macros aren't hygenic; they pollute your scope. Thanks STL.
#define FOR_INPUTS(ctype, itype, var) \
Vector<const ctype> var##_vec = \
::v8::internal::compiler::ValueHelper::itype##_vector(); \
for (Vector<const ctype>::iterator var = var##_vec.begin(), \
var##_end = var##_vec.end(); \
var != var##_end; ++var)
// Helper macros that can be used in FOR_INT32_INPUTS(i) { ... i ... }
#define FOR_INPUTS(ctype, itype, var) \
for (ctype var : ::v8::internal::compiler::ValueHelper::itype##_vector())
#define FOR_INT32_INPUTS(var) FOR_INPUTS(int32_t, int32, var)
#define FOR_UINT32_INPUTS(var) FOR_INPUTS(uint32_t, uint32, var)
......
......@@ -4094,18 +4094,18 @@ namespace {
std::vector<Float32> Float32Inputs() {
std::vector<Float32> inputs;
FOR_FLOAT32_INPUTS(f) {
inputs.push_back(Float32::FromBits(bit_cast<uint32_t>(*f)));
inputs.push_back(Float32::FromBits(bit_cast<uint32_t>(f)));
}
FOR_UINT32_INPUTS(bits) { inputs.push_back(Float32::FromBits(*bits)); }
FOR_UINT32_INPUTS(bits) { inputs.push_back(Float32::FromBits(bits)); }
return inputs;
}
std::vector<Float64> Float64Inputs() {
std::vector<Float64> inputs;
FOR_FLOAT64_INPUTS(f) {
inputs.push_back(Float64::FromBits(bit_cast<uint64_t>(*f)));
inputs.push_back(Float64::FromBits(bit_cast<uint64_t>(f)));
}
FOR_UINT64_INPUTS(bits) { inputs.push_back(Float64::FromBits(*bits)); }
FOR_UINT64_INPUTS(bits) { inputs.push_back(Float64::FromBits(bits)); }
return inputs;
}
......
......@@ -109,7 +109,7 @@ TEST(TestCWasmEntryArgPassing_int32) {
return base::AddWithWraparound(base::MulWithWraparound(2, a), 1);
});
FOR_INT32_INPUTS(v) { tester.CheckCall(*v); }
FOR_INT32_INPUTS(v) { tester.CheckCall(v); }
}
// Pass int64_t, return double.
......@@ -119,7 +119,7 @@ TEST(TestCWasmEntryArgPassing_double_int64) {
WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0))},
[](int64_t a) { return static_cast<double>(a); });
FOR_INT64_INPUTS(v) { tester.CheckCall(*v); }
FOR_INT64_INPUTS(v) { tester.CheckCall(v); }
}
// Pass double, return int64_t.
......@@ -129,7 +129,7 @@ TEST(TestCWasmEntryArgPassing_int64_double) {
WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0))},
[](double d) { return static_cast<int64_t>(d); });
FOR_INT64_INPUTS(i) { tester.CheckCall(*i); }
FOR_INT64_INPUTS(i) { tester.CheckCall(i); }
}
// Pass float, return double.
......@@ -141,7 +141,7 @@ TEST(TestCWasmEntryArgPassing_float_double) {
WASM_F64(1))},
[](float f) { return 2. * static_cast<double>(f) + 1.; });
FOR_FLOAT32_INPUTS(f) { tester.CheckCall(*f); }
FOR_FLOAT32_INPUTS(f) { tester.CheckCall(f); }
}
// Pass two doubles, return double.
......@@ -152,7 +152,7 @@ TEST(TestCWasmEntryArgPassing_double_double) {
[](double a, double b) { return a + b; });
FOR_FLOAT64_INPUTS(d1) {
FOR_FLOAT64_INPUTS(d2) { tester.CheckCall(*d1, *d2); }
FOR_FLOAT64_INPUTS(d2) { tester.CheckCall(d1, d2); }
}
}
......
This diff is collapsed.
......@@ -73,8 +73,8 @@ WASM_EXEC_TEST(I32AsmjsSConvertF32) {
BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF32, WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
int32_t expected = DoubleToInt32(*i);
CHECK_EQ(expected, r.Call(*i));
int32_t expected = DoubleToInt32(i);
CHECK_EQ(expected, r.Call(i));
}
}
......@@ -84,8 +84,8 @@ WASM_EXEC_TEST(I32AsmjsSConvertF64) {
BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF64, WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
int32_t expected = DoubleToInt32(*i);
CHECK_EQ(expected, r.Call(*i));
int32_t expected = DoubleToInt32(i);
CHECK_EQ(expected, r.Call(i));
}
}
......@@ -95,8 +95,8 @@ WASM_EXEC_TEST(I32AsmjsUConvertF32) {
BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF32, WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
uint32_t expected = DoubleToUint32(*i);
CHECK_EQ(expected, r.Call(*i));
uint32_t expected = DoubleToUint32(i);
CHECK_EQ(expected, r.Call(i));
}
}
......@@ -106,8 +106,8 @@ WASM_EXEC_TEST(I32AsmjsUConvertF64) {
BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF64, WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
uint32_t expected = DoubleToUint32(*i);
CHECK_EQ(expected, r.Call(*i));
uint32_t expected = DoubleToUint32(i);
CHECK_EQ(expected, r.Call(i));
}
}
......
......@@ -22,11 +22,11 @@ void RunU32BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
uint32_t initial = *i;
uint32_t initial = i;
FOR_UINT32_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
CHECK_EQ(initial, r.Call(*j));
uint32_t expected = expected_op(*i, *j);
CHECK_EQ(initial, r.Call(j));
uint32_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
......@@ -51,11 +51,11 @@ void RunU16BinOp(ExecutionTier tier, WasmOpcode wasm_op,
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
uint16_t initial = *i;
uint16_t initial = i;
FOR_UINT16_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
CHECK_EQ(initial, r.Call(*j));
uint16_t expected = expected_op(*i, *j);
CHECK_EQ(initial, r.Call(j));
uint16_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
......@@ -79,11 +79,11 @@ void RunU8BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
uint8_t initial = *i;
uint8_t initial = i;
FOR_UINT8_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
CHECK_EQ(initial, r.Call(*j));
uint8_t expected = expected_op(*i, *j);
CHECK_EQ(initial, r.Call(j));
uint8_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
......@@ -107,11 +107,11 @@ WASM_EXEC_TEST(I32AtomicCompareExchange) {
WASM_GET_LOCAL(1), MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
uint32_t initial = *i;
uint32_t initial = i;
FOR_UINT32_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
CHECK_EQ(initial, r.Call(*i, *j));
uint32_t expected = CompareExchange(initial, *i, *j);
CHECK_EQ(initial, r.Call(i, j));
uint32_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
......@@ -129,11 +129,11 @@ WASM_EXEC_TEST(I32AtomicCompareExchange16U) {
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
uint16_t initial = *i;
uint16_t initial = i;
FOR_UINT16_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
CHECK_EQ(initial, r.Call(*i, *j));
uint16_t expected = CompareExchange(initial, *i, *j);
CHECK_EQ(initial, r.Call(i, j));
uint16_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
......@@ -150,11 +150,11 @@ WASM_EXEC_TEST(I32AtomicCompareExchange8U) {
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
uint8_t initial = *i;
uint8_t initial = i;
FOR_UINT8_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
CHECK_EQ(initial, r.Call(*i, *j));
uint8_t expected = CompareExchange(initial, *i, *j);
CHECK_EQ(initial, r.Call(i, j));
uint8_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
......@@ -192,7 +192,7 @@ WASM_EXEC_TEST(I32AtomicLoad) {
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
uint32_t expected = *i;
uint32_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
......@@ -208,7 +208,7 @@ WASM_EXEC_TEST(I32AtomicLoad16U) {
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
uint16_t expected = *i;
uint16_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
......@@ -223,7 +223,7 @@ WASM_EXEC_TEST(I32AtomicLoad8U) {
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
uint8_t expected = *i;
uint8_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
......@@ -243,8 +243,8 @@ WASM_EXEC_TEST(I32AtomicStoreLoad) {
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
uint32_t expected = *i;
CHECK_EQ(expected, r.Call(*i));
uint32_t expected = i;
CHECK_EQ(expected, r.Call(i));
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
......@@ -264,8 +264,8 @@ WASM_EXEC_TEST(I32AtomicStoreLoad16U) {
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
uint16_t expected = *i;
CHECK_EQ(expected, r.Call(*i));
uint16_t expected = i;
CHECK_EQ(expected, r.Call(i));
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
......@@ -283,9 +283,9 @@ WASM_EXEC_TEST(I32AtomicStoreLoad8U) {
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
uint8_t expected = *i;
CHECK_EQ(expected, r.Call(*i));
CHECK_EQ(*i, r.builder().ReadMemory(&memory[0]));
uint8_t expected = i;
CHECK_EQ(expected, r.Call(i));
CHECK_EQ(i, r.builder().ReadMemory(&memory[0]));
}
}
......
......@@ -22,11 +22,11 @@ void RunU64BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
MachineRepresentation::kWord64));
FOR_UINT64_INPUTS(i) {
uint64_t initial = *i;
uint64_t initial = i;
FOR_UINT64_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
CHECK_EQ(initial, r.Call(*j));
uint64_t expected = expected_op(*i, *j);
CHECK_EQ(initial, r.Call(j));
uint64_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
......@@ -51,11 +51,11 @@ void RunU32BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
uint32_t initial = *i;
uint32_t initial = i;
FOR_UINT32_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
CHECK_EQ(initial, r.Call(*j));
uint32_t expected = expected_op(*i, *j);
CHECK_EQ(initial, r.Call(j));
uint32_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
......@@ -80,11 +80,11 @@ void RunU16BinOp(ExecutionTier tier, WasmOpcode wasm_op,
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
uint16_t initial = *i;
uint16_t initial = i;
FOR_UINT16_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
CHECK_EQ(initial, r.Call(*j));
uint16_t expected = expected_op(*i, *j);
CHECK_EQ(initial, r.Call(j));
uint16_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
......@@ -108,11 +108,11 @@ void RunU8BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
uint8_t initial = *i;
uint8_t initial = i;
FOR_UINT8_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
CHECK_EQ(initial, r.Call(*j));
uint8_t expected = expected_op(*i, *j);
CHECK_EQ(initial, r.Call(j));
uint8_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
......@@ -136,11 +136,11 @@ WASM_EXEC_TEST(I64AtomicCompareExchange) {
WASM_GET_LOCAL(1), MachineRepresentation::kWord64));
FOR_UINT64_INPUTS(i) {
uint64_t initial = *i;
uint64_t initial = i;
FOR_UINT64_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
CHECK_EQ(initial, r.Call(*i, *j));
uint64_t expected = CompareExchange(initial, *i, *j);
CHECK_EQ(initial, r.Call(i, j));
uint64_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
......@@ -158,11 +158,11 @@ WASM_EXEC_TEST(I64AtomicCompareExchange32U) {
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
uint32_t initial = *i;
uint32_t initial = i;
FOR_UINT32_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
CHECK_EQ(initial, r.Call(*i, *j));
uint32_t expected = CompareExchange(initial, *i, *j);
CHECK_EQ(initial, r.Call(i, j));
uint32_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
......@@ -180,11 +180,11 @@ WASM_EXEC_TEST(I64AtomicCompareExchange16U) {
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
uint16_t initial = *i;
uint16_t initial = i;
FOR_UINT16_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
CHECK_EQ(initial, r.Call(*i, *j));
uint16_t expected = CompareExchange(initial, *i, *j);
CHECK_EQ(initial, r.Call(i, j));
uint16_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
......@@ -200,11 +200,11 @@ WASM_EXEC_TEST(I32AtomicCompareExchange8U) {
WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
uint8_t initial = *i;
uint8_t initial = i;
FOR_UINT8_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
CHECK_EQ(initial, r.Call(*i, *j));
uint8_t expected = CompareExchange(initial, *i, *j);
CHECK_EQ(initial, r.Call(i, j));
uint8_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
......@@ -220,7 +220,7 @@ WASM_EXEC_TEST(I64AtomicLoad) {
MachineRepresentation::kWord64));
FOR_UINT64_INPUTS(i) {
uint64_t expected = *i;
uint64_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
......@@ -236,7 +236,7 @@ WASM_EXEC_TEST(I64AtomicLoad32U) {
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
uint32_t expected = *i;
uint32_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
......@@ -252,7 +252,7 @@ WASM_EXEC_TEST(I64AtomicLoad16U) {
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
uint16_t expected = *i;
uint16_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
......@@ -267,7 +267,7 @@ WASM_EXEC_TEST(I64AtomicLoad8U) {
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
uint8_t expected = *i;
uint8_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
......@@ -287,8 +287,8 @@ WASM_EXEC_TEST(I64AtomicStoreLoad) {
MachineRepresentation::kWord64));
FOR_UINT64_INPUTS(i) {
uint64_t expected = *i;
CHECK_EQ(expected, r.Call(*i));
uint64_t expected = i;
CHECK_EQ(expected, r.Call(i));
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
......@@ -308,8 +308,8 @@ WASM_EXEC_TEST(I64AtomicStoreLoad32U) {
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
uint32_t expected = *i;
CHECK_EQ(expected, r.Call(*i));
uint32_t expected = i;
CHECK_EQ(expected, r.Call(i));
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
......@@ -329,8 +329,8 @@ WASM_EXEC_TEST(I64AtomicStoreLoad16U) {
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
uint16_t expected = *i;
CHECK_EQ(expected, r.Call(*i));
uint16_t expected = i;
CHECK_EQ(expected, r.Call(i));
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
......@@ -348,9 +348,9 @@ WASM_EXEC_TEST(I64AtomicStoreLoad8U) {
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
uint8_t expected = *i;
CHECK_EQ(expected, r.Call(*i));
CHECK_EQ(*i, r.builder().ReadMemory(&memory[0]));
uint8_t expected = i;
CHECK_EQ(expected, r.Call(i));
CHECK_EQ(i, r.builder().ReadMemory(&memory[0]));
}
}
......
......@@ -192,7 +192,7 @@ TEST(Breakpoint_I32Add) {
FOR_UINT32_INPUTS(a) {
for (uint32_t b = 11; b < 3000000000u; b += 1000000000u) {
thread->Reset();
WasmValue args[] = {WasmValue(*a), WasmValue(b)};
WasmValue args[] = {WasmValue(a), WasmValue(b)};
thread->InitFrame(r.function(), args);
for (int i = 0; i < kNumBreakpoints; i++) {
......@@ -207,7 +207,7 @@ TEST(Breakpoint_I32Add) {
// Check the thread finished with the right value.
CHECK_EQ(WasmInterpreter::FINISHED, thread->state());
uint32_t expected = (*a) + (b);
uint32_t expected = (a) + (b);
CHECK_EQ(expected, thread->GetReturnValue().to<uint32_t>());
}
}
......@@ -227,7 +227,7 @@ TEST(Step_I32Mul) {
FOR_UINT32_INPUTS(a) {
for (uint32_t b = 33; b < 3000000000u; b += 1000000000u) {
thread->Reset();
WasmValue args[] = {WasmValue(*a), WasmValue(b)};
WasmValue args[] = {WasmValue(a), WasmValue(b)};
thread->InitFrame(r.function(), args);
// Run instructions one by one.
......@@ -242,7 +242,7 @@ TEST(Step_I32Mul) {
// Check the thread finished with the right value.
CHECK_EQ(WasmInterpreter::FINISHED, thread->state());
uint32_t expected = (*a) * (b);
uint32_t expected = (a) * (b);
CHECK_EQ(expected, thread->GetReturnValue().to<uint32_t>());
}
}
......@@ -269,7 +269,7 @@ TEST(Breakpoint_I32And_disable) {
interpreter->SetBreakpoint(r.function(), kLocalsDeclSize + offsets[0],
do_break);
thread->Reset();
WasmValue args[] = {WasmValue(*a), WasmValue(b)};
WasmValue args[] = {WasmValue(a), WasmValue(b)};
thread->InitFrame(r.function(), args);
if (do_break) {
......@@ -284,7 +284,7 @@ TEST(Breakpoint_I32And_disable) {
// Check the thread finished with the right value.
CHECK_EQ(WasmInterpreter::FINISHED, thread->state());
uint32_t expected = (*a) & (b);
uint32_t expected = (a) & (b);
CHECK_EQ(expected, thread->GetReturnValue().to<uint32_t>());
}
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -105,7 +105,7 @@ TEST(TestArgumentPassing_int32) {
return base::AddWithWraparound(base::MulWithWraparound(2, a), 1);
});
FOR_INT32_INPUTS(v) { helper.CheckCall(*v); }
FOR_INT32_INPUTS(v) { helper.CheckCall(v); }
}
// Pass int64_t, return double.
......@@ -129,12 +129,12 @@ TEST(TestArgumentPassing_double_int64) {
});
FOR_INT32_INPUTS(v1) {
FOR_INT32_INPUTS(v2) { helper.CheckCall(*v1, *v2); }
FOR_INT32_INPUTS(v2) { helper.CheckCall(v1, v2); }
}
FOR_INT64_INPUTS(v) {
int32_t v1 = static_cast<int32_t>(*v);
int32_t v2 = static_cast<int32_t>(*v >> 32);
int32_t v1 = static_cast<int32_t>(v);
int32_t v2 = static_cast<int32_t>(v >> 32);
helper.CheckCall(v1, v2);
helper.CheckCall(v2, v1);
}
......@@ -175,7 +175,7 @@ TEST(TestArgumentPassing_float_double) {
WASM_GET_LOCAL(0), WASM_CALL_FUNCTION0(f2.function_index())},
[](float f) { return 2. * static_cast<double>(f) + 1.; });
FOR_FLOAT32_INPUTS(f) { helper.CheckCall(*f); }
FOR_FLOAT32_INPUTS(f) { helper.CheckCall(f); }
}
// Pass two doubles, return double.
......@@ -192,7 +192,7 @@ TEST(TestArgumentPassing_double_double) {
[](double a, double b) { return a + b; });
FOR_FLOAT64_INPUTS(d1) {
FOR_FLOAT64_INPUTS(d2) { helper.CheckCall(*d1, *d2); }
FOR_FLOAT64_INPUTS(d2) { helper.CheckCall(d1, d2); }
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment