| Index: src/x64/lithium-codegen-x64.cc
|
| diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
|
| index 89e311e4614b10cfe000b417a61c3bf7515b9c85..17837fb94cab0044a89c4830c44cc1a2ccdf2780 100644
|
| --- a/src/x64/lithium-codegen-x64.cc
|
| +++ b/src/x64/lithium-codegen-x64.cc
|
| @@ -351,7 +351,9 @@ Operand LCodeGen::ToOperand(LOperand* op) const {
|
|
|
|
|
| void LCodeGen::WriteTranslation(LEnvironment* environment,
|
| - Translation* translation) {
|
| + Translation* translation,
|
| + int* args_index,
|
| + int* args_count) {
|
| if (environment == NULL) return;
|
|
|
| // The translation includes one command per value in the environment.
|
| @@ -359,7 +361,11 @@ void LCodeGen::WriteTranslation(LEnvironment* environment,
|
| // The output frame height does not include the parameters.
|
| int height = translation_size - environment->parameter_count();
|
|
|
| - WriteTranslation(environment->outer(), translation);
|
| + // Function parameters are arguments to the outermost environment.
|
| + *args_index = -environment->parameter_count();
|
| + *args_count = environment->parameter_count();
|
| +
|
| + WriteTranslation(environment->outer(), translation, args_index, args_count);
|
| int closure_id = *info()->closure() != *environment->closure()
|
| ? DefineDeoptimizationLiteral(environment->closure())
|
| : Translation::kSelfLiteralId;
|
| @@ -385,6 +391,16 @@ void LCodeGen::WriteTranslation(LEnvironment* environment,
|
| translation->BeginArgumentsAdaptorFrame(closure_id, translation_size);
|
| break;
|
| }
|
| +
|
| + // Inlined frames which push their arguments cause the index to be
|
| + // bumped and a new stack area to be used for materialization.
|
| + if (environment->entry() != NULL &&
|
| + environment->entry()->arguments_pushed()) {
|
| + bool outermost = *args_index < 0;
|
| + *args_index = outermost ? GetStackSlotCount() : *args_index + *args_count;
|
| + *args_count = environment->entry()->arguments_count() + 1;
|
| + }
|
| +
|
| for (int i = 0; i < translation_size; ++i) {
|
| LOperand* value = environment->values()->at(i);
|
| // spilled_registers_ and spilled_double_registers_ are either
|
| @@ -396,7 +412,9 @@ void LCodeGen::WriteTranslation(LEnvironment* environment,
|
| AddToTranslation(translation,
|
| environment->spilled_registers()[value->index()],
|
| environment->HasTaggedValueAt(i),
|
| - environment->HasUint32ValueAt(i));
|
| + environment->HasUint32ValueAt(i),
|
| + *args_index,
|
| + *args_count);
|
| } else if (
|
| value->IsDoubleRegister() &&
|
| environment->spilled_double_registers()[value->index()] != NULL) {
|
| @@ -405,14 +423,18 @@ void LCodeGen::WriteTranslation(LEnvironment* environment,
|
| translation,
|
| environment->spilled_double_registers()[value->index()],
|
| false,
|
| - false);
|
| + false,
|
| + *args_index,
|
| + *args_count);
|
| }
|
| }
|
|
|
| AddToTranslation(translation,
|
| value,
|
| environment->HasTaggedValueAt(i),
|
| - environment->HasUint32ValueAt(i));
|
| + environment->HasUint32ValueAt(i),
|
| + *args_index,
|
| + *args_count);
|
| }
|
| }
|
|
|
| @@ -420,12 +442,14 @@ void LCodeGen::WriteTranslation(LEnvironment* environment,
|
| void LCodeGen::AddToTranslation(Translation* translation,
|
| LOperand* op,
|
| bool is_tagged,
|
| - bool is_uint32) {
|
| + bool is_uint32,
|
| + int arguments_index,
|
| + int arguments_count) {
|
| if (op == NULL) {
|
| // TODO(twuerthinger): Introduce marker operands to indicate that this value
|
| // is not present and must be reconstructed from the deoptimizer. Currently
|
| // this is only used for the arguments object.
|
| - translation->StoreArgumentsObject();
|
| + translation->StoreArgumentsObject(arguments_index, arguments_count);
|
| } else if (op->IsStackSlot()) {
|
| if (is_tagged) {
|
| translation->StoreStackSlot(op->index());
|
| @@ -531,15 +555,16 @@ void LCodeGen::RegisterEnvironmentForDeoptimization(LEnvironment* environment,
|
|
|
| int frame_count = 0;
|
| int jsframe_count = 0;
|
| + int args_index = 0;
|
| + int args_count = 0;
|
| for (LEnvironment* e = environment; e != NULL; e = e->outer()) {
|
| ++frame_count;
|
| if (e->frame_type() == JS_FUNCTION) {
|
| ++jsframe_count;
|
| }
|
| }
|
| - Translation translation(&translations_, frame_count, jsframe_count,
|
| - environment->zone());
|
| - WriteTranslation(environment, &translation);
|
| + Translation translation(&translations_, frame_count, jsframe_count, zone());
|
| + WriteTranslation(environment, &translation, &args_index, &args_count);
|
| int deoptimization_index = deoptimizations_.length();
|
| int pc_offset = masm()->pc_offset();
|
| environment->Register(deoptimization_index,
|
|
|