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/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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 | 784 |
785 | 785 |
786 TEST(LowerBooleanNot_bit_bit) { | 786 TEST(LowerBooleanNot_bit_bit) { |
787 // BooleanNot(x: kRepBit) used as kRepBit | 787 // BooleanNot(x: kRepBit) used as kRepBit |
788 TestingGraph t(Type::Boolean()); | 788 TestingGraph t(Type::Boolean()); |
789 Node* b = t.ExampleWithOutput(kRepBit); | 789 Node* b = t.ExampleWithOutput(kRepBit); |
790 Node* inv = t.graph()->NewNode(t.simplified()->BooleanNot(), b); | 790 Node* inv = t.graph()->NewNode(t.simplified()->BooleanNot(), b); |
791 Node* use = t.Branch(inv); | 791 Node* use = t.Branch(inv); |
792 t.Lower(); | 792 t.Lower(); |
793 Node* cmp = use->InputAt(0); | 793 Node* cmp = use->InputAt(0); |
794 CHECK_EQ(t.machine()->WordEqual()->opcode(), cmp->opcode()); | 794 CHECK_EQ(t.machine()->Word32Equal()->opcode(), cmp->opcode()); |
795 CHECK(b == cmp->InputAt(0) || b == cmp->InputAt(1)); | 795 CHECK(b == cmp->InputAt(0) || b == cmp->InputAt(1)); |
796 Node* f = t.jsgraph.Int32Constant(0); | 796 Node* f = t.jsgraph.Int32Constant(0); |
797 CHECK(f == cmp->InputAt(0) || f == cmp->InputAt(1)); | 797 CHECK(f == cmp->InputAt(0) || f == cmp->InputAt(1)); |
798 } | 798 } |
799 | 799 |
800 | 800 |
801 TEST(LowerBooleanNot_bit_tagged) { | 801 TEST(LowerBooleanNot_bit_tagged) { |
802 // BooleanNot(x: kRepBit) used as kRepTagged | 802 // BooleanNot(x: kRepBit) used as kRepTagged |
803 TestingGraph t(Type::Boolean()); | 803 TestingGraph t(Type::Boolean()); |
804 Node* b = t.ExampleWithOutput(kRepBit); | 804 Node* b = t.ExampleWithOutput(kRepBit); |
805 Node* inv = t.graph()->NewNode(t.simplified()->BooleanNot(), b); | 805 Node* inv = t.graph()->NewNode(t.simplified()->BooleanNot(), b); |
806 Node* use = t.Use(inv, kRepTagged); | 806 Node* use = t.Use(inv, kRepTagged); |
807 t.Return(use); | 807 t.Return(use); |
808 t.Lower(); | 808 t.Lower(); |
809 CHECK_EQ(IrOpcode::kChangeBitToBool, use->InputAt(0)->opcode()); | 809 CHECK_EQ(IrOpcode::kChangeBitToBool, use->InputAt(0)->opcode()); |
810 Node* cmp = use->InputAt(0)->InputAt(0); | 810 Node* cmp = use->InputAt(0)->InputAt(0); |
811 CHECK_EQ(t.machine()->WordEqual()->opcode(), cmp->opcode()); | 811 CHECK_EQ(t.machine()->Word32Equal()->opcode(), cmp->opcode()); |
812 CHECK(b == cmp->InputAt(0) || b == cmp->InputAt(1)); | 812 CHECK(b == cmp->InputAt(0) || b == cmp->InputAt(1)); |
813 Node* f = t.jsgraph.Int32Constant(0); | 813 Node* f = t.jsgraph.Int32Constant(0); |
814 CHECK(f == cmp->InputAt(0) || f == cmp->InputAt(1)); | 814 CHECK(f == cmp->InputAt(0) || f == cmp->InputAt(1)); |
815 } | 815 } |
816 | 816 |
817 | 817 |
818 TEST(LowerBooleanNot_tagged_bit) { | 818 TEST(LowerBooleanNot_tagged_bit) { |
819 // BooleanNot(x: kRepTagged) used as kRepBit | 819 // BooleanNot(x: kRepTagged) used as kRepBit |
820 TestingGraph t(Type::Boolean()); | 820 TestingGraph t(Type::Boolean()); |
821 Node* b = t.p0; | 821 Node* b = t.p0; |
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1925 TestingGraph t(Type::Unsigned32()); | 1925 TestingGraph t(Type::Unsigned32()); |
1926 Node* k = t.jsgraph.Constant(0); | 1926 Node* k = t.jsgraph.Constant(0); |
1927 Node* mod = t.graph()->NewNode(t.simplified()->NumberModulus(), t.p0, k); | 1927 Node* mod = t.graph()->NewNode(t.simplified()->NumberModulus(), t.p0, k); |
1928 Node* trunc = t.graph()->NewNode(t.simplified()->NumberToUint32(), mod); | 1928 Node* trunc = t.graph()->NewNode(t.simplified()->NumberToUint32(), mod); |
1929 t.Return(trunc); | 1929 t.Return(trunc); |
1930 t.Lower(); | 1930 t.Lower(); |
1931 | 1931 |
1932 CHECK_EQ(IrOpcode::kFloat64Mod, mod->opcode()); | 1932 CHECK_EQ(IrOpcode::kFloat64Mod, mod->opcode()); |
1933 } | 1933 } |
1934 } | 1934 } |
OLD | NEW |