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

Unified Diff: src/x64/stub-cache-x64.cc

Issue 22267005: Use StackArgumenstAccessor and kPCOnStackSize/kFPOnStackSize to compute stack address/operand (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased with master and refactored newly-introduced GenerateFastApiCall with StackArgumentsAccessor Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« src/x64/macro-assembler-x64.cc ('K') | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/stub-cache-x64.cc
diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc
index 31f60be565e2de24697de08cca2a78ded9ec27c2..b7e564b43273b1546f160f18a95cc5e12266732a 100644
--- a/src/x64/stub-cache-x64.cc
+++ b/src/x64/stub-cache-x64.cc
@@ -538,23 +538,21 @@ static void GenerateFastApiCall(MacroAssembler* masm,
ASSERT(optimization.is_simple_api_call());
ASSERT(!receiver.is(scratch));
- const int stack_space = kFastApiCallArguments + argc + 1;
- // Copy return value.
- __ movq(scratch, Operand(rsp, 0));
- // Assign stack space for the call arguments.
- __ subq(rsp, Immediate(stack_space * kPointerSize));
- // Move the return address on top of the stack.
- __ movq(Operand(rsp, 0), scratch);
+ int fast_api_call_argc = argc + kFastApiCallArguments;
+ StackArgumentsAccessor args(rsp, fast_api_call_argc);
+
+ __ movq(scratch, StackOperandForReturnAddress(0));
+ // Assign stack space for the call arguments and receiver.
+ __ subq(rsp, Immediate((fast_api_call_argc + 1) * kPointerSize));
+ __ movq(StackOperandForReturnAddress(0), scratch);
// Write holder to stack frame.
- __ movq(Operand(rsp, 1 * kPointerSize), receiver);
- // Write receiver to stack frame.
- int index = stack_space;
- __ movq(Operand(rsp, index-- * kPointerSize), receiver);
+ __ movq(args.GetArgumentOperand(fast_api_call_argc), receiver);
+ __ movq(args.GetReceiverOperand(), receiver);
// Write the arguments to stack frame.
for (int i = 0; i < argc; i++) {
ASSERT(!receiver.is(values[i]));
ASSERT(!scratch.is(values[i]));
- __ movq(Operand(rsp, index-- * kPointerSize), values[i]);
+ __ movq(args.GetArgumentOperand(i + 1), values[i]);
}
GenerateFastApiCall(masm, optimization, argc);
@@ -2171,7 +2169,7 @@ Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall(
GenerateNameCheck(name, &miss);
if (cell.is_null()) {
- __ movq(rdx, args.GetArgumentOperand(argc - 1));
+ __ movq(rdx, args.GetReceiverOperand());
__ JumpIfSmi(rdx, &miss);
CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi,
name, &miss);
@@ -2241,6 +2239,7 @@ Handle<Code> CallStubCompiler::CompileMathFloorCall(
CpuFeatureScope use_sse2(masm(), SSE2);
const int argc = arguments().immediate();
+ StackArgumentsAccessor args(rsp, argc);
// If the object is not a JSObject or we got an unexpected number of
// arguments, bail out to the regular call.
@@ -2252,7 +2251,7 @@ Handle<Code> CallStubCompiler::CompileMathFloorCall(
GenerateNameCheck(name, &miss);
if (cell.is_null()) {
- __ movq(rdx, Operand(rsp, 2 * kPointerSize));
+ __ movq(rdx, args.GetReceiverOperand());
STATIC_ASSERT(kSmiTag == 0);
__ JumpIfSmi(rdx, &miss);
@@ -2267,7 +2266,7 @@ Handle<Code> CallStubCompiler::CompileMathFloorCall(
}
// Load the (only) argument into rax.
- __ movq(rax, Operand(rsp, 1 * kPointerSize));
+ __ movq(rax, args.GetArgumentOperand(argc));
// Check if the argument is a smi.
Label smi;
@@ -2334,7 +2333,7 @@ Handle<Code> CallStubCompiler::CompileMathFloorCall(
// Return the argument (when it's an already round heap number).
__ bind(&already_round);
- __ movq(rax, Operand(rsp, 1 * kPointerSize));
+ __ movq(rax, args.GetArgumentOperand(argc));
danno 2013/09/18 12:08:42 1 instead of argc
haitao.feng 2013/09/22 08:16:00 Done.
__ ret(2 * kPointerSize);
// Tail call the full function. We do not have to patch the receiver
@@ -2378,7 +2377,7 @@ Handle<Code> CallStubCompiler::CompileMathAbsCall(
GenerateNameCheck(name, &miss);
if (cell.is_null()) {
- __ movq(rdx, args.GetArgumentOperand(argc - 1));
+ __ movq(rdx, args.GetReceiverOperand());
__ JumpIfSmi(rdx, &miss);
CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi,
name, &miss);
« src/x64/macro-assembler-x64.cc ('K') | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698