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

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

Issue 850013003: [turbofan] Fix truncation/representation sloppiness wrt. bool/bit. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixes/Cleanups 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
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 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 return graph()->NewNode(common()->Int64Constant(v)); 780 return graph()->NewNode(common()->Int64Constant(v));
781 } 781 }
782 782
783 SimplifiedOperatorBuilder* simplified() { return &main_simplified_; } 783 SimplifiedOperatorBuilder* simplified() { return &main_simplified_; }
784 MachineOperatorBuilder* machine() { return &main_machine_; } 784 MachineOperatorBuilder* machine() { return &main_machine_; }
785 CommonOperatorBuilder* common() { return &main_common_; } 785 CommonOperatorBuilder* common() { return &main_common_; }
786 Graph* graph() { return main_graph_; } 786 Graph* graph() { return main_graph_; }
787 }; 787 };
788 788
789 789
790 TEST(LowerAnyToBoolean_bit_bit) {
791 // AnyToBoolean(x: kRepBit) used as kRepBit
792 HandleAndZoneScope scope;
793 Factory* f = scope.main_zone()->isolate()->factory();
794 Handle<Object> zero = f->NewNumber(0);
795 Handle<Object> one = f->NewNumber(1);
796 Type* singleton_zero = Type::Constant(zero, scope.main_zone());
797 Type* singleton_one = Type::Constant(one, scope.main_zone());
798 Type* zero_one_range = Type::Range(zero, one, scope.main_zone());
799 static Type* kTypes[] = {
800 singleton_zero, singleton_one, zero_one_range, Type::Boolean(),
801 Type::Union(Type::Boolean(), singleton_zero, scope.main_zone()),
802 Type::Union(Type::Boolean(), singleton_one, scope.main_zone()),
803 Type::Union(Type::Boolean(), zero_one_range, scope.main_zone())};
804 for (Type* type : kTypes) {
805 TestingGraph t(type);
806 Node* x = t.ExampleWithTypeAndRep(type, kRepBit);
807 Node* cnv = t.graph()->NewNode(t.simplified()->AnyToBoolean(), x);
808 Node* use = t.Branch(cnv);
809 t.Lower();
810 CHECK_EQ(x, use->InputAt(0));
811 }
812 }
813
814
815 #if V8_TURBOFAN_TARGET 790 #if V8_TURBOFAN_TARGET
816 791
817 TEST(LowerAnyToBoolean_tagged_tagged) { 792 TEST(LowerAnyToBoolean_tagged_tagged) {
818 // AnyToBoolean(x: kRepTagged) used as kRepTagged 793 // AnyToBoolean(x: kRepTagged) used as kRepTagged
819 TestingGraph t(Type::Any()); 794 TestingGraph t(Type::Any());
820 Node* x = t.p0; 795 Node* x = t.p0;
821 Node* cnv = t.graph()->NewNode(t.simplified()->AnyToBoolean(), x); 796 Node* cnv = t.graph()->NewNode(t.simplified()->AnyToBoolean(), x);
822 Node* use = t.Use(cnv, kRepTagged); 797 Node* use = t.Use(cnv, kRepTagged);
823 t.Return(use); 798 t.Return(use);
824 t.Lower(); 799 t.Lower();
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 Bounds phi_bounds = Bounds::Either(Bounds(d.arg1), Bounds(d.arg2), z); 2043 Bounds phi_bounds = Bounds::Either(Bounds(d.arg1), Bounds(d.arg2), z);
2069 NodeProperties::SetBounds(phi, phi_bounds); 2044 NodeProperties::SetBounds(phi, phi_bounds);
2070 2045
2071 Node* use = t.Use(phi, d.use); 2046 Node* use = t.Use(phi, d.use);
2072 t.Return(use); 2047 t.Return(use);
2073 t.Lower(); 2048 t.Lower();
2074 2049
2075 CHECK_EQ(d.expected, OpParameter<MachineType>(phi)); 2050 CHECK_EQ(d.expected, OpParameter<MachineType>(phi));
2076 } 2051 }
2077 } 2052 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-representation-change.cc ('k') | test/mjsunit/compiler/regress-3812.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698