| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/full-codegen/full-codegen.h" | 5 #include "src/full-codegen/full-codegen.h" |
| 6 | 6 |
| 7 #include "src/ast/ast-numbering.h" | 7 #include "src/ast/ast-numbering.h" |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
| 10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
| (...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 __ jmp(&body); | 1254 __ jmp(&body); |
| 1255 } | 1255 } |
| 1256 | 1256 |
| 1257 PrepareForBailoutForId(stmt->ExitId(), BailoutState::NO_REGISTERS); | 1257 PrepareForBailoutForId(stmt->ExitId(), BailoutState::NO_REGISTERS); |
| 1258 __ bind(loop_statement.break_label()); | 1258 __ bind(loop_statement.break_label()); |
| 1259 decrement_loop_depth(); | 1259 decrement_loop_depth(); |
| 1260 } | 1260 } |
| 1261 | 1261 |
| 1262 | 1262 |
| 1263 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) { | 1263 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) { |
| 1264 Comment cmnt(masm_, "[ ForOfStatement"); | 1264 // Iterator looping is not supported. |
| 1265 | 1265 UNREACHABLE(); |
| 1266 Iteration loop_statement(this, stmt); | |
| 1267 increment_loop_depth(); | |
| 1268 | |
| 1269 // var iterator = iterable[Symbol.iterator](); | |
| 1270 SetExpressionAsStatementPosition(stmt->assign_iterator()); | |
| 1271 VisitForEffect(stmt->assign_iterator()); | |
| 1272 | |
| 1273 // Loop entry. | |
| 1274 __ bind(loop_statement.continue_label()); | |
| 1275 | |
| 1276 // result = iterator.next() | |
| 1277 SetExpressionAsStatementPosition(stmt->next_result()); | |
| 1278 VisitForEffect(stmt->next_result()); | |
| 1279 | |
| 1280 // if (result.done) break; | |
| 1281 Label result_not_done; | |
| 1282 VisitForControl(stmt->result_done(), loop_statement.break_label(), | |
| 1283 &result_not_done, &result_not_done); | |
| 1284 __ bind(&result_not_done); | |
| 1285 | |
| 1286 // each = result.value | |
| 1287 VisitForEffect(stmt->assign_each()); | |
| 1288 | |
| 1289 // Generate code for the body of the loop. | |
| 1290 Visit(stmt->body()); | |
| 1291 | |
| 1292 // Check stack before looping. | |
| 1293 PrepareForBailoutForId(stmt->BackEdgeId(), BailoutState::NO_REGISTERS); | |
| 1294 EmitBackEdgeBookkeeping(stmt, loop_statement.continue_label()); | |
| 1295 __ jmp(loop_statement.continue_label()); | |
| 1296 | |
| 1297 // Exit and decrement the loop depth. | |
| 1298 PrepareForBailoutForId(stmt->ExitId(), BailoutState::NO_REGISTERS); | |
| 1299 __ bind(loop_statement.break_label()); | |
| 1300 decrement_loop_depth(); | |
| 1301 } | 1266 } |
| 1302 | 1267 |
| 1303 void FullCodeGenerator::VisitThisFunction(ThisFunction* expr) { | 1268 void FullCodeGenerator::VisitThisFunction(ThisFunction* expr) { |
| 1304 LoadFromFrameField(JavaScriptFrameConstants::kFunctionOffset, | 1269 LoadFromFrameField(JavaScriptFrameConstants::kFunctionOffset, |
| 1305 result_register()); | 1270 result_register()); |
| 1306 context()->Plug(result_register()); | 1271 context()->Plug(result_register()); |
| 1307 } | 1272 } |
| 1308 | 1273 |
| 1309 void FullCodeGenerator::VisitTryCatchStatement(TryCatchStatement* stmt) { | 1274 void FullCodeGenerator::VisitTryCatchStatement(TryCatchStatement* stmt) { |
| 1310 // Exception handling is not supported. | 1275 // Exception handling is not supported. |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1697 return info_->has_simple_parameters(); | 1662 return info_->has_simple_parameters(); |
| 1698 } | 1663 } |
| 1699 | 1664 |
| 1700 FunctionLiteral* FullCodeGenerator::literal() const { return info_->literal(); } | 1665 FunctionLiteral* FullCodeGenerator::literal() const { return info_->literal(); } |
| 1701 | 1666 |
| 1702 #undef __ | 1667 #undef __ |
| 1703 | 1668 |
| 1704 | 1669 |
| 1705 } // namespace internal | 1670 } // namespace internal |
| 1706 } // namespace v8 | 1671 } // namespace v8 |
| OLD | NEW |