| Index: src/compiler/js-call-reducer.cc
|
| diff --git a/src/compiler/js-call-reducer.cc b/src/compiler/js-call-reducer.cc
|
| index 22acbc66489e15f7402f6e2c77029b4dfaa6e68c..376ab113fed4d228c1a4aeb4d5f1fa2814db7698 100644
|
| --- a/src/compiler/js-call-reducer.cc
|
| +++ b/src/compiler/js-call-reducer.cc
|
| @@ -129,8 +129,7 @@ Reduction JSCallReducer::ReduceFunctionPrototypeApply(Node* node) {
|
| // Get to the actual frame state from which to extract the arguments;
|
| // we can only optimize this in case the {node} was already inlined into
|
| // some other function (and same for the {arg_array}).
|
| - CreateArgumentsParameters const& p =
|
| - CreateArgumentsParametersOf(arg_array->op());
|
| + CreateArgumentsType type = CreateArgumentsTypeOf(arg_array->op());
|
| Node* frame_state = NodeProperties::GetFrameStateInput(arg_array, 0);
|
| Node* outer_state = frame_state->InputAt(kFrameStateOuterStateInput);
|
| if (outer_state->opcode() != IrOpcode::kFrameState) return NoChange();
|
| @@ -140,17 +139,22 @@ Reduction JSCallReducer::ReduceFunctionPrototypeApply(Node* node) {
|
| frame_state = outer_state;
|
| }
|
| FrameStateInfo state_info = OpParameter<FrameStateInfo>(frame_state);
|
| - if (p.type() == CreateArgumentsParameters::kMappedArguments) {
|
| + int start_index = 0;
|
| + if (type == CreateArgumentsType::kMappedArguments) {
|
| // Mapped arguments (sloppy mode) cannot be handled if they are aliased.
|
| Handle<SharedFunctionInfo> shared;
|
| if (!state_info.shared_info().ToHandle(&shared)) return NoChange();
|
| if (shared->internal_formal_parameter_count() != 0) return NoChange();
|
| + } else if (type == CreateArgumentsType::kRestParameter) {
|
| + Handle<SharedFunctionInfo> shared;
|
| + if (!state_info.shared_info().ToHandle(&shared)) return NoChange();
|
| + start_index = shared->internal_formal_parameter_count();
|
| }
|
| // Remove the argArray input from the {node}.
|
| node->RemoveInput(static_cast<int>(--arity));
|
| // Add the actual parameters to the {node}, skipping the receiver.
|
| Node* const parameters = frame_state->InputAt(kFrameStateParametersInput);
|
| - for (int i = p.start_index() + 1; i < state_info.parameter_count(); ++i) {
|
| + for (int i = start_index + 1; i < state_info.parameter_count(); ++i) {
|
| node->InsertInput(graph()->zone(), static_cast<int>(arity),
|
| parameters->InputAt(i));
|
| ++arity;
|
|
|