| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
| 8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
| 9 #include "src/debug.h" | 9 #include "src/debug.h" |
| 10 #include "src/full-codegen.h" | 10 #include "src/full-codegen.h" |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 masm_, expr->position(), !checker.is_breakable()); | 847 masm_, expr->position(), !checker.is_breakable()); |
| 848 // If the position recording did record a new position generate a debug | 848 // If the position recording did record a new position generate a debug |
| 849 // break slot to make the statement breakable. | 849 // break slot to make the statement breakable. |
| 850 if (position_recorded) { | 850 if (position_recorded) { |
| 851 DebugCodegen::GenerateSlot(masm_); | 851 DebugCodegen::GenerateSlot(masm_); |
| 852 } | 852 } |
| 853 } | 853 } |
| 854 } | 854 } |
| 855 | 855 |
| 856 | 856 |
| 857 void FullCodeGenerator::SetStatementPosition(int pos) { | |
| 858 CodeGenerator::RecordPositions(masm_, pos); | |
| 859 } | |
| 860 | |
| 861 | |
| 862 void FullCodeGenerator::SetSourcePosition(int pos) { | 857 void FullCodeGenerator::SetSourcePosition(int pos) { |
| 863 if (pos != RelocInfo::kNoPosition) { | 858 if (pos != RelocInfo::kNoPosition) { |
| 864 masm_->positions_recorder()->RecordPosition(pos); | 859 masm_->positions_recorder()->RecordPosition(pos); |
| 865 } | 860 } |
| 866 } | 861 } |
| 867 | 862 |
| 868 | 863 |
| 869 // Lookup table for code generators for special runtime calls which are | 864 // Lookup table for code generators for special runtime calls which are |
| 870 // generated inline. | 865 // generated inline. |
| 871 #define INLINE_FUNCTION_GENERATOR_ADDRESS(Name, argc, ressize) \ | 866 #define INLINE_FUNCTION_GENERATOR_ADDRESS(Name, argc, ressize) \ |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 __ jmp(&body); | 1271 __ jmp(&body); |
| 1277 | 1272 |
| 1278 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 1273 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
| 1279 __ bind(loop_statement.break_label()); | 1274 __ bind(loop_statement.break_label()); |
| 1280 decrement_loop_depth(); | 1275 decrement_loop_depth(); |
| 1281 } | 1276 } |
| 1282 | 1277 |
| 1283 | 1278 |
| 1284 void FullCodeGenerator::VisitWhileStatement(WhileStatement* stmt) { | 1279 void FullCodeGenerator::VisitWhileStatement(WhileStatement* stmt) { |
| 1285 Comment cmnt(masm_, "[ WhileStatement"); | 1280 Comment cmnt(masm_, "[ WhileStatement"); |
| 1286 Label test, body; | 1281 Label loop, body; |
| 1287 | 1282 |
| 1288 Iteration loop_statement(this, stmt); | 1283 Iteration loop_statement(this, stmt); |
| 1289 increment_loop_depth(); | 1284 increment_loop_depth(); |
| 1290 | 1285 |
| 1291 // Emit the test at the bottom of the loop. | 1286 __ bind(&loop); |
| 1292 __ jmp(&test); | 1287 |
| 1288 SetExpressionPosition(stmt->cond()); |
| 1289 VisitForControl(stmt->cond(), |
| 1290 &body, |
| 1291 loop_statement.break_label(), |
| 1292 &body); |
| 1293 | 1293 |
| 1294 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); | 1294 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); |
| 1295 __ bind(&body); | 1295 __ bind(&body); |
| 1296 Visit(stmt->body()); | 1296 Visit(stmt->body()); |
| 1297 | 1297 |
| 1298 // Emit the statement position here as this is where the while | |
| 1299 // statement code starts. | |
| 1300 __ bind(loop_statement.continue_label()); | 1298 __ bind(loop_statement.continue_label()); |
| 1301 SetStatementPosition(stmt); | |
| 1302 | 1299 |
| 1303 // Check stack before looping. | 1300 // Check stack before looping. |
| 1304 EmitBackEdgeBookkeeping(stmt, &body); | 1301 EmitBackEdgeBookkeeping(stmt, &loop); |
| 1305 | 1302 __ jmp(&loop); |
| 1306 __ bind(&test); | |
| 1307 VisitForControl(stmt->cond(), | |
| 1308 &body, | |
| 1309 loop_statement.break_label(), | |
| 1310 loop_statement.break_label()); | |
| 1311 | 1303 |
| 1312 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 1304 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
| 1313 __ bind(loop_statement.break_label()); | 1305 __ bind(loop_statement.break_label()); |
| 1314 decrement_loop_depth(); | 1306 decrement_loop_depth(); |
| 1315 } | 1307 } |
| 1316 | 1308 |
| 1317 | 1309 |
| 1318 void FullCodeGenerator::VisitForStatement(ForStatement* stmt) { | 1310 void FullCodeGenerator::VisitForStatement(ForStatement* stmt) { |
| 1319 Comment cmnt(masm_, "[ ForStatement"); | 1311 Comment cmnt(masm_, "[ ForStatement"); |
| 1320 Label test, body; | 1312 Label test, body; |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1698 } | 1690 } |
| 1699 return true; | 1691 return true; |
| 1700 } | 1692 } |
| 1701 #endif // DEBUG | 1693 #endif // DEBUG |
| 1702 | 1694 |
| 1703 | 1695 |
| 1704 #undef __ | 1696 #undef __ |
| 1705 | 1697 |
| 1706 | 1698 |
| 1707 } } // namespace v8::internal | 1699 } } // namespace v8::internal |
| OLD | NEW |