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

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

Issue 837153002: Restrict representation inference to avoid truncation of phi inputs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comment tweaks 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 unified diff | Download patch
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | test/mjsunit/compiler/regress-446778.js » ('j') | 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/graph-reducer.h" 10 #include "src/compiler/graph-reducer.h"
(...skipping 2019 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 CHECK_EQ(IrOpcode::kUint32Mod, use->InputAt(0)->opcode()); 2030 CHECK_EQ(IrOpcode::kUint32Mod, use->InputAt(0)->opcode());
2031 } 2031 }
2032 } 2032 }
2033 } 2033 }
2034 2034
2035 2035
2036 TEST(PhiRepresentation) { 2036 TEST(PhiRepresentation) {
2037 HandleAndZoneScope scope; 2037 HandleAndZoneScope scope;
2038 Zone* z = scope.main_zone(); 2038 Zone* z = scope.main_zone();
2039 2039
2040 Factory* f = z->isolate()->factory();
2041 Handle<Object> range_min = f->NewNumber(-1e13);
2042 Handle<Object> range_max = f->NewNumber(1e+15);
2043 Type* range = Type::Range(range_min, range_max, z);
2044
2045 struct TestData { 2040 struct TestData {
2046 Type* arg1; 2041 Type* arg1;
2047 Type* arg2; 2042 Type* arg2;
2048 MachineType use; 2043 MachineType use;
2049 MachineTypeUnion expected; 2044 MachineTypeUnion expected;
2050 }; 2045 };
2051 2046
2052 TestData test_data[] = { 2047 TestData test_data[] = {
2053 {Type::Signed32(), Type::Unsigned32(), kMachInt32, 2048 {Type::Signed32(), Type::Unsigned32(), kMachInt32,
2054 kRepWord32 | kTypeNumber}, 2049 kRepWord32 | kTypeNumber},
2055 {range, range, kMachUint32, kRepWord32 | kTypeNumber}, 2050 {Type::Signed32(), Type::Unsigned32(), kMachUint32,
2051 kRepWord32 | kTypeNumber},
2056 {Type::Signed32(), Type::Signed32(), kMachInt32, kMachInt32}, 2052 {Type::Signed32(), Type::Signed32(), kMachInt32, kMachInt32},
2057 {Type::Unsigned32(), Type::Unsigned32(), kMachInt32, kMachUint32}, 2053 {Type::Unsigned32(), Type::Unsigned32(), kMachInt32, kMachUint32},
2058 {Type::Number(), Type::Signed32(), kMachInt32, kMachFloat64}, 2054 {Type::Number(), Type::Signed32(), kMachInt32, kMachFloat64},
2059 {Type::Signed32(), Type::String(), kMachInt32, kMachAnyTagged}}; 2055 {Type::Signed32(), Type::String(), kMachInt32, kMachAnyTagged}};
2060 2056
2061 for (auto const d : test_data) { 2057 for (auto const d : test_data) {
2062 TestingGraph t(d.arg1, d.arg2, Type::Boolean()); 2058 TestingGraph t(d.arg1, d.arg2, Type::Boolean());
2063 2059
2064 Node* br = t.graph()->NewNode(t.common()->Branch(), t.p2, t.start); 2060 Node* br = t.graph()->NewNode(t.common()->Branch(), t.p2, t.start);
2065 Node* tb = t.graph()->NewNode(t.common()->IfTrue(), br); 2061 Node* tb = t.graph()->NewNode(t.common()->IfTrue(), br);
2066 Node* fb = t.graph()->NewNode(t.common()->IfFalse(), br); 2062 Node* fb = t.graph()->NewNode(t.common()->IfFalse(), br);
2067 Node* m = t.graph()->NewNode(t.common()->Merge(2), tb, fb); 2063 Node* m = t.graph()->NewNode(t.common()->Merge(2), tb, fb);
2068 2064
2069 Node* phi = 2065 Node* phi =
2070 t.graph()->NewNode(t.common()->Phi(kMachAnyTagged, 2), t.p0, t.p1, m); 2066 t.graph()->NewNode(t.common()->Phi(kMachAnyTagged, 2), t.p0, t.p1, m);
2071 2067
2072 Bounds phi_bounds = Bounds::Either(Bounds(d.arg1), Bounds(d.arg2), z); 2068 Bounds phi_bounds = Bounds::Either(Bounds(d.arg1), Bounds(d.arg2), z);
2073 NodeProperties::SetBounds(phi, phi_bounds); 2069 NodeProperties::SetBounds(phi, phi_bounds);
2074 2070
2075 Node* use = t.Use(phi, d.use); 2071 Node* use = t.Use(phi, d.use);
2076 t.Return(use); 2072 t.Return(use);
2077 t.Lower(); 2073 t.Lower();
2078 2074
2079 CHECK_EQ(d.expected, OpParameter<MachineType>(phi)); 2075 CHECK_EQ(d.expected, OpParameter<MachineType>(phi));
2080 } 2076 }
2081 } 2077 }
OLDNEW
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | test/mjsunit/compiler/regress-446778.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698