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" |
11 #include "src/compiler/common-operator.h" | 11 #include "src/compiler/common-operator.h" |
12 #include "src/compiler/js-context-specialization.h" | |
13 #include "src/compiler/js-operator.h" | 12 #include "src/compiler/js-operator.h" |
14 #include "src/compiler/node-matchers.h" | 13 #include "src/compiler/node-matchers.h" |
15 #include "src/compiler/node-properties.h" | 14 #include "src/compiler/node-properties.h" |
16 #include "src/compiler/operator-properties.h" | 15 #include "src/compiler/operator-properties.h" |
17 #include "src/full-codegen.h" | 16 #include "src/full-codegen.h" |
18 #include "src/parser.h" | 17 #include "src/parser.h" |
19 #include "src/rewriter.h" | 18 #include "src/rewriter.h" |
20 #include "src/scopes.h" | 19 #include "src/scopes.h" |
21 | 20 |
22 namespace v8 { | 21 namespace v8 { |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 Graph graph(info.zone()); | 274 Graph graph(info.zone()); |
276 JSGraph jsgraph(info.isolate(), &graph, jsgraph_->common(), | 275 JSGraph jsgraph(info.isolate(), &graph, jsgraph_->common(), |
277 jsgraph_->javascript(), jsgraph_->machine()); | 276 jsgraph_->javascript(), jsgraph_->machine()); |
278 | 277 |
279 // The inlinee specializes to the context from the JSFunction object. | 278 // The inlinee specializes to the context from the JSFunction object. |
280 // TODO(turbofan): We might want to load the context from the JSFunction at | 279 // TODO(turbofan): We might want to load the context from the JSFunction at |
281 // runtime in case we only know the SharedFunctionInfo once we have dynamic | 280 // runtime in case we only know the SharedFunctionInfo once we have dynamic |
282 // type feedback in the compiler. | 281 // type feedback in the compiler. |
283 AstGraphBuilder graph_builder(local_zone_, &info, &jsgraph); | 282 AstGraphBuilder graph_builder(local_zone_, &info, &jsgraph); |
284 graph_builder.CreateGraph(true, false); | 283 graph_builder.CreateGraph(true, false); |
285 GraphReducer graph_reducer(local_zone_, &graph); | |
286 JSContextSpecializer context_specializer(&graph_reducer, &jsgraph); | |
287 graph_reducer.AddReducer(&context_specializer); | |
288 graph_reducer.ReduceGraph(); | |
289 | 284 |
290 CopyVisitor visitor(&graph, jsgraph_->graph(), info.zone()); | 285 CopyVisitor visitor(&graph, jsgraph_->graph(), info.zone()); |
291 visitor.CopyGraph(); | 286 visitor.CopyGraph(); |
292 | 287 |
293 Node* start = visitor.GetCopy(graph.start()); | 288 Node* start = visitor.GetCopy(graph.start()); |
294 Node* end = visitor.GetCopy(graph.end()); | 289 Node* end = visitor.GetCopy(graph.end()); |
295 | 290 |
296 Node* frame_state = call.frame_state(); | 291 Node* frame_state = call.frame_state(); |
297 size_t const inlinee_formal_parameters = start->op()->ValueOutputCount() - 3; | 292 size_t const inlinee_formal_parameters = start->op()->ValueOutputCount() - 3; |
298 // Insert argument adaptor frame if required. | 293 // Insert argument adaptor frame if required. |
(...skipping 10 matching lines...) Expand all Loading... |
309 | 304 |
310 // Remember that we inlined this function. | 305 // Remember that we inlined this function. |
311 info_->AddInlinedFunction(info.shared_info()); | 306 info_->AddInlinedFunction(info.shared_info()); |
312 | 307 |
313 return InlineCall(node, frame_state, start, end); | 308 return InlineCall(node, frame_state, start, end); |
314 } | 309 } |
315 | 310 |
316 } // namespace compiler | 311 } // namespace compiler |
317 } // namespace internal | 312 } // namespace internal |
318 } // namespace v8 | 313 } // namespace v8 |
OLD | NEW |