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

Side by Side Diff: src/interpreter/bytecode-generator.h

Issue 2664083002: [ignition] desugar async functions/generators/modules in BytecodeGenerator
Patch Set: make it a little easier to read Created 3 years, 10 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
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_BYTECODE_GENERATOR_H_ 5 #ifndef V8_INTERPRETER_BYTECODE_GENERATOR_H_
6 #define V8_INTERPRETER_BYTECODE_GENERATOR_H_ 6 #define V8_INTERPRETER_BYTECODE_GENERATOR_H_
7 7
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/interpreter/bytecode-array-builder.h" 9 #include "src/interpreter/bytecode-array-builder.h"
10 #include "src/interpreter/bytecode-label.h" 10 #include "src/interpreter/bytecode-label.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 class ExpressionResultScope; 46 class ExpressionResultScope;
47 class EffectResultScope; 47 class EffectResultScope;
48 class GlobalDeclarationsBuilder; 48 class GlobalDeclarationsBuilder;
49 class RegisterAllocationScope; 49 class RegisterAllocationScope;
50 class TestResultScope; 50 class TestResultScope;
51 class ValueResultScope; 51 class ValueResultScope;
52 52
53 enum class TestFallthrough { kThen, kElse, kNone }; 53 enum class TestFallthrough { kThen, kElse, kNone };
54 54
55 void GenerateBytecodeBody(); 55 void GenerateBytecodeBody();
56 void GenerateBytecodeBodyForAsyncFunction();
57 void GenerateBytecodeBodyForGenerator();
58 void GenerateBytecodeBodyForModule();
59
60 enum class BuildJSGeneratorObject { kNoInitialYield, kInitialYield };
61 void BuildAllocateAndStoreJSGeneratorObject(BuildJSGeneratorObject tag);
62 void BuildAllocateAndStoreJSPromise();
63 void BindUnboundGeneratorResumePoints();
64
56 void AllocateDeferredConstants(Isolate* isolate); 65 void AllocateDeferredConstants(Isolate* isolate);
57 66
58 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); 67 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
59 68
60 // Dispatched from VisitBinaryOperation. 69 // Dispatched from VisitBinaryOperation.
61 void VisitArithmeticExpression(BinaryOperation* binop); 70 void VisitArithmeticExpression(BinaryOperation* binop);
62 void VisitCommaExpression(BinaryOperation* binop); 71 void VisitCommaExpression(BinaryOperation* binop);
63 void VisitLogicalOrExpression(BinaryOperation* binop); 72 void VisitLogicalOrExpression(BinaryOperation* binop);
64 void VisitLogicalAndExpression(BinaryOperation* binop); 73 void VisitLogicalAndExpression(BinaryOperation* binop);
65 74
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // register, or just getting the effect. 166 // register, or just getting the effect.
158 void VisitForAccumulatorValue(Expression* expr); 167 void VisitForAccumulatorValue(Expression* expr);
159 void VisitForAccumulatorValueOrTheHole(Expression* expr); 168 void VisitForAccumulatorValueOrTheHole(Expression* expr);
160 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expr); 169 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expr);
161 void VisitForRegisterValue(Expression* expr, Register destination); 170 void VisitForRegisterValue(Expression* expr, Register destination);
162 void VisitAndPushIntoRegisterList(Expression* expr, RegisterList* reg_list); 171 void VisitAndPushIntoRegisterList(Expression* expr, RegisterList* reg_list);
163 void VisitForEffect(Expression* expr); 172 void VisitForEffect(Expression* expr);
164 void VisitForTest(Expression* expr, BytecodeLabels* then_labels, 173 void VisitForTest(Expression* expr, BytecodeLabels* then_labels,
165 BytecodeLabels* else_labels, TestFallthrough fallthrough); 174 BytecodeLabels* else_labels, TestFallthrough fallthrough);
166 175
176 void BuildYield(int yield_id, Register generator, Register value);
177 void BuildYieldResumePoint(int yield_id, Yield::OnException on_exception,
178 Register generator, int position);
179
180 void BuildTryCatch(HandlerTable::CatchPrediction catch_prediction,
181 std::function<void()> build_try,
182 std::function<void(Register context)> build_catch);
183 void BuildTryFinally(std::function<void()> build_try,
184 std::function<void()> build_finally);
185
167 // Returns the runtime function id for a store to super for the function's 186 // Returns the runtime function id for a store to super for the function's
168 // language mode. 187 // language mode.
169 inline Runtime::FunctionId StoreToSuperRuntimeId(); 188 inline Runtime::FunctionId StoreToSuperRuntimeId();
170 inline Runtime::FunctionId StoreKeyedToSuperRuntimeId(); 189 inline Runtime::FunctionId StoreKeyedToSuperRuntimeId();
171 190
172 inline BytecodeArrayBuilder* builder() const { return builder_; } 191 inline BytecodeArrayBuilder* builder() const { return builder_; }
173 inline Zone* zone() const { return zone_; } 192 inline Zone* zone() const { return zone_; }
174 inline DeclarationScope* scope() const { return scope_; } 193 inline DeclarationScope* scope() const { return scope_; }
175 inline CompilationInfo* info() const { return info_; } 194 inline CompilationInfo* info() const { return info_; }
176 195
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 ZoneVector<std::pair<ObjectLiteral*, size_t>> object_literals_; 232 ZoneVector<std::pair<ObjectLiteral*, size_t>> object_literals_;
214 ZoneVector<std::pair<ArrayLiteral*, size_t>> array_literals_; 233 ZoneVector<std::pair<ArrayLiteral*, size_t>> array_literals_;
215 234
216 ControlScope* execution_control_; 235 ControlScope* execution_control_;
217 ContextScope* execution_context_; 236 ContextScope* execution_context_;
218 ExpressionResultScope* execution_result_; 237 ExpressionResultScope* execution_result_;
219 238
220 ZoneVector<BytecodeLabel> generator_resume_points_; 239 ZoneVector<BytecodeLabel> generator_resume_points_;
221 Register generator_state_; 240 Register generator_state_;
222 int loop_depth_; 241 int loop_depth_;
242 HandlerTable::CatchPrediction catch_prediction_;
223 243
224 Handle<Name> home_object_symbol_; 244 Handle<Name> home_object_symbol_;
225 Handle<Name> iterator_symbol_; 245 Handle<Name> iterator_symbol_;
226 Handle<Name> prototype_string_; 246 Handle<Name> prototype_string_;
227 Handle<FixedArray> empty_fixed_array_; 247 Handle<FixedArray> empty_fixed_array_;
228 const AstRawString* undefined_string_; 248 const AstRawString* undefined_string_;
229 }; 249 };
230 250
231 } // namespace interpreter 251 } // namespace interpreter
232 } // namespace internal 252 } // namespace internal
233 } // namespace v8 253 } // namespace v8
234 254
235 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ 255 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698