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

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

Issue 5625: Fix issue 86 by keeping track of the fact that finally blocks... (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 | « no previous file | 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)
3186 // result - while evaluating the finally block. Record it, so that a
3187 // break/continue crossing this statement can restore the stack.
3188 const int kFinallyStackSize = 1 * kPointerSize;
3189 break_stack_height_ += kFinallyStackSize;
3190
3185 // Push the state on the stack. If necessary move the state to a 3191 // Push the state on the stack. If necessary move the state to a
3186 // local variable to avoid having extra values on the stack while 3192 // local variable to avoid having extra values on the stack while
3187 // evaluating the finally block. 3193 // evaluating the finally block.
3188 __ push(r2); 3194 __ push(r2);
3189 if (node->finally_var() != NULL) { 3195 if (node->finally_var() != NULL) {
3190 Reference target(this, node->finally_var()); 3196 Reference target(this, node->finally_var());
3191 SetValue(&target); 3197 SetValue(&target);
3192 ASSERT(target.size() == 0); // no extra stuff on the stack 3198 ASSERT(target.size() == 0); // no extra stuff on the stack
3193 __ pop(); // remove the extra avalue that was pushed above 3199 __ pop(); // remove the extra avalue that was pushed above
3194 } 3200 }
3195 3201
3196 // Generate code for the statements in the finally block. 3202 // Generate code for the statements in the finally block.
3197 VisitStatements(node->finally_block()->statements()); 3203 VisitStatements(node->finally_block()->statements());
3198 3204
3199 // Get the state from the stack - or the local variable. 3205 // Get the state from the stack - or the local variable.
3200 if (node->finally_var() != NULL) { 3206 if (node->finally_var() != NULL) {
3201 Reference target(this, node->finally_var()); 3207 Reference target(this, node->finally_var());
3202 GetValue(&target); 3208 GetValue(&target);
3203 } 3209 }
3204 __ pop(r2); 3210 __ pop(r2);
3205 3211
3206 __ pop(r0); // Restore value or faked TOS. 3212 // Restore return value or faked TOS.
3213 __ pop(r0);
3214
3215 // Record the fact that the result has been removed from the stack.
3216 break_stack_height_ -= kFinallyStackSize;
3217
3207 // Generate code that jumps to the right destination for all used 3218 // Generate code that jumps to the right destination for all used
3208 // shadow labels. 3219 // shadow labels.
3209 for (int i = 0; i <= nof_escapes; i++) { 3220 for (int i = 0; i <= nof_escapes; i++) {
3210 if (shadows[i]->is_bound()) { 3221 if (shadows[i]->is_bound()) {
3211 __ cmp(r2, Operand(Smi::FromInt(JUMPING + i))); 3222 __ cmp(r2, Operand(Smi::FromInt(JUMPING + i)));
3212 if (shadows[i]->shadowed() != &function_return_) { 3223 if (shadows[i]->shadowed() != &function_return_) {
3213 Label next; 3224 Label next;
3214 __ b(ne, &next); 3225 __ b(ne, &next);
3215 __ b(shadows[i]->shadowed()); 3226 __ b(shadows[i]->shadowed());
3216 __ bind(&next); 3227 __ bind(&next);
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after
4531 bool is_eval) { 4542 bool is_eval) {
4532 Handle<Code> code = ArmCodeGenerator::MakeCode(fun, script, is_eval); 4543 Handle<Code> code = ArmCodeGenerator::MakeCode(fun, script, is_eval);
4533 if (!code.is_null()) { 4544 if (!code.is_null()) {
4534 Counters::total_compiled_code_size.Increment(code->instruction_size()); 4545 Counters::total_compiled_code_size.Increment(code->instruction_size());
4535 } 4546 }
4536 return code; 4547 return code;
4537 } 4548 }
4538 4549
4539 4550
4540 } } // namespace v8::internal 4551 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698