Chromium Code Reviews| Index: src/compiler/code-generator.cc |
| diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc |
| index f85168e155669025594260f9f68501af87b5d618..0d803a35bdebabc4a0c5277564c486a36c02f1ab 100644 |
| --- a/src/compiler/code-generator.cc |
| +++ b/src/compiler/code-generator.cc |
| @@ -301,11 +301,17 @@ FrameStateDescriptor* CodeGenerator::GetFrameStateDescriptor( |
| } |
| -int CodeGenerator::BuildTranslation(Instruction* instr, int frame_state_offset, |
| - OutputFrameStateCombine state_combine) { |
| - FrameStateDescriptor* descriptor = |
| - GetFrameStateDescriptor(instr, frame_state_offset); |
| - frame_state_offset++; |
| +void CodeGenerator::BuildTranslationForFrameStateDescriptor( |
| + FrameStateDescriptor* descriptor, Instruction* instr, |
| + Translation* translation, int frame_state_offset, |
| + OutputFrameStateCombine state_combine) { |
| + // Outer-most state must be added to translation first. |
| + if (descriptor->outer_state() != NULL) { |
| + BuildTranslationForFrameStateDescriptor( |
| + descriptor->outer_state(), instr, translation, |
| + frame_state_offset + descriptor->size(), |
| + descriptor->outer_state()->state_combine()); |
|
Jarin
2014/09/02 10:28:38
I think we will have to ignore the output for the
sigurds
2014/09/02 10:43:58
Done.
|
| + } |
| int height = descriptor->size() - descriptor->parameters_count(); |
| switch (state_combine) { |
| @@ -316,24 +322,35 @@ int CodeGenerator::BuildTranslation(Instruction* instr, int frame_state_offset, |
| break; |
| } |
| - |
| - Translation translation(&translations_, 1, 1, zone()); |
| - translation.BeginJSFrame(descriptor->bailout_id(), |
| - Translation::kSelfLiteralId, height); |
| + translation->BeginJSFrame(descriptor->bailout_id(), |
| + Translation::kSelfLiteralId, height); |
| for (int i = 0; i < descriptor->size(); i++) { |
| - AddTranslationForOperand(&translation, instr, |
| + AddTranslationForOperand(translation, instr, |
| instr->InputAt(i + frame_state_offset)); |
| } |
| switch (state_combine) { |
| case kPushOutput: |
| DCHECK(instr->OutputCount() == 1); |
| - AddTranslationForOperand(&translation, instr, instr->OutputAt(0)); |
| + AddTranslationForOperand(translation, instr, instr->OutputAt(0)); |
| break; |
| case kIgnoreOutput: |
| break; |
| } |
| +} |
| + |
| + |
| +int CodeGenerator::BuildTranslation(Instruction* instr, int frame_state_offset, |
| + OutputFrameStateCombine state_combine) { |
| + FrameStateDescriptor* descriptor = |
| + GetFrameStateDescriptor(instr, frame_state_offset); |
| + frame_state_offset++; |
| + |
| + int frame_count = descriptor->GetFrameCount(); |
| + Translation translation(&translations_, frame_count, frame_count, zone()); |
| + BuildTranslationForFrameStateDescriptor(descriptor, instr, &translation, |
| + frame_state_offset, state_combine); |
| int deoptimization_id = static_cast<int>(deoptimization_states_.size()); |