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.h" | 9 #include "src/compiler.h" |
10 #include "src/compiler/all-nodes.h" | 10 #include "src/compiler/all-nodes.h" |
11 #include "src/compiler/ast-graph-builder.h" | 11 #include "src/compiler/ast-graph-builder.h" |
12 #include "src/compiler/common-operator.h" | 12 #include "src/compiler/common-operator.h" |
13 #include "src/compiler/common-operator-reducer.h" | 13 #include "src/compiler/common-operator-reducer.h" |
14 #include "src/compiler/dead-code-elimination.h" | 14 #include "src/compiler/dead-code-elimination.h" |
15 #include "src/compiler/graph-reducer.h" | 15 #include "src/compiler/graph-reducer.h" |
16 #include "src/compiler/js-global-specialization.h" | 16 #include "src/compiler/js-native-context-specialization.h" |
17 #include "src/compiler/js-operator.h" | 17 #include "src/compiler/js-operator.h" |
18 #include "src/compiler/node-matchers.h" | 18 #include "src/compiler/node-matchers.h" |
19 #include "src/compiler/node-properties.h" | 19 #include "src/compiler/node-properties.h" |
20 #include "src/compiler/operator-properties.h" | 20 #include "src/compiler/operator-properties.h" |
21 #include "src/isolate-inl.h" | 21 #include "src/isolate-inl.h" |
22 #include "src/parser.h" | 22 #include "src/parser.h" |
23 #include "src/rewriter.h" | 23 #include "src/rewriter.h" |
24 #include "src/scopes.h" | 24 #include "src/scopes.h" |
25 | 25 |
26 namespace v8 { | 26 namespace v8 { |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 graph_builder.CreateGraph(false); | 357 graph_builder.CreateGraph(false); |
358 | 358 |
359 // TODO(mstarzinger): Unify this with the Pipeline once JSInliner refactoring | 359 // TODO(mstarzinger): Unify this with the Pipeline once JSInliner refactoring |
360 // starts. | 360 // starts. |
361 if (info.is_native_context_specializing()) { | 361 if (info.is_native_context_specializing()) { |
362 GraphReducer graph_reducer(local_zone_, &graph, jsgraph.Dead()); | 362 GraphReducer graph_reducer(local_zone_, &graph, jsgraph.Dead()); |
363 DeadCodeElimination dead_code_elimination(&graph_reducer, &graph, | 363 DeadCodeElimination dead_code_elimination(&graph_reducer, &graph, |
364 jsgraph.common()); | 364 jsgraph.common()); |
365 CommonOperatorReducer common_reducer(&graph_reducer, &graph, | 365 CommonOperatorReducer common_reducer(&graph_reducer, &graph, |
366 jsgraph.common(), jsgraph.machine()); | 366 jsgraph.common(), jsgraph.machine()); |
367 JSGlobalSpecialization global_specialization( | 367 JSNativeContextSpecialization native_context_specialization( |
368 &graph_reducer, &jsgraph, | 368 &graph_reducer, &jsgraph, |
369 info.is_deoptimization_enabled() | 369 info.is_deoptimization_enabled() |
370 ? JSGlobalSpecialization::kDeoptimizationEnabled | 370 ? JSNativeContextSpecialization::kDeoptimizationEnabled |
371 : JSGlobalSpecialization::kNoFlags, | 371 : JSNativeContextSpecialization::kNoFlags, |
372 handle(info.global_object(), info.isolate()), info_->dependencies(), | 372 handle(info.global_object(), info.isolate()), info_->dependencies(), |
373 local_zone_); | 373 local_zone_); |
374 graph_reducer.AddReducer(&dead_code_elimination); | 374 graph_reducer.AddReducer(&dead_code_elimination); |
375 graph_reducer.AddReducer(&common_reducer); | 375 graph_reducer.AddReducer(&common_reducer); |
376 graph_reducer.AddReducer(&global_specialization); | 376 graph_reducer.AddReducer(&native_context_specialization); |
377 graph_reducer.ReduceGraph(); | 377 graph_reducer.ReduceGraph(); |
378 } | 378 } |
379 | 379 |
380 // The inlinee specializes to the context from the JSFunction object. | 380 // The inlinee specializes to the context from the JSFunction object. |
381 // TODO(turbofan): We might want to load the context from the JSFunction at | 381 // TODO(turbofan): We might want to load the context from the JSFunction at |
382 // runtime in case we only know the SharedFunctionInfo once we have dynamic | 382 // runtime in case we only know the SharedFunctionInfo once we have dynamic |
383 // type feedback in the compiler. | 383 // type feedback in the compiler. |
384 Node* context = jsgraph_->Constant(handle(function->context())); | 384 Node* context = jsgraph_->Constant(handle(function->context())); |
385 | 385 |
386 CopyVisitor visitor(&graph, jsgraph_->graph(), info.zone()); | 386 CopyVisitor visitor(&graph, jsgraph_->graph(), info.zone()); |
(...skipping 18 matching lines...) Expand all Loading... |
405 | 405 |
406 // Remember that we inlined this function. | 406 // Remember that we inlined this function. |
407 info_->AddInlinedFunction(info.shared_info()); | 407 info_->AddInlinedFunction(info.shared_info()); |
408 | 408 |
409 return InlineCall(node, context, frame_state, start, end); | 409 return InlineCall(node, context, frame_state, start, end); |
410 } | 410 } |
411 | 411 |
412 } // namespace compiler | 412 } // namespace compiler |
413 } // namespace internal | 413 } // namespace internal |
414 } // namespace v8 | 414 } // namespace v8 |
OLD | NEW |