OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 "src/compiler/graph-builder.h" | 5 #include "src/compiler/graph-builder.h" |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/compiler/generic-graph.h" | 8 #include "src/compiler/generic-graph.h" |
9 #include "src/compiler/generic-node.h" | 9 #include "src/compiler/generic-node.h" |
10 #include "src/compiler/generic-node-inl.h" | 10 #include "src/compiler/generic-node-inl.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 current_context_(NULL), | 27 current_context_(NULL), |
28 exit_control_(NULL) {} | 28 exit_control_(NULL) {} |
29 | 29 |
30 | 30 |
31 Node* StructuredGraphBuilder::MakeNode(Operator* op, int value_input_count, | 31 Node* StructuredGraphBuilder::MakeNode(Operator* op, int value_input_count, |
32 Node** value_inputs) { | 32 Node** value_inputs) { |
33 bool has_context = OperatorProperties::HasContextInput(op); | 33 bool has_context = OperatorProperties::HasContextInput(op); |
34 bool has_control = OperatorProperties::GetControlInputCount(op) == 1; | 34 bool has_control = OperatorProperties::GetControlInputCount(op) == 1; |
35 bool has_effect = OperatorProperties::GetEffectInputCount(op) == 1; | 35 bool has_effect = OperatorProperties::GetEffectInputCount(op) == 1; |
36 | 36 |
37 ASSERT(OperatorProperties::GetControlInputCount(op) < 2); | 37 DCHECK(OperatorProperties::GetControlInputCount(op) < 2); |
38 ASSERT(OperatorProperties::GetEffectInputCount(op) < 2); | 38 DCHECK(OperatorProperties::GetEffectInputCount(op) < 2); |
39 | 39 |
40 Node* result = NULL; | 40 Node* result = NULL; |
41 if (!has_context && !has_control && !has_effect) { | 41 if (!has_context && !has_control && !has_effect) { |
42 result = graph()->NewNode(op, value_input_count, value_inputs); | 42 result = graph()->NewNode(op, value_input_count, value_inputs); |
43 } else { | 43 } else { |
44 int input_count_with_deps = value_input_count; | 44 int input_count_with_deps = value_input_count; |
45 if (has_context) ++input_count_with_deps; | 45 if (has_context) ++input_count_with_deps; |
46 if (has_control) ++input_count_with_deps; | 46 if (has_control) ++input_count_with_deps; |
47 if (has_effect) ++input_count_with_deps; | 47 if (has_effect) ++input_count_with_deps; |
48 void* raw_buffer = alloca(kPointerSize * input_count_with_deps); | 48 void* raw_buffer = alloca(kPointerSize * input_count_with_deps); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 | 109 |
110 StructuredGraphBuilder::Environment::Environment(const Environment& copy) | 110 StructuredGraphBuilder::Environment::Environment(const Environment& copy) |
111 : builder_(copy.builder()), | 111 : builder_(copy.builder()), |
112 control_dependency_(copy.control_dependency_), | 112 control_dependency_(copy.control_dependency_), |
113 effect_dependency_(copy.effect_dependency_), | 113 effect_dependency_(copy.effect_dependency_), |
114 values_(copy.values_) {} | 114 values_(copy.values_) {} |
115 | 115 |
116 | 116 |
117 void StructuredGraphBuilder::Environment::Merge(Environment* other) { | 117 void StructuredGraphBuilder::Environment::Merge(Environment* other) { |
118 ASSERT(values_.size() == other->values_.size()); | 118 DCHECK(values_.size() == other->values_.size()); |
119 | 119 |
120 // Nothing to do if the other environment is dead. | 120 // Nothing to do if the other environment is dead. |
121 if (other->IsMarkedAsUnreachable()) return; | 121 if (other->IsMarkedAsUnreachable()) return; |
122 | 122 |
123 // Resurrect a dead environment by copying the contents of the other one and | 123 // Resurrect a dead environment by copying the contents of the other one and |
124 // placing a singleton merge as the new control dependency. | 124 // placing a singleton merge as the new control dependency. |
125 if (this->IsMarkedAsUnreachable()) { | 125 if (this->IsMarkedAsUnreachable()) { |
126 Node* other_control = other->control_dependency_; | 126 Node* other_control = other->control_dependency_; |
127 control_dependency_ = graph()->NewNode(common()->Merge(1), other_control); | 127 control_dependency_ = graph()->NewNode(common()->Merge(1), other_control); |
128 effect_dependency_ = other->effect_dependency_; | 128 effect_dependency_ = other->effect_dependency_; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 if (!dead_control_.is_set()) { | 242 if (!dead_control_.is_set()) { |
243 Node* dead_node = graph()->NewNode(common_->Dead()); | 243 Node* dead_node = graph()->NewNode(common_->Dead()); |
244 dead_control_.set(dead_node); | 244 dead_control_.set(dead_node); |
245 return dead_node; | 245 return dead_node; |
246 } | 246 } |
247 return dead_control_.get(); | 247 return dead_control_.get(); |
248 } | 248 } |
249 } | 249 } |
250 } | 250 } |
251 } // namespace v8::internal::compiler | 251 } // namespace v8::internal::compiler |
OLD | NEW |