| 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/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
| 10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 } | 428 } |
| 429 return NoChange(); | 429 return NoChange(); |
| 430 } | 430 } |
| 431 | 431 |
| 432 if (!Compiler::EnsureDeoptimizationSupport(&info)) { | 432 if (!Compiler::EnsureDeoptimizationSupport(&info)) { |
| 433 TRACE("Not inlining %s into %s because deoptimization support failed\n", | 433 TRACE("Not inlining %s into %s because deoptimization support failed\n", |
| 434 shared_info->DebugName()->ToCString().get(), | 434 shared_info->DebugName()->ToCString().get(), |
| 435 info_->shared_info()->DebugName()->ToCString().get()); | 435 info_->shared_info()->DebugName()->ToCString().get()); |
| 436 return NoChange(); | 436 return NoChange(); |
| 437 } | 437 } |
| 438 |
| 438 // Remember that we inlined this function. This needs to be called right | 439 // Remember that we inlined this function. This needs to be called right |
| 439 // after we ensure deoptimization support so that the code flusher | 440 // after we ensure deoptimization support so that the code flusher |
| 440 // does not remove the code with the deoptimization support. | 441 // does not remove the code with the deoptimization support. |
| 441 info_->AddInlinedFunction(shared_info); | 442 info_->AddInlinedFunction(shared_info); |
| 442 | 443 |
| 443 // ---------------------------------------------------------------- | 444 // ---------------------------------------------------------------- |
| 444 // After this point, we've made a decision to inline this function. | 445 // After this point, we've made a decision to inline this function. |
| 445 // We shall not bailout from inlining if we got here. | 446 // We shall not bailout from inlining if we got here. |
| 446 | 447 |
| 447 TRACE("Inlining %s into %s\n", | 448 TRACE("Inlining %s into %s\n", |
| 448 shared_info->DebugName()->ToCString().get(), | 449 shared_info->DebugName()->ToCString().get(), |
| 449 info_->shared_info()->DebugName()->ToCString().get()); | 450 info_->shared_info()->DebugName()->ToCString().get()); |
| 450 | 451 |
| 452 // If function was lazily compiled, it's literals array may not yet be set up. |
| 453 JSFunction::EnsureLiterals(function); |
| 454 |
| 451 // Run the loop assignment analyzer on the inlinee. | 455 // Run the loop assignment analyzer on the inlinee. |
| 452 AstLoopAssignmentAnalyzer loop_assignment_analyzer(&zone, &info); | 456 AstLoopAssignmentAnalyzer loop_assignment_analyzer(&zone, &info); |
| 453 LoopAssignmentAnalysis* loop_assignment = loop_assignment_analyzer.Analyze(); | 457 LoopAssignmentAnalysis* loop_assignment = loop_assignment_analyzer.Analyze(); |
| 454 | 458 |
| 455 // Run the type hint analyzer on the inlinee. | 459 // Run the type hint analyzer on the inlinee. |
| 456 TypeHintAnalyzer type_hint_analyzer(&zone); | 460 TypeHintAnalyzer type_hint_analyzer(&zone); |
| 457 TypeHintAnalysis* type_hint_analysis = | 461 TypeHintAnalysis* type_hint_analysis = |
| 458 type_hint_analyzer.Analyze(handle(shared_info->code(), info.isolate())); | 462 type_hint_analyzer.Analyze(handle(shared_info->code(), info.isolate())); |
| 459 | 463 |
| 460 // TODO(mstarzinger): We could use the temporary zone for the graph because | 464 // TODO(mstarzinger): We could use the temporary zone for the graph because |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 node, frame_state, call.formal_arguments(), | 570 node, frame_state, call.formal_arguments(), |
| 567 FrameStateType::kArgumentsAdaptor, shared_info); | 571 FrameStateType::kArgumentsAdaptor, shared_info); |
| 568 } | 572 } |
| 569 | 573 |
| 570 return InlineCall(node, new_target, context, frame_state, start, end); | 574 return InlineCall(node, new_target, context, frame_state, start, end); |
| 571 } | 575 } |
| 572 | 576 |
| 573 } // namespace compiler | 577 } // namespace compiler |
| 574 } // namespace internal | 578 } // namespace internal |
| 575 } // namespace v8 | 579 } // namespace v8 |
| OLD | NEW |