Chromium Code Reviews| Index: src/compiler/code-generator.cc |
| diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc |
| index b091a5ceb8ffda5c142c7784197ac1e1cc2086f4..b68c83f3457f1675ec1f169cf5c0f22fe5450077 100644 |
| --- a/src/compiler/code-generator.cc |
| +++ b/src/compiler/code-generator.cc |
| @@ -56,12 +56,8 @@ CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage, |
| for (int i = 0; i < code->InstructionBlockCount(); ++i) { |
| new (&labels_[i]) Label; |
| } |
| - if (code->ContainsCall()) { |
| - frame->MarkNeedsFrame(); |
| - } |
| } |
| - |
| Handle<Code> CodeGenerator::GenerateCode() { |
| CompilationInfo* info = this->info(); |
| @@ -80,7 +76,6 @@ Handle<Code> CodeGenerator::GenerateCode() { |
| } |
| // Architecture-specific, linkage-specific prologue. |
| info->set_prologue_offset(masm()->pc_offset()); |
| - AssemblePrologue(); |
| if (linkage()->GetIncomingDescriptor()->InitializeRootRegister()) { |
| masm()->InitializeRootRegister(); |
| } |
| @@ -104,6 +99,9 @@ Handle<Code> CodeGenerator::GenerateCode() { |
| } |
| } |
| + // Finish the Frame |
| + frame()->AlignFrame(kFrameAlignmentInBytes); |
| + AssembleSetupStackPointer(); |
| // Assemble all non-deferred blocks, followed by deferred ones. |
| for (int deferred = 0; deferred < 2; ++deferred) { |
| for (const InstructionBlock* block : code()->instruction_blocks()) { |
| @@ -143,9 +141,23 @@ Handle<Code> CodeGenerator::GenerateCode() { |
| SNPrintF(buffer, " --"); |
| masm()->RecordComment(buffer_start); |
| } |
| + |
| + frame_access_state()->MarkHasFrame(block->needs_frame()); |
| + |
| masm()->bind(GetLabel(current_block_)); |
| + if (block->must_construct_frame()) { |
| + AssemblePrologue(); |
|
Benedikt Meurer
2016/03/30 04:00:25
Maybe we should rename AssemblePrologue to Assembl
Mircea Trofin
2016/03/30 04:13:27
I want to do that, but together with separating fr
Benedikt Meurer
2016/03/30 04:34:08
Acknowledged.
|
| + } |
| + |
| for (int i = block->code_start(); i < block->code_end(); ++i) { |
| - AssembleInstruction(code()->InstructionAt(i)); |
| + Instruction* instr = code()->InstructionAt(i); |
|
Benedikt Meurer
2016/03/30 04:00:25
Please put all of this into AssembleInstruction be
Mircea Trofin
2016/03/30 04:13:27
We need the operands involved in the gap to be emi
Benedikt Meurer
2016/03/30 04:34:08
Sure, but that can all be done inside AssembleInst
Mircea Trofin
2016/03/30 05:58:20
Done.
|
| + AssembleGaps(instr); |
| + if (block->must_deconstruct_frame() && |
|
Benedikt Meurer
2016/03/30 04:00:25
This condition looks unnecessarily complex. Isn't
Mircea Trofin
2016/03/30 04:13:27
That's true for ret, and I plan to address that se
Benedikt Meurer
2016/03/30 04:34:08
Acknowledged.
|
| + i == block->last_instruction_index() && !instr->IsRet()) { |
| + DCHECK(instr->IsJump()); |
| + AssembleDeconstructFrame(); |
| + } |
| + AssembleInstruction(instr); |
| } |
| } |
| } |
| @@ -290,9 +302,7 @@ bool CodeGenerator::IsMaterializableFromRoot( |
| return false; |
| } |
| - |
| void CodeGenerator::AssembleInstruction(Instruction* instr) { |
| - AssembleGaps(instr); |
| AssembleSourcePosition(instr); |
| // Assemble architecture-specific code for the instruction. |
| AssembleArchInstruction(instr); |
| @@ -761,19 +771,16 @@ DeoptimizationExit* CodeGenerator::AddDeoptimizationExit( |
| } |
| int CodeGenerator::TailCallFrameStackSlotDelta(int stack_param_delta) { |
| - CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
| - int spill_slots = frame()->GetSpillSlotCount(); |
| - bool has_frame = descriptor->IsJSFunctionCall() || spill_slots > 0; |
| // Leave the PC on the stack on platforms that have that as part of their ABI |
| int pc_slots = V8_TARGET_ARCH_STORES_RETURN_ADDRESS_ON_STACK ? 1 : 0; |
| - int sp_slot_delta = |
| - has_frame ? (frame()->GetTotalFrameSlotCount() - pc_slots) : 0; |
| + int sp_slot_delta = frame_access_state()->has_frame() |
| + ? (frame()->GetTotalFrameSlotCount() - pc_slots) |
| + : 0; |
| // Discard only slots that won't be used by new parameters. |
| sp_slot_delta += stack_param_delta; |
| return sp_slot_delta; |
| } |
| - |
| OutOfLineCode::OutOfLineCode(CodeGenerator* gen) |
| : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { |
| gen->ools_ = this; |