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-inl.h" | 7 #include "src/compiler/node-properties-inl.h" |
8 #include "test/unittests/compiler/node-test-utils.h" | 8 #include "test/unittests/compiler/node-test-utils.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 namespace compiler { | 12 namespace compiler { |
13 | 13 |
14 GraphTest::GraphTest(int num_parameters) : common_(zone()), graph_(zone()) { | 14 GraphTest::GraphTest(int num_parameters) : common_(zone()), graph_(zone()) { |
15 graph()->SetStart(graph()->NewNode(common()->Start(num_parameters))); | 15 graph()->SetStart(graph()->NewNode(common()->Start(num_parameters))); |
| 16 graph()->SetEnd(graph()->NewNode(common()->End(), graph()->start())); |
16 } | 17 } |
17 | 18 |
18 | 19 |
19 GraphTest::~GraphTest() {} | 20 GraphTest::~GraphTest() {} |
20 | 21 |
21 | 22 |
22 Node* GraphTest::Parameter(int32_t index) { | 23 Node* GraphTest::Parameter(int32_t index) { |
23 return graph()->NewNode(common()->Parameter(index), graph()->start()); | 24 return graph()->NewNode(common()->Parameter(index), graph()->start()); |
24 } | 25 } |
25 | 26 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 Unique<HeapObject>::CreateImmovable(factory()->false_value())); | 86 Unique<HeapObject>::CreateImmovable(factory()->false_value())); |
86 } | 87 } |
87 | 88 |
88 | 89 |
89 Matcher<Node*> GraphTest::IsTrueConstant() { | 90 Matcher<Node*> GraphTest::IsTrueConstant() { |
90 return IsHeapConstant( | 91 return IsHeapConstant( |
91 Unique<HeapObject>::CreateImmovable(factory()->true_value())); | 92 Unique<HeapObject>::CreateImmovable(factory()->true_value())); |
92 } | 93 } |
93 | 94 |
94 | 95 |
| 96 Matcher<Node*> GraphTest::IsUndefinedConstant() { |
| 97 return IsHeapConstant( |
| 98 Unique<HeapObject>::CreateImmovable(factory()->undefined_value())); |
| 99 } |
| 100 |
| 101 |
95 TypedGraphTest::TypedGraphTest(int num_parameters) | 102 TypedGraphTest::TypedGraphTest(int num_parameters) |
96 : GraphTest(num_parameters), | 103 : GraphTest(num_parameters), |
97 typer_(isolate(), graph(), MaybeHandle<Context>()) {} | 104 typer_(isolate(), graph(), MaybeHandle<Context>()) {} |
98 | 105 |
99 | 106 |
100 TypedGraphTest::~TypedGraphTest() {} | 107 TypedGraphTest::~TypedGraphTest() {} |
101 | 108 |
102 | 109 |
103 Node* TypedGraphTest::Parameter(Type* type, int32_t index) { | 110 Node* TypedGraphTest::Parameter(Type* type, int32_t index) { |
104 Node* node = GraphTest::Parameter(index); | 111 Node* node = GraphTest::Parameter(index); |
(...skipping 17 matching lines...) Expand all Loading... |
122 EXPECT_LT(0, n0->id()); | 129 EXPECT_LT(0, n0->id()); |
123 EXPECT_LT(0, n1->id()); | 130 EXPECT_LT(0, n1->id()); |
124 EXPECT_NE(n0->id(), n1->id()); | 131 EXPECT_NE(n0->id(), n1->id()); |
125 EXPECT_EQ(&kDummyOperator, n0->op()); | 132 EXPECT_EQ(&kDummyOperator, n0->op()); |
126 EXPECT_EQ(&kDummyOperator, n1->op()); | 133 EXPECT_EQ(&kDummyOperator, n1->op()); |
127 } | 134 } |
128 | 135 |
129 } // namespace compiler | 136 } // namespace compiler |
130 } // namespace internal | 137 } // namespace internal |
131 } // namespace v8 | 138 } // namespace v8 |
OLD | NEW |