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

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

Issue 1284853002: Revert of [turbofan] Various fixes to allow unboxed doubles as arguments in registers... (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();
41 } 44 }
42 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); 45 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot());
43 FrameOffset offset = 46 // The linkage computes where all spill slots are located.
44 linkage()->GetFrameOffset(AllocatedOperand::cast(op)->index(), frame()); 47 FrameOffset offset = linkage()->GetFrameOffset(
45 return Operand(offset.from_stack_pointer() ? esp : ebp, 48 AllocatedOperand::cast(op)->index(), frame(), extra);
46 offset.offset() + extra); 49 return Operand(offset.from_stack_pointer() ? esp : ebp, offset.offset());
47 } 50 }
48 51
49 Operand HighOperand(InstructionOperand* op) { 52 Operand HighOperand(InstructionOperand* op) {
50 DCHECK(op->IsDoubleStackSlot()); 53 DCHECK(op->IsDoubleStackSlot());
51 return ToOperand(op, kPointerSize); 54 return ToOperand(op, kPointerSize);
52 } 55 }
53 56
54 Immediate ToImmediate(InstructionOperand* operand) { 57 Immediate ToImmediate(InstructionOperand* operand) {
55 Constant constant = ToConstant(operand); 58 Constant constant = ToConstant(operand);
56 switch (constant.type()) { 59 switch (constant.type()) {
(...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 1561
1559 // Initailize FPU state. 1562 // Initailize FPU state.
1560 __ fninit(); 1563 __ fninit();
1561 __ fld1(); 1564 __ fld1();
1562 } 1565 }
1563 1566
1564 1567
1565 void CodeGenerator::AssembleReturn() { 1568 void CodeGenerator::AssembleReturn() {
1566 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 1569 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
1567 int stack_slots = frame()->GetSpillSlotCount(); 1570 int stack_slots = frame()->GetSpillSlotCount();
1568 int pop_count = static_cast<int>(descriptor->StackParameterCount());
1569 if (descriptor->kind() == CallDescriptor::kCallAddress) { 1571 if (descriptor->kind() == CallDescriptor::kCallAddress) {
1570 const RegList saves = descriptor->CalleeSavedRegisters(); 1572 const RegList saves = descriptor->CalleeSavedRegisters();
1571 if (frame()->GetRegisterSaveAreaSize() > 0) { 1573 if (frame()->GetRegisterSaveAreaSize() > 0) {
1572 // Remove this frame's spill slots first. 1574 // Remove this frame's spill slots first.
1573 if (stack_slots > 0) { 1575 if (stack_slots > 0) {
1574 __ add(esp, Immediate(stack_slots * kPointerSize)); 1576 __ add(esp, Immediate(stack_slots * kPointerSize));
1575 } 1577 }
1576 // Restore registers. 1578 // Restore registers.
1577 if (saves != 0) { 1579 if (saves != 0) {
1578 for (int i = 0; i < Register::kNumRegisters; i++) { 1580 for (int i = 0; i < Register::kNumRegisters; i++) {
1579 if (!((1 << i) & saves)) continue; 1581 if (!((1 << i) & saves)) continue;
1580 __ pop(Register::from_code(i)); 1582 __ pop(Register::from_code(i));
1581 } 1583 }
1582 } 1584 }
1583 __ pop(ebp); // Pop caller's frame pointer. 1585 __ pop(ebp); // Pop caller's frame pointer.
1586 __ ret(0);
1584 } else { 1587 } else {
1585 // No saved registers. 1588 // No saved registers.
1586 __ mov(esp, ebp); // Move stack pointer back to frame pointer. 1589 __ mov(esp, ebp); // Move stack pointer back to frame pointer.
1587 __ pop(ebp); // Pop caller's frame pointer. 1590 __ pop(ebp); // Pop caller's frame pointer.
1591 __ ret(0);
1588 } 1592 }
1589 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { 1593 } else if (descriptor->IsJSFunctionCall() || needs_frame_) {
1590 // Canonicalize JSFunction return sites for now. 1594 // Canonicalize JSFunction return sites for now.
1591 if (return_label_.is_bound()) { 1595 if (return_label_.is_bound()) {
1592 __ jmp(&return_label_); 1596 __ jmp(&return_label_);
1593 return;
1594 } else { 1597 } else {
1595 __ bind(&return_label_); 1598 __ bind(&return_label_);
1596 __ mov(esp, ebp); // Move stack pointer back to frame pointer. 1599 __ mov(esp, ebp); // Move stack pointer back to frame pointer.
1597 __ pop(ebp); // Pop caller's frame pointer. 1600 __ 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 }
1598 } 1607 }
1599 } 1608 } else {
1600 if (pop_count == 0) {
1601 __ ret(0); 1609 __ ret(0);
1602 } else {
1603 __ Ret(pop_count * kPointerSize, ebx);
1604 } 1610 }
1605 } 1611 }
1606 1612
1607 1613
1608 void CodeGenerator::AssembleMove(InstructionOperand* source, 1614 void CodeGenerator::AssembleMove(InstructionOperand* source,
1609 InstructionOperand* destination) { 1615 InstructionOperand* destination) {
1610 X87OperandConverter g(this, NULL); 1616 X87OperandConverter g(this, NULL);
1611 // Dispatch on the source and destination operand kinds. Not all 1617 // Dispatch on the source and destination operand kinds. Not all
1612 // combinations are possible. 1618 // combinations are possible.
1613 if (source->IsRegister()) { 1619 if (source->IsRegister()) {
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1834 __ Nop(padding_size); 1840 __ Nop(padding_size);
1835 } 1841 }
1836 } 1842 }
1837 } 1843 }
1838 1844
1839 #undef __ 1845 #undef __
1840 1846
1841 } // namespace compiler 1847 } // namespace compiler
1842 } // namespace internal 1848 } // namespace internal
1843 } // namespace v8 1849 } // 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