OLD | NEW |
---|---|
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 Loading... | |
4265 | 4265 |
4266 __ bind(&throw_normal_exception); | 4266 __ bind(&throw_normal_exception); |
4267 __ Throw(rax); | 4267 __ Throw(rax); |
4268 } | 4268 } |
4269 | 4269 |
4270 | 4270 |
4271 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { | 4271 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { |
4272 Label invoke, handler_entry, exit; | 4272 Label invoke, handler_entry, exit; |
4273 Label not_outermost_js, not_outermost_js_2; | 4273 Label not_outermost_js, not_outermost_js_2; |
4274 | 4274 |
4275 #ifdef _WIN64 | |
4276 const int kCalleeSaveXMMRegisters = 10; | |
4277 const int kFullXMMRegisterSize = 16; | |
4278 #endif | |
4279 { // NOLINT. Scope block confuses linter. | 4275 { // NOLINT. Scope block confuses linter. |
4280 MacroAssembler::NoRootArrayScope uninitialized_root_register(masm); | 4276 MacroAssembler::NoRootArrayScope uninitialized_root_register(masm); |
4281 // Set up frame. | 4277 // Set up frame. |
4282 __ push(rbp); | 4278 __ push(rbp); |
4283 __ movq(rbp, rsp); | 4279 __ movq(rbp, rsp); |
4284 | 4280 |
4285 // Push the stack frame type marker twice. | 4281 // Push the stack frame type marker twice. |
4286 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; | 4282 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; |
4287 // Scratch register is neither callee-save, nor an argument register on any | 4283 // Scratch register is neither callee-save, nor an argument register on any |
4288 // platform. It's free to use at this point. | 4284 // platform. It's free to use at this point. |
4289 // Cannot use smi-register for loading yet. | 4285 // Cannot use smi-register for loading yet. |
4290 __ movq(kScratchRegister, | 4286 __ movq(kScratchRegister, |
4291 reinterpret_cast<uint64_t>(Smi::FromInt(marker)), | 4287 reinterpret_cast<uint64_t>(Smi::FromInt(marker)), |
4292 RelocInfo::NONE64); | 4288 RelocInfo::NONE64); |
4293 __ push(kScratchRegister); // context slot | 4289 __ push(kScratchRegister); // context slot |
4294 __ push(kScratchRegister); // function slot | 4290 __ push(kScratchRegister); // function slot |
4295 // Save callee-saved registers (X64/Win64 calling conventions). | 4291 // Save callee-saved registers (X64/Win64 calling conventions). |
4296 __ push(r12); | 4292 __ push(r12); |
4297 __ push(r13); | 4293 __ push(r13); |
4298 __ push(r14); | 4294 __ push(r14); |
4299 __ push(r15); | 4295 __ push(r15); |
4300 #ifdef _WIN64 | 4296 #ifdef _WIN64 |
4301 __ push(rdi); // Only callee save in Win64 ABI, argument in AMD64 ABI. | 4297 __ push(rdi); // Only callee save in Win64 ABI, argument in AMD64 ABI. |
4302 __ push(rsi); // Only callee save in Win64 ABI, argument in AMD64 ABI. | 4298 __ push(rsi); // Only callee save in Win64 ABI, argument in AMD64 ABI. |
4303 #endif | 4299 #endif |
4304 __ push(rbx); | 4300 __ push(rbx); |
4305 | 4301 |
4306 #ifdef _WIN64 | 4302 #ifdef _WIN64 |
4307 // On Win64 XMM6-XMM15 are callee-save | 4303 // On Win64 XMM6-XMM15 are callee-save |
4308 __ subq(rsp, Immediate(kCalleeSaveXMMRegisters * kFullXMMRegisterSize)); | 4304 __ subq(rsp, Immediate(EntryFrameConstants::kXMMRegistersBlockSize)); |
4309 __ movdqu(Operand(rsp, kFullXMMRegisterSize * 0), xmm6); | 4305 __ movdqu(Operand(rsp, EntryFrameConstants::kXMMRegisterSize * 0), xmm6); |
4310 __ movdqu(Operand(rsp, kFullXMMRegisterSize * 1), xmm7); | 4306 __ movdqu(Operand(rsp, EntryFrameConstants::kXMMRegisterSize * 1), xmm7); |
4311 __ movdqu(Operand(rsp, kFullXMMRegisterSize * 2), xmm8); | 4307 __ movdqu(Operand(rsp, EntryFrameConstants::kXMMRegisterSize * 2), xmm8); |
4312 __ movdqu(Operand(rsp, kFullXMMRegisterSize * 3), xmm9); | 4308 __ movdqu(Operand(rsp, EntryFrameConstants::kXMMRegisterSize * 3), xmm9); |
4313 __ movdqu(Operand(rsp, kFullXMMRegisterSize * 4), xmm10); | 4309 __ movdqu(Operand(rsp, EntryFrameConstants::kXMMRegisterSize * 4), xmm10); |
4314 __ movdqu(Operand(rsp, kFullXMMRegisterSize * 5), xmm11); | 4310 __ movdqu(Operand(rsp, EntryFrameConstants::kXMMRegisterSize * 5), xmm11); |
4315 __ movdqu(Operand(rsp, kFullXMMRegisterSize * 6), xmm12); | 4311 __ movdqu(Operand(rsp, EntryFrameConstants::kXMMRegisterSize * 6), xmm12); |
4316 __ movdqu(Operand(rsp, kFullXMMRegisterSize * 7), xmm13); | 4312 __ movdqu(Operand(rsp, EntryFrameConstants::kXMMRegisterSize * 7), xmm13); |
4317 __ movdqu(Operand(rsp, kFullXMMRegisterSize * 8), xmm14); | 4313 __ movdqu(Operand(rsp, EntryFrameConstants::kXMMRegisterSize * 8), xmm14); |
4318 __ movdqu(Operand(rsp, kFullXMMRegisterSize * 9), xmm15); | 4314 __ movdqu(Operand(rsp, EntryFrameConstants::kXMMRegisterSize * 9), xmm15); |
4319 #endif | 4315 #endif |
4320 | 4316 |
4321 // Set up the roots and smi constant registers. | 4317 // Set up the roots and smi constant registers. |
4322 // Needs to be done before any further smi loads. | 4318 // Needs to be done before any further smi loads. |
4323 __ InitializeSmiConstantRegister(); | 4319 __ InitializeSmiConstantRegister(); |
4324 __ InitializeRootRegister(); | 4320 __ InitializeRootRegister(); |
4325 } | 4321 } |
4326 | 4322 |
4327 Isolate* isolate = masm->isolate(); | 4323 Isolate* isolate = masm->isolate(); |
4328 | 4324 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4401 __ bind(¬_outermost_js_2); | 4397 __ bind(¬_outermost_js_2); |
4402 | 4398 |
4403 // Restore the top frame descriptor from the stack. | 4399 // Restore the top frame descriptor from the stack. |
4404 { Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp); | 4400 { Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp); |
4405 __ pop(c_entry_fp_operand); | 4401 __ pop(c_entry_fp_operand); |
4406 } | 4402 } |
4407 | 4403 |
4408 // Restore callee-saved registers (X64 conventions). | 4404 // Restore callee-saved registers (X64 conventions). |
4409 #ifdef _WIN64 | 4405 #ifdef _WIN64 |
4410 // On Win64 XMM6-XMM15 are callee-save | 4406 // On Win64 XMM6-XMM15 are callee-save |
4411 __ movdqu(xmm6, Operand(rsp, kFullXMMRegisterSize * 0)); | 4407 __ movdqu(xmm6, Operand(rsp, EntryFrameConstants::kXMMRegisterSize * 0)); |
4412 __ movdqu(xmm7, Operand(rsp, kFullXMMRegisterSize * 1)); | 4408 __ movdqu(xmm7, Operand(rsp, EntryFrameConstants::kXMMRegisterSize * 1)); |
4413 __ movdqu(xmm8, Operand(rsp, kFullXMMRegisterSize * 2)); | 4409 __ movdqu(xmm8, Operand(rsp, EntryFrameConstants::kXMMRegisterSize * 2)); |
4414 __ movdqu(xmm8, Operand(rsp, kFullXMMRegisterSize * 3)); | 4410 __ movdqu(xmm8, Operand(rsp, EntryFrameConstants::kXMMRegisterSize * 3)); |
Jakob Kummerow
2013/04/17 16:34:38
DBC: the "8" in this line looks *very* suspicious.
| |
4415 __ movdqu(xmm10, Operand(rsp, kFullXMMRegisterSize * 4)); | 4411 __ movdqu(xmm10, Operand(rsp, EntryFrameConstants::kXMMRegisterSize * 4)); |
4416 __ movdqu(xmm11, Operand(rsp, kFullXMMRegisterSize * 5)); | 4412 __ movdqu(xmm11, Operand(rsp, EntryFrameConstants::kXMMRegisterSize * 5)); |
4417 __ movdqu(xmm12, Operand(rsp, kFullXMMRegisterSize * 6)); | 4413 __ movdqu(xmm12, Operand(rsp, EntryFrameConstants::kXMMRegisterSize * 6)); |
4418 __ movdqu(xmm13, Operand(rsp, kFullXMMRegisterSize * 7)); | 4414 __ movdqu(xmm13, Operand(rsp, EntryFrameConstants::kXMMRegisterSize * 7)); |
4419 __ movdqu(xmm14, Operand(rsp, kFullXMMRegisterSize * 8)); | 4415 __ movdqu(xmm14, Operand(rsp, EntryFrameConstants::kXMMRegisterSize * 8)); |
4420 __ movdqu(xmm15, Operand(rsp, kFullXMMRegisterSize * 9)); | 4416 __ movdqu(xmm15, Operand(rsp, EntryFrameConstants::kXMMRegisterSize * 9)); |
4421 __ addq(rsp, Immediate(kCalleeSaveXMMRegisters * kFullXMMRegisterSize)); | 4417 __ addq(rsp, Immediate(EntryFrameConstants::kXMMRegistersBlockSize)); |
4422 #endif | 4418 #endif |
4423 | 4419 |
4424 __ pop(rbx); | 4420 __ pop(rbx); |
4425 #ifdef _WIN64 | 4421 #ifdef _WIN64 |
4426 // Callee save on in Win64 ABI, arguments/volatile in AMD64 ABI. | 4422 // Callee save on in Win64 ABI, arguments/volatile in AMD64 ABI. |
4427 __ pop(rsi); | 4423 __ pop(rsi); |
4428 __ pop(rdi); | 4424 __ pop(rdi); |
4429 #endif | 4425 #endif |
4430 __ pop(r15); | 4426 __ pop(r15); |
4431 __ pop(r14); | 4427 __ pop(r14); |
(...skipping 2315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6747 #endif | 6743 #endif |
6748 | 6744 |
6749 __ Ret(); | 6745 __ Ret(); |
6750 } | 6746 } |
6751 | 6747 |
6752 #undef __ | 6748 #undef __ |
6753 | 6749 |
6754 } } // namespace v8::internal | 6750 } } // namespace v8::internal |
6755 | 6751 |
6756 #endif // V8_TARGET_ARCH_X64 | 6752 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |