Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(720)

Side by Side Diff: src/compiler/x87/code-generator-x87.cc

Issue 1263033004: [turbofan] Various fixes to allow unboxed doubles as arguments in registers and on the stack. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/x64/code-generator-x64.cc ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 20 matching lines...) Expand all
31 Immediate InputImmediate(size_t index) { 31 Immediate InputImmediate(size_t index) {
32 return ToImmediate(instr_->InputAt(index)); 32 return ToImmediate(instr_->InputAt(index));
33 } 33 }
34 34
35 Operand OutputOperand() { return ToOperand(instr_->Output()); } 35 Operand OutputOperand() { return ToOperand(instr_->Output()); }
36 36
37 Operand ToOperand(InstructionOperand* op, int extra = 0) { 37 Operand ToOperand(InstructionOperand* op, int extra = 0) {
38 if (op->IsRegister()) { 38 if (op->IsRegister()) {
39 DCHECK(extra == 0); 39 DCHECK(extra == 0);
40 return Operand(ToRegister(op)); 40 return Operand(ToRegister(op));
41 } else if (op->IsDoubleRegister()) {
42 DCHECK(extra == 0);
43 UNIMPLEMENTED();
44 } 41 }
45 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); 42 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot());
46 // The linkage computes where all spill slots are located. 43 FrameOffset offset =
47 FrameOffset offset = linkage()->GetFrameOffset( 44 linkage()->GetFrameOffset(AllocatedOperand::cast(op)->index(), frame());
48 AllocatedOperand::cast(op)->index(), frame(), extra); 45 return Operand(offset.from_stack_pointer() ? esp : ebp,
49 return Operand(offset.from_stack_pointer() ? esp : ebp, offset.offset()); 46 offset.offset() + extra);
50 } 47 }
51 48
52 Operand HighOperand(InstructionOperand* op) { 49 Operand HighOperand(InstructionOperand* op) {
53 DCHECK(op->IsDoubleStackSlot()); 50 DCHECK(op->IsDoubleStackSlot());
54 return ToOperand(op, kPointerSize); 51 return ToOperand(op, kPointerSize);
55 } 52 }
56 53
57 Immediate ToImmediate(InstructionOperand* operand) { 54 Immediate ToImmediate(InstructionOperand* operand) {
58 Constant constant = ToConstant(operand); 55 Constant constant = ToConstant(operand);
59 switch (constant.type()) { 56 switch (constant.type()) {
(...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after
1561 1558
1562 // Initailize FPU state. 1559 // Initailize FPU state.
1563 __ fninit(); 1560 __ fninit();
1564 __ fld1(); 1561 __ fld1();
1565 } 1562 }
1566 1563
1567 1564
1568 void CodeGenerator::AssembleReturn() { 1565 void CodeGenerator::AssembleReturn() {
1569 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 1566 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
1570 int stack_slots = frame()->GetSpillSlotCount(); 1567 int stack_slots = frame()->GetSpillSlotCount();
1568 int pop_count = static_cast<int>(descriptor->StackParameterCount());
1571 if (descriptor->kind() == CallDescriptor::kCallAddress) { 1569 if (descriptor->kind() == CallDescriptor::kCallAddress) {
1572 const RegList saves = descriptor->CalleeSavedRegisters(); 1570 const RegList saves = descriptor->CalleeSavedRegisters();
1573 if (frame()->GetRegisterSaveAreaSize() > 0) { 1571 if (frame()->GetRegisterSaveAreaSize() > 0) {
1574 // Remove this frame's spill slots first. 1572 // Remove this frame's spill slots first.
1575 if (stack_slots > 0) { 1573 if (stack_slots > 0) {
1576 __ add(esp, Immediate(stack_slots * kPointerSize)); 1574 __ add(esp, Immediate(stack_slots * kPointerSize));
1577 } 1575 }
1578 // Restore registers. 1576 // Restore registers.
1579 if (saves != 0) { 1577 if (saves != 0) {
1580 for (int i = 0; i < Register::kNumRegisters; i++) { 1578 for (int i = 0; i < Register::kNumRegisters; i++) {
1581 if (!((1 << i) & saves)) continue; 1579 if (!((1 << i) & saves)) continue;
1582 __ pop(Register::from_code(i)); 1580 __ pop(Register::from_code(i));
1583 } 1581 }
1584 } 1582 }
1585 __ pop(ebp); // Pop caller's frame pointer. 1583 __ pop(ebp); // Pop caller's frame pointer.
1586 __ ret(0);
1587 } else { 1584 } else {
1588 // No saved registers. 1585 // No saved registers.
1589 __ mov(esp, ebp); // Move stack pointer back to frame pointer. 1586 __ mov(esp, ebp); // Move stack pointer back to frame pointer.
1590 __ pop(ebp); // Pop caller's frame pointer. 1587 __ pop(ebp); // Pop caller's frame pointer.
1591 __ ret(0);
1592 } 1588 }
1593 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { 1589 } else if (descriptor->IsJSFunctionCall() || needs_frame_) {
1594 // Canonicalize JSFunction return sites for now. 1590 // Canonicalize JSFunction return sites for now.
1595 if (return_label_.is_bound()) { 1591 if (return_label_.is_bound()) {
1596 __ jmp(&return_label_); 1592 __ jmp(&return_label_);
1593 return;
1597 } else { 1594 } else {
1598 __ bind(&return_label_); 1595 __ bind(&return_label_);
1599 __ mov(esp, ebp); // Move stack pointer back to frame pointer. 1596 __ mov(esp, ebp); // Move stack pointer back to frame pointer.
1600 __ pop(ebp); // Pop caller's frame pointer. 1597 __ pop(ebp); // Pop caller's frame pointer.
1601 int pop_count = static_cast<int>(descriptor->StackParameterCount());
1602 if (pop_count == 0) {
1603 __ ret(0);
1604 } else {
1605 __ Ret(pop_count * kPointerSize, ebx);
1606 }
1607 } 1598 }
1599 }
1600 if (pop_count == 0) {
1601 __ ret(0);
1608 } else { 1602 } else {
1609 __ ret(0); 1603 __ Ret(pop_count * kPointerSize, ebx);
1610 } 1604 }
1611 } 1605 }
1612 1606
1613 1607
1614 void CodeGenerator::AssembleMove(InstructionOperand* source, 1608 void CodeGenerator::AssembleMove(InstructionOperand* source,
1615 InstructionOperand* destination) { 1609 InstructionOperand* destination) {
1616 X87OperandConverter g(this, NULL); 1610 X87OperandConverter g(this, NULL);
1617 // Dispatch on the source and destination operand kinds. Not all 1611 // Dispatch on the source and destination operand kinds. Not all
1618 // combinations are possible. 1612 // combinations are possible.
1619 if (source->IsRegister()) { 1613 if (source->IsRegister()) {
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 __ Nop(padding_size); 1834 __ Nop(padding_size);
1841 } 1835 }
1842 } 1836 }
1843 } 1837 }
1844 1838
1845 #undef __ 1839 #undef __
1846 1840
1847 } // namespace compiler 1841 } // namespace compiler
1848 } // namespace internal 1842 } // namespace internal
1849 } // namespace v8 1843 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/x64/code-generator-x64.cc ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698