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

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

Issue 1524893003: [Interpreter] Add support for break statements in labelled blocks. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@oth-0009-phi
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
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | src/interpreter/control-flow-builders.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/control-flow-builders.h
diff --git a/src/interpreter/control-flow-builders.h b/src/interpreter/control-flow-builders.h
index 1f5196861a4edca17ccc2eb6c9f1e1bf297bbf35..6566c980e003bead1e36c2b30fac4277a1cddd6e 100644
--- a/src/interpreter/control-flow-builders.h
+++ b/src/interpreter/control-flow-builders.h
@@ -65,6 +65,20 @@ class BreakableControlFlowBuilder : public ControlFlowBuilder {
ZoneVector<BytecodeLabel> break_sites_;
};
+
+// Class to track control flow for block statements (which can break in JS).
+class BlockBuilder final : public BreakableControlFlowBuilder {
+ public:
+ explicit BlockBuilder(BytecodeArrayBuilder* builder)
+ : BreakableControlFlowBuilder(builder) {}
+
+ void EndBlock();
+
+ private:
+ BytecodeLabel block_end_;
+};
+
+
// A class to help with co-ordinating break and continue statements with
// their loop.
class LoopBuilder final : public BreakableControlFlowBuilder {
@@ -79,7 +93,7 @@ class LoopBuilder final : public BreakableControlFlowBuilder {
void Next() { builder()->Bind(&next_); }
void JumpToHeader() { builder()->Jump(&loop_header_); }
void JumpToHeaderIfTrue() { builder()->JumpIfTrue(&loop_header_); }
- void LoopEnd();
+ void EndLoop();
// This method is called when visiting continue statements in the AST.
// Inserts a jump to a unbound label that is patched when the corresponding
@@ -101,8 +115,8 @@ class LoopBuilder final : public BreakableControlFlowBuilder {
ZoneVector<BytecodeLabel> continue_sites_;
};
+
// A class to help with co-ordinating break statements with their switch.
-// TODO(oth): add support for TF branch/merge info.
class SwitchBuilder final : public BreakableControlFlowBuilder {
public:
explicit SwitchBuilder(BytecodeArrayBuilder* builder, int number_of_cases)
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | src/interpreter/control-flow-builders.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698