| 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/ast-graph-builder.h" | 5 #include "src/compiler/ast-graph-builder.h" |
| 6 #include "src/compiler/common-operator.h" | 6 #include "src/compiler/common-operator.h" |
| 7 #include "src/compiler/generic-node-inl.h" | 7 #include "src/compiler/generic-node-inl.h" |
| 8 #include "src/compiler/graph-inl.h" | 8 #include "src/compiler/graph-inl.h" |
| 9 #include "src/compiler/graph-visualizer.h" | 9 #include "src/compiler/graph-visualizer.h" |
| 10 #include "src/compiler/js-inlining.h" | 10 #include "src/compiler/js-inlining.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 int inlinee_context_index = inlinee_inputs - 1; | 177 int inlinee_context_index = inlinee_inputs - 1; |
| 178 // {inliner_inputs} counts JSFunction, Receiver, arguments, but not | 178 // {inliner_inputs} counts JSFunction, Receiver, arguments, but not |
| 179 // context, effect, control. | 179 // context, effect, control. |
| 180 int inliner_inputs = OperatorProperties::GetValueInputCount(call->op()); | 180 int inliner_inputs = OperatorProperties::GetValueInputCount(call->op()); |
| 181 // Iterate over all uses of the start node. | 181 // Iterate over all uses of the start node. |
| 182 UseIter iter = graph()->start()->uses().begin(); | 182 UseIter iter = graph()->start()->uses().begin(); |
| 183 while (iter != graph()->start()->uses().end()) { | 183 while (iter != graph()->start()->uses().end()) { |
| 184 Node* use = *iter; | 184 Node* use = *iter; |
| 185 switch (use->opcode()) { | 185 switch (use->opcode()) { |
| 186 case IrOpcode::kParameter: { | 186 case IrOpcode::kParameter: { |
| 187 int index = 1 + static_cast<Operator1<int>*>(use->op())->parameter(); | 187 int index = 1 + OpParameter<int>(use->op()); |
| 188 if (index < inliner_inputs && index < inlinee_context_index) { | 188 if (index < inliner_inputs && index < inlinee_context_index) { |
| 189 // There is an input from the call, and the index is a value | 189 // There is an input from the call, and the index is a value |
| 190 // projection but not the context, so rewire the input. | 190 // projection but not the context, so rewire the input. |
| 191 NodeProperties::ReplaceWithValue(*iter, call->InputAt(index)); | 191 NodeProperties::ReplaceWithValue(*iter, call->InputAt(index)); |
| 192 } else if (index == inlinee_context_index) { | 192 } else if (index == inlinee_context_index) { |
| 193 // This is the context projection, rewire it to the context from the | 193 // This is the context projection, rewire it to the context from the |
| 194 // JSFunction object. | 194 // JSFunction object. |
| 195 NodeProperties::ReplaceWithValue(*iter, context); | 195 NodeProperties::ReplaceWithValue(*iter, context); |
| 196 } else if (index < inlinee_context_index) { | 196 } else if (index < inlinee_context_index) { |
| 197 // Call has fewer arguments than required, fill with undefined. | 197 // Call has fewer arguments than required, fill with undefined. |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 287 |
| 288 Inlinee inlinee(&jsgraph); | 288 Inlinee inlinee(&jsgraph); |
| 289 inlinee.UnifyReturn(); | 289 inlinee.UnifyReturn(); |
| 290 inlinee.InlineAtCall(jsgraph_, node); | 290 inlinee.InlineAtCall(jsgraph_, node); |
| 291 | 291 |
| 292 jsgraph_->graph()->SetNextNodeId(inlinee.graph()->NextNodeID()); | 292 jsgraph_->graph()->SetNextNodeId(inlinee.graph()->NextNodeID()); |
| 293 } | 293 } |
| 294 } | 294 } |
| 295 } | 295 } |
| 296 } // namespace v8::internal::compiler | 296 } // namespace v8::internal::compiler |
| OLD | NEW |