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

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

Issue 1901713003: [generators] Perform state dispatch in loop header. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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/control-flow-builders.h
diff --git a/src/interpreter/control-flow-builders.h b/src/interpreter/control-flow-builders.h
index e4d376b9b21e90bdd1121589bcc28d6cc8de4924..3c87e86bd20701d55aaeb4f747d77bbb1340ffcb 100644
--- a/src/interpreter/control-flow-builders.h
+++ b/src/interpreter/control-flow-builders.h
@@ -82,16 +82,22 @@ class BlockBuilder final : public BreakableControlFlowBuilder {
// their loop.
class LoopBuilder final : public BreakableControlFlowBuilder {
public:
- explicit LoopBuilder(BytecodeArrayBuilder* builder)
+ explicit LoopBuilder(BytecodeArrayBuilder* builder, int yield_count)
: BreakableControlFlowBuilder(builder),
+ yield_count(yield_count),
continue_sites_(builder->zone()) {}
~LoopBuilder();
void LoopHeader();
void Condition() { builder()->Bind(&condition_); }
void Next() { builder()->Bind(&next_); }
- void JumpToHeader() { builder()->Jump(&loop_header_); }
- void JumpToHeaderIfTrue() { builder()->JumpIfTrue(&loop_header_); }
+ void JumpToHeader();
+ void JumpToHeaderIfTrue() {
+ BytecodeLabel no_jump;
+ builder()->JumpIfFalse(&no_jump);
+ JumpToHeader();
+ builder()->Bind(&no_jump);
+ }
void EndLoop();
// This method is called when visiting continue statements in the AST.
@@ -102,6 +108,9 @@ class LoopBuilder final : public BreakableControlFlowBuilder {
void ContinueIfUndefined() { EmitJumpIfUndefined(&continue_sites_); }
void ContinueIfNull() { EmitJumpIfNull(&continue_sites_); }
+ // Number of yields inside the loop.
+ const int yield_count;
+
private:
void SetContinueTarget(const BytecodeLabel& continue_target);

Powered by Google App Engine
This is Rietveld 408576698