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 "test/cctest/cctest.h" | 7 #include "test/cctest/cctest.h" |
8 #include "test/cctest/compiler/codegen-tester.h" | 8 #include "test/cctest/compiler/codegen-tester.h" |
9 #include "test/cctest/compiler/graph-builder-tester.h" | 9 #include "test/cctest/compiler/graph-builder-tester.h" |
10 #include "test/cctest/compiler/value-helper.h" | 10 #include "test/cctest/compiler/value-helper.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 void CheckUint32Constant(Node* n, uint32_t expected) { | 49 void CheckUint32Constant(Node* n, uint32_t expected) { |
50 Uint32Matcher m(n); | 50 Uint32Matcher m(n); |
51 CHECK(m.HasValue()); | 51 CHECK(m.HasValue()); |
52 CHECK_EQ(static_cast<int>(expected), static_cast<int>(m.Value())); | 52 CHECK_EQ(static_cast<int>(expected), static_cast<int>(m.Value())); |
53 } | 53 } |
54 | 54 |
55 void CheckFloat64Constant(Node* n, double expected) { | 55 void CheckFloat64Constant(Node* n, double expected) { |
56 Float64Matcher m(n); | 56 Float64Matcher m(n); |
57 CHECK(m.HasValue()); | 57 CHECK(m.HasValue()); |
58 CheckDoubleEq(expected, m.Value()); | 58 CHECK_DOUBLE_EQ(expected, m.Value()); |
59 } | 59 } |
60 | 60 |
61 void CheckFloat32Constant(Node* n, float expected) { | 61 void CheckFloat32Constant(Node* n, float expected) { |
62 CHECK_EQ(IrOpcode::kFloat32Constant, n->opcode()); | 62 CHECK_EQ(IrOpcode::kFloat32Constant, n->opcode()); |
63 float fval = OpParameter<float>(n->op()); | 63 float fval = OpParameter<float>(n->op()); |
64 CheckDoubleEq(expected, fval); | 64 CHECK_FLOAT_EQ(expected, fval); |
65 } | 65 } |
66 | 66 |
67 void CheckHeapConstant(Node* n, HeapObject* expected) { | 67 void CheckHeapConstant(Node* n, HeapObject* expected) { |
68 HeapObjectMatcher m(n); | 68 HeapObjectMatcher m(n); |
69 CHECK(m.HasValue()); | 69 CHECK(m.HasValue()); |
70 CHECK_EQ(expected, *m.Value()); | 70 CHECK_EQ(expected, *m.Value()); |
71 } | 71 } |
72 | 72 |
73 void CheckNumberConstant(Node* n, double expected) { | 73 void CheckNumberConstant(Node* n, double expected) { |
74 NumberMatcher m(n); | 74 NumberMatcher m(n); |
75 CHECK_EQ(IrOpcode::kNumberConstant, n->opcode()); | 75 CHECK_EQ(IrOpcode::kNumberConstant, n->opcode()); |
76 CHECK(m.HasValue()); | 76 CHECK(m.HasValue()); |
77 CheckDoubleEq(expected, m.Value()); | 77 CHECK_DOUBLE_EQ(expected, m.Value()); |
78 } | 78 } |
79 | 79 |
80 Node* Parameter(int index = 0) { | 80 Node* Parameter(int index = 0) { |
81 Node* n = graph()->NewNode(common()->Parameter(index), graph()->start()); | 81 Node* n = graph()->NewNode(common()->Parameter(index), graph()->start()); |
82 NodeProperties::SetType(n, Type::Any()); | 82 NodeProperties::SetType(n, Type::Any()); |
83 return n; | 83 return n; |
84 } | 84 } |
85 | 85 |
86 void CheckTypeError(MachineRepresentation from, Type* from_type, | 86 void CheckTypeError(MachineRepresentation from, Type* from_type, |
87 MachineRepresentation to) { | 87 MachineRepresentation to) { |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 MachineRepresentation::kWord64); | 621 MachineRepresentation::kWord64); |
622 r.CheckTypeError(MachineRepresentation::kWord32, Type::Signed32(), | 622 r.CheckTypeError(MachineRepresentation::kWord32, Type::Signed32(), |
623 MachineRepresentation::kWord64); | 623 MachineRepresentation::kWord64); |
624 r.CheckTypeError(MachineRepresentation::kWord32, Type::Unsigned32(), | 624 r.CheckTypeError(MachineRepresentation::kWord32, Type::Unsigned32(), |
625 MachineRepresentation::kWord64); | 625 MachineRepresentation::kWord64); |
626 } | 626 } |
627 | 627 |
628 } // namespace compiler | 628 } // namespace compiler |
629 } // namespace internal | 629 } // namespace internal |
630 } // namespace v8 | 630 } // namespace v8 |
OLD | NEW |