| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
| 6 | 6 |
| 7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
| 8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
| 9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
| 10 #include "src/scopes.h" | 10 #include "src/scopes.h" |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 } \ | 531 } \ |
| 532 } while (false) | 532 } while (false) |
| 533 | 533 |
| 534 | 534 |
| 535 void CodeGenerator::AssembleDeconstructActivationRecord() { | 535 void CodeGenerator::AssembleDeconstructActivationRecord() { |
| 536 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 536 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
| 537 int stack_slots = frame()->GetSpillSlotCount(); | 537 int stack_slots = frame()->GetSpillSlotCount(); |
| 538 if (descriptor->IsJSFunctionCall() || stack_slots > 0) { | 538 if (descriptor->IsJSFunctionCall() || stack_slots > 0) { |
| 539 __ movq(rsp, rbp); | 539 __ movq(rsp, rbp); |
| 540 __ popq(rbp); | 540 __ popq(rbp); |
| 541 int32_t bytes_to_pop = | |
| 542 descriptor->IsJSFunctionCall() | |
| 543 ? static_cast<int32_t>(descriptor->JSParameterCount() * | |
| 544 kPointerSize) | |
| 545 : 0; | |
| 546 __ popq(Operand(rsp, bytes_to_pop)); | |
| 547 __ addq(rsp, Immediate(bytes_to_pop)); | |
| 548 } | 541 } |
| 549 } | 542 } |
| 550 | 543 |
| 551 | 544 |
| 552 // Assembles an instruction after register allocation, producing machine code. | 545 // Assembles an instruction after register allocation, producing machine code. |
| 553 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { | 546 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
| 554 X64OperandConverter i(this, instr); | 547 X64OperandConverter i(this, instr); |
| 555 | 548 |
| 556 switch (ArchOpcodeField::decode(instr->opcode())) { | 549 switch (ArchOpcodeField::decode(instr->opcode())) { |
| 557 case kArchCallCodeObject: { | 550 case kArchCallCodeObject: { |
| (...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1571 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { | 1564 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { |
| 1572 // Canonicalize JSFunction return sites for now. | 1565 // Canonicalize JSFunction return sites for now. |
| 1573 if (return_label_.is_bound()) { | 1566 if (return_label_.is_bound()) { |
| 1574 __ jmp(&return_label_); | 1567 __ jmp(&return_label_); |
| 1575 } else { | 1568 } else { |
| 1576 __ bind(&return_label_); | 1569 __ bind(&return_label_); |
| 1577 __ movq(rsp, rbp); // Move stack pointer back to frame pointer. | 1570 __ movq(rsp, rbp); // Move stack pointer back to frame pointer. |
| 1578 __ popq(rbp); // Pop caller's frame pointer. | 1571 __ popq(rbp); // Pop caller's frame pointer. |
| 1579 int pop_count = descriptor->IsJSFunctionCall() | 1572 int pop_count = descriptor->IsJSFunctionCall() |
| 1580 ? static_cast<int>(descriptor->JSParameterCount()) | 1573 ? static_cast<int>(descriptor->JSParameterCount()) |
| 1581 : 0; | 1574 : (info()->IsStub() |
| 1582 __ Ret(pop_count * kPointerSize, rbx); | 1575 ? info()->code_stub()->GetStackParameterCount() |
| 1576 : 0); |
| 1577 if (pop_count == 0) { |
| 1578 __ Ret(); |
| 1579 } else { |
| 1580 __ Ret(pop_count * kPointerSize, rbx); |
| 1581 } |
| 1583 } | 1582 } |
| 1584 } else { | 1583 } else { |
| 1585 __ ret(0); | 1584 __ Ret(); |
| 1586 } | 1585 } |
| 1587 } | 1586 } |
| 1588 | 1587 |
| 1589 | 1588 |
| 1590 void CodeGenerator::AssembleMove(InstructionOperand* source, | 1589 void CodeGenerator::AssembleMove(InstructionOperand* source, |
| 1591 InstructionOperand* destination) { | 1590 InstructionOperand* destination) { |
| 1592 X64OperandConverter g(this, NULL); | 1591 X64OperandConverter g(this, NULL); |
| 1593 // Dispatch on the source and destination operand kinds. Not all | 1592 // Dispatch on the source and destination operand kinds. Not all |
| 1594 // combinations are possible. | 1593 // combinations are possible. |
| 1595 if (source->IsRegister()) { | 1594 if (source->IsRegister()) { |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1774 __ Nop(padding_size); | 1773 __ Nop(padding_size); |
| 1775 } | 1774 } |
| 1776 } | 1775 } |
| 1777 } | 1776 } |
| 1778 | 1777 |
| 1779 #undef __ | 1778 #undef __ |
| 1780 | 1779 |
| 1781 } // namespace internal | 1780 } // namespace internal |
| 1782 } // namespace compiler | 1781 } // namespace compiler |
| 1783 } // namespace v8 | 1782 } // namespace v8 |
| OLD | NEW |