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/control-builders.h" | 9 #include "src/compiler/control-builders.h" |
10 #include "src/compiler/effect-control-linearizer.h" | 10 #include "src/compiler/effect-control-linearizer.h" |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 } else if (type.representation() == MachineRepresentation::kFloat64) { | 804 } else if (type.representation() == MachineRepresentation::kFloat64) { |
805 return graph()->NewNode(machine()->Float64Add(), node, | 805 return graph()->NewNode(machine()->Float64Add(), node, |
806 jsgraph.Float64Constant(1)); | 806 jsgraph.Float64Constant(1)); |
807 } else if (type.representation() == MachineRepresentation::kWord64) { | 807 } else if (type.representation() == MachineRepresentation::kWord64) { |
808 return graph()->NewNode(machine()->Int64LessThan(), node, | 808 return graph()->NewNode(machine()->Int64LessThan(), node, |
809 Int64Constant(1)); | 809 Int64Constant(1)); |
810 } else if (type.representation() == MachineRepresentation::kWord32) { | 810 } else if (type.representation() == MachineRepresentation::kWord32) { |
811 return graph()->NewNode(machine()->Word32Equal(), node, | 811 return graph()->NewNode(machine()->Word32Equal(), node, |
812 jsgraph.Int32Constant(1)); | 812 jsgraph.Int32Constant(1)); |
813 } else { | 813 } else { |
814 return graph()->NewNode(simplified()->ReferenceEqual(Type::Any()), node, | 814 return graph()->NewNode(simplified()->ReferenceEqual(), node, |
815 jsgraph.TrueConstant()); | 815 jsgraph.TrueConstant()); |
816 } | 816 } |
817 } | 817 } |
818 | 818 |
819 Node* Branch(Node* cond) { | 819 Node* Branch(Node* cond) { |
820 Node* br = graph()->NewNode(common()->Branch(), cond, start); | 820 Node* br = graph()->NewNode(common()->Branch(), cond, start); |
821 Node* tb = graph()->NewNode(common()->IfTrue(), br); | 821 Node* tb = graph()->NewNode(common()->IfTrue(), br); |
822 Node* fb = graph()->NewNode(common()->IfFalse(), br); | 822 Node* fb = graph()->NewNode(common()->IfFalse(), br); |
823 Node* m = graph()->NewNode(common()->Merge(2), tb, fb); | 823 Node* m = graph()->NewNode(common()->Merge(2), tb, fb); |
824 NodeProperties::ReplaceControlInput(ret, m); | 824 NodeProperties::ReplaceControlInput(ret, m); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 t.Return(use); | 1081 t.Return(use); |
1082 t.Lower(); | 1082 t.Lower(); |
1083 CheckChangeOf(IrOpcode::kTruncateFloat64ToWord32, input, use->InputAt(0)); | 1083 CheckChangeOf(IrOpcode::kTruncateFloat64ToWord32, input, use->InputAt(0)); |
1084 } | 1084 } |
1085 | 1085 |
1086 | 1086 |
1087 TEST(LowerReferenceEqual_to_wordeq) { | 1087 TEST(LowerReferenceEqual_to_wordeq) { |
1088 TestingGraph t(Type::Any(), Type::Any()); | 1088 TestingGraph t(Type::Any(), Type::Any()); |
1089 IrOpcode::Value opcode = | 1089 IrOpcode::Value opcode = |
1090 static_cast<IrOpcode::Value>(t.machine()->WordEqual()->opcode()); | 1090 static_cast<IrOpcode::Value>(t.machine()->WordEqual()->opcode()); |
1091 t.CheckLoweringBinop(opcode, t.simplified()->ReferenceEqual(Type::Any())); | 1091 t.CheckLoweringBinop(opcode, t.simplified()->ReferenceEqual()); |
1092 } | 1092 } |
1093 | 1093 |
1094 void CheckChangeInsertion(IrOpcode::Value expected, MachineType from, | 1094 void CheckChangeInsertion(IrOpcode::Value expected, MachineType from, |
1095 MachineType to, Type* type = Type::Any()) { | 1095 MachineType to, Type* type = Type::Any()) { |
1096 TestingGraph t(Type::Any()); | 1096 TestingGraph t(Type::Any()); |
1097 Node* in = t.ExampleWithOutput(from); | 1097 Node* in = t.ExampleWithOutput(from); |
1098 NodeProperties::SetType(in, type); | 1098 NodeProperties::SetType(in, type); |
1099 Node* use = t.Use(in, to); | 1099 Node* use = t.Use(in, to); |
1100 t.Return(use); | 1100 t.Return(use); |
1101 t.Lower(); | 1101 t.Lower(); |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1747 t.Return(use); | 1747 t.Return(use); |
1748 t.Lower(); | 1748 t.Lower(); |
1749 | 1749 |
1750 CHECK_EQ(d.expected, PhiRepresentationOf(phi->op())); | 1750 CHECK_EQ(d.expected, PhiRepresentationOf(phi->op())); |
1751 } | 1751 } |
1752 } | 1752 } |
1753 | 1753 |
1754 } // namespace compiler | 1754 } // namespace compiler |
1755 } // namespace internal | 1755 } // namespace internal |
1756 } // namespace v8 | 1756 } // namespace v8 |
OLD | NEW |