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 "test/unittests/compiler/graph-unittest.h" | 5 #include "test/unittests/compiler/graph-unittest.h" |
6 | 6 |
7 #include "src/compiler/node-properties.h" | 7 #include "src/compiler/node-properties.h" |
8 #include "src/factory.h" | 8 #include "src/factory.h" |
9 #include "src/objects-inl.h" // TODO(everyone): Make typer.h IWYU compliant. | 9 #include "src/objects-inl.h" // TODO(everyone): Make typer.h IWYU compliant. |
10 #include "test/unittests/compiler/node-test-utils.h" | 10 #include "test/unittests/compiler/node-test-utils.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 | 49 |
50 Node* GraphTest::NumberConstant(volatile double value) { | 50 Node* GraphTest::NumberConstant(volatile double value) { |
51 return graph()->NewNode(common()->NumberConstant(value)); | 51 return graph()->NewNode(common()->NumberConstant(value)); |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 Node* GraphTest::HeapConstant(const Handle<HeapObject>& value) { | 55 Node* GraphTest::HeapConstant(const Handle<HeapObject>& value) { |
56 Node* node = graph()->NewNode(common()->HeapConstant(value)); | 56 Node* node = graph()->NewNode(common()->HeapConstant(value)); |
57 Type* type = Type::Constant(value, zone()); | 57 Type* type = Type::Constant(value, zone()); |
58 NodeProperties::SetBounds(node, Bounds(type)); | 58 NodeProperties::SetType(node, type); |
59 return node; | 59 return node; |
60 } | 60 } |
61 | 61 |
62 | 62 |
63 Node* GraphTest::FalseConstant() { | 63 Node* GraphTest::FalseConstant() { |
64 return HeapConstant(factory()->false_value()); | 64 return HeapConstant(factory()->false_value()); |
65 } | 65 } |
66 | 66 |
67 | 67 |
68 Node* GraphTest::TrueConstant() { | 68 Node* GraphTest::TrueConstant() { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 TypedGraphTest::TypedGraphTest(int num_parameters) | 103 TypedGraphTest::TypedGraphTest(int num_parameters) |
104 : GraphTest(num_parameters), typer_(isolate(), graph()) {} | 104 : GraphTest(num_parameters), typer_(isolate(), graph()) {} |
105 | 105 |
106 | 106 |
107 TypedGraphTest::~TypedGraphTest() {} | 107 TypedGraphTest::~TypedGraphTest() {} |
108 | 108 |
109 | 109 |
110 Node* TypedGraphTest::Parameter(Type* type, int32_t index) { | 110 Node* TypedGraphTest::Parameter(Type* type, int32_t index) { |
111 Node* node = GraphTest::Parameter(index); | 111 Node* node = GraphTest::Parameter(index); |
112 NodeProperties::SetBounds(node, Bounds(type)); | 112 NodeProperties::SetType(node, type); |
113 return node; | 113 return node; |
114 } | 114 } |
115 | 115 |
116 | 116 |
117 namespace { | 117 namespace { |
118 | 118 |
119 const Operator kDummyOperator(0, Operator::kNoProperties, "Dummy", 0, 0, 0, 1, | 119 const Operator kDummyOperator(0, Operator::kNoProperties, "Dummy", 0, 0, 0, 1, |
120 0, 0); | 120 0, 0); |
121 | 121 |
122 } // namespace | 122 } // namespace |
123 | 123 |
124 | 124 |
125 TEST_F(GraphTest, NewNode) { | 125 TEST_F(GraphTest, NewNode) { |
126 Node* n0 = graph()->NewNode(&kDummyOperator); | 126 Node* n0 = graph()->NewNode(&kDummyOperator); |
127 Node* n1 = graph()->NewNode(&kDummyOperator); | 127 Node* n1 = graph()->NewNode(&kDummyOperator); |
128 EXPECT_NE(n0, n1); | 128 EXPECT_NE(n0, n1); |
129 EXPECT_LT(0u, n0->id()); | 129 EXPECT_LT(0u, n0->id()); |
130 EXPECT_LT(0u, n1->id()); | 130 EXPECT_LT(0u, n1->id()); |
131 EXPECT_NE(n0->id(), n1->id()); | 131 EXPECT_NE(n0->id(), n1->id()); |
132 EXPECT_EQ(&kDummyOperator, n0->op()); | 132 EXPECT_EQ(&kDummyOperator, n0->op()); |
133 EXPECT_EQ(&kDummyOperator, n1->op()); | 133 EXPECT_EQ(&kDummyOperator, n1->op()); |
134 } | 134 } |
135 | 135 |
136 } // namespace compiler | 136 } // namespace compiler |
137 } // namespace internal | 137 } // namespace internal |
138 } // namespace v8 | 138 } // namespace v8 |
OLD | NEW |