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

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

Issue 2783002: Better handling of stepping out of a function... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 6 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/debug.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 ASSERT(loop_depth() == 0); 189 ASSERT(loop_depth() == 0);
190 VisitStatements(function()->body()); 190 VisitStatements(function()->body());
191 ASSERT(loop_depth() == 0); 191 ASSERT(loop_depth() == 0);
192 } 192 }
193 193
194 { Comment cmnt(masm_, "[ return <undefined>;"); 194 { Comment cmnt(masm_, "[ return <undefined>;");
195 // Emit a 'return undefined' in case control fell off the end of the 195 // Emit a 'return undefined' in case control fell off the end of the
196 // body. 196 // body.
197 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); 197 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
198 } 198 }
199 EmitReturnSequence(function()->end_position()); 199 EmitReturnSequence();
200 } 200 }
201 201
202 202
203 void FullCodeGenerator::EmitReturnSequence(int position) { 203 void FullCodeGenerator::EmitReturnSequence() {
204 Comment cmnt(masm_, "[ Return sequence"); 204 Comment cmnt(masm_, "[ Return sequence");
205 if (return_label_.is_bound()) { 205 if (return_label_.is_bound()) {
206 __ b(&return_label_); 206 __ b(&return_label_);
207 } else { 207 } else {
208 __ bind(&return_label_); 208 __ bind(&return_label_);
209 if (FLAG_trace) { 209 if (FLAG_trace) {
210 // Push the return value on the stack as the parameter. 210 // Push the return value on the stack as the parameter.
211 // Runtime::TraceExit returns its parameter in r0. 211 // Runtime::TraceExit returns its parameter in r0.
212 __ push(r0); 212 __ push(r0);
213 __ CallRuntime(Runtime::kTraceExit, 1); 213 __ CallRuntime(Runtime::kTraceExit, 1);
214 } 214 }
215 215
216 #ifdef DEBUG 216 #ifdef DEBUG
217 // Add a label for checking the size of the code used for returning. 217 // Add a label for checking the size of the code used for returning.
218 Label check_exit_codesize; 218 Label check_exit_codesize;
219 masm_->bind(&check_exit_codesize); 219 masm_->bind(&check_exit_codesize);
220 #endif 220 #endif
221 // Make sure that the constant pool is not emitted inside of the return 221 // Make sure that the constant pool is not emitted inside of the return
222 // sequence. 222 // sequence.
223 { Assembler::BlockConstPoolScope block_const_pool(masm_); 223 { Assembler::BlockConstPoolScope block_const_pool(masm_);
224 // Here we use masm_-> instead of the __ macro to avoid the code coverage 224 // Here we use masm_-> instead of the __ macro to avoid the code coverage
225 // tool from instrumenting as we rely on the code size here. 225 // tool from instrumenting as we rely on the code size here.
226 int32_t sp_delta = (scope()->num_parameters() + 1) * kPointerSize; 226 int32_t sp_delta = (scope()->num_parameters() + 1) * kPointerSize;
227 CodeGenerator::RecordPositions(masm_, position); 227 CodeGenerator::RecordPositions(masm_, function()->end_position());
228 __ RecordJSReturn(); 228 __ RecordJSReturn();
229 masm_->mov(sp, fp); 229 masm_->mov(sp, fp);
230 masm_->ldm(ia_w, sp, fp.bit() | lr.bit()); 230 masm_->ldm(ia_w, sp, fp.bit() | lr.bit());
231 masm_->add(sp, sp, Operand(sp_delta)); 231 masm_->add(sp, sp, Operand(sp_delta));
232 masm_->Jump(lr); 232 masm_->Jump(lr);
233 } 233 }
234 234
235 #ifdef DEBUG 235 #ifdef DEBUG
236 // Check that the size of the code used for returning matches what is 236 // Check that the size of the code used for returning matches what is
237 // expected by the debugger. If the sp_delts above cannot be encoded in the 237 // expected by the debugger. If the sp_delts above cannot be encoded in the
(...skipping 2897 matching lines...) Expand 10 before | Expand all | Expand 10 after
3135 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. 3135 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value.
3136 __ add(pc, r1, Operand(masm_->CodeObject())); 3136 __ add(pc, r1, Operand(masm_->CodeObject()));
3137 } 3137 }
3138 3138
3139 3139
3140 #undef __ 3140 #undef __
3141 3141
3142 } } // namespace v8::internal 3142 } } // namespace v8::internal
3143 3143
3144 #endif // V8_TARGET_ARCH_ARM 3144 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/debug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698