Commit 48d1e492 authored by whesse@chromium.org's avatar whesse@chromium.org

Use stack frame marker constants to mark arguments adaptor frame.

Review URL: http://codereview.chromium.org/174522

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2770 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a6973777
...@@ -573,7 +573,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { ...@@ -573,7 +573,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) {
__ mov(r0, Operand(r0, LSL, kSmiTagSize)); __ mov(r0, Operand(r0, LSL, kSmiTagSize));
__ mov(r4, Operand(ArgumentsAdaptorFrame::SENTINEL)); __ mov(r4, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
__ stm(db_w, sp, r0.bit() | r1.bit() | r4.bit() | fp.bit() | lr.bit()); __ stm(db_w, sp, r0.bit() | r1.bit() | r4.bit() | fp.bit() | lr.bit());
__ add(fp, sp, Operand(3 * kPointerSize)); __ add(fp, sp, Operand(3 * kPointerSize));
} }
......
...@@ -3324,7 +3324,7 @@ void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) { ...@@ -3324,7 +3324,7 @@ void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) {
// Skip the arguments adaptor frame if it exists. // Skip the arguments adaptor frame if it exists.
Label check_frame_marker; Label check_frame_marker;
__ ldr(r1, MemOperand(r2, StandardFrameConstants::kContextOffset)); __ ldr(r1, MemOperand(r2, StandardFrameConstants::kContextOffset));
__ cmp(r1, Operand(ArgumentsAdaptorFrame::SENTINEL)); __ cmp(r1, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
__ b(ne, &check_frame_marker); __ b(ne, &check_frame_marker);
__ ldr(r2, MemOperand(r2, StandardFrameConstants::kCallerFPOffset)); __ ldr(r2, MemOperand(r2, StandardFrameConstants::kCallerFPOffset));
...@@ -5980,9 +5980,9 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { ...@@ -5980,9 +5980,9 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
// r2: receiver // r2: receiver
// r3: argc // r3: argc
// r4: argv // r4: argv
int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY;
__ mov(r8, Operand(-1)); // Push a bad frame pointer to fail if it is used. __ mov(r8, Operand(-1)); // Push a bad frame pointer to fail if it is used.
__ mov(r7, Operand(~ArgumentsAdaptorFrame::SENTINEL)); int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY;
__ mov(r7, Operand(Smi::FromInt(marker)));
__ mov(r6, Operand(Smi::FromInt(marker))); __ mov(r6, Operand(Smi::FromInt(marker)));
__ mov(r5, Operand(ExternalReference(Top::k_c_entry_fp_address))); __ mov(r5, Operand(ExternalReference(Top::k_c_entry_fp_address)));
__ ldr(r5, MemOperand(r5)); __ ldr(r5, MemOperand(r5));
...@@ -6139,7 +6139,7 @@ void ArgumentsAccessStub::GenerateReadLength(MacroAssembler* masm) { ...@@ -6139,7 +6139,7 @@ void ArgumentsAccessStub::GenerateReadLength(MacroAssembler* masm) {
Label adaptor; Label adaptor;
__ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
__ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset)); __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset));
__ cmp(r3, Operand(ArgumentsAdaptorFrame::SENTINEL)); __ cmp(r3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
__ b(eq, &adaptor); __ b(eq, &adaptor);
// Nothing to do: The formal number of parameters has already been // Nothing to do: The formal number of parameters has already been
...@@ -6168,7 +6168,7 @@ void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { ...@@ -6168,7 +6168,7 @@ void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
Label adaptor; Label adaptor;
__ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
__ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset)); __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset));
__ cmp(r3, Operand(ArgumentsAdaptorFrame::SENTINEL)); __ cmp(r3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
__ b(eq, &adaptor); __ b(eq, &adaptor);
// Check index against formal parameters count limit passed in // Check index against formal parameters count limit passed in
...@@ -6210,7 +6210,7 @@ void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) { ...@@ -6210,7 +6210,7 @@ void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) {
Label runtime; Label runtime;
__ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
__ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset)); __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset));
__ cmp(r3, Operand(ArgumentsAdaptorFrame::SENTINEL)); __ cmp(r3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
__ b(ne, &runtime); __ b(ne, &runtime);
// Patch the arguments.length and the parameters pointer. // Patch the arguments.length and the parameters pointer.
......
...@@ -128,8 +128,9 @@ inline Address StandardFrame::ComputePCAddress(Address fp) { ...@@ -128,8 +128,9 @@ inline Address StandardFrame::ComputePCAddress(Address fp) {
inline bool StandardFrame::IsArgumentsAdaptorFrame(Address fp) { inline bool StandardFrame::IsArgumentsAdaptorFrame(Address fp) {
int context = Memory::int_at(fp + StandardFrameConstants::kContextOffset); Object* marker =
return context == ArgumentsAdaptorFrame::SENTINEL; Memory::Object_at(fp + StandardFrameConstants::kContextOffset);
return marker == Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR);
} }
......
...@@ -434,15 +434,6 @@ class JavaScriptFrame: public StandardFrame { ...@@ -434,15 +434,6 @@ class JavaScriptFrame: public StandardFrame {
// match the formal number of parameters. // match the formal number of parameters.
class ArgumentsAdaptorFrame: public JavaScriptFrame { class ArgumentsAdaptorFrame: public JavaScriptFrame {
public: public:
// This sentinel value is temporarily used to distinguish arguments
// adaptor frames from ordinary JavaScript frames. If a frame has
// the sentinel as its context, it is an arguments adaptor frame. It
// must be tagged as a small integer to avoid GC issues. Crud.
enum {
SENTINEL = (1 << kSmiTagSize) | kSmiTag,
NON_SENTINEL = ~SENTINEL
};
virtual Type type() const { return ARGUMENTS_ADAPTOR; } virtual Type type() const { return ARGUMENTS_ADAPTOR; }
// Determine the code for the frame. // Determine the code for the frame.
......
...@@ -669,7 +669,7 @@ static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { ...@@ -669,7 +669,7 @@ static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) {
__ mov(ebp, Operand(esp)); __ mov(ebp, Operand(esp));
// Store the arguments adaptor context sentinel. // Store the arguments adaptor context sentinel.
__ push(Immediate(ArgumentsAdaptorFrame::SENTINEL)); __ push(Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
// Push the function on the stack. // Push the function on the stack.
__ push(edi); __ push(edi);
......
...@@ -2139,7 +2139,8 @@ void CodeGenerator::CallApplyLazy(Property* apply, ...@@ -2139,7 +2139,8 @@ void CodeGenerator::CallApplyLazy(Property* apply,
Label invoke, adapted; Label invoke, adapted;
__ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
__ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset)); __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset));
__ cmp(ecx, ArgumentsAdaptorFrame::SENTINEL); __ cmp(Operand(ecx),
Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
__ j(equal, &adapted); __ j(equal, &adapted);
// No arguments adaptor frame. Copy fixed number of arguments. // No arguments adaptor frame. Copy fixed number of arguments.
...@@ -4912,7 +4913,7 @@ void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) { ...@@ -4912,7 +4913,7 @@ void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) {
// Skip the arguments adaptor frame if it exists. // Skip the arguments adaptor frame if it exists.
Label check_frame_marker; Label check_frame_marker;
__ cmp(Operand(fp.reg(), StandardFrameConstants::kContextOffset), __ cmp(Operand(fp.reg(), StandardFrameConstants::kContextOffset),
Immediate(ArgumentsAdaptorFrame::SENTINEL)); Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
__ j(not_equal, &check_frame_marker); __ j(not_equal, &check_frame_marker);
__ mov(fp.reg(), Operand(fp.reg(), StandardFrameConstants::kCallerFPOffset)); __ mov(fp.reg(), Operand(fp.reg(), StandardFrameConstants::kCallerFPOffset));
...@@ -7109,7 +7110,7 @@ void ArgumentsAccessStub::GenerateReadLength(MacroAssembler* masm) { ...@@ -7109,7 +7110,7 @@ void ArgumentsAccessStub::GenerateReadLength(MacroAssembler* masm) {
Label adaptor; Label adaptor;
__ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
__ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset)); __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset));
__ cmp(ecx, ArgumentsAdaptorFrame::SENTINEL); __ cmp(Operand(ecx), Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
__ j(equal, &adaptor); __ j(equal, &adaptor);
// Nothing to do: The formal number of parameters has already been // Nothing to do: The formal number of parameters has already been
...@@ -7141,7 +7142,7 @@ void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { ...@@ -7141,7 +7142,7 @@ void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
Label adaptor; Label adaptor;
__ mov(ebx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); __ mov(ebx, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
__ mov(ecx, Operand(ebx, StandardFrameConstants::kContextOffset)); __ mov(ecx, Operand(ebx, StandardFrameConstants::kContextOffset));
__ cmp(ecx, ArgumentsAdaptorFrame::SENTINEL); __ cmp(Operand(ecx), Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
__ j(equal, &adaptor); __ j(equal, &adaptor);
// Check index against formal parameters count limit passed in // Check index against formal parameters count limit passed in
...@@ -7192,7 +7193,7 @@ void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) { ...@@ -7192,7 +7193,7 @@ void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) {
Label runtime; Label runtime;
__ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
__ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset)); __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset));
__ cmp(ecx, ArgumentsAdaptorFrame::SENTINEL); __ cmp(Operand(ecx), Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
__ j(not_equal, &runtime); __ j(not_equal, &runtime);
// Patch the arguments.length and the parameters pointer. // Patch the arguments.length and the parameters pointer.
...@@ -7724,11 +7725,11 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { ...@@ -7724,11 +7725,11 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
__ push(ebp); __ push(ebp);
__ mov(ebp, Operand(esp)); __ mov(ebp, Operand(esp));
// Save callee-saved registers (C calling conventions). // Push marker in two places.
int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY;
// Push something that is not an arguments adaptor. __ push(Immediate(Smi::FromInt(marker))); // context slot
__ push(Immediate(~ArgumentsAdaptorFrame::SENTINEL)); __ push(Immediate(Smi::FromInt(marker))); // function slot
__ push(Immediate(Smi::FromInt(marker))); // @ function offset // Save callee-saved registers (C calling conventions).
__ push(edi); __ push(edi);
__ push(esi); __ push(esi);
__ push(ebx); __ push(ebx);
......
...@@ -53,7 +53,7 @@ static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { ...@@ -53,7 +53,7 @@ static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) {
__ movq(rbp, rsp); __ movq(rbp, rsp);
// Store the arguments adaptor context sentinel. // Store the arguments adaptor context sentinel.
__ push(Immediate(ArgumentsAdaptorFrame::SENTINEL)); __ push(Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
// Push the function on the stack. // Push the function on the stack.
__ push(rdi); __ push(rdi);
......
...@@ -3473,7 +3473,7 @@ void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) { ...@@ -3473,7 +3473,7 @@ void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) {
// Skip the arguments adaptor frame if it exists. // Skip the arguments adaptor frame if it exists.
Label check_frame_marker; Label check_frame_marker;
__ cmpq(Operand(fp.reg(), StandardFrameConstants::kContextOffset), __ cmpq(Operand(fp.reg(), StandardFrameConstants::kContextOffset),
Immediate(ArgumentsAdaptorFrame::SENTINEL)); Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
__ j(not_equal, &check_frame_marker); __ j(not_equal, &check_frame_marker);
__ movq(fp.reg(), Operand(fp.reg(), StandardFrameConstants::kCallerFPOffset)); __ movq(fp.reg(), Operand(fp.reg(), StandardFrameConstants::kCallerFPOffset));
...@@ -6618,7 +6618,7 @@ void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) { ...@@ -6618,7 +6618,7 @@ void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) {
Label runtime; Label runtime;
__ movq(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); __ movq(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
__ movq(rcx, Operand(rdx, StandardFrameConstants::kContextOffset)); __ movq(rcx, Operand(rdx, StandardFrameConstants::kContextOffset));
__ cmpq(rcx, Immediate(ArgumentsAdaptorFrame::SENTINEL)); __ cmpq(rcx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
__ j(not_equal, &runtime); __ j(not_equal, &runtime);
// Value in rcx is Smi encoded. // Value in rcx is Smi encoded.
...@@ -6651,7 +6651,7 @@ void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { ...@@ -6651,7 +6651,7 @@ void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
Label adaptor; Label adaptor;
__ movq(rbx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); __ movq(rbx, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
__ movq(rcx, Operand(rbx, StandardFrameConstants::kContextOffset)); __ movq(rcx, Operand(rbx, StandardFrameConstants::kContextOffset));
__ cmpq(rcx, Immediate(ArgumentsAdaptorFrame::SENTINEL)); __ cmpq(rcx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
__ j(equal, &adaptor); __ j(equal, &adaptor);
// Check index against formal parameters count limit passed in // Check index against formal parameters count limit passed in
...@@ -6701,7 +6701,7 @@ void ArgumentsAccessStub::GenerateReadLength(MacroAssembler* masm) { ...@@ -6701,7 +6701,7 @@ void ArgumentsAccessStub::GenerateReadLength(MacroAssembler* masm) {
Label adaptor; Label adaptor;
__ movq(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); __ movq(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
__ movq(rcx, Operand(rdx, StandardFrameConstants::kContextOffset)); __ movq(rcx, Operand(rdx, StandardFrameConstants::kContextOffset));
__ cmpq(rcx, Immediate(ArgumentsAdaptorFrame::SENTINEL)); __ cmpq(rcx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
__ j(equal, &adaptor); __ j(equal, &adaptor);
// Nothing to do: The formal number of parameters has already been // Nothing to do: The formal number of parameters has already been
...@@ -7015,11 +7015,11 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { ...@@ -7015,11 +7015,11 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
__ push(rbp); __ push(rbp);
__ movq(rbp, rsp); __ movq(rbp, rsp);
// Save callee-saved registers (X64 calling conventions). // Push the stack frame type marker twice.
int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY;
// Push something that is not an arguments adaptor. __ push(Immediate(Smi::FromInt(marker))); // context slot
__ push(Immediate(ArgumentsAdaptorFrame::NON_SENTINEL)); __ push(Immediate(Smi::FromInt(marker))); // function slot
__ push(Immediate(Smi::FromInt(marker))); // @ function offset // Save callee-saved registers (X64 calling conventions).
__ push(r12); __ push(r12);
__ push(r13); __ push(r13);
__ push(r14); __ push(r14);
......
...@@ -92,10 +92,12 @@ class StandardFrameConstants : public AllStatic { ...@@ -92,10 +92,12 @@ class StandardFrameConstants : public AllStatic {
class JavaScriptFrameConstants : public AllStatic { class JavaScriptFrameConstants : public AllStatic {
public: public:
// FP-relative.
static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset; static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
static const int kSavedRegistersOffset = +2 * kPointerSize; static const int kSavedRegistersOffset = +2 * kPointerSize;
static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset; static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset;
// Caller SP-relative.
static const int kParam0Offset = -2 * kPointerSize; static const int kParam0Offset = -2 * kPointerSize;
static const int kReceiverOffset = -1 * kPointerSize; static const int kReceiverOffset = -1 * kPointerSize;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment