OLD | NEW |
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 2812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2823 } else { | 2823 } else { |
2824 // Fake TOS for targets that shadowed breaks and continues. | 2824 // Fake TOS for targets that shadowed breaks and continues. |
2825 frame_->EmitPush(Immediate(Factory::undefined_value())); | 2825 frame_->EmitPush(Immediate(Factory::undefined_value())); |
2826 } | 2826 } |
2827 __ Set(ecx, Immediate(Smi::FromInt(JUMPING + i))); | 2827 __ Set(ecx, Immediate(Smi::FromInt(JUMPING + i))); |
2828 unlink.Jump(); | 2828 unlink.Jump(); |
2829 } | 2829 } |
2830 } | 2830 } |
2831 | 2831 |
2832 // Unlink from try chain; be careful not to destroy the TOS. | 2832 // Unlink from try chain; be careful not to destroy the TOS. |
2833 unlink.Bind(); | 2833 if (unlink.is_linked()) { |
2834 // Reload sp from the top handler, because some statements that we | 2834 unlink.Bind(); |
2835 // break from (eg, for...in) may have left stuff on the stack. | 2835 } |
2836 // Preserve the TOS in a register across stack manipulation. | |
2837 frame_->EmitPop(eax); | |
2838 ExternalReference handler_address(Top::k_handler_address); | |
2839 __ mov(edx, Operand::StaticVariable(handler_address)); | |
2840 const int kNextOffset = StackHandlerConstants::kNextOffset + | |
2841 StackHandlerConstants::kAddressDisplacement; | |
2842 __ lea(esp, Operand(edx, kNextOffset)); | |
2843 frame_->Forget(frame_->height() - handler_height); | |
2844 | 2836 |
2845 frame_->EmitPop(Operand::StaticVariable(handler_address)); | 2837 // Control can reach here via a jump to unlink or by falling off the |
2846 frame_->Drop(StackHandlerConstants::kSize / kPointerSize - 1); | 2838 // end of the try block (with no unlinks). |
2847 // Next_sp popped. | 2839 if (has_valid_frame()) { |
2848 frame_->EmitPush(eax); | 2840 // Reload sp from the top handler, because some statements that we |
| 2841 // break from (eg, for...in) may have left stuff on the stack. |
| 2842 // Preserve the TOS in a register across stack manipulation. |
| 2843 frame_->EmitPop(eax); |
| 2844 ExternalReference handler_address(Top::k_handler_address); |
| 2845 __ mov(edx, Operand::StaticVariable(handler_address)); |
| 2846 const int kNextOffset = StackHandlerConstants::kNextOffset + |
| 2847 StackHandlerConstants::kAddressDisplacement; |
| 2848 __ lea(esp, Operand(edx, kNextOffset)); |
| 2849 frame_->Forget(frame_->height() - handler_height); |
| 2850 |
| 2851 frame_->EmitPop(Operand::StaticVariable(handler_address)); |
| 2852 frame_->Drop(StackHandlerConstants::kSize / kPointerSize - 1); |
| 2853 // Next_sp popped. |
| 2854 frame_->EmitPush(eax); |
| 2855 } |
2849 | 2856 |
2850 // --- Finally block --- | 2857 // --- Finally block --- |
2851 finally_block.Bind(); | 2858 finally_block.Bind(); |
2852 | 2859 |
2853 // Push the state on the stack. | 2860 // Push the state on the stack. |
2854 frame_->EmitPush(ecx); | 2861 frame_->EmitPush(ecx); |
2855 | 2862 |
2856 // We keep two elements on the stack - the (possibly faked) result | 2863 // We keep two elements on the stack - the (possibly faked) result |
2857 // and the state - while evaluating the finally block. Record it, so | 2864 // and the state - while evaluating the finally block. Record it, so |
2858 // that a break/continue crossing this statement can restore the | 2865 // that a break/continue crossing this statement can restore the |
(...skipping 3960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6819 | 6826 |
6820 // Slow-case: Go through the JavaScript implementation. | 6827 // Slow-case: Go through the JavaScript implementation. |
6821 __ bind(&slow); | 6828 __ bind(&slow); |
6822 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 6829 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
6823 } | 6830 } |
6824 | 6831 |
6825 | 6832 |
6826 #undef __ | 6833 #undef __ |
6827 | 6834 |
6828 } } // namespace v8::internal | 6835 } } // namespace v8::internal |
OLD | NEW |