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

Side by Side Diff: src/codegen-ia32.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/codegen-arm.cc ('k') | src/parser.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 3540 matching lines...) Expand 10 before | Expand all | Expand 10 after
3551 __ lea(esp, Operand(edx, kNextOffset)); 3551 __ lea(esp, Operand(edx, kNextOffset));
3552 3552
3553 __ pop(Operand::StaticVariable(handler_address)); 3553 __ pop(Operand::StaticVariable(handler_address));
3554 __ add(Operand(esp), Immediate(StackHandlerConstants::kSize - kPointerSize)); 3554 __ add(Operand(esp), Immediate(StackHandlerConstants::kSize - kPointerSize));
3555 // next_sp popped. 3555 // next_sp popped.
3556 __ push(eax); // preserve the TOS in a register across stack manipulation 3556 __ push(eax); // preserve the TOS in a register across stack manipulation
3557 3557
3558 // --- Finally block --- 3558 // --- Finally block ---
3559 __ bind(&finally_block); 3559 __ bind(&finally_block);
3560 3560
3561 // We keep a single element on the stack - the (possibly faked) 3561 // Push the state on the stack.
3562 // result - while evaluating the finally block. Record it, so that a 3562 __ push(ecx);
3563 // break/continue crossing this statement can restore the stack. 3563
3564 const int kFinallyStackSize = 1 * kPointerSize; 3564 // We keep two elements on the stack - the (possibly faked) result
3565 // and the state - while evaluating the finally block. Record it, so
3566 // that a break/continue crossing this statement can restore the
3567 // stack.
3568 const int kFinallyStackSize = 2 * kPointerSize;
3565 break_stack_height_ += kFinallyStackSize; 3569 break_stack_height_ += kFinallyStackSize;
3566 3570
3567 // Push the state on the stack. If necessary move the state to a
3568 // local variable to avoid having extra values on the stack while
3569 // evaluating the finally block.
3570 __ push(ecx);
3571 if (node->finally_var() != NULL) {
3572 Reference target(this, node->finally_var());
3573 SetValue(&target);
3574 ASSERT(target.size() == 0); // no extra stuff on the stack
3575 __ pop(edx); // remove the extra value that was pushed above
3576 }
3577
3578 // Generate code for the statements in the finally block. 3571 // Generate code for the statements in the finally block.
3579 VisitStatements(node->finally_block()->statements()); 3572 VisitStatements(node->finally_block()->statements());
3580 3573
3581 // Get the state from the stack - or the local variable - and 3574 // Restore state and return value or faked TOS.
3582 // restore the TOS register.
3583 if (node->finally_var() != NULL) {
3584 Reference target(this, node->finally_var());
3585 GetValue(&target);
3586 }
3587 __ pop(ecx); 3575 __ pop(ecx);
3588
3589 // Restore return value or faked TOS.
3590 __ pop(eax); 3576 __ pop(eax);
3591
3592 // Record the fact that the result has been removed from the stack.
3593 break_stack_height_ -= kFinallyStackSize; 3577 break_stack_height_ -= kFinallyStackSize;
3594 3578
3595 // Generate code that jumps to the right destination for all used 3579 // Generate code that jumps to the right destination for all used
3596 // shadow labels. 3580 // shadow labels.
3597 for (int i = 0; i <= nof_escapes; i++) { 3581 for (int i = 0; i <= nof_escapes; i++) {
3598 if (shadows[i]->is_bound()) { 3582 if (shadows[i]->is_bound()) {
3599 __ cmp(Operand(ecx), Immediate(Smi::FromInt(JUMPING + i))); 3583 __ cmp(Operand(ecx), Immediate(Smi::FromInt(JUMPING + i)));
3600 __ j(equal, shadows[i]->shadowed()); 3584 __ j(equal, shadows[i]->shadowed());
3601 } 3585 }
3602 } 3586 }
(...skipping 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after
5489 bool is_eval) { 5473 bool is_eval) {
5490 Handle<Code> code = Ia32CodeGenerator::MakeCode(fun, script, is_eval); 5474 Handle<Code> code = Ia32CodeGenerator::MakeCode(fun, script, is_eval);
5491 if (!code.is_null()) { 5475 if (!code.is_null()) {
5492 Counters::total_compiled_code_size.Increment(code->instruction_size()); 5476 Counters::total_compiled_code_size.Increment(code->instruction_size());
5493 } 5477 }
5494 return code; 5478 return code;
5495 } 5479 }
5496 5480
5497 5481
5498 } } // namespace v8::internal 5482 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/codegen-arm.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698