OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1153 decrement_loop_depth(); | 1153 decrement_loop_depth(); |
1154 } | 1154 } |
1155 | 1155 |
1156 | 1156 |
1157 void FullCodeGenerator::VisitForStatement(ForStatement* stmt) { | 1157 void FullCodeGenerator::VisitForStatement(ForStatement* stmt) { |
1158 Comment cmnt(masm_, "[ ForStatement"); | 1158 Comment cmnt(masm_, "[ ForStatement"); |
1159 Label test, body; | 1159 Label test, body; |
1160 | 1160 |
1161 Iteration loop_statement(this, stmt); | 1161 Iteration loop_statement(this, stmt); |
1162 if (stmt->init() != NULL) { | 1162 if (stmt->init() != NULL) { |
1163 SetStatementPosition(stmt); | |
1163 Visit(stmt->init()); | 1164 Visit(stmt->init()); |
1164 } | 1165 } |
1165 | 1166 |
1166 increment_loop_depth(); | 1167 increment_loop_depth(); |
1167 // Emit the test at the bottom of the loop (even if empty). | 1168 // Emit the test at the bottom of the loop (even if empty). |
1168 __ jmp(&test); | 1169 __ jmp(&test); |
1169 | 1170 |
1170 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); | 1171 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); |
1171 __ bind(&body); | 1172 __ bind(&body); |
1172 Visit(stmt->body()); | 1173 Visit(stmt->body()); |
1173 | 1174 |
1174 PrepareForBailoutForId(stmt->ContinueId(), NO_REGISTERS); | 1175 PrepareForBailoutForId(stmt->ContinueId(), NO_REGISTERS); |
1175 __ bind(loop_statement.continue_label()); | 1176 __ bind(loop_statement.continue_label()); |
1176 SetStatementPosition(stmt); | |
1177 if (stmt->next() != NULL) { | 1177 if (stmt->next() != NULL) { |
1178 SetStatementPosition(stmt); | |
Yang
2012/03/07 18:28:36
Only set a debug break slot if there is actually a
| |
1178 Visit(stmt->next()); | 1179 Visit(stmt->next()); |
1179 } | 1180 } |
1180 | 1181 |
1181 // Emit the statement position here as this is where the for | 1182 // Emit the statement position here as this is where the for |
1182 // statement code starts. | 1183 // statement code starts. |
1183 SetStatementPosition(stmt); | 1184 SetStatementPosition(stmt); |
1184 | 1185 |
1185 // Check stack before looping. | 1186 // Check stack before looping. |
1186 EmitStackCheck(stmt, &body); | 1187 EmitStackCheck(stmt, &body); |
1187 | 1188 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1418 } | 1419 } |
1419 | 1420 |
1420 return false; | 1421 return false; |
1421 } | 1422 } |
1422 | 1423 |
1423 | 1424 |
1424 #undef __ | 1425 #undef __ |
1425 | 1426 |
1426 | 1427 |
1427 } } // namespace v8::internal | 1428 } } // namespace v8::internal |
OLD | NEW |