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

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

Issue 2331033002: [interpreter] Merge {OsrPoll} with {Jump} bytecode. (Closed)
Patch Set: Fix for wide jumps. Created 4 years, 3 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
Index: src/interpreter/bytecode-generator.cc
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index 8822344e192ada7ee16104f1df28f184b9e5d501..fa451754a7809d48882c0a6a807cbf18869cddc8 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -826,14 +826,6 @@ void BytecodeGenerator::VisitIterationHeader(IterationStatement* stmt,
loop_builder->LoopHeader(&resume_points_in_loop);
- // Insert an explicit {OsrPoll} right after the loop header, to trigger
- // on-stack replacement when armed for the given loop nesting depth.
- if (FLAG_ignition_osr) {
- // TODO(4764): Merge this with another bytecode (e.g. {Jump} back edge).
- int level = Min(loop_depth_, AbstractCode::kMaxLoopNestingMarker - 1);
- builder()->OsrPoll(level);
- }
-
if (stmt->yield_count() > 0) {
// If we are not resuming, fall through to loop body.
// If we are resuming, perform state dispatch.
@@ -1169,13 +1161,16 @@ void BytecodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) {
} else if (stmt->cond()->ToBooleanIsTrue()) {
VisitIterationHeader(stmt, &loop_builder);
VisitIterationBody(stmt, &loop_builder);
- loop_builder.JumpToHeader();
+ loop_builder.JumpToHeader(loop_depth_);
} else {
VisitIterationHeader(stmt, &loop_builder);
VisitIterationBody(stmt, &loop_builder);
builder()->SetExpressionAsStatementPosition(stmt->cond());
- VisitForTest(stmt->cond(), loop_builder.header_labels(),
- loop_builder.break_labels(), TestFallthrough::kElse);
+ BytecodeLabels loop_backbranch(zone());
+ VisitForTest(stmt->cond(), &loop_backbranch, loop_builder.break_labels(),
+ TestFallthrough::kThen);
+ loop_backbranch.Bind(builder());
+ loop_builder.JumpToHeader(loop_depth_);
}
loop_builder.EndLoop();
}
@@ -1196,7 +1191,7 @@ void BytecodeGenerator::VisitWhileStatement(WhileStatement* stmt) {
loop_body.Bind(builder());
}
VisitIterationBody(stmt, &loop_builder);
- loop_builder.JumpToHeader();
+ loop_builder.JumpToHeader(loop_depth_);
loop_builder.EndLoop();
}
@@ -1224,7 +1219,7 @@ void BytecodeGenerator::VisitForStatement(ForStatement* stmt) {
builder()->SetStatementPosition(stmt->next());
Visit(stmt->next());
}
- loop_builder.JumpToHeader();
+ loop_builder.JumpToHeader(loop_depth_);
loop_builder.EndLoop();
}
@@ -1345,7 +1340,7 @@ void BytecodeGenerator::VisitForInStatement(ForInStatement* stmt) {
VisitIterationBody(stmt, &loop_builder);
builder()->ForInStep(index);
builder()->StoreAccumulatorInRegister(index);
- loop_builder.JumpToHeader();
+ loop_builder.JumpToHeader(loop_depth_);
loop_builder.EndLoop();
builder()->Bind(&subject_null_label);
builder()->Bind(&subject_undefined_label);
@@ -1365,7 +1360,7 @@ void BytecodeGenerator::VisitForOfStatement(ForOfStatement* stmt) {
VisitForEffect(stmt->assign_each());
VisitIterationBody(stmt, &loop_builder);
- loop_builder.JumpToHeader();
+ loop_builder.JumpToHeader(loop_depth_);
loop_builder.EndLoop();
}

Powered by Google App Engine
This is Rietveld 408576698