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

Side by Side Diff: test/cctest/compiler/test-simplified-lowering.cc

Issue 683873002: [turbofan] Avoid unnecessary (u)int32<->float64 changes in simplified lowering. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Test Created 6 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <limits> 5 #include <limits>
6 6
7 #include "src/compiler/access-builder.h" 7 #include "src/compiler/access-builder.h"
8 #include "src/compiler/change-lowering.h" 8 #include "src/compiler/change-lowering.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/generic-node-inl.h" 10 #include "src/compiler/generic-node-inl.h"
(...skipping 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after
1950 Node* k = t.jsgraph.Constant(c); 1950 Node* k = t.jsgraph.Constant(c);
1951 Node* mod = t.graph()->NewNode(t.simplified()->NumberModulus(), t.p0, k); 1951 Node* mod = t.graph()->NewNode(t.simplified()->NumberModulus(), t.p0, k);
1952 Node* use = t.Use(mod, type); 1952 Node* use = t.Use(mod, type);
1953 t.Return(use); 1953 t.Return(use);
1954 t.Lower(); 1954 t.Lower();
1955 1955
1956 CHECK_EQ(IrOpcode::kUint32Mod, use->InputAt(0)->opcode()); 1956 CHECK_EQ(IrOpcode::kUint32Mod, use->InputAt(0)->opcode());
1957 } 1957 }
1958 } 1958 }
1959 } 1959 }
1960
1961
1962 TEST(PhiRepresentation) {
1963 HandleAndZoneScope scope;
1964 Zone* z = scope.main_zone();
1965
1966 Factory* f = z->isolate()->factory();
1967 Handle<Object> range_min = f->NewNumber(-1e13);
1968 Handle<Object> range_max = f->NewNumber(1e+15);
1969 Type* range = Type::Range(range_min, range_max, z);
1970
1971 struct TestData {
1972 Type* arg1;
1973 Type* arg2;
1974 MachineType use;
1975 MachineTypeUnion expected;
1976 };
1977
1978 TestData test_data[] = {
1979 {Type::Signed32(), Type::Unsigned32(), kMachInt32,
1980 kRepWord32 | kTypeNumber},
1981 {range, range, kMachUint32, kRepWord32 | kTypeNumber},
1982 {Type::Signed32(), Type::Signed32(), kMachInt32, kMachInt32},
1983 {Type::Unsigned32(), Type::Unsigned32(), kMachInt32, kMachUint32},
1984 {Type::Number(), Type::Signed32(), kMachInt32, kMachFloat64},
1985 {Type::Signed32(), Type::String(), kMachInt32, kMachAnyTagged}};
1986
1987 for (auto const d : test_data) {
1988 TestingGraph t(d.arg1, d.arg2, Type::Boolean());
1989
1990 Node* br = t.graph()->NewNode(t.common()->Branch(), t.p2, t.start);
1991 Node* tb = t.graph()->NewNode(t.common()->IfTrue(), br);
1992 Node* fb = t.graph()->NewNode(t.common()->IfFalse(), br);
1993 Node* m = t.graph()->NewNode(t.common()->Merge(2), tb, fb);
1994
1995 Node* phi =
1996 t.graph()->NewNode(t.common()->Phi(kMachAnyTagged, 2), t.p0, t.p1, m);
1997
1998 Bounds phi_bounds = Bounds::Either(Bounds(d.arg1), Bounds(d.arg2), z);
1999 NodeProperties::SetBounds(phi, phi_bounds);
2000
2001 Node* use = t.Use(phi, d.use);
2002 t.Return(use);
2003 t.Lower();
2004
2005 CHECK_EQ(d.expected, OpParameter<MachineType>(phi));
2006 }
2007 }
OLDNEW
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698