Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Unified Diff: src/full-codegen.cc

Issue 353823002: Reorder full code for while loops to better reflect statement positions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/full-codegen.h ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/full-codegen.cc
diff --git a/src/full-codegen.cc b/src/full-codegen.cc
index 088a9c9a7ed1409ba31667608a3ecdd8b1e8f6a2..3c2feee3522edc7f38e37de67cca34dc18e1f2ad 100644
--- a/src/full-codegen.cc
+++ b/src/full-codegen.cc
@@ -854,11 +854,6 @@ void FullCodeGenerator::SetExpressionPosition(Expression* expr) {
}
-void FullCodeGenerator::SetStatementPosition(int pos) {
- CodeGenerator::RecordPositions(masm_, pos);
-}
-
-
void FullCodeGenerator::SetSourcePosition(int pos) {
if (pos != RelocInfo::kNoPosition) {
masm_->positions_recorder()->RecordPosition(pos);
@@ -1283,31 +1278,28 @@ void FullCodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) {
void FullCodeGenerator::VisitWhileStatement(WhileStatement* stmt) {
Comment cmnt(masm_, "[ WhileStatement");
- Label test, body;
+ Label loop, body;
Iteration loop_statement(this, stmt);
increment_loop_depth();
- // Emit the test at the bottom of the loop.
- __ jmp(&test);
+ __ bind(&loop);
+
+ SetExpressionPosition(stmt->cond());
+ VisitForControl(stmt->cond(),
+ &body,
+ loop_statement.break_label(),
+ &body);
PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS);
__ bind(&body);
Visit(stmt->body());
- // Emit the statement position here as this is where the while
- // statement code starts.
__ bind(loop_statement.continue_label());
- SetStatementPosition(stmt);
// Check stack before looping.
- EmitBackEdgeBookkeeping(stmt, &body);
-
- __ bind(&test);
- VisitForControl(stmt->cond(),
- &body,
- loop_statement.break_label(),
- loop_statement.break_label());
+ EmitBackEdgeBookkeeping(stmt, &loop);
+ __ jmp(&loop);
PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS);
__ bind(loop_statement.break_label());
« no previous file with comments | « src/full-codegen.h ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698