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

Unified Diff: test/cctest/compiler/test-simplified-lowering.cc

Issue 2202883005: [turbofan] Unify number operation typing rules. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove useless cementation. DCHECKs instead of defensive programming are way more useful. Created 4 years, 4 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 | « src/types.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-simplified-lowering.cc
diff --git a/test/cctest/compiler/test-simplified-lowering.cc b/test/cctest/compiler/test-simplified-lowering.cc
index 45bc1fa7075785d19bcdc0774427997214f0a562..ccf2790d8ceb384eae62418b785bb4338066d514 100644
--- a/test/cctest/compiler/test-simplified-lowering.cc
+++ b/test/cctest/compiler/test-simplified-lowering.cc
@@ -1547,84 +1547,6 @@ TEST(UpdatePhi) {
}
-TEST(RunNumberDivide_minus_1_TruncatingToInt32) {
- SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
- Node* num = t.NumberToInt32(t.Parameter(0));
- Node* div = t.NumberDivide(num, t.jsgraph.Constant(-1));
- Node* trunc = t.NumberToInt32(div);
- t.Return(trunc);
-
- t.LowerAllNodesAndLowerChanges();
- t.GenerateCode();
-
- FOR_INT32_INPUTS(i) {
- int32_t x = 0 - *i;
- t.CheckNumberCall(static_cast<double>(x), static_cast<double>(*i));
- }
-}
-
-
-TEST(RunNumberMultiply_TruncatingToInt32) {
- int32_t constants[] = {-100, -10, -1, 0, 1, 100, 1000, 3000999};
-
- for (size_t i = 0; i < arraysize(constants); i++) {
- double k = static_cast<double>(constants[i]);
- SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
- Node* num = t.NumberToInt32(t.Parameter(0));
- Node* mul = t.NumberMultiply(num, t.jsgraph.Constant(k));
- Node* trunc = t.NumberToInt32(mul);
- t.Return(trunc);
-
- t.LowerAllNodesAndLowerChanges();
- t.GenerateCode();
-
- FOR_INT32_INPUTS(i) {
- int32_t x = DoubleToInt32(static_cast<double>(*i) * k);
- t.CheckNumberCall(static_cast<double>(x), static_cast<double>(*i));
- }
- }
-}
-
-
-TEST(RunNumberMultiply_TruncatingToUint32) {
- uint32_t constants[] = {0, 1, 2, 3, 4, 100, 1000, 1024, 2048, 3000999};
-
- for (size_t i = 0; i < arraysize(constants); i++) {
- double k = static_cast<double>(constants[i]);
- SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
- Node* num = t.NumberToUint32(t.Parameter(0));
- Node* mul = t.NumberMultiply(num, t.jsgraph.Constant(k));
- Node* trunc = t.NumberToUint32(mul);
- t.Return(trunc);
-
- t.LowerAllNodesAndLowerChanges();
- t.GenerateCode();
-
- FOR_UINT32_INPUTS(i) {
- uint32_t x = DoubleToUint32(static_cast<double>(*i) * k);
- t.CheckNumberCall(static_cast<double>(x), static_cast<double>(*i));
- }
- }
-}
-
-
-TEST(RunNumberDivide_2_TruncatingToUint32) {
- SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
- Node* num = t.NumberToUint32(t.Parameter(0));
- Node* div = t.NumberDivide(num, t.jsgraph.Constant(2));
- Node* trunc = t.NumberToUint32(div);
- t.Return(trunc);
-
- t.LowerAllNodesAndLowerChanges();
- t.GenerateCode();
-
- FOR_UINT32_INPUTS(i) {
- uint32_t x = DoubleToUint32(static_cast<double>(*i / 2.0));
- t.CheckNumberCall(static_cast<double>(x), static_cast<double>(*i));
- }
-}
-
-
TEST(NumberMultiply_ConstantOutOfRange) {
TestingGraph t(Type::Signed32());
Node* k = t.jsgraph.Constant(1000000023);
@@ -1664,29 +1586,6 @@ TEST(NumberDivide_TruncatingToInt32) {
}
-TEST(RunNumberDivide_TruncatingToInt32) {
- int32_t constants[] = {-100, -10, -1, 1, 2, 100, 1000, 1024, 2048};
-
- for (size_t i = 0; i < arraysize(constants); i++) {
- int32_t k = constants[i];
- SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
- Node* num = t.NumberToInt32(t.Parameter(0));
- Node* div = t.NumberDivide(num, t.jsgraph.Constant(k));
- Node* trunc = t.NumberToInt32(div);
- t.Return(trunc);
-
- t.LowerAllNodesAndLowerChanges();
- t.GenerateCode();
-
- FOR_INT32_INPUTS(i) {
- if (*i == INT_MAX) continue; // exclude max int.
- int32_t x = DoubleToInt32(static_cast<double>(*i) / k);
- t.CheckNumberCall(static_cast<double>(x), static_cast<double>(*i));
- }
- }
-}
-
-
TEST(NumberDivide_TruncatingToUint32) {
double constants[] = {1, 3, 100, 1000, 100998348};
@@ -1703,28 +1602,6 @@ TEST(NumberDivide_TruncatingToUint32) {
}
-TEST(RunNumberDivide_TruncatingToUint32) {
- uint32_t constants[] = {100, 10, 1, 1, 2, 4, 1000, 1024, 2048};
-
- for (size_t i = 0; i < arraysize(constants); i++) {
- uint32_t k = constants[i];
- SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
- Node* num = t.NumberToUint32(t.Parameter(0));
- Node* div = t.NumberDivide(num, t.jsgraph.Constant(static_cast<double>(k)));
- Node* trunc = t.NumberToUint32(div);
- t.Return(trunc);
-
- t.LowerAllNodesAndLowerChanges();
- t.GenerateCode();
-
- FOR_UINT32_INPUTS(i) {
- uint32_t x = *i / k;
- t.CheckNumberCall(static_cast<double>(x), static_cast<double>(*i));
- }
- }
-}
-
-
TEST(NumberDivide_BadConstants) {
{
TestingGraph t(Type::Signed32());
@@ -1779,29 +1656,6 @@ TEST(NumberModulus_TruncatingToInt32) {
}
-TEST(RunNumberModulus_TruncatingToInt32) {
- int32_t constants[] = {-100, -10, -1, 1, 2, 100, 1000, 1024, 2048};
-
- for (size_t i = 0; i < arraysize(constants); i++) {
- int32_t k = constants[i];
- SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
- Node* num = t.NumberToInt32(t.Parameter(0));
- Node* mod = t.NumberModulus(num, t.jsgraph.Constant(k));
- Node* trunc = t.NumberToInt32(mod);
- t.Return(trunc);
-
- t.LowerAllNodesAndLowerChanges();
- t.GenerateCode();
-
- FOR_INT32_INPUTS(i) {
- if (*i == INT_MAX) continue; // exclude max int.
- int32_t x = DoubleToInt32(std::fmod(static_cast<double>(*i), k));
- t.CheckNumberCall(static_cast<double>(x), static_cast<double>(*i));
- }
- }
-}
-
-
TEST(NumberModulus_TruncatingToUint32) {
double constants[] = {1, 3, 100, 1000, 100998348};
@@ -1818,29 +1672,6 @@ TEST(NumberModulus_TruncatingToUint32) {
}
-TEST(RunNumberModulus_TruncatingToUint32) {
- uint32_t constants[] = {1, 2, 100, 1000, 1024, 2048};
-
- for (size_t i = 0; i < arraysize(constants); i++) {
- uint32_t k = constants[i];
- SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
- Node* num = t.NumberToUint32(t.Parameter(0));
- Node* mod =
- t.NumberModulus(num, t.jsgraph.Constant(static_cast<double>(k)));
- Node* trunc = t.NumberToUint32(mod);
- t.Return(trunc);
-
- t.LowerAllNodesAndLowerChanges();
- t.GenerateCode();
-
- FOR_UINT32_INPUTS(i) {
- uint32_t x = *i % k;
- t.CheckNumberCall(static_cast<double>(x), static_cast<double>(*i));
- }
- }
-}
-
-
TEST(NumberModulus_Int32) {
int32_t constants[] = {-100, -10, 1, 4, 100, 1000};
« no previous file with comments | « src/types.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698