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/graph-reducer.h" | 10 #include "src/compiler/graph-reducer.h" |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 TestingGraph t(type); | 805 TestingGraph t(type); |
806 Node* x = t.ExampleWithTypeAndRep(type, kRepBit); | 806 Node* x = t.ExampleWithTypeAndRep(type, kRepBit); |
807 Node* cnv = t.graph()->NewNode(t.simplified()->AnyToBoolean(), x); | 807 Node* cnv = t.graph()->NewNode(t.simplified()->AnyToBoolean(), x); |
808 Node* use = t.Branch(cnv); | 808 Node* use = t.Branch(cnv); |
809 t.Lower(); | 809 t.Lower(); |
810 CHECK_EQ(x, use->InputAt(0)); | 810 CHECK_EQ(x, use->InputAt(0)); |
811 } | 811 } |
812 } | 812 } |
813 | 813 |
814 | 814 |
| 815 #if V8_TURBOFAN_TARGET |
| 816 |
815 TEST(LowerAnyToBoolean_tagged_tagged) { | 817 TEST(LowerAnyToBoolean_tagged_tagged) { |
816 // AnyToBoolean(x: kRepTagged) used as kRepTagged | 818 // AnyToBoolean(x: kRepTagged) used as kRepTagged |
817 TestingGraph t(Type::Any()); | 819 TestingGraph t(Type::Any()); |
818 Node* x = t.p0; | 820 Node* x = t.p0; |
819 Node* cnv = t.graph()->NewNode(t.simplified()->AnyToBoolean(), x); | 821 Node* cnv = t.graph()->NewNode(t.simplified()->AnyToBoolean(), x); |
820 Node* use = t.Use(cnv, kRepTagged); | 822 Node* use = t.Use(cnv, kRepTagged); |
821 t.Return(use); | 823 t.Return(use); |
822 t.Lower(); | 824 t.Lower(); |
823 CHECK_EQ(IrOpcode::kCall, cnv->opcode()); | 825 CHECK_EQ(IrOpcode::kCall, cnv->opcode()); |
824 CHECK_EQ(IrOpcode::kHeapConstant, cnv->InputAt(0)->opcode()); | 826 CHECK_EQ(IrOpcode::kHeapConstant, cnv->InputAt(0)->opcode()); |
825 CHECK_EQ(x, cnv->InputAt(1)); | 827 CHECK_EQ(x, cnv->InputAt(1)); |
826 CHECK_EQ(t.jsgraph.NoContextConstant(), cnv->InputAt(2)); | 828 CHECK_EQ(t.jsgraph.NoContextConstant(), cnv->InputAt(2)); |
827 } | 829 } |
828 | 830 |
| 831 #endif |
| 832 |
829 | 833 |
830 TEST(LowerBooleanNot_bit_bit) { | 834 TEST(LowerBooleanNot_bit_bit) { |
831 // BooleanNot(x: kRepBit) used as kRepBit | 835 // BooleanNot(x: kRepBit) used as kRepBit |
832 TestingGraph t(Type::Boolean()); | 836 TestingGraph t(Type::Boolean()); |
833 Node* b = t.ExampleWithOutput(kRepBit); | 837 Node* b = t.ExampleWithOutput(kRepBit); |
834 Node* inv = t.graph()->NewNode(t.simplified()->BooleanNot(), b); | 838 Node* inv = t.graph()->NewNode(t.simplified()->BooleanNot(), b); |
835 Node* use = t.Branch(inv); | 839 Node* use = t.Branch(inv); |
836 t.Lower(); | 840 t.Lower(); |
837 Node* cmp = use->InputAt(0); | 841 Node* cmp = use->InputAt(0); |
838 CHECK_EQ(t.machine()->Word32Equal()->opcode(), cmp->opcode()); | 842 CHECK_EQ(t.machine()->Word32Equal()->opcode(), cmp->opcode()); |
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2068 Bounds phi_bounds = Bounds::Either(Bounds(d.arg1), Bounds(d.arg2), z); | 2072 Bounds phi_bounds = Bounds::Either(Bounds(d.arg1), Bounds(d.arg2), z); |
2069 NodeProperties::SetBounds(phi, phi_bounds); | 2073 NodeProperties::SetBounds(phi, phi_bounds); |
2070 | 2074 |
2071 Node* use = t.Use(phi, d.use); | 2075 Node* use = t.Use(phi, d.use); |
2072 t.Return(use); | 2076 t.Return(use); |
2073 t.Lower(); | 2077 t.Lower(); |
2074 | 2078 |
2075 CHECK_EQ(d.expected, OpParameter<MachineType>(phi)); | 2079 CHECK_EQ(d.expected, OpParameter<MachineType>(phi)); |
2076 } | 2080 } |
2077 } | 2081 } |
OLD | NEW |