| 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 2903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2914 // Push the state on the stack. | 2914 // Push the state on the stack. |
| 2915 frame_->EmitPush(ecx); | 2915 frame_->EmitPush(ecx); |
| 2916 | 2916 |
| 2917 // We keep two elements on the stack - the (possibly faked) result | 2917 // We keep two elements on the stack - the (possibly faked) result |
| 2918 // and the state - while evaluating the finally block. | 2918 // and the state - while evaluating the finally block. |
| 2919 // | 2919 // |
| 2920 // Generate code for the statements in the finally block. | 2920 // Generate code for the statements in the finally block. |
| 2921 VisitStatementsAndSpill(node->finally_block()->statements()); | 2921 VisitStatementsAndSpill(node->finally_block()->statements()); |
| 2922 | 2922 |
| 2923 if (has_valid_frame()) { | 2923 if (has_valid_frame()) { |
| 2924 JumpTarget exit(this); | |
| 2925 // Restore state and return value or faked TOS. | 2924 // Restore state and return value or faked TOS. |
| 2926 frame_->EmitPop(ecx); | 2925 frame_->EmitPop(ecx); |
| 2927 frame_->EmitPop(eax); | 2926 frame_->EmitPop(eax); |
| 2927 } |
| 2928 | 2928 |
| 2929 // Generate code to jump to the right destination for all used | 2929 // Generate code to jump to the right destination for all used |
| 2930 // formerly shadowing targets. Deallocate each shadow target. | 2930 // formerly shadowing targets. Deallocate each shadow target. |
| 2931 for (int i = 0; i < shadows.length(); i++) { | 2931 for (int i = 0; i < shadows.length(); i++) { |
| 2932 if (shadows[i]->is_bound()) { | 2932 if (has_valid_frame() && shadows[i]->is_bound()) { |
| 2933 JumpTarget* original = shadows[i]->other_target(); | 2933 JumpTarget* original = shadows[i]->other_target(); |
| 2934 __ cmp(Operand(ecx), Immediate(Smi::FromInt(JUMPING + i))); | 2934 __ cmp(Operand(ecx), Immediate(Smi::FromInt(JUMPING + i))); |
| 2935 if (!function_return_is_shadowed_ && i == kReturnShadowIndex) { | 2935 if (!function_return_is_shadowed_ && i == kReturnShadowIndex) { |
| 2936 JumpTarget skip(this); | 2936 JumpTarget skip(this); |
| 2937 skip.Branch(not_equal); | 2937 skip.Branch(not_equal); |
| 2938 frame_->PrepareForReturn(); | 2938 frame_->PrepareForReturn(); |
| 2939 original->Jump(); | 2939 original->Jump(); |
| 2940 skip.Bind(); | 2940 skip.Bind(); |
| 2941 } else { | 2941 } else { |
| 2942 original->Branch(equal); | 2942 original->Branch(equal); |
| 2943 } | |
| 2944 } | 2943 } |
| 2945 delete shadows[i]; | |
| 2946 } | 2944 } |
| 2945 delete shadows[i]; |
| 2946 } |
| 2947 | 2947 |
| 2948 if (has_valid_frame()) { |
| 2948 // Check if we need to rethrow the exception. | 2949 // Check if we need to rethrow the exception. |
| 2950 JumpTarget exit(this); |
| 2949 __ cmp(Operand(ecx), Immediate(Smi::FromInt(THROWING))); | 2951 __ cmp(Operand(ecx), Immediate(Smi::FromInt(THROWING))); |
| 2950 exit.Branch(not_equal); | 2952 exit.Branch(not_equal); |
| 2951 | 2953 |
| 2952 // Rethrow exception. | 2954 // Rethrow exception. |
| 2953 frame_->EmitPush(eax); // undo pop from above | 2955 frame_->EmitPush(eax); // undo pop from above |
| 2954 frame_->CallRuntime(Runtime::kReThrow, 1); | 2956 frame_->CallRuntime(Runtime::kReThrow, 1); |
| 2955 | 2957 |
| 2956 // Done. | 2958 // Done. |
| 2957 exit.Bind(); | 2959 exit.Bind(); |
| 2958 } | 2960 } |
| (...skipping 3974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6933 | 6935 |
| 6934 // Slow-case: Go through the JavaScript implementation. | 6936 // Slow-case: Go through the JavaScript implementation. |
| 6935 __ bind(&slow); | 6937 __ bind(&slow); |
| 6936 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 6938 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
| 6937 } | 6939 } |
| 6938 | 6940 |
| 6939 | 6941 |
| 6940 #undef __ | 6942 #undef __ |
| 6941 | 6943 |
| 6942 } } // namespace v8::internal | 6944 } } // namespace v8::internal |
| OLD | NEW |