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

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

Issue 137443004: Use kRegisterSize when passing arguments to the C++ runtime for X64 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment Created 6 years, 11 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 | « no previous file | src/x64/debug-x64.cc » ('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 // 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 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1609 1609
1610 // Isolates: note we add an additional parameter here (isolate pointer). 1610 // Isolates: note we add an additional parameter here (isolate pointer).
1611 static const int kRegExpExecuteArguments = 9; 1611 static const int kRegExpExecuteArguments = 9;
1612 int argument_slots_on_stack = 1612 int argument_slots_on_stack =
1613 masm->ArgumentStackSlotsForCFunctionCall(kRegExpExecuteArguments); 1613 masm->ArgumentStackSlotsForCFunctionCall(kRegExpExecuteArguments);
1614 __ EnterApiExitFrame(argument_slots_on_stack); 1614 __ EnterApiExitFrame(argument_slots_on_stack);
1615 1615
1616 // Argument 9: Pass current isolate address. 1616 // Argument 9: Pass current isolate address.
1617 __ LoadAddress(kScratchRegister, 1617 __ LoadAddress(kScratchRegister,
1618 ExternalReference::isolate_address(masm->isolate())); 1618 ExternalReference::isolate_address(masm->isolate()));
1619 __ movq(Operand(rsp, (argument_slots_on_stack - 1) * kPointerSize), 1619 __ movq(Operand(rsp, (argument_slots_on_stack - 1) * kRegisterSize),
1620 kScratchRegister); 1620 kScratchRegister);
1621 1621
1622 // Argument 8: Indicate that this is a direct call from JavaScript. 1622 // Argument 8: Indicate that this is a direct call from JavaScript.
1623 __ movq(Operand(rsp, (argument_slots_on_stack - 2) * kPointerSize), 1623 __ movq(Operand(rsp, (argument_slots_on_stack - 2) * kRegisterSize),
1624 Immediate(1)); 1624 Immediate(1));
1625 1625
1626 // Argument 7: Start (high end) of backtracking stack memory area. 1626 // Argument 7: Start (high end) of backtracking stack memory area.
1627 __ Move(kScratchRegister, address_of_regexp_stack_memory_address); 1627 __ Move(kScratchRegister, address_of_regexp_stack_memory_address);
1628 __ movq(r9, Operand(kScratchRegister, 0)); 1628 __ movq(r9, Operand(kScratchRegister, 0));
1629 __ Move(kScratchRegister, address_of_regexp_stack_memory_size); 1629 __ Move(kScratchRegister, address_of_regexp_stack_memory_size);
1630 __ addq(r9, Operand(kScratchRegister, 0)); 1630 __ addq(r9, Operand(kScratchRegister, 0));
1631 __ movq(Operand(rsp, (argument_slots_on_stack - 3) * kPointerSize), r9); 1631 __ movq(Operand(rsp, (argument_slots_on_stack - 3) * kRegisterSize), r9);
1632 1632
1633 // Argument 6: Set the number of capture registers to zero to force global 1633 // Argument 6: Set the number of capture registers to zero to force global
1634 // regexps to behave as non-global. This does not affect non-global regexps. 1634 // regexps to behave as non-global. This does not affect non-global regexps.
1635 // Argument 6 is passed in r9 on Linux and on the stack on Windows. 1635 // Argument 6 is passed in r9 on Linux and on the stack on Windows.
1636 #ifdef _WIN64 1636 #ifdef _WIN64
1637 __ movq(Operand(rsp, (argument_slots_on_stack - 4) * kPointerSize), 1637 __ movq(Operand(rsp, (argument_slots_on_stack - 4) * kRegisterSize),
1638 Immediate(0)); 1638 Immediate(0));
1639 #else 1639 #else
1640 __ Set(r9, 0); 1640 __ Set(r9, 0);
1641 #endif 1641 #endif
1642 1642
1643 // Argument 5: static offsets vector buffer. 1643 // Argument 5: static offsets vector buffer.
1644 __ LoadAddress(r8, 1644 __ LoadAddress(r8,
1645 ExternalReference::address_of_static_offsets_vector(isolate)); 1645 ExternalReference::address_of_static_offsets_vector(isolate));
1646 // Argument 5 passed in r8 on Linux and on the stack on Windows. 1646 // Argument 5 passed in r8 on Linux and on the stack on Windows.
1647 #ifdef _WIN64 1647 #ifdef _WIN64
1648 __ movq(Operand(rsp, (argument_slots_on_stack - 5) * kPointerSize), r8); 1648 __ movq(Operand(rsp, (argument_slots_on_stack - 5) * kRegisterSize), r8);
1649 #endif 1649 #endif
1650 1650
1651 // rdi: subject string 1651 // rdi: subject string
1652 // rbx: previous index 1652 // rbx: previous index
1653 // rcx: encoding of subject string (1 if ASCII 0 if two_byte); 1653 // rcx: encoding of subject string (1 if ASCII 0 if two_byte);
1654 // r11: code 1654 // r11: code
1655 // r14: slice offset 1655 // r14: slice offset
1656 // r15: original subject string 1656 // r15: original subject string
1657 1657
1658 // Argument 2: Previous index. 1658 // Argument 2: Previous index.
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
2621 // Check for failure result. 2621 // Check for failure result.
2622 Label failure_returned; 2622 Label failure_returned;
2623 STATIC_ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); 2623 STATIC_ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0);
2624 #ifdef _WIN64 2624 #ifdef _WIN64
2625 // If return value is on the stack, pop it to registers. 2625 // If return value is on the stack, pop it to registers.
2626 if (result_size_ > 1) { 2626 if (result_size_ > 1) {
2627 ASSERT_EQ(2, result_size_); 2627 ASSERT_EQ(2, result_size_);
2628 // Read result values stored on stack. Result is stored 2628 // Read result values stored on stack. Result is stored
2629 // above the four argument mirror slots and the two 2629 // above the four argument mirror slots and the two
2630 // Arguments object slots. 2630 // Arguments object slots.
2631 __ movq(rax, Operand(rsp, 6 * kPointerSize)); 2631 __ movq(rax, Operand(rsp, 6 * kRegisterSize));
2632 __ movq(rdx, Operand(rsp, 7 * kPointerSize)); 2632 __ movq(rdx, Operand(rsp, 7 * kRegisterSize));
2633 } 2633 }
2634 #endif 2634 #endif
2635 __ lea(rcx, Operand(rax, 1)); 2635 __ lea(rcx, Operand(rax, 1));
2636 // Lower 2 bits of rcx are 0 iff rax has failure tag. 2636 // Lower 2 bits of rcx are 0 iff rax has failure tag.
2637 __ testl(rcx, Immediate(kFailureTagMask)); 2637 __ testl(rcx, Immediate(kFailureTagMask));
2638 __ j(zero, &failure_returned); 2638 __ j(zero, &failure_returned);
2639 2639
2640 // Exit the JavaScript to C++ exit frame. 2640 // Exit the JavaScript to C++ exit frame.
2641 __ LeaveExitFrame(save_doubles_); 2641 __ LeaveExitFrame(save_doubles_);
2642 __ ret(0); 2642 __ ret(0);
(...skipping 2526 matching lines...) Expand 10 before | Expand all | Expand 10 after
5169 5169
5170 5170
5171 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { 5171 void ProfileEntryHookStub::Generate(MacroAssembler* masm) {
5172 // This stub can be called from essentially anywhere, so it needs to save 5172 // This stub can be called from essentially anywhere, so it needs to save
5173 // all volatile and callee-save registers. 5173 // all volatile and callee-save registers.
5174 const size_t kNumSavedRegisters = 2; 5174 const size_t kNumSavedRegisters = 2;
5175 __ push(arg_reg_1); 5175 __ push(arg_reg_1);
5176 __ push(arg_reg_2); 5176 __ push(arg_reg_2);
5177 5177
5178 // Calculate the original stack pointer and store it in the second arg. 5178 // Calculate the original stack pointer and store it in the second arg.
5179 __ lea(arg_reg_2, Operand(rsp, (kNumSavedRegisters + 1) * kPointerSize)); 5179 __ lea(arg_reg_2,
5180 Operand(rsp, kNumSavedRegisters * kRegisterSize + kPCOnStackSize));
5180 5181
5181 // Calculate the function address to the first arg. 5182 // Calculate the function address to the first arg.
5182 __ movq(arg_reg_1, Operand(rsp, kNumSavedRegisters * kPointerSize)); 5183 __ movq(arg_reg_1, Operand(rsp, kNumSavedRegisters * kRegisterSize));
5183 __ subq(arg_reg_1, Immediate(Assembler::kShortCallInstructionLength)); 5184 __ subq(arg_reg_1, Immediate(Assembler::kShortCallInstructionLength));
5184 5185
5185 // Save the remainder of the volatile registers. 5186 // Save the remainder of the volatile registers.
5186 masm->PushCallerSaved(kSaveFPRegs, arg_reg_1, arg_reg_2); 5187 masm->PushCallerSaved(kSaveFPRegs, arg_reg_1, arg_reg_2);
5187 5188
5188 // Call the entry hook function. 5189 // Call the entry hook function.
5189 __ Move(rax, FUNCTION_ADDR(masm->isolate()->function_entry_hook()), 5190 __ Move(rax, FUNCTION_ADDR(masm->isolate()->function_entry_hook()),
5190 RelocInfo::NONE64); 5191 RelocInfo::NONE64);
5191 5192
5192 AllowExternalCallThatCantCauseGC scope(masm); 5193 AllowExternalCallThatCantCauseGC scope(masm);
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
5529 __ bind(&fast_elements_case); 5530 __ bind(&fast_elements_case);
5530 GenerateCase(masm, FAST_ELEMENTS); 5531 GenerateCase(masm, FAST_ELEMENTS);
5531 } 5532 }
5532 5533
5533 5534
5534 #undef __ 5535 #undef __
5535 5536
5536 } } // namespace v8::internal 5537 } } // namespace v8::internal
5537 5538
5538 #endif // V8_TARGET_ARCH_X64 5539 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | src/x64/debug-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698