| Index: src/compiler/x64/code-generator-x64.cc
|
| diff --git a/src/compiler/x64/code-generator-x64.cc b/src/compiler/x64/code-generator-x64.cc
|
| index 782dba9fc4d228d163544db25d4f817434413123..2bcb6edc13b379d833cfd05b8dac8199d3d246fc 100644
|
| --- a/src/compiler/x64/code-generator-x64.cc
|
| +++ b/src/compiler/x64/code-generator-x64.cc
|
| @@ -607,8 +607,6 @@ void CodeGenerator::AssembleDeconstructFrame() {
|
| __ popq(rbp);
|
| }
|
|
|
| -void CodeGenerator::AssembleSetupStackPointer() {}
|
| -
|
| void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) {
|
| int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta);
|
| if (sp_slot_delta > 0) {
|
| @@ -1932,8 +1930,36 @@ static const int kQuadWordSize = 16;
|
|
|
| } // namespace
|
|
|
| +void CodeGenerator::FinishFrame(Frame* frame) {
|
| + CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
|
| + int stack_shrink_slots = frame->GetSpillSlotCount();
|
| + if (info()->is_osr()) {
|
| + stack_shrink_slots -=
|
| + static_cast<int>(OsrHelper(info()).UnoptimizedFrameSlots());
|
| + }
|
| + const RegList saves_fp = descriptor->CalleeSavedFPRegisters();
|
| + if (saves_fp != 0) {
|
| + stack_shrink_slots += frame->AlignSavedCalleeRegisterSlots();
|
| + if (saves_fp != 0) { // Save callee-saved XMM registers.
|
| + const uint32_t saves_fp_count = base::bits::CountPopulation32(saves_fp);
|
| + frame->AllocateSavedCalleeRegisterSlots(saves_fp_count *
|
| + (kQuadWordSize / kPointerSize));
|
| + }
|
| + }
|
| + const RegList saves = descriptor->CalleeSavedRegisters();
|
| + if (saves != 0) { // Save callee-saved registers.
|
| + int count = 0;
|
| + for (int i = Register::kNumRegisters - 1; i >= 0; i--) {
|
| + if (((1 << i) & saves)) {
|
| + ++count;
|
| + }
|
| + }
|
| + frame->AllocateSavedCalleeRegisterSlots(count);
|
| + }
|
| + frame->set_stack_shrink_slots(stack_shrink_slots);
|
| +}
|
|
|
| -void CodeGenerator::AssemblePrologue() {
|
| +void CodeGenerator::AssembleConstructFrame() {
|
| CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
|
| if (frame_access_state()->has_frame()) {
|
| if (descriptor->IsCFunctionCall()) {
|
| @@ -1945,7 +1971,6 @@ void CodeGenerator::AssemblePrologue() {
|
| __ StubPrologue(info()->GetOutputStackFrameType());
|
| }
|
| }
|
| - int stack_shrink_slots = frame()->GetSpillSlotCount();
|
| if (info()->is_osr()) {
|
| // TurboFan OSR-compiled functions cannot be entered directly.
|
| __ Abort(kShouldNotDirectlyEnterOsrFunction);
|
| @@ -1956,16 +1981,11 @@ void CodeGenerator::AssemblePrologue() {
|
| // remaining stack slots.
|
| if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
|
| osr_pc_offset_ = __ pc_offset();
|
| - stack_shrink_slots -=
|
| - static_cast<int>(OsrHelper(info()).UnoptimizedFrameSlots());
|
| }
|
|
|
| const RegList saves_fp = descriptor->CalleeSavedFPRegisters();
|
| - if (saves_fp != 0) {
|
| - stack_shrink_slots += frame()->AlignSavedCalleeRegisterSlots();
|
| - }
|
| - if (stack_shrink_slots > 0) {
|
| - __ subq(rsp, Immediate(stack_shrink_slots * kPointerSize));
|
| + if (frame()->stack_shrink_slots() > 0) {
|
| + __ subq(rsp, Immediate(frame()->stack_shrink_slots() * kPointerSize));
|
| }
|
|
|
| if (saves_fp != 0) { // Save callee-saved XMM registers.
|
| @@ -1981,8 +2001,6 @@ void CodeGenerator::AssemblePrologue() {
|
| XMMRegister::from_code(i));
|
| slot_idx++;
|
| }
|
| - frame()->AllocateSavedCalleeRegisterSlots(saves_fp_count *
|
| - (kQuadWordSize / kPointerSize));
|
| }
|
|
|
| const RegList saves = descriptor->CalleeSavedRegisters();
|
| @@ -1990,7 +2008,6 @@ void CodeGenerator::AssemblePrologue() {
|
| for (int i = Register::kNumRegisters - 1; i >= 0; i--) {
|
| if (!((1 << i) & saves)) continue;
|
| __ pushq(Register::from_code(i));
|
| - frame()->AllocateSavedCalleeRegisterSlots(1);
|
| }
|
| }
|
| }
|
|
|