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

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

Issue 636283009: [turbofan] Use range types to type and lower arithmetic ops. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rename MaybeWeaken and rebase Created 6 years, 2 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') | test/cctest/compiler/test-typer.cc » ('j') | 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 6553bf70a91588ae71df45e8e822fefe8a5e8a89..3d1c2551d00c140b57e38d0fed0edab5a966e938 100644
--- a/test/cctest/compiler/test-simplified-lowering.cc
+++ b/test/cctest/compiler/test-simplified-lowering.cc
@@ -947,24 +947,50 @@ TEST(LowerNumberCmp_to_float64) {
TEST(LowerNumberAddSub_to_int32) {
- TestingGraph t(Type::Signed32(), Type::Signed32());
- t.CheckLoweringTruncatedBinop(IrOpcode::kInt32Add,
- t.simplified()->NumberAdd(),
- t.simplified()->NumberToInt32());
- t.CheckLoweringTruncatedBinop(IrOpcode::kInt32Sub,
- t.simplified()->NumberSubtract(),
- t.simplified()->NumberToInt32());
+ HandleAndZoneScope scope;
+ Factory* f = scope.main_zone()->isolate()->factory();
+ Type* small_range =
+ Type::Range(f->NewNumber(1), f->NewNumber(10), scope.main_zone());
+ Type* large_range =
+ Type::Range(f->NewNumber(-1e+13), f->NewNumber(1e+14), scope.main_zone());
+ static Type* types[] = {Type::Signed32(), Type::Integral32(), small_range,
+ large_range};
+
+ for (size_t i = 0; i < arraysize(types); i++) {
+ for (size_t j = 0; j < arraysize(types); j++) {
+ TestingGraph t(types[i], types[j]);
+ t.CheckLoweringTruncatedBinop(IrOpcode::kInt32Add,
+ t.simplified()->NumberAdd(),
+ t.simplified()->NumberToInt32());
+ t.CheckLoweringTruncatedBinop(IrOpcode::kInt32Sub,
+ t.simplified()->NumberSubtract(),
+ t.simplified()->NumberToInt32());
+ }
+ }
}
TEST(LowerNumberAddSub_to_uint32) {
- TestingGraph t(Type::Unsigned32(), Type::Unsigned32());
- t.CheckLoweringTruncatedBinop(IrOpcode::kInt32Add,
- t.simplified()->NumberAdd(),
- t.simplified()->NumberToUint32());
- t.CheckLoweringTruncatedBinop(IrOpcode::kInt32Sub,
- t.simplified()->NumberSubtract(),
- t.simplified()->NumberToUint32());
+ HandleAndZoneScope scope;
+ Factory* f = scope.main_zone()->isolate()->factory();
+ Type* small_range =
+ Type::Range(f->NewNumber(1), f->NewNumber(10), scope.main_zone());
+ Type* large_range =
+ Type::Range(f->NewNumber(-1e+13), f->NewNumber(1e+14), scope.main_zone());
+ static Type* types[] = {Type::Signed32(), Type::Integral32(), small_range,
+ large_range};
+
+ for (size_t i = 0; i < arraysize(types); i++) {
+ for (size_t j = 0; j < arraysize(types); j++) {
+ TestingGraph t(types[i], types[j]);
+ t.CheckLoweringTruncatedBinop(IrOpcode::kInt32Add,
+ t.simplified()->NumberAdd(),
+ t.simplified()->NumberToUint32());
+ t.CheckLoweringTruncatedBinop(IrOpcode::kInt32Sub,
+ t.simplified()->NumberSubtract(),
+ t.simplified()->NumberToUint32());
+ }
+ }
}
« no previous file with comments | « src/types.h ('k') | test/cctest/compiler/test-typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698