| 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 30 matching lines...) Expand all Loading... |
| 41 class ControlScopeForBreakable; | 41 class ControlScopeForBreakable; |
| 42 class ControlScopeForIteration; | 42 class ControlScopeForIteration; |
| 43 class ControlScopeForTopLevel; | 43 class ControlScopeForTopLevel; |
| 44 class ControlScopeForTryCatch; | 44 class ControlScopeForTryCatch; |
| 45 class ControlScopeForTryFinally; | 45 class ControlScopeForTryFinally; |
| 46 class ExpressionResultScope; | 46 class ExpressionResultScope; |
| 47 class EffectResultScope; | 47 class EffectResultScope; |
| 48 class GlobalDeclarationsBuilder; | 48 class GlobalDeclarationsBuilder; |
| 49 class RegisterResultScope; | 49 class RegisterResultScope; |
| 50 class RegisterAllocationScope; | 50 class RegisterAllocationScope; |
| 51 class TestResultScope; |
| 52 |
| 53 enum class TestFallthrough { kThen, kElse, kNone }; |
| 51 | 54 |
| 52 void GenerateBytecode(); | 55 void GenerateBytecode(); |
| 53 void GenerateBytecodeBody(); | 56 void GenerateBytecodeBody(); |
| 54 void FinalizeBytecode(); | 57 void FinalizeBytecode(); |
| 55 | 58 |
| 56 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 59 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
| 57 | 60 |
| 58 // Dispatched from VisitBinaryOperation. | 61 // Dispatched from VisitBinaryOperation. |
| 59 void VisitArithmeticExpression(BinaryOperation* binop); | 62 void VisitArithmeticExpression(BinaryOperation* binop); |
| 60 void VisitCommaExpression(BinaryOperation* binop); | 63 void VisitCommaExpression(BinaryOperation* binop); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // Visit a statement and switch scopes, the context is in the accumulator. | 158 // Visit a statement and switch scopes, the context is in the accumulator. |
| 156 void VisitInScope(Statement* stmt, Scope* scope); | 159 void VisitInScope(Statement* stmt, Scope* scope); |
| 157 | 160 |
| 158 // Visitors for obtaining expression result in the accumulator, in a | 161 // Visitors for obtaining expression result in the accumulator, in a |
| 159 // register, or just getting the effect. | 162 // register, or just getting the effect. |
| 160 void VisitForAccumulatorValue(Expression* expr); | 163 void VisitForAccumulatorValue(Expression* expr); |
| 161 void VisitForAccumulatorValueOrTheHole(Expression* expr); | 164 void VisitForAccumulatorValueOrTheHole(Expression* expr); |
| 162 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expr); | 165 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expr); |
| 163 void VisitForRegisterValue(Expression* expr, Register destination); | 166 void VisitForRegisterValue(Expression* expr, Register destination); |
| 164 void VisitForEffect(Expression* expr); | 167 void VisitForEffect(Expression* expr); |
| 168 void VisitForTest(Expression* expr, BytecodeLabels* then_labels, |
| 169 BytecodeLabels* else_labels, TestFallthrough fallthrough); |
| 165 | 170 |
| 166 // Methods for tracking and remapping register. | 171 // Methods for tracking and remapping register. |
| 167 void RecordStoreToRegister(Register reg); | 172 void RecordStoreToRegister(Register reg); |
| 168 Register LoadFromAliasedRegister(Register reg); | 173 Register LoadFromAliasedRegister(Register reg); |
| 169 | 174 |
| 170 // Initialize an array of temporary registers with consecutive registers. | 175 // Initialize an array of temporary registers with consecutive registers. |
| 171 template <size_t N> | 176 template <size_t N> |
| 172 void InitializeWithConsecutiveRegisters(Register (®isters)[N]); | 177 void InitializeWithConsecutiveRegisters(Register (®isters)[N]); |
| 173 | 178 |
| 174 inline BytecodeArrayBuilder* builder() const { return builder_; } | 179 inline BytecodeArrayBuilder* builder() const { return builder_; } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 ZoneVector<BytecodeLabel> generator_resume_points_; | 223 ZoneVector<BytecodeLabel> generator_resume_points_; |
| 219 Register generator_state_; | 224 Register generator_state_; |
| 220 int loop_depth_; | 225 int loop_depth_; |
| 221 }; | 226 }; |
| 222 | 227 |
| 223 } // namespace interpreter | 228 } // namespace interpreter |
| 224 } // namespace internal | 229 } // namespace internal |
| 225 } // namespace v8 | 230 } // namespace v8 |
| 226 | 231 |
| 227 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 232 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
| OLD | NEW |