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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 | 56 |
57 // static | 57 // static |
58 Node* NodeProperties::GetContextInput(Node* node) { | 58 Node* NodeProperties::GetContextInput(Node* node) { |
59 DCHECK(OperatorProperties::HasContextInput(node->op())); | 59 DCHECK(OperatorProperties::HasContextInput(node->op())); |
60 return node->InputAt(FirstContextIndex(node)); | 60 return node->InputAt(FirstContextIndex(node)); |
61 } | 61 } |
62 | 62 |
63 | 63 |
64 // static | 64 // static |
65 Node* NodeProperties::GetFrameStateInput(Node* node, int index) { | 65 Node* NodeProperties::GetFrameStateInput(Node* node) { |
66 DCHECK_LT(index, OperatorProperties::GetFrameStateInputCount(node->op())); | 66 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op())); |
67 return node->InputAt(FirstFrameStateIndex(node) + index); | 67 return node->InputAt(FirstFrameStateIndex(node)); |
68 } | 68 } |
69 | 69 |
70 | 70 |
71 // static | 71 // static |
72 Node* NodeProperties::GetEffectInput(Node* node, int index) { | 72 Node* NodeProperties::GetEffectInput(Node* node, int index) { |
73 DCHECK(0 <= index && index < node->op()->EffectInputCount()); | 73 DCHECK(0 <= index && index < node->op()->EffectInputCount()); |
74 return node->InputAt(FirstEffectIndex(node) + index); | 74 return node->InputAt(FirstEffectIndex(node) + index); |
75 } | 75 } |
76 | 76 |
77 | 77 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 | 166 |
167 // static | 167 // static |
168 void NodeProperties::ReplaceEffectInput(Node* node, Node* effect, int index) { | 168 void NodeProperties::ReplaceEffectInput(Node* node, Node* effect, int index) { |
169 DCHECK(index < node->op()->EffectInputCount()); | 169 DCHECK(index < node->op()->EffectInputCount()); |
170 return node->ReplaceInput(FirstEffectIndex(node) + index, effect); | 170 return node->ReplaceInput(FirstEffectIndex(node) + index, effect); |
171 } | 171 } |
172 | 172 |
173 | 173 |
174 // static | 174 // static |
175 void NodeProperties::ReplaceFrameStateInput(Node* node, int index, | 175 void NodeProperties::ReplaceFrameStateInput(Node* node, Node* frame_state) { |
176 Node* frame_state) { | 176 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op())); |
177 DCHECK_LT(index, OperatorProperties::GetFrameStateInputCount(node->op())); | 177 node->ReplaceInput(FirstFrameStateIndex(node), frame_state); |
178 node->ReplaceInput(FirstFrameStateIndex(node) + index, frame_state); | |
179 } | 178 } |
180 | 179 |
181 | 180 |
182 // static | 181 // static |
183 void NodeProperties::RemoveNonValueInputs(Node* node) { | 182 void NodeProperties::RemoveNonValueInputs(Node* node) { |
184 node->TrimInputCount(node->op()->ValueInputCount()); | 183 node->TrimInputCount(node->op()->ValueInputCount()); |
185 } | 184 } |
186 | 185 |
187 | 186 |
188 // static | 187 // static |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 236 |
238 | 237 |
239 // static | 238 // static |
240 Node* NodeProperties::FindFrameStateBefore(Node* node) { | 239 Node* NodeProperties::FindFrameStateBefore(Node* node) { |
241 Node* effect = NodeProperties::GetEffectInput(node); | 240 Node* effect = NodeProperties::GetEffectInput(node); |
242 while (effect->opcode() != IrOpcode::kCheckpoint) { | 241 while (effect->opcode() != IrOpcode::kCheckpoint) { |
243 if (effect->opcode() == IrOpcode::kDead) return effect; | 242 if (effect->opcode() == IrOpcode::kDead) return effect; |
244 DCHECK_EQ(1, effect->op()->EffectInputCount()); | 243 DCHECK_EQ(1, effect->op()->EffectInputCount()); |
245 effect = NodeProperties::GetEffectInput(effect); | 244 effect = NodeProperties::GetEffectInput(effect); |
246 } | 245 } |
247 Node* frame_state = GetFrameStateInput(effect, 0); | 246 Node* frame_state = GetFrameStateInput(effect); |
248 return frame_state; | 247 return frame_state; |
249 } | 248 } |
250 | 249 |
251 // static | 250 // static |
252 Node* NodeProperties::FindProjection(Node* node, size_t projection_index) { | 251 Node* NodeProperties::FindProjection(Node* node, size_t projection_index) { |
253 for (auto use : node->uses()) { | 252 for (auto use : node->uses()) { |
254 if (use->opcode() == IrOpcode::kProjection && | 253 if (use->opcode() == IrOpcode::kProjection && |
255 ProjectionIndexOf(use->op()) == projection_index) { | 254 ProjectionIndexOf(use->op()) == projection_index) { |
256 return use; | 255 return use; |
257 } | 256 } |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 // static | 424 // static |
426 bool NodeProperties::IsInputRange(Edge edge, int first, int num) { | 425 bool NodeProperties::IsInputRange(Edge edge, int first, int num) { |
427 if (num == 0) return false; | 426 if (num == 0) return false; |
428 int const index = edge.index(); | 427 int const index = edge.index(); |
429 return first <= index && index < first + num; | 428 return first <= index && index < first + num; |
430 } | 429 } |
431 | 430 |
432 } // namespace compiler | 431 } // namespace compiler |
433 } // namespace internal | 432 } // namespace internal |
434 } // namespace v8 | 433 } // namespace v8 |
OLD | NEW |