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

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

Issue 1902013002: [Interpreter] Pass CompileInfo to BytecodeGenerator's constructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | src/interpreter/bytecode-generator.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_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/bytecodes.h" 10 #include "src/interpreter/bytecodes.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 namespace interpreter { 14 namespace interpreter {
15 15
16 class LoopBuilder; 16 class LoopBuilder;
17 17
18 class BytecodeGenerator final : public AstVisitor { 18 class BytecodeGenerator final : public AstVisitor {
19 public: 19 public:
20 BytecodeGenerator(Isolate* isolate, Zone* zone); 20 explicit BytecodeGenerator(CompilationInfo* info);
21 21
22 Handle<BytecodeArray> MakeBytecode(CompilationInfo* info); 22 Handle<BytecodeArray> MakeBytecode();
23 23
24 #define DECLARE_VISIT(type) void Visit##type(type* node) override; 24 #define DECLARE_VISIT(type) void Visit##type(type* node) override;
25 AST_NODE_LIST(DECLARE_VISIT) 25 AST_NODE_LIST(DECLARE_VISIT)
26 #undef DECLARE_VISIT 26 #undef DECLARE_VISIT
27 27
28 // Visiting function for declarations list and statements are overridden. 28 // Visiting function for declarations list and statements are overridden.
29 void VisitDeclarations(ZoneList<Declaration*>* declarations) override; 29 void VisitDeclarations(ZoneList<Declaration*>* declarations) override;
30 void VisitStatements(ZoneList<Statement*>* statments) override; 30 void VisitStatements(ZoneList<Statement*>* statments) override;
31 31
32 private: 32 private:
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 Register LoadFromAliasedRegister(Register reg); 154 Register LoadFromAliasedRegister(Register reg);
155 155
156 // Methods for tracking try-block nesting. 156 // Methods for tracking try-block nesting.
157 bool IsInsideTryCatch() const { return try_catch_nesting_level_ > 0; } 157 bool IsInsideTryCatch() const { return try_catch_nesting_level_ > 0; }
158 bool IsInsideTryFinally() const { return try_finally_nesting_level_ > 0; } 158 bool IsInsideTryFinally() const { return try_finally_nesting_level_ > 0; }
159 159
160 // Initialize an array of temporary registers with consecutive registers. 160 // Initialize an array of temporary registers with consecutive registers.
161 template <size_t N> 161 template <size_t N>
162 void InitializeWithConsecutiveRegisters(Register (&registers)[N]); 162 void InitializeWithConsecutiveRegisters(Register (&registers)[N]);
163 163
164 inline void set_builder(BytecodeArrayBuilder* builder) { builder_ = builder; }
165 inline BytecodeArrayBuilder* builder() const { return builder_; } 164 inline BytecodeArrayBuilder* builder() const { return builder_; }
166
167 inline Isolate* isolate() const { return isolate_; } 165 inline Isolate* isolate() const { return isolate_; }
168 inline Zone* zone() const { return zone_; } 166 inline Zone* zone() const { return zone_; }
169
170 inline Scope* scope() const { return scope_; } 167 inline Scope* scope() const { return scope_; }
171 inline void set_scope(Scope* scope) { scope_ = scope; }
172 inline CompilationInfo* info() const { return info_; } 168 inline CompilationInfo* info() const { return info_; }
173 inline void set_info(CompilationInfo* info) { info_ = info; }
174 169
175 inline ControlScope* execution_control() const { return execution_control_; } 170 inline ControlScope* execution_control() const { return execution_control_; }
176 inline void set_execution_control(ControlScope* scope) { 171 inline void set_execution_control(ControlScope* scope) {
177 execution_control_ = scope; 172 execution_control_ = scope;
178 } 173 }
179 inline ContextScope* execution_context() const { return execution_context_; } 174 inline ContextScope* execution_context() const { return execution_context_; }
180 inline void set_execution_context(ContextScope* context) { 175 inline void set_execution_context(ContextScope* context) {
181 execution_context_ = context; 176 execution_context_ = context;
182 } 177 }
183 inline void set_execution_result(ExpressionResultScope* execution_result) { 178 inline void set_execution_result(ExpressionResultScope* execution_result) {
(...skipping 26 matching lines...) Expand all
210 int try_catch_nesting_level_; 205 int try_catch_nesting_level_;
211 int try_finally_nesting_level_; 206 int try_finally_nesting_level_;
212 int generator_yields_seen_; 207 int generator_yields_seen_;
213 }; 208 };
214 209
215 } // namespace interpreter 210 } // namespace interpreter
216 } // namespace internal 211 } // namespace internal
217 } // namespace v8 212 } // namespace v8
218 213
219 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ 214 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_
OLDNEW
« no previous file with comments | « no previous file | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698