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

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

Issue 1373903005: [Interpreter] Add for/while/do support to the bytecode generator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Incorporate feedback from mstarzinger which revealed use after destruction bug. Created 5 years, 2 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.h" 8 #include "src/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 BytecodeGenerator : public AstVisitor { 16 class BytecodeGenerator : public AstVisitor {
17 public: 17 public:
18 BytecodeGenerator(Isolate* isolate, Zone* zone); 18 BytecodeGenerator(Isolate* isolate, Zone* zone);
19 virtual ~BytecodeGenerator(); 19 virtual ~BytecodeGenerator();
20 20
21 Handle<BytecodeArray> MakeBytecode(CompilationInfo* info); 21 Handle<BytecodeArray> MakeBytecode(CompilationInfo* info);
22 22
23 #define DECLARE_VISIT(type) void Visit##type(type* node) override; 23 #define DECLARE_VISIT(type) void Visit##type(type* node) override;
24 AST_NODE_LIST(DECLARE_VISIT) 24 AST_NODE_LIST(DECLARE_VISIT)
25 #undef DECLARE_VISIT 25 #undef DECLARE_VISIT
26 26
27 private: 27 private:
28 class ControlScope;
29 class ControlScopeForBreakable;
rmcilroy 2015/10/01 09:18:56 doesn't exist?
oth 2015/10/01 11:43:02 Done.
30 class ControlScopeForIteration;
31
28 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); 32 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
29 33
30 void VisitArithmeticExpression(BinaryOperation* binop); 34 void VisitArithmeticExpression(BinaryOperation* binop);
31 void VisitPropertyLoad(Register obj, Property* expr); 35 void VisitPropertyLoad(Register obj, Property* expr);
32 void VisitVariableLoad(Variable* variable); 36 void VisitVariableLoad(Variable* variable);
33 37
34 inline BytecodeArrayBuilder& builder() { return builder_; } 38 inline BytecodeArrayBuilder* builder() { return &builder_; }
35 inline Scope* scope() const { return scope_; } 39 inline Scope* scope() const { return scope_; }
36 inline void set_scope(Scope* scope) { scope_ = scope; } 40 inline void set_scope(Scope* scope) { scope_ = scope; }
41 inline ControlScope* control_scope() const { return control_scope_; }
42 inline void set_control_scope(ControlScope* scope) { control_scope_ = scope; }
37 inline CompilationInfo* info() const { return info_; } 43 inline CompilationInfo* info() const { return info_; }
38 inline void set_info(CompilationInfo* info) { info_ = info; } 44 inline void set_info(CompilationInfo* info) { info_ = info; }
39 45
40 LanguageMode language_mode() const; 46 LanguageMode language_mode() const;
41 int feedback_index(FeedbackVectorICSlot slot) const; 47 int feedback_index(FeedbackVectorICSlot slot) const;
42 48
43 BytecodeArrayBuilder builder_; 49 BytecodeArrayBuilder builder_;
44 CompilationInfo* info_; 50 CompilationInfo* info_;
45 Scope* scope_; 51 Scope* scope_;
52 ControlScope* control_scope_;
46 }; 53 };
47 54
48 } // namespace interpreter 55 } // namespace interpreter
49 } // namespace internal 56 } // namespace internal
50 } // namespace v8 57 } // namespace v8
51 58
52 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ 59 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698