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

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

Issue 1379793004: [Interpreter] Add support for new local function context creation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_decl
Patch Set: Fix interpreter-assembler-unittest 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
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | 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.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"
(...skipping 10 matching lines...) Expand all
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 // Visiting function for declarations list is overridden. 27 // Visiting function for declarations list is overridden.
28 void VisitDeclarations(ZoneList<Declaration*>* declarations) override; 28 void VisitDeclarations(ZoneList<Declaration*>* declarations) override;
29 29
30 private: 30 private:
31 class ContextScope;
31 class ControlScope; 32 class ControlScope;
32 class ControlScopeForIteration; 33 class ControlScopeForIteration;
33 34
35 void MakeBytecodeBody();
36
34 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); 37 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
35 38
36 void VisitArithmeticExpression(BinaryOperation* binop); 39 void VisitArithmeticExpression(BinaryOperation* binop);
37 void VisitPropertyLoad(Register obj, Property* expr); 40 void VisitPropertyLoad(Register obj, Property* expr);
38 void VisitVariableLoad(Variable* variable, FeedbackVectorSlot slot); 41 void VisitVariableLoad(Variable* variable, FeedbackVectorSlot slot);
39 void VisitVariableAssignment(Variable* variable, FeedbackVectorSlot slot); 42 void VisitVariableAssignment(Variable* variable, FeedbackVectorSlot slot);
43 void VisitNewLocalFunctionContext();
40 44
41 // Dispatched from VisitUnaryOperation. 45 // Dispatched from VisitUnaryOperation.
42 void VisitVoid(UnaryOperation* expr); 46 void VisitVoid(UnaryOperation* expr);
43 void VisitTypeOf(UnaryOperation* expr); 47 void VisitTypeOf(UnaryOperation* expr);
44 void VisitNot(UnaryOperation* expr); 48 void VisitNot(UnaryOperation* expr);
45 49
46 inline BytecodeArrayBuilder* builder() { return &builder_; } 50 inline BytecodeArrayBuilder* builder() { return &builder_; }
51
47 inline Scope* scope() const { return scope_; } 52 inline Scope* scope() const { return scope_; }
48 inline void set_scope(Scope* scope) { scope_ = scope; } 53 inline void set_scope(Scope* scope) { scope_ = scope; }
54 inline CompilationInfo* info() const { return info_; }
55 inline void set_info(CompilationInfo* info) { info_ = info; }
56
49 inline ControlScope* control_scope() const { return control_scope_; } 57 inline ControlScope* control_scope() const { return control_scope_; }
50 inline void set_control_scope(ControlScope* scope) { control_scope_ = scope; } 58 inline void set_control_scope(ControlScope* scope) { control_scope_ = scope; }
51 inline CompilationInfo* info() const { return info_; } 59 inline Register current_context() const { return current_context_; }
52 inline void set_info(CompilationInfo* info) { info_ = info; } 60 inline void set_current_context(Register context) {
61 current_context_ = context;
62 }
63
53 ZoneVector<Handle<Object>>* globals() { return &globals_; } 64 ZoneVector<Handle<Object>>* globals() { return &globals_; }
54 65 inline LanguageMode language_mode() const;
55 LanguageMode language_mode() const;
56 Strength language_mode_strength() const; 66 Strength language_mode_strength() const;
57 int feedback_index(FeedbackVectorSlot slot) const; 67 int feedback_index(FeedbackVectorSlot slot) const;
58 Register current_context() const;
59 68
60 BytecodeArrayBuilder builder_; 69 BytecodeArrayBuilder builder_;
61 CompilationInfo* info_; 70 CompilationInfo* info_;
62 Scope* scope_; 71 Scope* scope_;
63 ZoneVector<Handle<Object>> globals_; 72 ZoneVector<Handle<Object>> globals_;
64 ControlScope* control_scope_; 73 ControlScope* control_scope_;
65 74
66 // TODO(rmcilroy): Encapsulate this in an environment object.
67 Register current_context_; 75 Register current_context_;
68 }; 76 };
69 77
70 } // namespace interpreter 78 } // namespace interpreter
71 } // namespace internal 79 } // namespace internal
72 } // namespace v8 80 } // namespace v8
73 81
74 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ 82 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698