| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 } | 788 } |
| 789 __ bind(&done); | 789 __ bind(&done); |
| 790 } | 790 } |
| 791 | 791 |
| 792 | 792 |
| 793 void FullCodeGenerator::VisitContinueStatement(ContinueStatement* stmt) { | 793 void FullCodeGenerator::VisitContinueStatement(ContinueStatement* stmt) { |
| 794 Comment cmnt(masm_, "[ ContinueStatement"); | 794 Comment cmnt(masm_, "[ ContinueStatement"); |
| 795 SetStatementPosition(stmt); | 795 SetStatementPosition(stmt); |
| 796 NestedStatement* current = nesting_stack_; | 796 NestedStatement* current = nesting_stack_; |
| 797 int stack_depth = 0; | 797 int stack_depth = 0; |
| 798 // When continuing, we clobber the unpredictable value in the accumulator |
| 799 // with one that's safe for GC. If we hit an exit from the try block of |
| 800 // try...finally on our way out, we will unconditionally preserve the |
| 801 // accumulator on the stack. |
| 802 ClearAccumulator(); |
| 798 while (!current->IsContinueTarget(stmt->target())) { | 803 while (!current->IsContinueTarget(stmt->target())) { |
| 799 stack_depth = current->Exit(stack_depth); | 804 stack_depth = current->Exit(stack_depth); |
| 800 current = current->outer(); | 805 current = current->outer(); |
| 801 } | 806 } |
| 802 __ Drop(stack_depth); | 807 __ Drop(stack_depth); |
| 803 | 808 |
| 804 Iteration* loop = current->AsIteration(); | 809 Iteration* loop = current->AsIteration(); |
| 805 __ jmp(loop->continue_target()); | 810 __ jmp(loop->continue_target()); |
| 806 } | 811 } |
| 807 | 812 |
| 808 | 813 |
| 809 void FullCodeGenerator::VisitBreakStatement(BreakStatement* stmt) { | 814 void FullCodeGenerator::VisitBreakStatement(BreakStatement* stmt) { |
| 810 Comment cmnt(masm_, "[ BreakStatement"); | 815 Comment cmnt(masm_, "[ BreakStatement"); |
| 811 SetStatementPosition(stmt); | 816 SetStatementPosition(stmt); |
| 812 NestedStatement* current = nesting_stack_; | 817 NestedStatement* current = nesting_stack_; |
| 813 int stack_depth = 0; | 818 int stack_depth = 0; |
| 819 // When breaking, we clobber the unpredictable value in the accumulator |
| 820 // with one that's safe for GC. If we hit an exit from the try block of |
| 821 // try...finally on our way out, we will unconditionally preserve the |
| 822 // accumulator on the stack. |
| 823 ClearAccumulator(); |
| 814 while (!current->IsBreakTarget(stmt->target())) { | 824 while (!current->IsBreakTarget(stmt->target())) { |
| 815 stack_depth = current->Exit(stack_depth); | 825 stack_depth = current->Exit(stack_depth); |
| 816 current = current->outer(); | 826 current = current->outer(); |
| 817 } | 827 } |
| 818 __ Drop(stack_depth); | 828 __ Drop(stack_depth); |
| 819 | 829 |
| 820 Breakable* target = current->AsBreakable(); | 830 Breakable* target = current->AsBreakable(); |
| 821 __ jmp(target->break_target()); | 831 __ jmp(target->break_target()); |
| 822 } | 832 } |
| 823 | 833 |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 } | 1103 } |
| 1094 | 1104 |
| 1095 __ bind(&try_handler_setup); | 1105 __ bind(&try_handler_setup); |
| 1096 { | 1106 { |
| 1097 // Setup try handler (stack pointer registers). | 1107 // Setup try handler (stack pointer registers). |
| 1098 TryFinally try_block(this, &finally_entry); | 1108 TryFinally try_block(this, &finally_entry); |
| 1099 __ PushTryHandler(IN_JAVASCRIPT, TRY_FINALLY_HANDLER); | 1109 __ PushTryHandler(IN_JAVASCRIPT, TRY_FINALLY_HANDLER); |
| 1100 Visit(stmt->try_block()); | 1110 Visit(stmt->try_block()); |
| 1101 __ PopTryHandler(); | 1111 __ PopTryHandler(); |
| 1102 } | 1112 } |
| 1103 // Execute the finally block on the way out. | 1113 // Execute the finally block on the way out. Clobber the unpredictable |
| 1114 // value in the accumulator with one that's safe for GC. The finally |
| 1115 // block will unconditionally preserve the accumulator on the stack. |
| 1116 ClearAccumulator(); |
| 1104 __ Call(&finally_entry); | 1117 __ Call(&finally_entry); |
| 1105 } | 1118 } |
| 1106 | 1119 |
| 1107 | 1120 |
| 1108 void FullCodeGenerator::VisitDebuggerStatement(DebuggerStatement* stmt) { | 1121 void FullCodeGenerator::VisitDebuggerStatement(DebuggerStatement* stmt) { |
| 1109 #ifdef ENABLE_DEBUGGER_SUPPORT | 1122 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 1110 Comment cmnt(masm_, "[ DebuggerStatement"); | 1123 Comment cmnt(masm_, "[ DebuggerStatement"); |
| 1111 SetStatementPosition(stmt); | 1124 SetStatementPosition(stmt); |
| 1112 | 1125 |
| 1113 __ DebugBreak(); | 1126 __ DebugBreak(); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 __ Drop(stack_depth); | 1231 __ Drop(stack_depth); |
| 1219 __ PopTryHandler(); | 1232 __ PopTryHandler(); |
| 1220 return 0; | 1233 return 0; |
| 1221 } | 1234 } |
| 1222 | 1235 |
| 1223 | 1236 |
| 1224 #undef __ | 1237 #undef __ |
| 1225 | 1238 |
| 1226 | 1239 |
| 1227 } } // namespace v8::internal | 1240 } } // namespace v8::internal |
| OLD | NEW |