Chromium Code Reviews| Index: src/compiler/js-inlining.cc |
| diff --git a/src/compiler/js-inlining.cc b/src/compiler/js-inlining.cc |
| index 0888944852da3d36e52cc44198b302177517946e..a0ca0d763fc6ba2d106442058bd2275b93476114 100644 |
| --- a/src/compiler/js-inlining.cc |
| +++ b/src/compiler/js-inlining.cc |
| @@ -342,6 +342,17 @@ Reduction JSInliner::ReduceJSCallFunction(Node* node, |
| return NoChange(); |
| } |
| + // In strong mode, in case of too few arguments we need to throw a TypeError |
| + // so we must not inline this call. |
| + size_t parameter_count = info.literal()->parameter_count(); |
| + if (is_strong(info.language_mode()) && |
| + call.formal_arguments() < parameter_count) { |
| + TRACE("Not inlining %s into %s because too few arguments for strong mode\n", |
| + function->shared()->DebugName()->ToCString().get(), |
| + info_->shared_info()->DebugName()->ToCString().get()); |
| + return NoChange(); |
| + } |
| + |
| if (!Compiler::EnsureDeoptimizationSupport(&info)) { |
| TRACE("Not inlining %s into %s because deoptimization support failed\n", |
| function->shared()->DebugName()->ToCString().get(), |
| @@ -402,17 +413,8 @@ Reduction JSInliner::ReduceJSCallFunction(Node* node, |
| Node* end = visitor.GetCopy(graph.end()); |
| Node* frame_state = call.frame_state(); |
| - size_t const inlinee_formal_parameters = start->op()->ValueOutputCount() - 3; |
|
Jarin
2015/10/22 10:03:09
Now I am wondering whether we should dcheck that
Michael Starzinger
2015/10/22 10:35:41
Done.
|
| // Insert argument adaptor frame if required. |
| - if (call.formal_arguments() != inlinee_formal_parameters) { |
| - // In strong mode, in case of too few arguments we need to throw a |
| - // TypeError so we must not inline this call. |
| - // TODO(jarin) This check should be moved before the decision point |
| - // above so that we do not compile the function uselessly. |
| - if (is_strong(info.language_mode()) && |
| - call.formal_arguments() < inlinee_formal_parameters) { |
| - return NoChange(); |
| - } |
| + if (call.formal_arguments() != parameter_count) { |
| frame_state = CreateArgumentsAdaptorFrameState(&call, info.shared_info(), |
| info.zone()); |
| } |