Index: src/compiler/code-generator.cc |
diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc |
index 574d1ae8e939cd3127c8563b90675dbf8d641e6f..ae0e102485e15c2e27fe5f36691e8c425364132c 100644 |
--- a/src/compiler/code-generator.cc |
+++ b/src/compiler/code-generator.cc |
@@ -246,7 +246,7 @@ void CodeGenerator::AddSafepointAndDeopt(Instruction* instr) { |
// (just after the code address). |
InstructionOperandConverter converter(this, instr); |
// Deoptimization info starts at argument 1 |
- int frame_state_offset = 1; |
+ size_t frame_state_offset = 1; |
FrameStateDescriptor* descriptor = |
GetFrameStateDescriptor(instr, frame_state_offset); |
int pc_offset = masm()->pc_offset(); |
@@ -266,7 +266,7 @@ void CodeGenerator::AddSafepointAndDeopt(Instruction* instr) { |
// Make sure all the values live in stack slots or they are immediates. |
// (The values should not live in register because registers are clobbered |
// by calls.) |
- for (int i = 0; i < descriptor->size(); i++) { |
+ for (size_t i = 0; i < descriptor->size(); i++) { |
InstructionOperand* op = instr->InputAt(frame_state_offset + 1 + i); |
CHECK(op->IsStackSlot() || op->IsImmediate()); |
} |
@@ -287,40 +287,48 @@ int CodeGenerator::DefineDeoptimizationLiteral(Handle<Object> literal) { |
FrameStateDescriptor* CodeGenerator::GetFrameStateDescriptor( |
- Instruction* instr, int frame_state_offset) { |
+ Instruction* instr, size_t frame_state_offset) { |
InstructionOperandConverter i(this, instr); |
- InstructionSequence::StateId state_id = |
- InstructionSequence::StateId::FromInt(i.InputInt32(frame_state_offset)); |
+ InstructionSequence::StateId state_id = InstructionSequence::StateId::FromInt( |
+ i.InputInt32(static_cast<int>(frame_state_offset))); |
return code()->GetFrameStateDescriptor(state_id); |
} |
void CodeGenerator::BuildTranslationForFrameStateDescriptor( |
FrameStateDescriptor* descriptor, Instruction* instr, |
- Translation* translation, int frame_state_offset, |
+ Translation* translation, size_t 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(), kIgnoreOutput); |
+ BuildTranslationForFrameStateDescriptor(descriptor->outer_state(), instr, |
+ translation, frame_state_offset, |
+ kIgnoreOutput); |
} |
- int height = descriptor->size() - descriptor->parameters_count(); |
- switch (state_combine) { |
- case kPushOutput: |
- height++; |
+ int id = Translation::kSelfLiteralId; |
+ if (!descriptor->jsfunction().is_null()) { |
+ id = DefineDeoptimizationLiteral( |
+ Handle<Object>::cast(descriptor->jsfunction().ToHandleChecked())); |
+ } |
+ |
+ switch (descriptor->type()) { |
+ case JS_FRAME: |
+ translation->BeginJSFrame( |
+ descriptor->bailout_id(), id, |
+ static_cast<unsigned int>(descriptor->GetHeight(state_combine))); |
break; |
- case kIgnoreOutput: |
+ case ARGUMENTS_ADAPTOR: |
+ translation->BeginArgumentsAdaptorFrame( |
+ id, static_cast<unsigned int>(descriptor->parameters_count())); |
break; |
} |
- translation->BeginJSFrame(descriptor->bailout_id(), |
- Translation::kSelfLiteralId, height); |
- |
- for (int i = 0; i < descriptor->size(); i++) { |
- AddTranslationForOperand(translation, instr, |
- instr->InputAt(i + frame_state_offset)); |
+ frame_state_offset += descriptor->outer_state()->GetTotalSize(); |
+ for (size_t i = 0; i < descriptor->size(); i++) { |
+ AddTranslationForOperand( |
+ translation, instr, |
+ instr->InputAt(static_cast<int>(frame_state_offset + i))); |
} |
switch (state_combine) { |
@@ -335,14 +343,15 @@ void CodeGenerator::BuildTranslationForFrameStateDescriptor( |
int CodeGenerator::BuildTranslation(Instruction* instr, int pc_offset, |
- int frame_state_offset, |
+ size_t 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()); |
+ Translation translation( |
+ &translations_, static_cast<int>(descriptor->GetFrameCount()), |
+ static_cast<int>(descriptor->GetJSFrameCount()), zone()); |
BuildTranslationForFrameStateDescriptor(descriptor, instr, &translation, |
frame_state_offset, state_combine); |