OLD | NEW |
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 class ControlScope; | 44 class ControlScope; |
45 class ControlScopeForBreakable; | 45 class ControlScopeForBreakable; |
46 class ControlScopeForIteration; | 46 class ControlScopeForIteration; |
47 class ControlScopeForTopLevel; | 47 class ControlScopeForTopLevel; |
48 class ControlScopeForTryCatch; | 48 class ControlScopeForTryCatch; |
49 class ControlScopeForTryFinally; | 49 class ControlScopeForTryFinally; |
50 class CurrentScope; | 50 class CurrentScope; |
51 class ExpressionResultScope; | 51 class ExpressionResultScope; |
52 class EffectResultScope; | 52 class EffectResultScope; |
53 class GlobalDeclarationsBuilder; | 53 class GlobalDeclarationsBuilder; |
| 54 class BlockCoverageBuilder; |
54 class RegisterAllocationScope; | 55 class RegisterAllocationScope; |
55 class TestResultScope; | 56 class TestResultScope; |
56 class ValueResultScope; | 57 class ValueResultScope; |
57 | 58 |
58 using ToBooleanMode = BytecodeArrayBuilder::ToBooleanMode; | 59 using ToBooleanMode = BytecodeArrayBuilder::ToBooleanMode; |
59 | 60 |
60 enum class TestFallthrough { kThen, kElse, kNone }; | 61 enum class TestFallthrough { kThen, kElse, kNone }; |
61 enum class TypeHint { kAny, kString, kBoolean }; | 62 enum class TypeHint { kAny, kString, kBoolean }; |
62 | 63 |
63 void GenerateBytecodeBody(); | 64 void GenerateBytecodeBody(); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 LoopBuilder* loop_builder); | 172 LoopBuilder* loop_builder); |
172 void VisitIterationBody(IterationStatement* stmt, LoopBuilder* loop_builder); | 173 void VisitIterationBody(IterationStatement* stmt, LoopBuilder* loop_builder); |
173 | 174 |
174 // Visit a statement and switch scopes, the context is in the accumulator. | 175 // Visit a statement and switch scopes, the context is in the accumulator. |
175 void VisitInScope(Statement* stmt, Scope* scope); | 176 void VisitInScope(Statement* stmt, Scope* scope); |
176 | 177 |
177 void BuildPushUndefinedIntoRegisterList(RegisterList* reg_list); | 178 void BuildPushUndefinedIntoRegisterList(RegisterList* reg_list); |
178 | 179 |
179 void BuildLoadPropertyKey(LiteralProperty* property, Register out_reg); | 180 void BuildLoadPropertyKey(LiteralProperty* property, Register out_reg); |
180 | 181 |
| 182 int AllocateBlockCoverageSlotIfEnabled(SourceRange range); |
| 183 void BuildIncrementBlockCoverageCounterIfEnabled(int coverage_array_slot); |
| 184 |
181 // Visitors for obtaining expression result in the accumulator, in a | 185 // Visitors for obtaining expression result in the accumulator, in a |
182 // register, or just getting the effect. Some visitors return a TypeHint which | 186 // register, or just getting the effect. Some visitors return a TypeHint which |
183 // specifies the type of the result of the visited expression. | 187 // specifies the type of the result of the visited expression. |
184 TypeHint VisitForAccumulatorValue(Expression* expr); | 188 TypeHint VisitForAccumulatorValue(Expression* expr); |
185 void VisitForAccumulatorValueOrTheHole(Expression* expr); | 189 void VisitForAccumulatorValueOrTheHole(Expression* expr); |
186 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expr); | 190 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expr); |
187 void VisitForRegisterValue(Expression* expr, Register destination); | 191 void VisitForRegisterValue(Expression* expr, Register destination); |
188 void VisitAndPushIntoRegisterList(Expression* expr, RegisterList* reg_list); | 192 void VisitAndPushIntoRegisterList(Expression* expr, RegisterList* reg_list); |
189 void VisitForEffect(Expression* expr); | 193 void VisitForEffect(Expression* expr); |
190 void VisitForTest(Expression* expr, BytecodeLabels* then_labels, | 194 void VisitForTest(Expression* expr, BytecodeLabels* then_labels, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 int feedback_index(FeedbackSlot slot) const; | 241 int feedback_index(FeedbackSlot slot) const; |
238 | 242 |
239 Zone* zone_; | 243 Zone* zone_; |
240 BytecodeArrayBuilder* builder_; | 244 BytecodeArrayBuilder* builder_; |
241 CompilationInfo* info_; | 245 CompilationInfo* info_; |
242 const AstStringConstants* ast_string_constants_; | 246 const AstStringConstants* ast_string_constants_; |
243 DeclarationScope* closure_scope_; | 247 DeclarationScope* closure_scope_; |
244 Scope* current_scope_; | 248 Scope* current_scope_; |
245 | 249 |
246 GlobalDeclarationsBuilder* globals_builder_; | 250 GlobalDeclarationsBuilder* globals_builder_; |
| 251 BlockCoverageBuilder* block_coverage_builder_; |
247 ZoneVector<GlobalDeclarationsBuilder*> global_declarations_; | 252 ZoneVector<GlobalDeclarationsBuilder*> global_declarations_; |
248 ZoneVector<std::pair<FunctionLiteral*, size_t>> function_literals_; | 253 ZoneVector<std::pair<FunctionLiteral*, size_t>> function_literals_; |
249 ZoneVector<std::pair<NativeFunctionLiteral*, size_t>> | 254 ZoneVector<std::pair<NativeFunctionLiteral*, size_t>> |
250 native_function_literals_; | 255 native_function_literals_; |
251 ZoneVector<std::pair<ObjectLiteral*, size_t>> object_literals_; | 256 ZoneVector<std::pair<ObjectLiteral*, size_t>> object_literals_; |
252 ZoneVector<std::pair<ArrayLiteral*, size_t>> array_literals_; | 257 ZoneVector<std::pair<ArrayLiteral*, size_t>> array_literals_; |
253 | 258 |
254 ControlScope* execution_control_; | 259 ControlScope* execution_control_; |
255 ContextScope* execution_context_; | 260 ContextScope* execution_context_; |
256 ExpressionResultScope* execution_result_; | 261 ExpressionResultScope* execution_result_; |
257 | 262 |
258 BytecodeJumpTable* generator_jump_table_; | 263 BytecodeJumpTable* generator_jump_table_; |
259 Register generator_state_; | 264 Register generator_state_; |
260 int loop_depth_; | 265 int loop_depth_; |
261 }; | 266 }; |
262 | 267 |
263 } // namespace interpreter | 268 } // namespace interpreter |
264 } // namespace internal | 269 } // namespace internal |
265 } // namespace v8 | 270 } // namespace v8 |
266 | 271 |
267 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 272 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
OLD | NEW |