| 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 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 } | 792 } |
| 793 __ bind(&done); | 793 __ bind(&done); |
| 794 } | 794 } |
| 795 | 795 |
| 796 | 796 |
| 797 void FullCodeGenerator::VisitContinueStatement(ContinueStatement* stmt) { | 797 void FullCodeGenerator::VisitContinueStatement(ContinueStatement* stmt) { |
| 798 Comment cmnt(masm_, "[ ContinueStatement"); | 798 Comment cmnt(masm_, "[ ContinueStatement"); |
| 799 SetStatementPosition(stmt); | 799 SetStatementPosition(stmt); |
| 800 NestedStatement* current = nesting_stack_; | 800 NestedStatement* current = nesting_stack_; |
| 801 int stack_depth = 0; | 801 int stack_depth = 0; |
| 802 // When continuing, we clobber the unpredictable value in the accumulator |
| 803 // with one that's safe for GC. If we hit an exit from the try block of |
| 804 // try...finally on our way out, we will unconditionally preserve the |
| 805 // accumulator on the stack. |
| 806 ClearAccumulator(); |
| 802 while (!current->IsContinueTarget(stmt->target())) { | 807 while (!current->IsContinueTarget(stmt->target())) { |
| 803 stack_depth = current->Exit(stack_depth); | 808 stack_depth = current->Exit(stack_depth); |
| 804 current = current->outer(); | 809 current = current->outer(); |
| 805 } | 810 } |
| 806 __ Drop(stack_depth); | 811 __ Drop(stack_depth); |
| 807 | 812 |
| 808 Iteration* loop = current->AsIteration(); | 813 Iteration* loop = current->AsIteration(); |
| 809 __ jmp(loop->continue_target()); | 814 __ jmp(loop->continue_target()); |
| 810 } | 815 } |
| 811 | 816 |
| 812 | 817 |
| 813 void FullCodeGenerator::VisitBreakStatement(BreakStatement* stmt) { | 818 void FullCodeGenerator::VisitBreakStatement(BreakStatement* stmt) { |
| 814 Comment cmnt(masm_, "[ BreakStatement"); | 819 Comment cmnt(masm_, "[ BreakStatement"); |
| 815 SetStatementPosition(stmt); | 820 SetStatementPosition(stmt); |
| 816 NestedStatement* current = nesting_stack_; | 821 NestedStatement* current = nesting_stack_; |
| 817 int stack_depth = 0; | 822 int stack_depth = 0; |
| 823 // When breaking, we clobber the unpredictable value in the accumulator |
| 824 // with one that's safe for GC. If we hit an exit from the try block of |
| 825 // try...finally on our way out, we will unconditionally preserve the |
| 826 // accumulator on the stack. |
| 827 ClearAccumulator(); |
| 818 while (!current->IsBreakTarget(stmt->target())) { | 828 while (!current->IsBreakTarget(stmt->target())) { |
| 819 stack_depth = current->Exit(stack_depth); | 829 stack_depth = current->Exit(stack_depth); |
| 820 current = current->outer(); | 830 current = current->outer(); |
| 821 } | 831 } |
| 822 __ Drop(stack_depth); | 832 __ Drop(stack_depth); |
| 823 | 833 |
| 824 Breakable* target = current->AsBreakable(); | 834 Breakable* target = current->AsBreakable(); |
| 825 __ jmp(target->break_target()); | 835 __ jmp(target->break_target()); |
| 826 } | 836 } |
| 827 | 837 |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 } | 1107 } |
| 1098 | 1108 |
| 1099 __ bind(&try_handler_setup); | 1109 __ bind(&try_handler_setup); |
| 1100 { | 1110 { |
| 1101 // Setup try handler (stack pointer registers). | 1111 // Setup try handler (stack pointer registers). |
| 1102 TryFinally try_block(this, &finally_entry); | 1112 TryFinally try_block(this, &finally_entry); |
| 1103 __ PushTryHandler(IN_JAVASCRIPT, TRY_FINALLY_HANDLER); | 1113 __ PushTryHandler(IN_JAVASCRIPT, TRY_FINALLY_HANDLER); |
| 1104 Visit(stmt->try_block()); | 1114 Visit(stmt->try_block()); |
| 1105 __ PopTryHandler(); | 1115 __ PopTryHandler(); |
| 1106 } | 1116 } |
| 1107 // Execute the finally block on the way out. | 1117 // Execute the finally block on the way out. Clobber the unpredictable |
| 1118 // value in the accumulator with one that's safe for GC. The finally |
| 1119 // block will unconditionally preserve the accumulator on the stack. |
| 1120 ClearAccumulator(); |
| 1108 __ Call(&finally_entry); | 1121 __ Call(&finally_entry); |
| 1109 } | 1122 } |
| 1110 | 1123 |
| 1111 | 1124 |
| 1112 void FullCodeGenerator::VisitDebuggerStatement(DebuggerStatement* stmt) { | 1125 void FullCodeGenerator::VisitDebuggerStatement(DebuggerStatement* stmt) { |
| 1113 #ifdef ENABLE_DEBUGGER_SUPPORT | 1126 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 1114 Comment cmnt(masm_, "[ DebuggerStatement"); | 1127 Comment cmnt(masm_, "[ DebuggerStatement"); |
| 1115 SetStatementPosition(stmt); | 1128 SetStatementPosition(stmt); |
| 1116 | 1129 |
| 1117 __ DebugBreak(); | 1130 __ DebugBreak(); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1229 ASSERT(args->length() == 1); | 1242 ASSERT(args->length() == 1); |
| 1230 VisitForStackValue(args->at(0)); | 1243 VisitForStackValue(args->at(0)); |
| 1231 __ CallRuntime(Runtime::kRegExpCloneResult, 1); | 1244 __ CallRuntime(Runtime::kRegExpCloneResult, 1); |
| 1232 context()->Plug(result_register()); | 1245 context()->Plug(result_register()); |
| 1233 } | 1246 } |
| 1234 | 1247 |
| 1235 #undef __ | 1248 #undef __ |
| 1236 | 1249 |
| 1237 | 1250 |
| 1238 } } // namespace v8::internal | 1251 } } // namespace v8::internal |
| OLD | NEW |