OLD | NEW |
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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/compiler/access-builder.h" | 8 #include "src/compiler/access-builder.h" |
9 #include "src/compiler/change-lowering.h" | 9 #include "src/compiler/change-lowering.h" |
10 #include "src/compiler/control-builders.h" | 10 #include "src/compiler/control-builders.h" |
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 | 901 |
902 TEST(LowerBooleanToNumber_bit_tagged) { | 902 TEST(LowerBooleanToNumber_bit_tagged) { |
903 // BooleanToNumber(x: kRepBit) used as MachineType::AnyTagged() | 903 // BooleanToNumber(x: kRepBit) used as MachineType::AnyTagged() |
904 TestingGraph t(Type::Boolean()); | 904 TestingGraph t(Type::Boolean()); |
905 Node* b = t.ExampleWithOutput(MachineType::Bool()); | 905 Node* b = t.ExampleWithOutput(MachineType::Bool()); |
906 Node* cnv = t.graph()->NewNode(t.simplified()->BooleanToNumber(), b); | 906 Node* cnv = t.graph()->NewNode(t.simplified()->BooleanToNumber(), b); |
907 Node* use = t.Use(cnv, MachineType::AnyTagged()); | 907 Node* use = t.Use(cnv, MachineType::AnyTagged()); |
908 t.Return(use); | 908 t.Return(use); |
909 t.Lower(); | 909 t.Lower(); |
910 CHECK_EQ(b, use->InputAt(0)->InputAt(0)); | 910 CHECK_EQ(b, use->InputAt(0)->InputAt(0)); |
911 CHECK_EQ(IrOpcode::kChangeInt32ToTagged, use->InputAt(0)->opcode()); | 911 CHECK_EQ(IrOpcode::kChangeUint32ToTagged, use->InputAt(0)->opcode()); |
912 } | 912 } |
913 | 913 |
914 | 914 |
915 TEST(LowerBooleanToNumber_tagged_tagged) { | 915 TEST(LowerBooleanToNumber_tagged_tagged) { |
916 // BooleanToNumber(x: kRepTagged) used as MachineType::AnyTagged() | 916 // BooleanToNumber(x: kRepTagged) used as MachineType::AnyTagged() |
917 TestingGraph t(Type::Boolean()); | 917 TestingGraph t(Type::Boolean()); |
918 Node* b = t.p0; | 918 Node* b = t.p0; |
919 Node* cnv = t.graph()->NewNode(t.simplified()->BooleanToNumber(), b); | 919 Node* cnv = t.graph()->NewNode(t.simplified()->BooleanToNumber(), b); |
920 Node* use = t.Use(cnv, MachineType::AnyTagged()); | 920 Node* use = t.Use(cnv, MachineType::AnyTagged()); |
921 t.Return(use); | 921 t.Return(use); |
922 t.Lower(); | 922 t.Lower(); |
923 CHECK_EQ(cnv, use->InputAt(0)->InputAt(0)); | 923 CHECK_EQ(cnv, use->InputAt(0)->InputAt(0)); |
924 CHECK_EQ(IrOpcode::kChangeInt32ToTagged, use->InputAt(0)->opcode()); | 924 CHECK_EQ(IrOpcode::kChangeUint32ToTagged, use->InputAt(0)->opcode()); |
925 CHECK_EQ(t.machine()->WordEqual()->opcode(), cnv->opcode()); | 925 CHECK_EQ(t.machine()->WordEqual()->opcode(), cnv->opcode()); |
926 CHECK(b == cnv->InputAt(0) || b == cnv->InputAt(1)); | 926 CHECK(b == cnv->InputAt(0) || b == cnv->InputAt(1)); |
927 Node* c = t.jsgraph.TrueConstant(); | 927 Node* c = t.jsgraph.TrueConstant(); |
928 CHECK(c == cnv->InputAt(0) || c == cnv->InputAt(1)); | 928 CHECK(c == cnv->InputAt(0) || c == cnv->InputAt(1)); |
929 } | 929 } |
930 | 930 |
931 | 931 |
932 static Type* test_types[] = {Type::Signed32(), Type::Unsigned32(), | 932 static Type* test_types[] = {Type::Signed32(), Type::Unsigned32(), |
933 Type::Number(), Type::Any()}; | 933 Type::Number(), Type::Any()}; |
934 | 934 |
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1963 t.Return(use); | 1963 t.Return(use); |
1964 t.Lower(); | 1964 t.Lower(); |
1965 | 1965 |
1966 CHECK_EQ(d.expected, PhiRepresentationOf(phi->op())); | 1966 CHECK_EQ(d.expected, PhiRepresentationOf(phi->op())); |
1967 } | 1967 } |
1968 } | 1968 } |
1969 | 1969 |
1970 } // namespace compiler | 1970 } // namespace compiler |
1971 } // namespace internal | 1971 } // namespace internal |
1972 } // namespace v8 | 1972 } // namespace v8 |
OLD | NEW |