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

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

Issue 28021: Experimental: cleanup the handling of try...catch and try...finally on... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: Created 11 years, 10 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') | no next file » | 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 2636 matching lines...) Expand 10 before | Expand all | Expand 10 after
2647 // handler structure. 2647 // handler structure.
2648 if (FLAG_debug_code) { 2648 if (FLAG_debug_code) {
2649 __ mov(eax, Operand::StaticVariable(handler_address)); 2649 __ mov(eax, Operand::StaticVariable(handler_address));
2650 __ lea(eax, Operand(eax, StackHandlerConstants::kAddressDisplacement)); 2650 __ lea(eax, Operand(eax, StackHandlerConstants::kAddressDisplacement));
2651 __ cmp(esp, Operand(eax)); 2651 __ cmp(esp, Operand(eax));
2652 __ Assert(equal, "stack pointer should point to top handler"); 2652 __ Assert(equal, "stack pointer should point to top handler");
2653 } 2653 }
2654 2654
2655 // If we can fall off the end of the try block, unlink from try chain. 2655 // If we can fall off the end of the try block, unlink from try chain.
2656 if (has_valid_frame()) { 2656 if (has_valid_frame()) {
2657 // The TOS is the next handler address.
2657 frame_->EmitPop(eax); 2658 frame_->EmitPop(eax);
2658 __ mov(Operand::StaticVariable(handler_address), eax); // TOS == next_sp 2659 __ mov(Operand::StaticVariable(handler_address), eax);
2659 frame_->Drop(StackHandlerConstants::kSize / kPointerSize - 1); 2660 frame_->Drop(StackHandlerConstants::kSize / kPointerSize - 1);
2660 // next_sp popped.
2661 if (nof_unlinks > 0) { 2661 if (nof_unlinks > 0) {
2662 exit.Jump(); 2662 exit.Jump();
2663 } 2663 }
2664 } 2664 }
2665 2665
2666 // Generate unlink code for the (formerly) shadowing targets that have been 2666 // Generate unlink code for the (formerly) shadowing targets that have been
2667 // jumped to. 2667 // jumped to.
2668 for (int i = 0; i <= nof_escapes; i++) { 2668 for (int i = 0; i <= nof_escapes; i++) {
2669 if (shadows[i]->is_linked()) { 2669 if (shadows[i]->is_linked()) {
2670 // Unlink from try chain; be careful not to destroy the TOS. 2670 // Unlink from try chain; be careful not to destroy the TOS.
2671 // 2671 shadows[i]->Bind();
2672 // Because we can be jumping here (to spilled code) from unspilled 2672 // Because we can be jumping here (to spilled code) from unspilled
2673 // code, we need to reestablish a spilled frame at this block. 2673 // code, we need to reestablish a spilled frame at this block.
2674 shadows[i]->Bind();
2675 frame_->SpillAll(); 2674 frame_->SpillAll();
2676 2675
2677 // Reload sp from the top handler, because some statements that we 2676 // Reload sp from the top handler, because some statements that we
2678 // break from (eg, for...in) may have left stuff on the stack. 2677 // break from (eg, for...in) may have left stuff on the stack.
2679 __ mov(edx, Operand::StaticVariable(handler_address)); 2678 __ mov(edx, Operand::StaticVariable(handler_address));
2680 const int kNextOffset = StackHandlerConstants::kNextOffset + 2679 const int kNextOffset = StackHandlerConstants::kNextOffset +
2681 StackHandlerConstants::kAddressDisplacement; 2680 StackHandlerConstants::kAddressDisplacement;
2682 __ lea(esp, Operand(edx, kNextOffset)); 2681 __ lea(esp, Operand(edx, kNextOffset));
2683 frame_->Forget(frame_->height() - handler_height); 2682 frame_->Forget(frame_->height() - handler_height);
2684 2683
(...skipping 27 matching lines...) Expand all
2712 JumpTarget try_block(this); 2711 JumpTarget try_block(this);
2713 JumpTarget finally_block(this); 2712 JumpTarget finally_block(this);
2714 2713
2715 try_block.Call(); 2714 try_block.Call();
2716 2715
2717 frame_->EmitPush(eax); 2716 frame_->EmitPush(eax);
2718 // In case of thrown exceptions, this is where we continue. 2717 // In case of thrown exceptions, this is where we continue.
2719 __ Set(ecx, Immediate(Smi::FromInt(THROWING))); 2718 __ Set(ecx, Immediate(Smi::FromInt(THROWING)));
2720 finally_block.Jump(); 2719 finally_block.Jump();
2721 2720
2722
2723 // --- Try block --- 2721 // --- Try block ---
2724 try_block.Bind(); 2722 try_block.Bind();
2725 2723
2726 frame_->PushTryHandler(TRY_FINALLY_HANDLER); 2724 frame_->PushTryHandler(TRY_FINALLY_HANDLER);
2727 int handler_height = frame_->height(); 2725 int handler_height = frame_->height();
2728 2726
2729 // Shadow the jump targets for all escapes from the try block, including 2727 // Shadow the jump targets for all escapes from the try block, including
2730 // returns. During shadowing, the original target is hidden as the 2728 // returns. During shadowing, the original target is hidden as the
2731 // ShadowTarget and operations on the original actually affect the 2729 // ShadowTarget and operations on the original actually affect the
2732 // shadowing target. 2730 // shadowing target.
(...skipping 3936 matching lines...) Expand 10 before | Expand all | Expand 10 after
6669 6667
6670 // Slow-case: Go through the JavaScript implementation. 6668 // Slow-case: Go through the JavaScript implementation.
6671 __ bind(&slow); 6669 __ bind(&slow);
6672 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); 6670 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION);
6673 } 6671 }
6674 6672
6675 6673
6676 #undef __ 6674 #undef __
6677 6675
6678 } } // namespace v8::internal 6676 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/codegen-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698