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

Unified Diff: test/cctest/compiler/test-machine-operator-reducer.cc

Issue 877753007: Reland "Initial switch to Chromium-style CHECK_* and DCHECK_* macros.". (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: VS201x now happy? Created 5 years, 11 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/test-loop-assignment-analysis.cc ('k') | test/cctest/compiler/test-node.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-machine-operator-reducer.cc
diff --git a/test/cctest/compiler/test-machine-operator-reducer.cc b/test/cctest/compiler/test-machine-operator-reducer.cc
index c46045635d2354eb88cabdbded9e3ce7c1c9be9e..7ee5751875476846abc5cee5fba4c11b394a5087 100644
--- a/test/cctest/compiler/test-machine-operator-reducer.cc
+++ b/test/cctest/compiler/test-machine-operator-reducer.cc
@@ -100,7 +100,7 @@ class ReducerTester : public HandleAndZoneScope {
// the {expect} value.
template <typename T>
void CheckFoldBinop(volatile T expect, Node* a, Node* b) {
- CHECK_NE(NULL, binop);
+ CHECK(binop);
Node* n = CreateBinopNode(a, b);
MachineOperatorReducer reducer(&jsgraph);
Reduction reduction = reducer.Reduce(n);
@@ -112,7 +112,7 @@ class ReducerTester : public HandleAndZoneScope {
// Check that the reduction of this binop applied to {a} and {b} yields
// the {expect} node.
void CheckBinop(Node* expect, Node* a, Node* b) {
- CHECK_NE(NULL, binop);
+ CHECK(binop);
Node* n = CreateBinopNode(a, b);
MachineOperatorReducer reducer(&jsgraph);
Reduction reduction = reducer.Reduce(n);
@@ -124,7 +124,7 @@ class ReducerTester : public HandleAndZoneScope {
// this binop applied to {left_expect} and {right_expect}.
void CheckFoldBinop(Node* left_expect, Node* right_expect, Node* left,
Node* right) {
- CHECK_NE(NULL, binop);
+ CHECK(binop);
Node* n = CreateBinopNode(left, right);
MachineOperatorReducer reducer(&jsgraph);
Reduction reduction = reducer.Reduce(n);
@@ -139,7 +139,7 @@ class ReducerTester : public HandleAndZoneScope {
template <typename T>
void CheckFoldBinop(volatile T left_expect, const Operator* op_expect,
Node* right_expect, Node* left, Node* right) {
- CHECK_NE(NULL, binop);
+ CHECK(binop);
Node* n = CreateBinopNode(left, right);
MachineOperatorReducer reducer(&jsgraph);
Reduction r = reducer.Reduce(n);
@@ -154,7 +154,7 @@ class ReducerTester : public HandleAndZoneScope {
template <typename T>
void CheckFoldBinop(Node* left_expect, const Operator* op_expect,
volatile T right_expect, Node* left, Node* right) {
- CHECK_NE(NULL, binop);
+ CHECK(binop);
Node* n = CreateBinopNode(left, right);
MachineOperatorReducer reducer(&jsgraph);
Reduction r = reducer.Reduce(n);
@@ -723,133 +723,6 @@ TEST(ReduceLoadStore) {
}
-static void CheckNans(ReducerTester* R) {
- Node* x = R->Parameter();
- std::vector<double> nans = ValueHelper::nan_vector();
- for (std::vector<double>::const_iterator pl = nans.begin(); pl != nans.end();
- ++pl) {
- for (std::vector<double>::const_iterator pr = nans.begin();
- pr != nans.end(); ++pr) {
- Node* nan1 = R->Constant<double>(*pl);
- Node* nan2 = R->Constant<double>(*pr);
- R->CheckBinop(nan1, x, nan1); // x op NaN => NaN
- R->CheckBinop(nan1, nan1, x); // NaN op x => NaN
- R->CheckBinop(nan1, nan2, nan1); // NaN op NaN => NaN
- }
- }
-}
-
-
-TEST(ReduceFloat64Add) {
- ReducerTester R;
- R.binop = R.machine.Float64Add();
-
- FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) {
- double x = *pl, y = *pr;
- R.CheckFoldBinop<double>(x + y, x, y);
- }
- }
-
- FOR_FLOAT64_INPUTS(i) {
- Double tmp(*i);
- if (!tmp.IsSpecial() || tmp.IsInfinite()) {
- // Don't check NaNs as they are reduced more.
- R.CheckPutConstantOnRight(*i);
- }
- }
-
- CheckNans(&R);
-}
-
-
-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);
- }
- }
-
- Node* zero = R.Constant<double>(0.0);
- Node* x = R.Parameter();
-
- R.CheckBinop(x, x, zero); // x - 0.0 => x
-
- CheckNans(&R);
-}
-
-
-TEST(ReduceFloat64Mul) {
- ReducerTester R;
- R.binop = R.machine.Float64Mul();
-
- FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) {
- double x = *pl, y = *pr;
- R.CheckFoldBinop<double>(x * y, x, y);
- }
- }
-
- double inf = V8_INFINITY;
- R.CheckPutConstantOnRight(-inf);
- R.CheckPutConstantOnRight(-0.1);
- R.CheckPutConstantOnRight(0.1);
- R.CheckPutConstantOnRight(inf);
-
- Node* x = R.Parameter();
- Node* one = R.Constant<double>(1.0);
-
- R.CheckBinop(x, x, one); // x * 1.0 => x
- R.CheckBinop(x, one, x); // 1.0 * x => x
-
- CheckNans(&R);
-}
-
-
-TEST(ReduceFloat64Div) {
- ReducerTester R;
- R.binop = R.machine.Float64Div();
-
- FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) {
- double x = *pl, y = *pr;
- R.CheckFoldBinop<double>(x / y, x, y);
- }
- }
-
- Node* x = R.Parameter();
- Node* one = R.Constant<double>(1.0);
-
- R.CheckBinop(x, x, one); // x / 1.0 => x
-
- CheckNans(&R);
-}
-
-
-TEST(ReduceFloat64Mod) {
- ReducerTester R;
- R.binop = R.machine.Float64Mod();
-
- FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) {
- double x = *pl, y = *pr;
- R.CheckFoldBinop<double>(modulo(x, y), x, y);
- }
- }
-
- Node* x = R.Parameter();
- Node* zero = R.Constant<double>(0.0);
-
- R.CheckFoldBinop<double>(std::numeric_limits<double>::quiet_NaN(), x, zero);
-
- CheckNans(&R);
-}
-
-
// TODO(titzer): test MachineOperatorReducer for Word64And
// TODO(titzer): test MachineOperatorReducer for Word64Or
// TODO(titzer): test MachineOperatorReducer for Word64Xor
@@ -870,3 +743,8 @@ TEST(ReduceFloat64Mod) {
// TODO(titzer): test MachineOperatorReducer for ChangeInt32ToFloat64
// TODO(titzer): test MachineOperatorReducer for ChangeFloat64ToInt32
// TODO(titzer): test MachineOperatorReducer for Float64Compare
+// TODO(titzer): test MachineOperatorReducer for Float64Add
+// TODO(titzer): test MachineOperatorReducer for Float64Sub
+// TODO(titzer): test MachineOperatorReducer for Float64Mul
+// TODO(titzer): test MachineOperatorReducer for Float64Div
+// TODO(titzer): test MachineOperatorReducer for Float64Mod
« no previous file with comments | « test/cctest/compiler/test-loop-assignment-analysis.cc ('k') | test/cctest/compiler/test-node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698