summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc
diff options
context:
space:
mode:
authorUjjwal Sharma <usharma1998@gmail.com>2019-03-15 18:35:06 +0530
committerRefael Ackermann <refack@gmail.com>2019-03-28 16:36:18 -0400
commitf579e1194046c50f2e6bb54348d48c8e7d1a53cf (patch)
tree9125787c758358365f74f9fd9673c14f57e67870 /deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc
parent2c73868b0471fbd4038f500d076df056cbf697fe (diff)
downloadnode-new-f579e1194046c50f2e6bb54348d48c8e7d1a53cf.tar.gz
deps: update V8 to 7.4.288.13
PR-URL: https://github.com/nodejs/node/pull/26685 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc')
-rw-r--r--deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc139
1 files changed, 47 insertions, 92 deletions
diff --git a/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc b/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc
index 073891a52b..61736ae2dc 100644
--- a/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc
+++ b/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc
@@ -256,11 +256,8 @@ TEST(ReduceWord32And) {
ReducerTester R;
R.binop = R.machine.Word32And();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x & y, x, y);
- }
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x & y, x, y); }
}
R.CheckPutConstantOnRight(33);
@@ -282,11 +279,8 @@ TEST(ReduceWord32Or) {
ReducerTester R;
R.binop = R.machine.Word32Or();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x | y, x, y);
- }
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x | y, x, y); }
}
R.CheckPutConstantOnRight(36);
@@ -308,11 +302,8 @@ TEST(ReduceWord32Xor) {
ReducerTester R;
R.binop = R.machine.Word32Xor();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x ^ y, x, y);
- }
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x ^ y, x, y); }
}
R.CheckPutConstantOnRight(39);
@@ -332,10 +323,9 @@ TEST(ReduceWord32Shl) {
R.binop = R.machine.Word32Shl();
// TODO(titzer): out of range shifts
- FOR_INT32_INPUTS(i) {
+ FOR_INT32_INPUTS(x) {
for (int y = 0; y < 32; y++) {
- int32_t x = *i;
- R.CheckFoldBinop<int32_t>(x << y, x, y);
+ R.CheckFoldBinop<int32_t>(base::ShlWithWraparound(x, y), x, y);
}
}
@@ -351,10 +341,9 @@ TEST(ReduceWord64Shl) {
ReducerTester R;
R.binop = R.machine.Word64Shl();
- FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(x) {
for (int64_t y = 0; y < 64; y++) {
- int64_t x = *i;
- R.CheckFoldBinop<int64_t>(x << y, x, y);
+ R.CheckFoldBinop<int64_t>(base::ShlWithWraparound(x, y), x, y);
}
}
@@ -371,9 +360,8 @@ TEST(ReduceWord32Shr) {
R.binop = R.machine.Word32Shr();
// TODO(titzer): test out of range shifts
- FOR_UINT32_INPUTS(i) {
+ FOR_UINT32_INPUTS(x) {
for (uint32_t y = 0; y < 32; y++) {
- uint32_t x = *i;
R.CheckFoldBinop<int32_t>(x >> y, x, y);
}
}
@@ -390,9 +378,8 @@ TEST(ReduceWord64Shr) {
ReducerTester R;
R.binop = R.machine.Word64Shr();
- FOR_UINT64_INPUTS(i) {
+ FOR_UINT64_INPUTS(x) {
for (uint64_t y = 0; y < 64; y++) {
- uint64_t x = *i;
R.CheckFoldBinop<int64_t>(x >> y, x, y);
}
}
@@ -410,9 +397,8 @@ TEST(ReduceWord32Sar) {
R.binop = R.machine.Word32Sar();
// TODO(titzer): test out of range shifts
- FOR_INT32_INPUTS(i) {
+ FOR_INT32_INPUTS(x) {
for (int32_t y = 0; y < 32; y++) {
- int32_t x = *i;
R.CheckFoldBinop<int32_t>(x >> y, x, y);
}
}
@@ -429,9 +415,8 @@ TEST(ReduceWord64Sar) {
ReducerTester R;
R.binop = R.machine.Word64Sar();
- FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(x) {
for (int64_t y = 0; y < 64; y++) {
- int64_t x = *i;
R.CheckFoldBinop<int64_t>(x >> y, x, y);
}
}
@@ -477,11 +462,8 @@ TEST(Word32Equal) {
ReducerTester R;
R.binop = R.machine.Word32Equal();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x == y ? 1 : 0, x, y);
- }
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x == y ? 1 : 0, x, y); }
}
R.CheckPutConstantOnRight(48);
@@ -502,9 +484,8 @@ TEST(ReduceInt32Add) {
ReducerTester R;
R.binop = R.machine.Int32Add();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) {
R.CheckFoldBinop<int32_t>(base::AddWithWraparound(x, y), x, y);
}
}
@@ -523,9 +504,8 @@ TEST(ReduceInt64Add) {
ReducerTester R;
R.binop = R.machine.Int64Add();
- FOR_INT64_INPUTS(pl) {
- FOR_INT64_INPUTS(pr) {
- int64_t x = *pl, y = *pr;
+ FOR_INT64_INPUTS(x) {
+ FOR_INT64_INPUTS(y) {
R.CheckFoldBinop<int64_t>(base::AddWithWraparound(x, y), x, y);
}
}
@@ -542,9 +522,8 @@ TEST(ReduceInt32Sub) {
ReducerTester R;
R.binop = R.machine.Int32Sub();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) {
R.CheckFoldBinop<int32_t>(base::SubWithWraparound(x, y), x, y);
}
}
@@ -561,9 +540,8 @@ TEST(ReduceInt64Sub) {
ReducerTester R;
R.binop = R.machine.Int64Sub();
- FOR_INT64_INPUTS(pl) {
- FOR_INT64_INPUTS(pr) {
- int64_t x = *pl, y = *pr;
+ FOR_INT64_INPUTS(x) {
+ FOR_INT64_INPUTS(y) {
R.CheckFoldBinop<int64_t>(base::SubWithWraparound(x, y), x, y);
}
}
@@ -586,9 +564,8 @@ TEST(ReduceInt32Mul) {
ReducerTester R;
R.binop = R.machine.Int32Mul();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) {
R.CheckFoldBinop<int32_t>(base::MulWithWraparound(x, y), x, y);
}
}
@@ -624,9 +601,8 @@ TEST(ReduceInt32Div) {
ReducerTester R;
R.binop = R.machine.Int32Div();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) {
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
@@ -653,9 +629,8 @@ TEST(ReduceUint32Div) {
ReducerTester R;
R.binop = R.machine.Uint32Div();
- FOR_UINT32_INPUTS(pl) {
- FOR_UINT32_INPUTS(pr) {
- uint32_t x = *pl, y = *pr;
+ FOR_UINT32_INPUTS(x) {
+ FOR_UINT32_INPUTS(y) {
if (y == 0) continue; // TODO(titzer): test / 0
R.CheckFoldBinop<int32_t>(x / y, x, y);
}
@@ -682,9 +657,8 @@ TEST(ReduceInt32Mod) {
ReducerTester R;
R.binop = R.machine.Int32Mod();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) {
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);
@@ -706,9 +680,8 @@ TEST(ReduceUint32Mod) {
ReducerTester R;
R.binop = R.machine.Uint32Mod();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- uint32_t x = *pl, y = *pr;
+ FOR_UINT32_INPUTS(x) {
+ FOR_UINT32_INPUTS(y) {
if (y == 0) continue; // TODO(titzer): test x % 0
R.CheckFoldBinop<int32_t>(x % y, x, y);
}
@@ -734,11 +707,8 @@ TEST(ReduceInt32LessThan) {
ReducerTester R;
R.binop = R.machine.Int32LessThan();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x < y ? 1 : 0, x, y);
- }
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x < y ? 1 : 0, x, y); }
}
R.CheckDontPutConstantOnRight(41399);
@@ -754,14 +724,11 @@ TEST(ReduceInt32LessThanOrEqual) {
ReducerTester R;
R.binop = R.machine.Int32LessThanOrEqual();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x <= y ? 1 : 0, x, y);
- }
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) { 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);
@@ -773,11 +740,8 @@ TEST(ReduceUint32LessThan) {
ReducerTester R;
R.binop = R.machine.Uint32LessThan();
- FOR_UINT32_INPUTS(pl) {
- FOR_UINT32_INPUTS(pr) {
- uint32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x < y ? 1 : 0, x, y);
- }
+ FOR_UINT32_INPUTS(x) {
+ FOR_UINT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x < y ? 1 : 0, x, y); }
}
R.CheckDontPutConstantOnRight(41399);
@@ -797,11 +761,8 @@ TEST(ReduceUint32LessThanOrEqual) {
ReducerTester R;
R.binop = R.machine.Uint32LessThanOrEqual();
- FOR_UINT32_INPUTS(pl) {
- FOR_UINT32_INPUTS(pr) {
- uint32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x <= y ? 1 : 0, x, y);
- }
+ FOR_UINT32_INPUTS(x) {
+ FOR_UINT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x <= y ? 1 : 0, x, y); }
}
R.CheckDontPutConstantOnRight(41399);
@@ -846,11 +807,8 @@ TEST(ReduceFloat32Sub) {
ReducerTester R;
R.binop = R.machine.Float32Sub();
- FOR_FLOAT32_INPUTS(pl) {
- FOR_FLOAT32_INPUTS(pr) {
- float x = *pl, y = *pr;
- R.CheckFoldBinop<float>(x - y, x, y);
- }
+ FOR_FLOAT32_INPUTS(x) {
+ FOR_FLOAT32_INPUTS(y) { R.CheckFoldBinop<float>(x - y, x, y); }
}
Node* x = R.Parameter();
@@ -866,11 +824,8 @@ TEST(ReduceFloat64Sub) {
ReducerTester R;
R.binop = R.machine.Float64Sub();
- FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) {
- double x = *pl, y = *pr;
- R.CheckFoldBinop<double>(x - y, x, y);
- }
+ FOR_FLOAT64_INPUTS(x) {
+ FOR_FLOAT64_INPUTS(y) { R.CheckFoldBinop<double>(x - y, x, y); }
}
Node* x = R.Parameter();