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

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 14053008: Save and restore callee-save xmm registers on Win64 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Typo Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 4254 matching lines...) Expand 10 before | Expand all | Expand 10 after
4265 __ ThrowUncatchable(rax); 4265 __ ThrowUncatchable(rax);
4266 4266
4267 __ bind(&throw_normal_exception); 4267 __ bind(&throw_normal_exception);
4268 __ Throw(rax); 4268 __ Throw(rax);
4269 } 4269 }
4270 4270
4271 4271
4272 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { 4272 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
4273 Label invoke, handler_entry, exit; 4273 Label invoke, handler_entry, exit;
4274 Label not_outermost_js, not_outermost_js_2; 4274 Label not_outermost_js, not_outermost_js_2;
4275
4276 #ifdef _WIN64
4277 const int kCalleeSaveXMMRegisters = 10;
4278 const int kFullXMMRegisterSize = 16;
4279 #endif
4275 { // NOLINT. Scope block confuses linter. 4280 { // NOLINT. Scope block confuses linter.
4276 MacroAssembler::NoRootArrayScope uninitialized_root_register(masm); 4281 MacroAssembler::NoRootArrayScope uninitialized_root_register(masm);
4277 // Set up frame. 4282 // Set up frame.
4278 __ push(rbp); 4283 __ push(rbp);
4279 __ movq(rbp, rsp); 4284 __ movq(rbp, rsp);
4280 4285
4281 // Push the stack frame type marker twice. 4286 // Push the stack frame type marker twice.
4282 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; 4287 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY;
4283 // Scratch register is neither callee-save, nor an argument register on any 4288 // Scratch register is neither callee-save, nor an argument register on any
4284 // platform. It's free to use at this point. 4289 // platform. It's free to use at this point.
4285 // Cannot use smi-register for loading yet. 4290 // Cannot use smi-register for loading yet.
4286 __ movq(kScratchRegister, 4291 __ movq(kScratchRegister,
4287 reinterpret_cast<uint64_t>(Smi::FromInt(marker)), 4292 reinterpret_cast<uint64_t>(Smi::FromInt(marker)),
4288 RelocInfo::NONE64); 4293 RelocInfo::NONE64);
4289 __ push(kScratchRegister); // context slot 4294 __ push(kScratchRegister); // context slot
4290 __ push(kScratchRegister); // function slot 4295 __ push(kScratchRegister); // function slot
4291 // Save callee-saved registers (X64/Win64 calling conventions). 4296 // Save callee-saved registers (X64/Win64 calling conventions).
4292 __ push(r12); 4297 __ push(r12);
4293 __ push(r13); 4298 __ push(r13);
4294 __ push(r14); 4299 __ push(r14);
4295 __ push(r15); 4300 __ push(r15);
4296 #ifdef _WIN64 4301 #ifdef _WIN64
4297 __ push(rdi); // Only callee save in Win64 ABI, argument in AMD64 ABI. 4302 __ push(rdi); // Only callee save in Win64 ABI, argument in AMD64 ABI.
4298 __ push(rsi); // Only callee save in Win64 ABI, argument in AMD64 ABI. 4303 __ push(rsi); // Only callee save in Win64 ABI, argument in AMD64 ABI.
4299 #endif 4304 #endif
4300 __ push(rbx); 4305 __ push(rbx);
4301 // TODO(X64): On Win64, if we ever use XMM6-XMM15, the low low 64 bits are 4306
4302 // callee save as well. 4307 #ifdef _WIN64
4308 // On Win64 XMM6-XMM15 are callee-save
4309 __ subq(rsp, Immediate(kCalleeSaveXMMRegisters * kFullXMMRegisterSize);
Michael Starzinger 2013/04/17 08:26:02 nit: Indentation of the whole block is off.
4310 __ movdqu(Operand(rsp, kFullXMMRegisterSize * 0), xmm6);
4311 __ movdqu(Operand(rsp, kFullXMMRegisterSize * 1), xmm7);
4312 __ movdqu(Operand(rsp, kFullXMMRegisterSize * 2), xmm8);
4313 __ movdqu(Operand(rsp, kFullXMMRegisterSize * 3), xmm9);
4314 __ movdqu(Operand(rsp, kFullXMMRegisterSize * 4), xmm10);
4315 __ movdqu(Operand(rsp, kFullXMMRegisterSize * 5), xmm11);
4316 __ movdqu(Operand(rsp, kFullXMMRegisterSize * 6), xmm12);
4317 __ movdqu(Operand(rsp, kFullXMMRegisterSize * 7), xmm13);
4318 __ movdqu(Operand(rsp, kFullXMMRegisterSize * 8), xmm14);
4319 __ movdqu(Operand(rsp, kFullXMMRegisterSize * 9), xmm15);
4320 #endif
4303 4321
4304 // Set up the roots and smi constant registers. 4322 // Set up the roots and smi constant registers.
4305 // Needs to be done before any further smi loads. 4323 // Needs to be done before any further smi loads.
4306 __ InitializeSmiConstantRegister(); 4324 __ InitializeSmiConstantRegister();
4307 __ InitializeRootRegister(); 4325 __ InitializeRootRegister();
4308 } 4326 }
4309 4327
4310 Isolate* isolate = masm->isolate(); 4328 Isolate* isolate = masm->isolate();
4311 4329
4312 // Save copies of the top frame descriptor on the stack. 4330 // Save copies of the top frame descriptor on the stack.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
4382 __ movq(kScratchRegister, js_entry_sp); 4400 __ movq(kScratchRegister, js_entry_sp);
4383 __ movq(Operand(kScratchRegister, 0), Immediate(0)); 4401 __ movq(Operand(kScratchRegister, 0), Immediate(0));
4384 __ bind(&not_outermost_js_2); 4402 __ bind(&not_outermost_js_2);
4385 4403
4386 // Restore the top frame descriptor from the stack. 4404 // Restore the top frame descriptor from the stack.
4387 { Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp); 4405 { Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp);
4388 __ pop(c_entry_fp_operand); 4406 __ pop(c_entry_fp_operand);
4389 } 4407 }
4390 4408
4391 // Restore callee-saved registers (X64 conventions). 4409 // Restore callee-saved registers (X64 conventions).
4410 #ifdef _WIN64
4411 // On Win64 XMM6-XMM15 are callee-save
Michael Starzinger 2013/04/17 08:26:02 nit: Indentation of the comment is off.
4412 __ movdqu(xmm6, Operand(rsp, kFullXMMRegisterSize * 0));
4413 __ movdqu(xmm7, Operand(rsp, kFullXMMRegisterSize * 1));
4414 __ movdqu(xmm8, Operand(rsp, kFullXMMRegisterSize * 2));
4415 __ movdqu(xmm8, Operand(rsp, kFullXMMRegisterSize * 3));
4416 __ movdqu(xmm10, Operand(rsp, kFullXMMRegisterSize * 4));
4417 __ movdqu(xmm11, Operand(rsp, kFullXMMRegisterSize * 5));
4418 __ movdqu(xmm12, Operand(rsp, kFullXMMRegisterSize * 6));
4419 __ movdqu(xmm13, Operand(rsp, kFullXMMRegisterSize * 7));
4420 __ movdqu(xmm14, Operand(rsp, kFullXMMRegisterSize * 8));
4421 __ movdqu(xmm15, Operand(rsp, kFullXMMRegisterSize * 9));
4422 __ addq(rsp, Immediate(kCalleeSaveXMMRegisters * kFullXMMRegisterSize));
4423 #endif
4424
4392 __ pop(rbx); 4425 __ pop(rbx);
4393 #ifdef _WIN64 4426 #ifdef _WIN64
4394 // Callee save on in Win64 ABI, arguments/volatile in AMD64 ABI. 4427 // Callee save on in Win64 ABI, arguments/volatile in AMD64 ABI.
4395 __ pop(rsi); 4428 __ pop(rsi);
4396 __ pop(rdi); 4429 __ pop(rdi);
4397 #endif 4430 #endif
4398 __ pop(r15); 4431 __ pop(r15);
4399 __ pop(r14); 4432 __ pop(r14);
4400 __ pop(r13); 4433 __ pop(r13);
4401 __ pop(r12); 4434 __ pop(r12);
(...skipping 2313 matching lines...) Expand 10 before | Expand all | Expand 10 after
6715 #endif 6748 #endif
6716 6749
6717 __ Ret(); 6750 __ Ret();
6718 } 6751 }
6719 6752
6720 #undef __ 6753 #undef __
6721 6754
6722 } } // namespace v8::internal 6755 } } // namespace v8::internal
6723 6756
6724 #endif // V8_TARGET_ARCH_X64 6757 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698