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

Side by Side Diff: src/interpreter/control-flow-builders.h

Issue 1531693002: [Interpreter] Implement ForIn in bytecode graph builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@oth-0009-phi
Patch Set: Minor clean-up/simplication in Runtime_InterpreterForInPrepare. Created 4 years, 12 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 unified diff | Download patch
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | src/interpreter/control-flow-builders.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ 5 #ifndef V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_
6 #define V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ 6 #define V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_
7 7
8 #include "src/interpreter/bytecode-array-builder.h" 8 #include "src/interpreter/bytecode-array-builder.h"
9 9
10 #include "src/zone-containers.h" 10 #include "src/zone-containers.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 void EmitJump(ZoneVector<BytecodeLabel>* labels, int index); 53 void EmitJump(ZoneVector<BytecodeLabel>* labels, int index);
54 void EmitJumpIfTrue(ZoneVector<BytecodeLabel>* labels); 54 void EmitJumpIfTrue(ZoneVector<BytecodeLabel>* labels);
55 void EmitJumpIfTrue(ZoneVector<BytecodeLabel>* labels, int index); 55 void EmitJumpIfTrue(ZoneVector<BytecodeLabel>* labels, int index);
56 void EmitJumpIfFalse(ZoneVector<BytecodeLabel>* labels); 56 void EmitJumpIfFalse(ZoneVector<BytecodeLabel>* labels);
57 void EmitJumpIfFalse(ZoneVector<BytecodeLabel>* labels, int index); 57 void EmitJumpIfFalse(ZoneVector<BytecodeLabel>* labels, int index);
58 void EmitJumpIfUndefined(ZoneVector<BytecodeLabel>* labels); 58 void EmitJumpIfUndefined(ZoneVector<BytecodeLabel>* labels);
59 void EmitJumpIfNull(ZoneVector<BytecodeLabel>* labels); 59 void EmitJumpIfNull(ZoneVector<BytecodeLabel>* labels);
60 60
61 void BindLabels(const BytecodeLabel& target, ZoneVector<BytecodeLabel>* site); 61 void BindLabels(const BytecodeLabel& target, ZoneVector<BytecodeLabel>* site);
62 62
63 private:
64 // Unbound labels that identify jumps for break statements in the code. 63 // Unbound labels that identify jumps for break statements in the code.
65 ZoneVector<BytecodeLabel> break_sites_; 64 ZoneVector<BytecodeLabel> break_sites_;
66 }; 65 };
67 66
68 67
69 // Class to track control flow for block statements (which can break in JS). 68 // Class to track control flow for block statements (which can break in JS).
70 class BlockBuilder final : public BreakableControlFlowBuilder { 69 class BlockBuilder final : public BreakableControlFlowBuilder {
71 public: 70 public:
72 explicit BlockBuilder(BytecodeArrayBuilder* builder) 71 explicit BlockBuilder(BytecodeArrayBuilder* builder)
73 : BreakableControlFlowBuilder(builder) {} 72 : BreakableControlFlowBuilder(builder) {}
74 73
75 void EndBlock(); 74 void EndBlock();
76 75
77 private: 76 private:
78 BytecodeLabel block_end_; 77 BytecodeLabel block_end_;
79 }; 78 };
80 79
81 80
82 // A class to help with co-ordinating break and continue statements with 81 // A class to help with co-ordinating break and continue statements with
83 // their loop. 82 // their loop.
84 class LoopBuilder final : public BreakableControlFlowBuilder { 83 class LoopBuilder final : public BreakableControlFlowBuilder {
85 public: 84 public:
86 explicit LoopBuilder(BytecodeArrayBuilder* builder) 85 explicit LoopBuilder(BytecodeArrayBuilder* builder)
87 : BreakableControlFlowBuilder(builder), 86 : BreakableControlFlowBuilder(builder),
88 continue_sites_(builder->zone()) {} 87 continue_sites_(builder->zone()) {}
89 ~LoopBuilder(); 88 ~LoopBuilder();
90 89
91 void LoopHeader() { builder()->Bind(&loop_header_); } 90 void LoopHeader();
92 void Condition() { builder()->Bind(&condition_); } 91 void Condition() { builder()->Bind(&condition_); }
93 void Next() { builder()->Bind(&next_); } 92 void Next() { builder()->Bind(&next_); }
94 void JumpToHeader() { builder()->Jump(&loop_header_); } 93 void JumpToHeader() { builder()->Jump(&loop_header_); }
95 void JumpToHeaderIfTrue() { builder()->JumpIfTrue(&loop_header_); } 94 void JumpToHeaderIfTrue() { builder()->JumpIfTrue(&loop_header_); }
96 void EndLoop(); 95 void EndLoop();
97 96
98 // This method is called when visiting continue statements in the AST. 97 // This method is called when visiting continue statements in the AST.
99 // Inserts a jump to a unbound label that is patched when the corresponding 98 // Inserts a jump to a unbound label that is patched when the corresponding
100 // SetContinueTarget is called. 99 // SetContinueTarget is called.
101 void Continue() { EmitJump(&continue_sites_); } 100 void Continue() { EmitJump(&continue_sites_); }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 private: 142 private:
144 // Unbound labels that identify jumps for case statements in the code. 143 // Unbound labels that identify jumps for case statements in the code.
145 ZoneVector<BytecodeLabel> case_sites_; 144 ZoneVector<BytecodeLabel> case_sites_;
146 }; 145 };
147 146
148 } // namespace interpreter 147 } // namespace interpreter
149 } // namespace internal 148 } // namespace internal
150 } // namespace v8 149 } // namespace v8
151 150
152 #endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_ 151 #endif // V8_INTERPRETER_CONTROL_FLOW_BUILDERS_H_
OLDNEW
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | src/interpreter/control-flow-builders.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698