OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // Return is breakable if the expression is. | 89 // Return is breakable if the expression is. |
90 Visit(stmt->expression()); | 90 Visit(stmt->expression()); |
91 } | 91 } |
92 | 92 |
93 | 93 |
94 void BreakableStatementChecker::VisitWithStatement(WithStatement* stmt) { | 94 void BreakableStatementChecker::VisitWithStatement(WithStatement* stmt) { |
95 Visit(stmt->expression()); | 95 Visit(stmt->expression()); |
96 } | 96 } |
97 | 97 |
98 | 98 |
99 void BreakableStatementChecker::VisitExitContextStatement( | |
100 ExitContextStatement* stmt) { | |
101 } | |
102 | |
103 | |
104 void BreakableStatementChecker::VisitSwitchStatement(SwitchStatement* stmt) { | 99 void BreakableStatementChecker::VisitSwitchStatement(SwitchStatement* stmt) { |
105 // Switch statements breakable if the tag expression is. | 100 // Switch statements breakable if the tag expression is. |
106 Visit(stmt->tag()); | 101 Visit(stmt->tag()); |
107 } | 102 } |
108 | 103 |
109 | 104 |
110 void BreakableStatementChecker::VisitDoWhileStatement(DoWhileStatement* stmt) { | 105 void BreakableStatementChecker::VisitDoWhileStatement(DoWhileStatement* stmt) { |
111 // Mark do while as breakable to avoid adding a break slot in front of it. | 106 // Mark do while as breakable to avoid adding a break slot in front of it. |
112 is_breakable_ = true; | 107 is_breakable_ = true; |
113 } | 108 } |
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 Visit(stmt->statement()); | 977 Visit(stmt->statement()); |
983 } | 978 } |
984 | 979 |
985 // Pop context. | 980 // Pop context. |
986 LoadContextField(context_register(), Context::PREVIOUS_INDEX); | 981 LoadContextField(context_register(), Context::PREVIOUS_INDEX); |
987 // Update local stack frame context field. | 982 // Update local stack frame context field. |
988 StoreToFrameField(StandardFrameConstants::kContextOffset, context_register()); | 983 StoreToFrameField(StandardFrameConstants::kContextOffset, context_register()); |
989 } | 984 } |
990 | 985 |
991 | 986 |
992 void FullCodeGenerator::VisitExitContextStatement(ExitContextStatement* stmt) { | |
993 Comment cmnt(masm_, "[ ExitContextStatement"); | |
994 SetStatementPosition(stmt); | |
995 | |
996 // Pop context. | |
997 LoadContextField(context_register(), Context::PREVIOUS_INDEX); | |
998 // Update local stack frame context field. | |
999 StoreToFrameField(StandardFrameConstants::kContextOffset, context_register()); | |
1000 } | |
1001 | |
1002 | |
1003 void FullCodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) { | 987 void FullCodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) { |
1004 Comment cmnt(masm_, "[ DoWhileStatement"); | 988 Comment cmnt(masm_, "[ DoWhileStatement"); |
1005 SetStatementPosition(stmt); | 989 SetStatementPosition(stmt); |
1006 Label body, stack_check; | 990 Label body, stack_check; |
1007 | 991 |
1008 Iteration loop_statement(this, stmt); | 992 Iteration loop_statement(this, stmt); |
1009 increment_loop_depth(); | 993 increment_loop_depth(); |
1010 | 994 |
1011 __ bind(&body); | 995 __ bind(&body); |
1012 Visit(stmt->body()); | 996 Visit(stmt->body()); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 StoreToFrameField(StandardFrameConstants::kContextOffset, | 1124 StoreToFrameField(StandardFrameConstants::kContextOffset, |
1141 context_register()); | 1125 context_register()); |
1142 } | 1126 } |
1143 | 1127 |
1144 Scope* saved_scope = scope(); | 1128 Scope* saved_scope = scope(); |
1145 scope_ = stmt->scope(); | 1129 scope_ = stmt->scope(); |
1146 ASSERT(scope_->declarations()->is_empty()); | 1130 ASSERT(scope_->declarations()->is_empty()); |
1147 { WithOrCatch body(this); | 1131 { WithOrCatch body(this); |
1148 Visit(stmt->catch_block()); | 1132 Visit(stmt->catch_block()); |
1149 } | 1133 } |
| 1134 // Restore the context. |
| 1135 LoadContextField(context_register(), Context::PREVIOUS_INDEX); |
| 1136 StoreToFrameField(StandardFrameConstants::kContextOffset, context_register()); |
1150 scope_ = saved_scope; | 1137 scope_ = saved_scope; |
1151 __ jmp(&done); | 1138 __ jmp(&done); |
1152 | 1139 |
1153 // Try block code. Sets up the exception handler chain. | 1140 // Try block code. Sets up the exception handler chain. |
1154 __ bind(&try_handler_setup); | 1141 __ bind(&try_handler_setup); |
1155 { | 1142 { |
1156 const int delta = StackHandlerConstants::kSize / kPointerSize; | 1143 const int delta = StackHandlerConstants::kSize / kPointerSize; |
1157 TryCatch try_block(this); | 1144 TryCatch try_block(this); |
1158 __ PushTryHandler(IN_JAVASCRIPT, TRY_CATCH_HANDLER); | 1145 __ PushTryHandler(IN_JAVASCRIPT, TRY_CATCH_HANDLER); |
1159 increment_stack_height(delta); | 1146 increment_stack_height(delta); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 } | 1336 } |
1350 | 1337 |
1351 return false; | 1338 return false; |
1352 } | 1339 } |
1353 | 1340 |
1354 | 1341 |
1355 #undef __ | 1342 #undef __ |
1356 | 1343 |
1357 | 1344 |
1358 } } // namespace v8::internal | 1345 } } // namespace v8::internal |
OLD | NEW |