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/ast-numbering.h" | 7 #include "src/ast/ast-numbering.h" |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 !Compiler::EnsureDeoptimizationSupport(&info)) { | 503 !Compiler::EnsureDeoptimizationSupport(&info)) { |
504 TRACE("Not inlining %s into %s because deoptimization support failed\n", | 504 TRACE("Not inlining %s into %s because deoptimization support failed\n", |
505 shared_info->DebugName()->ToCString().get(), | 505 shared_info->DebugName()->ToCString().get(), |
506 info_->shared_info()->DebugName()->ToCString().get()); | 506 info_->shared_info()->DebugName()->ToCString().get()); |
507 return NoChange(); | 507 return NoChange(); |
508 } | 508 } |
509 | 509 |
510 // Remember that we inlined this function. This needs to be called right | 510 // Remember that we inlined this function. This needs to be called right |
511 // after we ensure deoptimization support so that the code flusher | 511 // after we ensure deoptimization support so that the code flusher |
512 // does not remove the code with the deoptimization support. | 512 // does not remove the code with the deoptimization support. |
513 info_->AddInlinedFunction(shared_info); | 513 int inlining_id = info_->AddInlinedFunction( |
| 514 shared_info, source_positions_->GetSourcePosition(node)); |
514 | 515 |
515 // ---------------------------------------------------------------- | 516 // ---------------------------------------------------------------- |
516 // After this point, we've made a decision to inline this function. | 517 // After this point, we've made a decision to inline this function. |
517 // We shall not bailout from inlining if we got here. | 518 // We shall not bailout from inlining if we got here. |
518 | 519 |
519 TRACE("Inlining %s into %s\n", | 520 TRACE("Inlining %s into %s\n", |
520 shared_info->DebugName()->ToCString().get(), | 521 shared_info->DebugName()->ToCString().get(), |
521 info_->shared_info()->DebugName()->ToCString().get()); | 522 info_->shared_info()->DebugName()->ToCString().get()); |
522 | 523 |
523 // If function was lazily compiled, its literals array may not yet be set up. | 524 // If function was lazily compiled, its literals array may not yet be set up. |
(...skipping 18 matching lines...) Expand all Loading... |
542 LoopAssignmentAnalysis* loop_assignment = | 543 LoopAssignmentAnalysis* loop_assignment = |
543 loop_assignment_analyzer.Analyze(); | 544 loop_assignment_analyzer.Analyze(); |
544 | 545 |
545 // Run the type hint analyzer on the inlinee. | 546 // Run the type hint analyzer on the inlinee. |
546 TypeHintAnalyzer type_hint_analyzer(&zone); | 547 TypeHintAnalyzer type_hint_analyzer(&zone); |
547 TypeHintAnalysis* type_hint_analysis = | 548 TypeHintAnalysis* type_hint_analysis = |
548 type_hint_analyzer.Analyze(handle(shared_info->code(), info.isolate())); | 549 type_hint_analyzer.Analyze(handle(shared_info->code(), info.isolate())); |
549 | 550 |
550 // Run the AstGraphBuilder to create the subgraph. | 551 // Run the AstGraphBuilder to create the subgraph. |
551 Graph::SubgraphScope scope(graph()); | 552 Graph::SubgraphScope scope(graph()); |
552 AstGraphBuilder graph_builder(&zone, &info, jsgraph(), call.frequency(), | 553 AstGraphBuilderWithPositions graph_builder( |
553 loop_assignment, type_hint_analysis); | 554 &zone, &info, jsgraph(), call.frequency(), loop_assignment, |
| 555 type_hint_analysis, source_positions_, inlining_id); |
554 graph_builder.CreateGraph(false); | 556 graph_builder.CreateGraph(false); |
555 | 557 |
556 // Extract the inlinee start/end nodes. | 558 // Extract the inlinee start/end nodes. |
557 start = graph()->start(); | 559 start = graph()->start(); |
558 end = graph()->end(); | 560 end = graph()->end(); |
559 } | 561 } |
560 | 562 |
561 if (exception_target != nullptr) { | 563 if (exception_target != nullptr) { |
562 // Find all uncaught 'calls' in the inlinee. | 564 // Find all uncaught 'calls' in the inlinee. |
563 AllNodes inlined_nodes(local_zone_, end, graph()); | 565 AllNodes inlined_nodes(local_zone_, end, graph()); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 | 693 |
692 CommonOperatorBuilder* JSInliner::common() const { return jsgraph()->common(); } | 694 CommonOperatorBuilder* JSInliner::common() const { return jsgraph()->common(); } |
693 | 695 |
694 SimplifiedOperatorBuilder* JSInliner::simplified() const { | 696 SimplifiedOperatorBuilder* JSInliner::simplified() const { |
695 return jsgraph()->simplified(); | 697 return jsgraph()->simplified(); |
696 } | 698 } |
697 | 699 |
698 } // namespace compiler | 700 } // namespace compiler |
699 } // namespace internal | 701 } // namespace internal |
700 } // namespace v8 | 702 } // namespace v8 |
OLD | NEW |