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

Side by Side Diff: src/compiler/ia32/code-generator-ia32.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/frame.h ('k') | src/compiler/linkage.h » ('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/ia32/assembler-ia32.h" 10 #include "src/ia32/assembler-ia32.h"
(...skipping 28 matching lines...) Expand all
39 39
40 Operand ToOperand(InstructionOperand* op, int extra = 0) { 40 Operand ToOperand(InstructionOperand* op, int extra = 0) {
41 if (op->IsRegister()) { 41 if (op->IsRegister()) {
42 DCHECK(extra == 0); 42 DCHECK(extra == 0);
43 return Operand(ToRegister(op)); 43 return Operand(ToRegister(op));
44 } else if (op->IsDoubleRegister()) { 44 } else if (op->IsDoubleRegister()) {
45 DCHECK(extra == 0); 45 DCHECK(extra == 0);
46 return Operand(ToDoubleRegister(op)); 46 return Operand(ToDoubleRegister(op));
47 } 47 }
48 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); 48 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot());
49 // The linkage computes where all spill slots are located. 49 FrameOffset offset =
50 FrameOffset offset = linkage()->GetFrameOffset( 50 linkage()->GetFrameOffset(AllocatedOperand::cast(op)->index(), frame());
51 AllocatedOperand::cast(op)->index(), frame(), extra); 51 return Operand(offset.from_stack_pointer() ? esp : ebp,
52 return Operand(offset.from_stack_pointer() ? esp : ebp, offset.offset()); 52 offset.offset() + extra);
53 } 53 }
54 54
55 Operand HighOperand(InstructionOperand* op) { 55 Operand HighOperand(InstructionOperand* op) {
56 DCHECK(op->IsDoubleStackSlot()); 56 DCHECK(op->IsDoubleStackSlot());
57 return ToOperand(op, kPointerSize); 57 return ToOperand(op, kPointerSize);
58 } 58 }
59 59
60 Immediate ToImmediate(InstructionOperand* operand) { 60 Immediate ToImmediate(InstructionOperand* operand) {
61 Constant constant = ToConstant(operand); 61 Constant constant = ToConstant(operand);
62 switch (constant.type()) { 62 switch (constant.type()) {
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 __ add(esp, Immediate(stack_slots * kPointerSize)); 1318 __ add(esp, Immediate(stack_slots * kPointerSize));
1319 } 1319 }
1320 // Restore registers. 1320 // Restore registers.
1321 if (saves != 0) { 1321 if (saves != 0) {
1322 for (int i = 0; i < Register::kNumRegisters; i++) { 1322 for (int i = 0; i < Register::kNumRegisters; i++) {
1323 if (!((1 << i) & saves)) continue; 1323 if (!((1 << i) & saves)) continue;
1324 __ pop(Register::from_code(i)); 1324 __ pop(Register::from_code(i));
1325 } 1325 }
1326 } 1326 }
1327 __ pop(ebp); // Pop caller's frame pointer. 1327 __ pop(ebp); // Pop caller's frame pointer.
1328 __ ret(0);
1329 } else { 1328 } else {
1330 // No saved registers. 1329 // No saved registers.
1331 __ mov(esp, ebp); // Move stack pointer back to frame pointer. 1330 __ mov(esp, ebp); // Move stack pointer back to frame pointer.
1332 __ pop(ebp); // Pop caller's frame pointer. 1331 __ pop(ebp); // Pop caller's frame pointer.
1333 __ ret(0);
1334 } 1332 }
1335 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { 1333 } else if (descriptor->IsJSFunctionCall() || needs_frame_) {
1336 // Canonicalize JSFunction return sites for now. 1334 // Canonicalize JSFunction return sites for now.
1337 if (return_label_.is_bound()) { 1335 if (return_label_.is_bound()) {
1338 __ jmp(&return_label_); 1336 __ jmp(&return_label_);
1337 return;
1339 } else { 1338 } else {
1340 __ bind(&return_label_); 1339 __ bind(&return_label_);
1341 __ mov(esp, ebp); // Move stack pointer back to frame pointer. 1340 __ mov(esp, ebp); // Move stack pointer back to frame pointer.
1342 __ pop(ebp); // Pop caller's frame pointer. 1341 __ pop(ebp); // Pop caller's frame pointer.
1343 int pop_count = static_cast<int>(descriptor->StackParameterCount());
1344 if (pop_count == 0) {
1345 __ ret(0);
1346 } else {
1347 __ Ret(pop_count * kPointerSize, ebx);
1348 }
1349 } 1342 }
1350 } else {
1351 __ ret(0);
1352 } 1343 }
1344 size_t pop_size = descriptor->StackParameterCount() * kPointerSize;
1345 // Might need ecx for scratch if pop_size is too big.
1346 DCHECK_EQ(0, descriptor->CalleeSavedRegisters() & ecx.bit());
1347 __ Ret(static_cast<int>(pop_size), ecx);
1353 } 1348 }
1354 1349
1355 1350
1356 void CodeGenerator::AssembleMove(InstructionOperand* source, 1351 void CodeGenerator::AssembleMove(InstructionOperand* source,
1357 InstructionOperand* destination) { 1352 InstructionOperand* destination) {
1358 IA32OperandConverter g(this, NULL); 1353 IA32OperandConverter g(this, NULL);
1359 // Dispatch on the source and destination operand kinds. Not all 1354 // Dispatch on the source and destination operand kinds. Not all
1360 // combinations are possible. 1355 // combinations are possible.
1361 if (source->IsRegister()) { 1356 if (source->IsRegister()) {
1362 DCHECK(destination->IsRegister() || destination->IsStackSlot()); 1357 DCHECK(destination->IsRegister() || destination->IsStackSlot());
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 __ Nop(padding_size); 1533 __ Nop(padding_size);
1539 } 1534 }
1540 } 1535 }
1541 } 1536 }
1542 1537
1543 #undef __ 1538 #undef __
1544 1539
1545 } // namespace compiler 1540 } // namespace compiler
1546 } // namespace internal 1541 } // namespace internal
1547 } // namespace v8 1542 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/frame.h ('k') | src/compiler/linkage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698