Chromium Code Reviews| 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" |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 341 } | 341 } |
| 342 return NoChange(); | 342 return NoChange(); |
| 343 } | 343 } |
| 344 | 344 |
| 345 if (!Compiler::EnsureDeoptimizationSupport(&info)) { | 345 if (!Compiler::EnsureDeoptimizationSupport(&info)) { |
| 346 TRACE("Not inlining %s into %s because deoptimization support failed\n", | 346 TRACE("Not inlining %s into %s because deoptimization support failed\n", |
| 347 function->shared()->DebugName()->ToCString().get(), | 347 function->shared()->DebugName()->ToCString().get(), |
| 348 info_->shared_info()->DebugName()->ToCString().get()); | 348 info_->shared_info()->DebugName()->ToCString().get()); |
| 349 return NoChange(); | 349 return NoChange(); |
| 350 } | 350 } |
| 351 // Remember that we inlined this function. This needs to be called right | |
| 352 // after we ensure deoptimization support so that the code flusher | |
| 353 // does not remove the code with the deoptimization support. | |
| 354 info_->AddInlinedFunction(info.shared_info()); | |
| 351 | 355 |
|
Michael Starzinger
2015/10/21 13:49:50
nit: Can we add a separator comment here, together
Jarin
2015/10/21 14:31:46
Done.
| |
| 352 TRACE("Inlining %s into %s\n", | 356 TRACE("Inlining %s into %s\n", |
| 353 function->shared()->DebugName()->ToCString().get(), | 357 function->shared()->DebugName()->ToCString().get(), |
| 354 info_->shared_info()->DebugName()->ToCString().get()); | 358 info_->shared_info()->DebugName()->ToCString().get()); |
| 355 | 359 |
| 356 Graph graph(info.zone()); | 360 Graph graph(info.zone()); |
| 357 JSGraph jsgraph(info.isolate(), &graph, jsgraph_->common(), | 361 JSGraph jsgraph(info.isolate(), &graph, jsgraph_->common(), |
| 358 jsgraph_->javascript(), jsgraph_->simplified(), | 362 jsgraph_->javascript(), jsgraph_->simplified(), |
| 359 jsgraph_->machine()); | 363 jsgraph_->machine()); |
| 360 AstGraphBuilder graph_builder(local_zone_, &info, &jsgraph); | 364 AstGraphBuilder graph_builder(local_zone_, &info, &jsgraph); |
| 361 graph_builder.CreateGraph(false); | 365 graph_builder.CreateGraph(false); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 Node* end = visitor.GetCopy(graph.end()); | 398 Node* end = visitor.GetCopy(graph.end()); |
| 395 | 399 |
| 396 Node* frame_state = call.frame_state(); | 400 Node* frame_state = call.frame_state(); |
| 397 size_t const inlinee_formal_parameters = start->op()->ValueOutputCount() - 3; | 401 size_t const inlinee_formal_parameters = start->op()->ValueOutputCount() - 3; |
| 398 // Insert argument adaptor frame if required. | 402 // Insert argument adaptor frame if required. |
| 399 if (call.formal_arguments() != inlinee_formal_parameters) { | 403 if (call.formal_arguments() != inlinee_formal_parameters) { |
| 400 // In strong mode, in case of too few arguments we need to throw a | 404 // In strong mode, in case of too few arguments we need to throw a |
| 401 // TypeError so we must not inline this call. | 405 // TypeError so we must not inline this call. |
| 402 if (is_strong(info.language_mode()) && | 406 if (is_strong(info.language_mode()) && |
| 403 call.formal_arguments() < inlinee_formal_parameters) { | 407 call.formal_arguments() < inlinee_formal_parameters) { |
| 404 return NoChange(); | 408 return NoChange(); |
|
Michael Starzinger
2015/10/21 13:49:50
nit: Can we add a TODO here that this bailout need
Jarin
2015/10/21 14:31:46
Done.
| |
| 405 } | 409 } |
| 406 frame_state = CreateArgumentsAdaptorFrameState(&call, info.shared_info(), | 410 frame_state = CreateArgumentsAdaptorFrameState(&call, info.shared_info(), |
| 407 info.zone()); | 411 info.zone()); |
| 408 } | 412 } |
| 409 | 413 |
| 410 // Remember that we inlined this function. | |
| 411 info_->AddInlinedFunction(info.shared_info()); | |
| 412 | |
| 413 return InlineCall(node, context, frame_state, start, end); | 414 return InlineCall(node, context, frame_state, start, end); |
| 414 } | 415 } |
| 415 | 416 |
| 416 } // namespace compiler | 417 } // namespace compiler |
| 417 } // namespace internal | 418 } // namespace internal |
| 418 } // namespace v8 | 419 } // namespace v8 |
| OLD | NEW |