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/cctest/compiler/simplified-graph-builder.h" | 5 #include "test/cctest/compiler/simplified-graph-builder.h" |
6 | 6 |
7 #include "src/compiler/operator-properties.h" | 7 #include "src/compiler/operator-properties.h" |
8 #include "src/compiler/operator-properties-inl.h" | 8 #include "src/compiler/operator-properties-inl.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 | 39 |
40 void SimplifiedGraphBuilder::End() { | 40 void SimplifiedGraphBuilder::End() { |
41 Node* end = graph()->NewNode(common()->End(), return_); | 41 Node* end = graph()->NewNode(common()->End(), return_); |
42 graph()->SetEnd(end); | 42 graph()->SetEnd(end); |
43 } | 43 } |
44 | 44 |
45 | 45 |
46 Node* SimplifiedGraphBuilder::MakeNode(const Operator* op, | 46 Node* SimplifiedGraphBuilder::MakeNode(const Operator* op, |
47 int value_input_count, | 47 int value_input_count, |
48 Node** value_inputs) { | 48 Node** value_inputs, bool incomplete) { |
49 DCHECK(op->InputCount() == value_input_count); | 49 DCHECK(op->InputCount() == value_input_count); |
50 | 50 |
51 DCHECK(!OperatorProperties::HasContextInput(op)); | 51 DCHECK(!OperatorProperties::HasContextInput(op)); |
52 DCHECK(!OperatorProperties::HasFrameStateInput(op)); | 52 DCHECK(!OperatorProperties::HasFrameStateInput(op)); |
53 bool has_control = OperatorProperties::GetControlInputCount(op) == 1; | 53 bool has_control = OperatorProperties::GetControlInputCount(op) == 1; |
54 bool has_effect = OperatorProperties::GetEffectInputCount(op) == 1; | 54 bool has_effect = OperatorProperties::GetEffectInputCount(op) == 1; |
55 | 55 |
56 DCHECK(OperatorProperties::GetControlInputCount(op) < 2); | 56 DCHECK(OperatorProperties::GetControlInputCount(op) < 2); |
57 DCHECK(OperatorProperties::GetEffectInputCount(op) < 2); | 57 DCHECK(OperatorProperties::GetEffectInputCount(op) < 2); |
58 | 58 |
59 Node* result = NULL; | 59 Node* result = NULL; |
60 if (!has_control && !has_effect) { | 60 if (!has_control && !has_effect) { |
61 result = graph()->NewNode(op, value_input_count, value_inputs); | 61 result = graph()->NewNode(op, value_input_count, value_inputs, incomplete); |
62 } else { | 62 } else { |
63 int input_count_with_deps = value_input_count; | 63 int input_count_with_deps = value_input_count; |
64 if (has_control) ++input_count_with_deps; | 64 if (has_control) ++input_count_with_deps; |
65 if (has_effect) ++input_count_with_deps; | 65 if (has_effect) ++input_count_with_deps; |
66 Node** buffer = zone()->NewArray<Node*>(input_count_with_deps); | 66 Node** buffer = zone()->NewArray<Node*>(input_count_with_deps); |
67 memcpy(buffer, value_inputs, kPointerSize * value_input_count); | 67 memcpy(buffer, value_inputs, kPointerSize * value_input_count); |
68 Node** current_input = buffer + value_input_count; | 68 Node** current_input = buffer + value_input_count; |
69 if (has_effect) { | 69 if (has_effect) { |
70 *current_input++ = effect_; | 70 *current_input++ = effect_; |
71 } | 71 } |
72 if (has_control) { | 72 if (has_control) { |
73 *current_input++ = graph()->start(); | 73 *current_input++ = graph()->start(); |
74 } | 74 } |
75 result = graph()->NewNode(op, input_count_with_deps, buffer); | 75 result = graph()->NewNode(op, input_count_with_deps, buffer, incomplete); |
76 if (has_effect) { | 76 if (has_effect) { |
77 effect_ = result; | 77 effect_ = result; |
78 } | 78 } |
79 if (OperatorProperties::HasControlOutput(result->op())) { | 79 if (OperatorProperties::HasControlOutput(result->op())) { |
80 // This graph builder does not support control flow. | 80 // This graph builder does not support control flow. |
81 UNREACHABLE(); | 81 UNREACHABLE(); |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 return result; | 85 return result; |
86 } | 86 } |
87 | 87 |
88 } // namespace compiler | 88 } // namespace compiler |
89 } // namespace internal | 89 } // namespace internal |
90 } // namespace v8 | 90 } // namespace v8 |
OLD | NEW |