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 "src/compiler/js-inlining.h" | 5 #include "src/compiler/js-inlining.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
9 #include "src/compiler/all-nodes.h" | 9 #include "src/compiler/all-nodes.h" |
10 #include "src/compiler/ast-graph-builder.h" | 10 #include "src/compiler/ast-graph-builder.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // Context is last argument. | 228 // Context is last argument. |
229 int inlinee_context_index = static_cast<int>(total_parameters()) - 1; | 229 int inlinee_context_index = static_cast<int>(total_parameters()) - 1; |
230 // {inliner_inputs} counts JSFunction, Receiver, arguments, but not | 230 // {inliner_inputs} counts JSFunction, Receiver, arguments, but not |
231 // context, effect, control. | 231 // context, effect, control. |
232 int inliner_inputs = call->op()->ValueInputCount(); | 232 int inliner_inputs = call->op()->ValueInputCount(); |
233 // Iterate over all uses of the start node. | 233 // Iterate over all uses of the start node. |
234 for (Edge edge : start_->use_edges()) { | 234 for (Edge edge : start_->use_edges()) { |
235 Node* use = edge.from(); | 235 Node* use = edge.from(); |
236 switch (use->opcode()) { | 236 switch (use->opcode()) { |
237 case IrOpcode::kParameter: { | 237 case IrOpcode::kParameter: { |
238 int index = 1 + OpParameter<int>(use->op()); | 238 int index = 1 + ParameterIndexOf(use->op()); |
239 if (index < inliner_inputs && index < inlinee_context_index) { | 239 if (index < inliner_inputs && index < inlinee_context_index) { |
240 // There is an input from the call, and the index is a value | 240 // There is an input from the call, and the index is a value |
241 // projection but not the context, so rewire the input. | 241 // projection but not the context, so rewire the input. |
242 NodeProperties::ReplaceWithValue(use, call->InputAt(index)); | 242 NodeProperties::ReplaceWithValue(use, call->InputAt(index)); |
243 } else if (index == inlinee_context_index) { | 243 } else if (index == inlinee_context_index) { |
244 // TODO(turbofan): We always context specialize inlinees currently, so | 244 // TODO(turbofan): We always context specialize inlinees currently, so |
245 // we should never get here. | 245 // we should never get here. |
246 UNREACHABLE(); | 246 UNREACHABLE(); |
247 } else if (index < inlinee_context_index) { | 247 } else if (index < inlinee_context_index) { |
248 // Call has fewer arguments than required, fill with undefined. | 248 // Call has fewer arguments than required, fill with undefined. |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 } | 376 } |
377 } | 377 } |
378 } | 378 } |
379 | 379 |
380 return inlinee.InlineAtCall(jsgraph_, node); | 380 return inlinee.InlineAtCall(jsgraph_, node); |
381 } | 381 } |
382 | 382 |
383 } // namespace compiler | 383 } // namespace compiler |
384 } // namespace internal | 384 } // namespace internal |
385 } // namespace v8 | 385 } // namespace v8 |
OLD | NEW |