| 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 "test/unittests/compiler/node-test-utils.h" | 8 #include "test/unittests/compiler/node-test-utils.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 return graph()->NewNode(common()->Int64Constant(value)); | 44 return graph()->NewNode(common()->Int64Constant(value)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 | 47 |
| 48 Node* GraphTest::NumberConstant(volatile double value) { | 48 Node* GraphTest::NumberConstant(volatile double value) { |
| 49 return graph()->NewNode(common()->NumberConstant(value)); | 49 return graph()->NewNode(common()->NumberConstant(value)); |
| 50 } | 50 } |
| 51 | 51 |
| 52 | 52 |
| 53 Node* GraphTest::HeapConstant(const Handle<HeapObject>& value) { | 53 Node* GraphTest::HeapConstant(const Handle<HeapObject>& value) { |
| 54 return HeapConstant(Unique<HeapObject>::CreateUninitialized(value)); | |
| 55 } | |
| 56 | |
| 57 | |
| 58 Node* GraphTest::HeapConstant(const Unique<HeapObject>& value) { | |
| 59 Node* node = graph()->NewNode(common()->HeapConstant(value)); | 54 Node* node = graph()->NewNode(common()->HeapConstant(value)); |
| 60 Type* type = Type::Constant(value.handle(), zone()); | 55 Type* type = Type::Constant(value, zone()); |
| 61 NodeProperties::SetBounds(node, Bounds(type)); | 56 NodeProperties::SetBounds(node, Bounds(type)); |
| 62 return node; | 57 return node; |
| 63 } | 58 } |
| 64 | 59 |
| 65 | 60 |
| 66 Node* GraphTest::FalseConstant() { | 61 Node* GraphTest::FalseConstant() { |
| 67 return HeapConstant( | 62 return HeapConstant(factory()->false_value()); |
| 68 Unique<HeapObject>::CreateImmovable(factory()->false_value())); | |
| 69 } | 63 } |
| 70 | 64 |
| 71 | 65 |
| 72 Node* GraphTest::TrueConstant() { | 66 Node* GraphTest::TrueConstant() { |
| 73 return HeapConstant( | 67 return HeapConstant(factory()->true_value()); |
| 74 Unique<HeapObject>::CreateImmovable(factory()->true_value())); | |
| 75 } | 68 } |
| 76 | 69 |
| 77 | 70 |
| 78 Node* GraphTest::UndefinedConstant() { | 71 Node* GraphTest::UndefinedConstant() { |
| 79 return HeapConstant( | 72 return HeapConstant(factory()->undefined_value()); |
| 80 Unique<HeapObject>::CreateImmovable(factory()->undefined_value())); | |
| 81 } | 73 } |
| 82 | 74 |
| 83 | 75 |
| 84 Node* GraphTest::EmptyFrameState() { | 76 Node* GraphTest::EmptyFrameState() { |
| 85 Node* state_values = graph()->NewNode(common()->StateValues(0)); | 77 Node* state_values = graph()->NewNode(common()->StateValues(0)); |
| 86 return graph()->NewNode( | 78 return graph()->NewNode( |
| 87 common()->FrameState(BailoutId::None(), OutputFrameStateCombine::Ignore(), | 79 common()->FrameState(BailoutId::None(), OutputFrameStateCombine::Ignore(), |
| 88 nullptr), | 80 nullptr), |
| 89 state_values, state_values, state_values, NumberConstant(0), | 81 state_values, state_values, state_values, NumberConstant(0), |
| 90 UndefinedConstant(), graph()->start()); | 82 UndefinedConstant(), graph()->start()); |
| 91 } | 83 } |
| 92 | 84 |
| 93 | 85 |
| 94 Matcher<Node*> GraphTest::IsFalseConstant() { | 86 Matcher<Node*> GraphTest::IsFalseConstant() { |
| 95 return IsHeapConstant( | 87 return IsHeapConstant(factory()->false_value()); |
| 96 Unique<HeapObject>::CreateImmovable(factory()->false_value())); | |
| 97 } | 88 } |
| 98 | 89 |
| 99 | 90 |
| 100 Matcher<Node*> GraphTest::IsTrueConstant() { | 91 Matcher<Node*> GraphTest::IsTrueConstant() { |
| 101 return IsHeapConstant( | 92 return IsHeapConstant(factory()->true_value()); |
| 102 Unique<HeapObject>::CreateImmovable(factory()->true_value())); | |
| 103 } | 93 } |
| 104 | 94 |
| 105 | 95 |
| 106 Matcher<Node*> GraphTest::IsUndefinedConstant() { | 96 Matcher<Node*> GraphTest::IsUndefinedConstant() { |
| 107 return IsHeapConstant( | 97 return IsHeapConstant(factory()->undefined_value()); |
| 108 Unique<HeapObject>::CreateImmovable(factory()->undefined_value())); | |
| 109 } | 98 } |
| 110 | 99 |
| 111 | 100 |
| 112 TypedGraphTest::TypedGraphTest(int num_parameters) | 101 TypedGraphTest::TypedGraphTest(int num_parameters) |
| 113 : GraphTest(num_parameters), typer_(isolate(), graph()) {} | 102 : GraphTest(num_parameters), typer_(isolate(), graph()) {} |
| 114 | 103 |
| 115 | 104 |
| 116 TypedGraphTest::~TypedGraphTest() {} | 105 TypedGraphTest::~TypedGraphTest() {} |
| 117 | 106 |
| 118 | 107 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 138 EXPECT_LT(0u, n0->id()); | 127 EXPECT_LT(0u, n0->id()); |
| 139 EXPECT_LT(0u, n1->id()); | 128 EXPECT_LT(0u, n1->id()); |
| 140 EXPECT_NE(n0->id(), n1->id()); | 129 EXPECT_NE(n0->id(), n1->id()); |
| 141 EXPECT_EQ(&kDummyOperator, n0->op()); | 130 EXPECT_EQ(&kDummyOperator, n0->op()); |
| 142 EXPECT_EQ(&kDummyOperator, n1->op()); | 131 EXPECT_EQ(&kDummyOperator, n1->op()); |
| 143 } | 132 } |
| 144 | 133 |
| 145 } // namespace compiler | 134 } // namespace compiler |
| 146 } // namespace internal | 135 } // namespace internal |
| 147 } // namespace v8 | 136 } // namespace v8 |
| OLD | NEW |