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

Unified Diff: src/interpreter/bytecode-generator.cc

Issue 1943383003: [interpreter] Always 'continue' loops by jumping forward to end of body. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | src/interpreter/control-flow-builders.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-generator.cc
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index ac4a63628d11548e030ba9aa9c092fbf96f8bfc7..4595a878b9ea9799df54ccd6d7f9bc073a165251 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -1038,6 +1038,7 @@ void BytecodeGenerator::VisitIterationBody(IterationStatement* stmt,
ControlScopeForIteration execution_control(this, stmt, loop_builder);
builder()->StackCheck(stmt->position());
Visit(stmt->body());
+ loop_builder->SetContinueTarget();
}
void BytecodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) {
@@ -1045,14 +1046,11 @@ void BytecodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) {
VisitIterationHeader(stmt, &loop_builder);
if (stmt->cond()->ToBooleanIsFalse()) {
VisitIterationBody(stmt, &loop_builder);
- loop_builder.Condition();
} else if (stmt->cond()->ToBooleanIsTrue()) {
- loop_builder.Condition();
VisitIterationBody(stmt, &loop_builder);
loop_builder.JumpToHeader();
} else {
VisitIterationBody(stmt, &loop_builder);
- loop_builder.Condition();
builder()->SetExpressionAsStatementPosition(stmt->cond());
VisitForAccumulatorValue(stmt->cond());
loop_builder.JumpToHeaderIfTrue();
@@ -1068,7 +1066,6 @@ void BytecodeGenerator::VisitWhileStatement(WhileStatement* stmt) {
LoopBuilder loop_builder(builder());
VisitIterationHeader(stmt, &loop_builder);
- loop_builder.Condition();
if (!stmt->cond()->ToBooleanIsTrue()) {
builder()->SetExpressionAsStatementPosition(stmt->cond());
VisitForAccumulatorValue(stmt->cond());
@@ -1092,7 +1089,6 @@ void BytecodeGenerator::VisitForStatement(ForStatement* stmt) {
LoopBuilder loop_builder(builder());
VisitIterationHeader(stmt, &loop_builder);
- loop_builder.Condition();
if (stmt->cond() && !stmt->cond()->ToBooleanIsTrue()) {
builder()->SetExpressionAsStatementPosition(stmt->cond());
VisitForAccumulatorValue(stmt->cond());
@@ -1100,7 +1096,6 @@ void BytecodeGenerator::VisitForStatement(ForStatement* stmt) {
}
VisitIterationBody(stmt, &loop_builder);
if (stmt->next() != nullptr) {
- loop_builder.Next();
builder()->SetStatementPosition(stmt->next());
Visit(stmt->next());
}
@@ -1218,7 +1213,6 @@ void BytecodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// The loop
VisitIterationHeader(stmt, &loop_builder);
builder()->SetExpressionAsStatementPosition(stmt->each());
- loop_builder.Condition();
builder()->ForInDone(index, cache_length);
loop_builder.BreakIfTrue();
DCHECK(Register::AreContiguous(cache_type, cache_array));
@@ -1227,7 +1221,6 @@ void BytecodeGenerator::VisitForInStatement(ForInStatement* stmt) {
loop_builder.ContinueIfUndefined();
VisitForInAssignment(stmt->each(), stmt->EachFeedbackSlot());
VisitIterationBody(stmt, &loop_builder);
- loop_builder.Next();
builder()->ForInStep(index);
builder()->StoreAccumulatorInRegister(index);
loop_builder.JumpToHeader();
@@ -1245,7 +1238,6 @@ void BytecodeGenerator::VisitForOfStatement(ForOfStatement* stmt) {
VisitForEffect(stmt->assign_iterator());
VisitIterationHeader(stmt, &loop_builder);
- loop_builder.Next();
builder()->SetExpressionAsStatementPosition(stmt->next_result());
VisitForEffect(stmt->next_result());
VisitForAccumulatorValue(stmt->result_done());
« no previous file with comments | « no previous file | src/interpreter/control-flow-builders.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698