| 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 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 PrepareForBailoutForId(stmt->ContinueId(), NO_REGISTERS); | 1066 PrepareForBailoutForId(stmt->ContinueId(), NO_REGISTERS); |
| 1067 SetExpressionPosition(stmt->cond(), stmt->condition_position()); | 1067 SetExpressionPosition(stmt->cond(), stmt->condition_position()); |
| 1068 VisitForControl(stmt->cond(), | 1068 VisitForControl(stmt->cond(), |
| 1069 &stack_check, | 1069 &stack_check, |
| 1070 loop_statement.break_label(), | 1070 loop_statement.break_label(), |
| 1071 &stack_check); | 1071 &stack_check); |
| 1072 | 1072 |
| 1073 // Check stack before looping. | 1073 // Check stack before looping. |
| 1074 PrepareForBailoutForId(stmt->BackEdgeId(), NO_REGISTERS); | 1074 PrepareForBailoutForId(stmt->BackEdgeId(), NO_REGISTERS); |
| 1075 __ bind(&stack_check); | 1075 __ bind(&stack_check); |
| 1076 EmitStackCheck(stmt); | 1076 EmitStackCheck(stmt, &body); |
| 1077 __ jmp(&body); | 1077 __ jmp(&body); |
| 1078 | 1078 |
| 1079 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 1079 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
| 1080 __ bind(loop_statement.break_label()); | 1080 __ bind(loop_statement.break_label()); |
| 1081 decrement_loop_depth(); | 1081 decrement_loop_depth(); |
| 1082 } | 1082 } |
| 1083 | 1083 |
| 1084 | 1084 |
| 1085 void FullCodeGenerator::VisitWhileStatement(WhileStatement* stmt) { | 1085 void FullCodeGenerator::VisitWhileStatement(WhileStatement* stmt) { |
| 1086 Comment cmnt(masm_, "[ WhileStatement"); | 1086 Comment cmnt(masm_, "[ WhileStatement"); |
| 1087 Label test, body; | 1087 Label test, body; |
| 1088 | 1088 |
| 1089 Iteration loop_statement(this, stmt); | 1089 Iteration loop_statement(this, stmt); |
| 1090 increment_loop_depth(); | 1090 increment_loop_depth(); |
| 1091 | 1091 |
| 1092 // Emit the test at the bottom of the loop. | 1092 // Emit the test at the bottom of the loop. |
| 1093 __ jmp(&test); | 1093 __ jmp(&test); |
| 1094 | 1094 |
| 1095 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); | 1095 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); |
| 1096 __ bind(&body); | 1096 __ bind(&body); |
| 1097 Visit(stmt->body()); | 1097 Visit(stmt->body()); |
| 1098 | 1098 |
| 1099 // Emit the statement position here as this is where the while | 1099 // Emit the statement position here as this is where the while |
| 1100 // statement code starts. | 1100 // statement code starts. |
| 1101 __ bind(loop_statement.continue_label()); | 1101 __ bind(loop_statement.continue_label()); |
| 1102 SetStatementPosition(stmt); | 1102 SetStatementPosition(stmt); |
| 1103 | 1103 |
| 1104 // Check stack before looping. | 1104 // Check stack before looping. |
| 1105 EmitStackCheck(stmt); | 1105 EmitStackCheck(stmt, &body); |
| 1106 | 1106 |
| 1107 __ bind(&test); | 1107 __ bind(&test); |
| 1108 VisitForControl(stmt->cond(), | 1108 VisitForControl(stmt->cond(), |
| 1109 &body, | 1109 &body, |
| 1110 loop_statement.break_label(), | 1110 loop_statement.break_label(), |
| 1111 loop_statement.break_label()); | 1111 loop_statement.break_label()); |
| 1112 | 1112 |
| 1113 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 1113 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
| 1114 __ bind(loop_statement.break_label()); | 1114 __ bind(loop_statement.break_label()); |
| 1115 decrement_loop_depth(); | 1115 decrement_loop_depth(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1138 SetStatementPosition(stmt); | 1138 SetStatementPosition(stmt); |
| 1139 if (stmt->next() != NULL) { | 1139 if (stmt->next() != NULL) { |
| 1140 Visit(stmt->next()); | 1140 Visit(stmt->next()); |
| 1141 } | 1141 } |
| 1142 | 1142 |
| 1143 // Emit the statement position here as this is where the for | 1143 // Emit the statement position here as this is where the for |
| 1144 // statement code starts. | 1144 // statement code starts. |
| 1145 SetStatementPosition(stmt); | 1145 SetStatementPosition(stmt); |
| 1146 | 1146 |
| 1147 // Check stack before looping. | 1147 // Check stack before looping. |
| 1148 EmitStackCheck(stmt); | 1148 EmitStackCheck(stmt, &body); |
| 1149 | 1149 |
| 1150 __ bind(&test); | 1150 __ bind(&test); |
| 1151 if (stmt->cond() != NULL) { | 1151 if (stmt->cond() != NULL) { |
| 1152 VisitForControl(stmt->cond(), | 1152 VisitForControl(stmt->cond(), |
| 1153 &body, | 1153 &body, |
| 1154 loop_statement.break_label(), | 1154 loop_statement.break_label(), |
| 1155 loop_statement.break_label()); | 1155 loop_statement.break_label()); |
| 1156 } else { | 1156 } else { |
| 1157 __ jmp(&body); | 1157 __ jmp(&body); |
| 1158 } | 1158 } |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 } | 1380 } |
| 1381 | 1381 |
| 1382 return false; | 1382 return false; |
| 1383 } | 1383 } |
| 1384 | 1384 |
| 1385 | 1385 |
| 1386 #undef __ | 1386 #undef __ |
| 1387 | 1387 |
| 1388 | 1388 |
| 1389 } } // namespace v8::internal | 1389 } } // namespace v8::internal |
| OLD | NEW |