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

Unified Diff: src/interpreter/control-flow-builders.cc

Issue 1502243002: [Interpreter] Local flow control in the bytecode graph builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years 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/control-flow-builders.cc
diff --git a/src/interpreter/control-flow-builders.cc b/src/interpreter/control-flow-builders.cc
index 3ecabe4351cb9ddbac13618b1b85e52d29ca0cd3..fcdc5be575206bda48ac485bbc5bb46e1ea2f081 100644
--- a/src/interpreter/control-flow-builders.cc
+++ b/src/interpreter/control-flow-builders.cc
@@ -32,6 +32,13 @@ void BreakableControlFlowBuilder::EmitJumpIfTrue(
}
+void BreakableControlFlowBuilder::EmitJumpIfFalse(
+ ZoneVector<BytecodeLabel>* sites) {
+ sites->push_back(BytecodeLabel());
+ builder()->JumpIfFalse(&sites->back());
+}
+
+
void BreakableControlFlowBuilder::EmitJumpIfUndefined(
ZoneVector<BytecodeLabel>* sites) {
sites->push_back(BytecodeLabel());
@@ -58,6 +65,12 @@ void BreakableControlFlowBuilder::EmitJumpIfTrue(
}
+void BreakableControlFlowBuilder::EmitJumpIfFalse(
+ ZoneVector<BytecodeLabel>* sites, int index) {
+ builder()->JumpIfFalse(&sites->at(index));
+}
+
+
void BreakableControlFlowBuilder::BindLabels(const BytecodeLabel& target,
ZoneVector<BytecodeLabel>* sites) {
for (size_t i = 0; i < sites->size(); i++) {
@@ -71,6 +84,24 @@ void BreakableControlFlowBuilder::BindLabels(const BytecodeLabel& target,
LoopBuilder::~LoopBuilder() { DCHECK(continue_sites_.empty()); }
+void LoopBuilder::LoopEnd() {
+ // Loop must have closed form, ie all loop elements are within the
rmcilroy 2015/12/15 17:35:44 nit - /ie/i.e./
oth 2015/12/15 22:42:17 Done.
+ // loop.
+ DCHECK(loop_header_.is_bound());
+ builder()->Bind(&loop_end_);
+ SetBreakTarget(loop_end_);
+ if (next_.is_bound()) {
+ DCHECK(!condition_.is_bound() || next_.offset() >= condition_.offset());
+ SetContinueTarget(next_);
+ } else {
+ DCHECK(condition_.is_bound());
+ DCHECK_GE(condition_.offset(), loop_header_.offset());
+ DCHECK_LE(condition_.offset(), loop_end_.offset());
+ SetContinueTarget(condition_);
+ }
+}
+
+
void LoopBuilder::SetContinueTarget(const BytecodeLabel& target) {
BindLabels(target, &continue_sites_);
}

Powered by Google App Engine
This is Rietveld 408576698