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

Side by Side Diff: src/arm/codegen-arm.cc

Issue 174522: Use stack frame marker constants to mark arguments adaptor frame. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/frames.h » ('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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 3306 matching lines...) Expand 10 before | Expand all | Expand 10 after
3317 void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) { 3317 void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) {
3318 VirtualFrame::SpilledScope spilled_scope; 3318 VirtualFrame::SpilledScope spilled_scope;
3319 ASSERT(args->length() == 0); 3319 ASSERT(args->length() == 0);
3320 3320
3321 // Get the frame pointer for the calling frame. 3321 // Get the frame pointer for the calling frame.
3322 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 3322 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
3323 3323
3324 // Skip the arguments adaptor frame if it exists. 3324 // Skip the arguments adaptor frame if it exists.
3325 Label check_frame_marker; 3325 Label check_frame_marker;
3326 __ ldr(r1, MemOperand(r2, StandardFrameConstants::kContextOffset)); 3326 __ ldr(r1, MemOperand(r2, StandardFrameConstants::kContextOffset));
3327 __ cmp(r1, Operand(ArgumentsAdaptorFrame::SENTINEL)); 3327 __ cmp(r1, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
3328 __ b(ne, &check_frame_marker); 3328 __ b(ne, &check_frame_marker);
3329 __ ldr(r2, MemOperand(r2, StandardFrameConstants::kCallerFPOffset)); 3329 __ ldr(r2, MemOperand(r2, StandardFrameConstants::kCallerFPOffset));
3330 3330
3331 // Check the marker in the calling frame. 3331 // Check the marker in the calling frame.
3332 __ bind(&check_frame_marker); 3332 __ bind(&check_frame_marker);
3333 __ ldr(r1, MemOperand(r2, StandardFrameConstants::kMarkerOffset)); 3333 __ ldr(r1, MemOperand(r2, StandardFrameConstants::kMarkerOffset));
3334 __ cmp(r1, Operand(Smi::FromInt(StackFrame::CONSTRUCT))); 3334 __ cmp(r1, Operand(Smi::FromInt(StackFrame::CONSTRUCT)));
3335 cc_reg_ = eq; 3335 cc_reg_ = eq;
3336 } 3336 }
3337 3337
(...skipping 2635 matching lines...) Expand 10 before | Expand all | Expand 10 after
5973 // r3: argc 5973 // r3: argc
5974 __ add(r4, sp, Operand((kNumCalleeSaved + 1)*kPointerSize)); 5974 __ add(r4, sp, Operand((kNumCalleeSaved + 1)*kPointerSize));
5975 __ ldr(r4, MemOperand(r4)); // argv 5975 __ ldr(r4, MemOperand(r4)); // argv
5976 5976
5977 // Push a frame with special values setup to mark it as an entry frame. 5977 // Push a frame with special values setup to mark it as an entry frame.
5978 // r0: code entry 5978 // r0: code entry
5979 // r1: function 5979 // r1: function
5980 // r2: receiver 5980 // r2: receiver
5981 // r3: argc 5981 // r3: argc
5982 // r4: argv 5982 // r4: argv
5983 __ mov(r8, Operand(-1)); // Push a bad frame pointer to fail if it is used.
5983 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; 5984 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY;
5984 __ mov(r8, Operand(-1)); // Push a bad frame pointer to fail if it is used. 5985 __ mov(r7, Operand(Smi::FromInt(marker)));
5985 __ mov(r7, Operand(~ArgumentsAdaptorFrame::SENTINEL));
5986 __ mov(r6, Operand(Smi::FromInt(marker))); 5986 __ mov(r6, Operand(Smi::FromInt(marker)));
5987 __ mov(r5, Operand(ExternalReference(Top::k_c_entry_fp_address))); 5987 __ mov(r5, Operand(ExternalReference(Top::k_c_entry_fp_address)));
5988 __ ldr(r5, MemOperand(r5)); 5988 __ ldr(r5, MemOperand(r5));
5989 __ stm(db_w, sp, r5.bit() | r6.bit() | r7.bit() | r8.bit()); 5989 __ stm(db_w, sp, r5.bit() | r6.bit() | r7.bit() | r8.bit());
5990 5990
5991 // Setup frame pointer for the frame to be pushed. 5991 // Setup frame pointer for the frame to be pushed.
5992 __ add(fp, sp, Operand(-EntryFrameConstants::kCallerFPOffset)); 5992 __ add(fp, sp, Operand(-EntryFrameConstants::kCallerFPOffset));
5993 5993
5994 // Call a faked try-block that does the invoke. 5994 // Call a faked try-block that does the invoke.
5995 __ bl(&invoke); 5995 __ bl(&invoke);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
6132 __ mov(r0, Operand(1)); // Arg count without receiver. 6132 __ mov(r0, Operand(1)); // Arg count without receiver.
6133 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_JS); 6133 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_JS);
6134 } 6134 }
6135 6135
6136 6136
6137 void ArgumentsAccessStub::GenerateReadLength(MacroAssembler* masm) { 6137 void ArgumentsAccessStub::GenerateReadLength(MacroAssembler* masm) {
6138 // Check if the calling frame is an arguments adaptor frame. 6138 // Check if the calling frame is an arguments adaptor frame.
6139 Label adaptor; 6139 Label adaptor;
6140 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 6140 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
6141 __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset)); 6141 __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset));
6142 __ cmp(r3, Operand(ArgumentsAdaptorFrame::SENTINEL)); 6142 __ cmp(r3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
6143 __ b(eq, &adaptor); 6143 __ b(eq, &adaptor);
6144 6144
6145 // Nothing to do: The formal number of parameters has already been 6145 // Nothing to do: The formal number of parameters has already been
6146 // passed in register r0 by calling function. Just return it. 6146 // passed in register r0 by calling function. Just return it.
6147 __ Jump(lr); 6147 __ Jump(lr);
6148 6148
6149 // Arguments adaptor case: Read the arguments length from the 6149 // Arguments adaptor case: Read the arguments length from the
6150 // adaptor frame and return it. 6150 // adaptor frame and return it.
6151 __ bind(&adaptor); 6151 __ bind(&adaptor);
6152 __ ldr(r0, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset)); 6152 __ ldr(r0, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset));
6153 __ Jump(lr); 6153 __ Jump(lr);
6154 } 6154 }
6155 6155
6156 6156
6157 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { 6157 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
6158 // The displacement is the offset of the last parameter (if any) 6158 // The displacement is the offset of the last parameter (if any)
6159 // relative to the frame pointer. 6159 // relative to the frame pointer.
6160 static const int kDisplacement = 6160 static const int kDisplacement =
6161 StandardFrameConstants::kCallerSPOffset - kPointerSize; 6161 StandardFrameConstants::kCallerSPOffset - kPointerSize;
6162 6162
6163 // Check that the key is a smi. 6163 // Check that the key is a smi.
6164 Label slow; 6164 Label slow;
6165 __ BranchOnNotSmi(r1, &slow); 6165 __ BranchOnNotSmi(r1, &slow);
6166 6166
6167 // Check if the calling frame is an arguments adaptor frame. 6167 // Check if the calling frame is an arguments adaptor frame.
6168 Label adaptor; 6168 Label adaptor;
6169 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 6169 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
6170 __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset)); 6170 __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset));
6171 __ cmp(r3, Operand(ArgumentsAdaptorFrame::SENTINEL)); 6171 __ cmp(r3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
6172 __ b(eq, &adaptor); 6172 __ b(eq, &adaptor);
6173 6173
6174 // Check index against formal parameters count limit passed in 6174 // Check index against formal parameters count limit passed in
6175 // through register eax. Use unsigned comparison to get negative 6175 // through register eax. Use unsigned comparison to get negative
6176 // check for free. 6176 // check for free.
6177 __ cmp(r1, r0); 6177 __ cmp(r1, r0);
6178 __ b(cs, &slow); 6178 __ b(cs, &slow);
6179 6179
6180 // Read the argument from the stack and return it. 6180 // Read the argument from the stack and return it.
6181 __ sub(r3, r0, r1); 6181 __ sub(r3, r0, r1);
(...skipping 21 matching lines...) Expand all
6203 __ push(r1); 6203 __ push(r1);
6204 __ TailCallRuntime(ExternalReference(Runtime::kGetArgumentsProperty), 1); 6204 __ TailCallRuntime(ExternalReference(Runtime::kGetArgumentsProperty), 1);
6205 } 6205 }
6206 6206
6207 6207
6208 void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) { 6208 void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) {
6209 // Check if the calling frame is an arguments adaptor frame. 6209 // Check if the calling frame is an arguments adaptor frame.
6210 Label runtime; 6210 Label runtime;
6211 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 6211 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
6212 __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset)); 6212 __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset));
6213 __ cmp(r3, Operand(ArgumentsAdaptorFrame::SENTINEL)); 6213 __ cmp(r3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
6214 __ b(ne, &runtime); 6214 __ b(ne, &runtime);
6215 6215
6216 // Patch the arguments.length and the parameters pointer. 6216 // Patch the arguments.length and the parameters pointer.
6217 __ ldr(r0, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset)); 6217 __ ldr(r0, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset));
6218 __ str(r0, MemOperand(sp, 0 * kPointerSize)); 6218 __ str(r0, MemOperand(sp, 0 * kPointerSize));
6219 __ add(r3, r2, Operand(r0, LSL, kPointerSizeLog2 - kSmiTagSize)); 6219 __ add(r3, r2, Operand(r0, LSL, kPointerSizeLog2 - kSmiTagSize));
6220 __ add(r3, r3, Operand(StandardFrameConstants::kCallerSPOffset)); 6220 __ add(r3, r3, Operand(StandardFrameConstants::kCallerSPOffset));
6221 __ str(r3, MemOperand(sp, 1 * kPointerSize)); 6221 __ str(r3, MemOperand(sp, 1 * kPointerSize));
6222 6222
6223 // Do the runtime call to allocate the arguments object. 6223 // Do the runtime call to allocate the arguments object.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
6257 int CompareStub::MinorKey() { 6257 int CompareStub::MinorKey() {
6258 // Encode the two parameters in a unique 16 bit value. 6258 // Encode the two parameters in a unique 16 bit value.
6259 ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15)); 6259 ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15));
6260 return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0); 6260 return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0);
6261 } 6261 }
6262 6262
6263 6263
6264 #undef __ 6264 #undef __
6265 6265
6266 } } // namespace v8::internal 6266 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/frames.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698