OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
6 #include "src/compiler/graph.h" | 6 #include "src/compiler/graph.h" |
7 #include "src/compiler/js-operator.h" | 7 #include "src/compiler/js-operator.h" |
8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 #include "src/compiler/operator-properties.h" | 10 #include "src/compiler/operator-properties.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 173 |
174 // static | 174 // static |
175 void NodeProperties::ReplaceFrameStateInput(Node* node, int index, | 175 void NodeProperties::ReplaceFrameStateInput(Node* node, int index, |
176 Node* frame_state) { | 176 Node* frame_state) { |
177 DCHECK_LT(index, OperatorProperties::GetFrameStateInputCount(node->op())); | 177 DCHECK_LT(index, OperatorProperties::GetFrameStateInputCount(node->op())); |
178 node->ReplaceInput(FirstFrameStateIndex(node) + index, frame_state); | 178 node->ReplaceInput(FirstFrameStateIndex(node) + index, frame_state); |
179 } | 179 } |
180 | 180 |
181 | 181 |
182 // static | 182 // static |
183 void NodeProperties::RemoveFrameStateInput(Node* node, int index) { | |
184 DCHECK_LT(index, OperatorProperties::GetFrameStateInputCount(node->op())); | |
185 node->RemoveInput(FirstFrameStateIndex(node) + index); | |
186 } | |
187 | |
188 | |
189 // static | |
190 void NodeProperties::RemoveNonValueInputs(Node* node) { | 183 void NodeProperties::RemoveNonValueInputs(Node* node) { |
191 node->TrimInputCount(node->op()->ValueInputCount()); | 184 node->TrimInputCount(node->op()->ValueInputCount()); |
192 } | 185 } |
193 | 186 |
194 | 187 |
195 // static | 188 // static |
196 void NodeProperties::RemoveValueInputs(Node* node) { | 189 void NodeProperties::RemoveValueInputs(Node* node) { |
197 int value_input_count = node->op()->ValueInputCount(); | 190 int value_input_count = node->op()->ValueInputCount(); |
198 while (--value_input_count >= 0) { | 191 while (--value_input_count >= 0) { |
199 node->RemoveInput(value_input_count); | 192 node->RemoveInput(value_input_count); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 229 |
237 | 230 |
238 // static | 231 // static |
239 void NodeProperties::ChangeOp(Node* node, const Operator* new_op) { | 232 void NodeProperties::ChangeOp(Node* node, const Operator* new_op) { |
240 node->set_op(new_op); | 233 node->set_op(new_op); |
241 Verifier::VerifyNode(node); | 234 Verifier::VerifyNode(node); |
242 } | 235 } |
243 | 236 |
244 | 237 |
245 // static | 238 // static |
| 239 Node* NodeProperties::FindFrameStateBefore(Node* node) { |
| 240 Node* effect = NodeProperties::GetEffectInput(node); |
| 241 while (effect->opcode() != IrOpcode::kCheckpoint) { |
| 242 DCHECK_EQ(1, effect->op()->EffectInputCount()); |
| 243 effect = NodeProperties::GetEffectInput(effect); |
| 244 } |
| 245 Node* frame_state = GetFrameStateInput(effect, 0); |
| 246 return frame_state; |
| 247 } |
| 248 |
| 249 // static |
246 Node* NodeProperties::FindProjection(Node* node, size_t projection_index) { | 250 Node* NodeProperties::FindProjection(Node* node, size_t projection_index) { |
247 for (auto use : node->uses()) { | 251 for (auto use : node->uses()) { |
248 if (use->opcode() == IrOpcode::kProjection && | 252 if (use->opcode() == IrOpcode::kProjection && |
249 ProjectionIndexOf(use->op()) == projection_index) { | 253 ProjectionIndexOf(use->op()) == projection_index) { |
250 return use; | 254 return use; |
251 } | 255 } |
252 } | 256 } |
253 return nullptr; | 257 return nullptr; |
254 } | 258 } |
255 | 259 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 // static | 424 // static |
421 bool NodeProperties::IsInputRange(Edge edge, int first, int num) { | 425 bool NodeProperties::IsInputRange(Edge edge, int first, int num) { |
422 if (num == 0) return false; | 426 if (num == 0) return false; |
423 int const index = edge.index(); | 427 int const index = edge.index(); |
424 return first <= index && index < first + num; | 428 return first <= index && index < first + num; |
425 } | 429 } |
426 | 430 |
427 } // namespace compiler | 431 } // namespace compiler |
428 } // namespace internal | 432 } // namespace internal |
429 } // namespace v8 | 433 } // namespace v8 |
OLD | NEW |