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

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

Issue 5626: Get rid of the local variable we use to keep the state... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 2 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/ast.h ('k') | src/codegen-ia32.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 3164 matching lines...) Expand 10 before | Expand all | Expand 10 after
3175 __ ldr(r1, MemOperand(sp, kNextOffset)); 3175 __ ldr(r1, MemOperand(sp, kNextOffset));
3176 __ str(r1, MemOperand(r3)); 3176 __ str(r1, MemOperand(r3));
3177 ASSERT(StackHandlerConstants::kCodeOffset == 0); // first field is code 3177 ASSERT(StackHandlerConstants::kCodeOffset == 0); // first field is code
3178 __ add(sp, sp, Operand(StackHandlerConstants::kSize - kPointerSize)); 3178 __ add(sp, sp, Operand(StackHandlerConstants::kSize - kPointerSize));
3179 // Code slot popped. 3179 // Code slot popped.
3180 __ push(r0); 3180 __ push(r0);
3181 3181
3182 // --- Finally block --- 3182 // --- Finally block ---
3183 __ bind(&finally_block); 3183 __ bind(&finally_block);
3184 3184
3185 // We keep a single element on the stack - the (possibly faked) 3185 // Push the state on the stack.
3186 // result - while evaluating the finally block. Record it, so that a 3186 __ push(r2);
3187 // break/continue crossing this statement can restore the stack. 3187
3188 const int kFinallyStackSize = 1 * kPointerSize; 3188 // We keep two elements on the stack - the (possibly faked) result
3189 // and the state - while evaluating the finally block. Record it, so
3190 // that a break/continue crossing this statement can restore the
3191 // stack.
3192 const int kFinallyStackSize = 2 * kPointerSize;
3189 break_stack_height_ += kFinallyStackSize; 3193 break_stack_height_ += kFinallyStackSize;
3190 3194
3191 // Push the state on the stack. If necessary move the state to a
3192 // local variable to avoid having extra values on the stack while
3193 // evaluating the finally block.
3194 __ push(r2);
3195 if (node->finally_var() != NULL) {
3196 Reference target(this, node->finally_var());
3197 SetValue(&target);
3198 ASSERT(target.size() == 0); // no extra stuff on the stack
3199 __ pop(); // remove the extra avalue that was pushed above
3200 }
3201
3202 // Generate code for the statements in the finally block. 3195 // Generate code for the statements in the finally block.
3203 VisitStatements(node->finally_block()->statements()); 3196 VisitStatements(node->finally_block()->statements());
3204 3197
3205 // Get the state from the stack - or the local variable. 3198 // Restore state and return value or faked TOS.
3206 if (node->finally_var() != NULL) {
3207 Reference target(this, node->finally_var());
3208 GetValue(&target);
3209 }
3210 __ pop(r2); 3199 __ pop(r2);
3211
3212 // Restore return value or faked TOS.
3213 __ pop(r0); 3200 __ pop(r0);
3214
3215 // Record the fact that the result has been removed from the stack.
3216 break_stack_height_ -= kFinallyStackSize; 3201 break_stack_height_ -= kFinallyStackSize;
3217 3202
3218 // Generate code that jumps to the right destination for all used 3203 // Generate code that jumps to the right destination for all used
3219 // shadow labels. 3204 // shadow labels.
3220 for (int i = 0; i <= nof_escapes; i++) { 3205 for (int i = 0; i <= nof_escapes; i++) {
3221 if (shadows[i]->is_bound()) { 3206 if (shadows[i]->is_bound()) {
3222 __ cmp(r2, Operand(Smi::FromInt(JUMPING + i))); 3207 __ cmp(r2, Operand(Smi::FromInt(JUMPING + i)));
3223 if (shadows[i]->shadowed() != &function_return_) { 3208 if (shadows[i]->shadowed() != &function_return_) {
3224 Label next; 3209 Label next;
3225 __ b(ne, &next); 3210 __ b(ne, &next);
(...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after
4542 bool is_eval) { 4527 bool is_eval) {
4543 Handle<Code> code = ArmCodeGenerator::MakeCode(fun, script, is_eval); 4528 Handle<Code> code = ArmCodeGenerator::MakeCode(fun, script, is_eval);
4544 if (!code.is_null()) { 4529 if (!code.is_null()) {
4545 Counters::total_compiled_code_size.Increment(code->instruction_size()); 4530 Counters::total_compiled_code_size.Increment(code->instruction_size());
4546 } 4531 }
4547 return code; 4532 return code;
4548 } 4533 }
4549 4534
4550 4535
4551 } } // namespace v8::internal 4536 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698