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/access-builder.h" |
5 #include "src/compiler/ast-graph-builder.h" | 6 #include "src/compiler/ast-graph-builder.h" |
6 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
7 #include "src/compiler/generic-node-inl.h" | 8 #include "src/compiler/generic-node-inl.h" |
8 #include "src/compiler/graph-inl.h" | 9 #include "src/compiler/graph-inl.h" |
9 #include "src/compiler/graph-visualizer.h" | 10 #include "src/compiler/graph-visualizer.h" |
10 #include "src/compiler/js-inlining.h" | 11 #include "src/compiler/js-inlining.h" |
11 #include "src/compiler/js-operator.h" | 12 #include "src/compiler/js-operator.h" |
12 #include "src/compiler/node-aux-data-inl.h" | 13 #include "src/compiler/node-aux-data-inl.h" |
13 #include "src/compiler/node-matchers.h" | 14 #include "src/compiler/node-matchers.h" |
14 #include "src/compiler/node-properties-inl.h" | 15 #include "src/compiler/node-properties-inl.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 }; | 221 }; |
221 | 222 |
222 | 223 |
223 void Inlinee::InlineAtCall(JSGraph* jsgraph, Node* call) { | 224 void Inlinee::InlineAtCall(JSGraph* jsgraph, Node* call) { |
224 // The scheduler is smart enough to place our code; we just ensure {control} | 225 // The scheduler is smart enough to place our code; we just ensure {control} |
225 // becomes the control input of the start of the inlinee. | 226 // becomes the control input of the start of the inlinee. |
226 Node* control = NodeProperties::GetControlInput(call); | 227 Node* control = NodeProperties::GetControlInput(call); |
227 | 228 |
228 // The inlinee uses the context from the JSFunction object. This will | 229 // The inlinee uses the context from the JSFunction object. This will |
229 // also be the effect dependency for the inlinee as it produces an effect. | 230 // also be the effect dependency for the inlinee as it produces an effect. |
230 // TODO(sigurds) Use simplified load once it is ready. | 231 SimplifiedOperatorBuilder simplified(jsgraph->zone()); |
231 Node* context = jsgraph->graph()->NewNode( | 232 Node* context = jsgraph->graph()->NewNode( |
232 jsgraph->machine()->Load(kMachAnyTagged), | 233 simplified.LoadField(AccessBuilder::ForJSFunctionContext()), |
233 NodeProperties::GetValueInput(call, 0), | 234 NodeProperties::GetValueInput(call, 0), |
234 jsgraph->Int32Constant(JSFunction::kContextOffset - kHeapObjectTag), | |
235 NodeProperties::GetEffectInput(call)); | 235 NodeProperties::GetEffectInput(call)); |
236 | 236 |
237 // {inlinee_inputs} counts JSFunction, Receiver, arguments, context, | 237 // {inlinee_inputs} counts JSFunction, Receiver, arguments, context, |
238 // but not effect, control. | 238 // but not effect, control. |
239 int inlinee_inputs = start_->op()->OutputCount(); | 239 int inlinee_inputs = start_->op()->OutputCount(); |
240 // Context is last argument. | 240 // Context is last argument. |
241 int inlinee_context_index = inlinee_inputs - 1; | 241 int inlinee_context_index = inlinee_inputs - 1; |
242 // {inliner_inputs} counts JSFunction, Receiver, arguments, but not | 242 // {inliner_inputs} counts JSFunction, Receiver, arguments, but not |
243 // context, effect, control. | 243 // context, effect, control. |
244 int inliner_inputs = OperatorProperties::GetValueInputCount(call->op()); | 244 int inliner_inputs = OperatorProperties::GetValueInputCount(call->op()); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 350 |
351 CopyVisitor visitor(&graph, jsgraph_->graph(), info.zone()); | 351 CopyVisitor visitor(&graph, jsgraph_->graph(), info.zone()); |
352 visitor.CopyGraph(); | 352 visitor.CopyGraph(); |
353 | 353 |
354 Inlinee inlinee(visitor.GetCopy(graph.start()), visitor.GetCopy(graph.end())); | 354 Inlinee inlinee(visitor.GetCopy(graph.start()), visitor.GetCopy(graph.end())); |
355 inlinee.InlineAtCall(jsgraph_, call); | 355 inlinee.InlineAtCall(jsgraph_, call); |
356 } | 356 } |
357 } | 357 } |
358 } | 358 } |
359 } // namespace v8::internal::compiler | 359 } // namespace v8::internal::compiler |
OLD | NEW |