Chromium Code Reviews| 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 19 matching lines...) Expand all Loading... | |
| 30 AST_NODE_LIST(DECLARE_VISIT) | 30 AST_NODE_LIST(DECLARE_VISIT) |
| 31 #undef DECLARE_VISIT | 31 #undef DECLARE_VISIT |
| 32 | 32 |
| 33 // Visiting function for declarations list and statements are overridden. | 33 // Visiting function for declarations list and statements are overridden. |
| 34 void VisitDeclarations(ZoneList<Declaration*>* declarations); | 34 void VisitDeclarations(ZoneList<Declaration*>* declarations); |
| 35 void VisitStatements(ZoneList<Statement*>* statments); | 35 void VisitStatements(ZoneList<Statement*>* statments); |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 class AccumulatorResultScope; | 38 class AccumulatorResultScope; |
| 39 class ContextScope; | 39 class ContextScope; |
| 40 class ControlResultScope; | |
|
rmcilroy
2016/08/12 11:15:26
Let's go with TestControlScope and VisitForTest. T
klaasb
2016/08/12 16:00:13
Done.
| |
| 40 class ControlScope; | 41 class ControlScope; |
| 41 class ControlScopeForBreakable; | 42 class ControlScopeForBreakable; |
| 42 class ControlScopeForIteration; | 43 class ControlScopeForIteration; |
| 43 class ControlScopeForTopLevel; | 44 class ControlScopeForTopLevel; |
| 44 class ControlScopeForTryCatch; | 45 class ControlScopeForTryCatch; |
| 45 class ControlScopeForTryFinally; | 46 class ControlScopeForTryFinally; |
| 46 class ExpressionResultScope; | 47 class ExpressionResultScope; |
| 47 class EffectResultScope; | 48 class EffectResultScope; |
| 48 class GlobalDeclarationsBuilder; | 49 class GlobalDeclarationsBuilder; |
| 49 class RegisterResultScope; | 50 class RegisterResultScope; |
| 50 class RegisterAllocationScope; | 51 class RegisterAllocationScope; |
| 52 class BytecodeLabels; | |
| 53 | |
| 54 enum class ControlFallthrough; | |
| 51 | 55 |
| 52 void GenerateBytecode(); | 56 void GenerateBytecode(); |
| 53 void GenerateBytecodeBody(); | 57 void GenerateBytecodeBody(); |
| 54 void FinalizeBytecode(); | 58 void FinalizeBytecode(); |
| 55 | 59 |
| 56 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 60 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
| 57 | 61 |
| 58 // Dispatched from VisitBinaryOperation. | 62 // Dispatched from VisitBinaryOperation. |
| 59 void VisitArithmeticExpression(BinaryOperation* binop); | 63 void VisitArithmeticExpression(BinaryOperation* binop); |
| 60 void VisitCommaExpression(BinaryOperation* binop); | 64 void VisitCommaExpression(BinaryOperation* binop); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 // Visit a statement and switch scopes, the context is in the accumulator. | 160 // Visit a statement and switch scopes, the context is in the accumulator. |
| 157 void VisitInScope(Statement* stmt, Scope* scope); | 161 void VisitInScope(Statement* stmt, Scope* scope); |
| 158 | 162 |
| 159 // Visitors for obtaining expression result in the accumulator, in a | 163 // Visitors for obtaining expression result in the accumulator, in a |
| 160 // register, or just getting the effect. | 164 // register, or just getting the effect. |
| 161 void VisitForAccumulatorValue(Expression* expr); | 165 void VisitForAccumulatorValue(Expression* expr); |
| 162 void VisitForAccumulatorValueOrTheHole(Expression* expr); | 166 void VisitForAccumulatorValueOrTheHole(Expression* expr); |
| 163 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expr); | 167 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expr); |
| 164 void VisitForRegisterValue(Expression* expr, Register destination); | 168 void VisitForRegisterValue(Expression* expr, Register destination); |
| 165 void VisitForEffect(Expression* expr); | 169 void VisitForEffect(Expression* expr); |
| 170 void VisitForControl(Expression* expr, BytecodeLabels* then_labels, | |
| 171 BytecodeLabels* else_labels, | |
| 172 ControlFallthrough fallthrough); | |
| 166 | 173 |
| 167 // Methods for tracking and remapping register. | 174 // Methods for tracking and remapping register. |
| 168 void RecordStoreToRegister(Register reg); | 175 void RecordStoreToRegister(Register reg); |
| 169 Register LoadFromAliasedRegister(Register reg); | 176 Register LoadFromAliasedRegister(Register reg); |
| 170 | 177 |
| 171 // Initialize an array of temporary registers with consecutive registers. | 178 // Initialize an array of temporary registers with consecutive registers. |
| 172 template <size_t N> | 179 template <size_t N> |
| 173 void InitializeWithConsecutiveRegisters(Register (®isters)[N]); | 180 void InitializeWithConsecutiveRegisters(Register (®isters)[N]); |
| 174 | 181 |
| 175 inline BytecodeArrayBuilder* builder() const { return builder_; } | 182 inline BytecodeArrayBuilder* builder() const { return builder_; } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 ZoneVector<BytecodeLabel> generator_resume_points_; | 226 ZoneVector<BytecodeLabel> generator_resume_points_; |
| 220 Register generator_state_; | 227 Register generator_state_; |
| 221 int loop_depth_; | 228 int loop_depth_; |
| 222 }; | 229 }; |
| 223 | 230 |
| 224 } // namespace interpreter | 231 } // namespace interpreter |
| 225 } // namespace internal | 232 } // namespace internal |
| 226 } // namespace v8 | 233 } // namespace v8 |
| 227 | 234 |
| 228 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 235 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
| OLD | NEW |