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

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

Issue 1392933002: [Interpreter] Reduce temporary register usage in generated bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Missed comments. 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"
(...skipping 13 matching lines...) Expand all
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 ContextScope;
32 class ControlScope; 32 class ControlScope;
33 class ControlScopeForIteration; 33 class ControlScopeForIteration;
34 class ExpressionResultScope;
35 class EffectResultScope;
36 class AccumulatorResultScope;
37 class RegisterResultScope;
34 38
35 void MakeBytecodeBody(); 39 void MakeBytecodeBody();
36 Register NextContextRegister() const; 40 Register NextContextRegister() const;
37 41
38 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); 42 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
39 43
40 Register VisitArguments(ZoneList<Expression*>* arguments, 44 Register VisitArguments(ZoneList<Expression*>* arguments);
41 TemporaryRegisterScope* caller_scope);
42 void VisitArithmeticExpression(BinaryOperation* binop); 45 void VisitArithmeticExpression(BinaryOperation* binop);
43 void VisitCommaExpression(BinaryOperation* binop); 46 void VisitCommaExpression(BinaryOperation* binop);
44 void VisitLogicalOrExpression(BinaryOperation* binop); 47 void VisitLogicalOrExpression(BinaryOperation* binop);
45 void VisitLogicalAndExpression(BinaryOperation* binop); 48 void VisitLogicalAndExpression(BinaryOperation* binop);
46 void VisitPropertyLoad(Register obj, Property* expr); 49 void VisitPropertyLoad(Register obj, Property* expr);
47 void VisitVariableLoad(Variable* variable, FeedbackVectorSlot slot); 50 void VisitVariableLoad(Variable* variable, FeedbackVectorSlot slot);
48 void VisitVariableAssignment(Variable* variable, FeedbackVectorSlot slot); 51 void VisitVariableAssignment(Variable* variable, FeedbackVectorSlot slot);
49 void VisitNewLocalFunctionContext(); 52 void VisitNewLocalFunctionContext();
50 void VisitBuildLocalActivationContext(); 53 void VisitBuildLocalActivationContext();
51 void VisitNewLocalBlockContext(Scope* scope); 54 void VisitNewLocalBlockContext(Scope* scope);
52 void VisitFunctionClosureForContext(); 55 void VisitFunctionClosureForContext();
53 void VisitSetHomeObject(Register value, Register home_object, 56 void VisitSetHomeObject(Register value, Register home_object,
54 ObjectLiteralProperty* property, int slot_number = 0); 57 ObjectLiteralProperty* property, int slot_number = 0);
55 void VisitObjectLiteralAccessor(Register home_object, 58 void VisitObjectLiteralAccessor(Register home_object,
56 ObjectLiteralProperty* property, 59 ObjectLiteralProperty* property,
57 Register value_out); 60 Register value_out);
58 61
59 // Dispatched from VisitUnaryOperation. 62 // Dispatched from VisitUnaryOperation.
60 void VisitVoid(UnaryOperation* expr); 63 void VisitVoid(UnaryOperation* expr);
61 void VisitTypeOf(UnaryOperation* expr); 64 void VisitTypeOf(UnaryOperation* expr);
62 void VisitNot(UnaryOperation* expr); 65 void VisitNot(UnaryOperation* expr);
63 66
67 // Visitors for obtaining expression result in the accumulator, in a
68 // register, or just getting the effect.
69 void VisitForAccumulatorValue(Expression* expression);
70 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expression);
71 void VisitForEffect(Expression* node);
72
73 // Binary expression state machine and load-store tracking.
74 void PrepareForBinaryExpression();
75 void RecordStoreToRegister(Register reg);
76 Register LoadFromAliasedRegister(Register reg);
rmcilroy 2015/10/20 16:39:20 nit - move these into a seperate block from Prepar
oth 2015/10/20 20:58:42 Done.
77 void CompleteBinaryExpression();
78
64 inline BytecodeArrayBuilder* builder() { return &builder_; } 79 inline BytecodeArrayBuilder* builder() { return &builder_; }
65 80
66 inline Isolate* isolate() const { return isolate_; } 81 inline Isolate* isolate() const { return isolate_; }
67 inline Zone* zone() const { return zone_; } 82 inline Zone* zone() const { return zone_; }
68 83
69 inline Scope* scope() const { return scope_; } 84 inline Scope* scope() const { return scope_; }
70 inline void set_scope(Scope* scope) { scope_ = scope; } 85 inline void set_scope(Scope* scope) { scope_ = scope; }
71 inline CompilationInfo* info() const { return info_; } 86 inline CompilationInfo* info() const { return info_; }
72 inline void set_info(CompilationInfo* info) { info_ = info; } 87 inline void set_info(CompilationInfo* info) { info_ = info; }
73 88
74 inline ControlScope* execution_control() const { return execution_control_; } 89 inline ControlScope* execution_control() const { return execution_control_; }
75 inline void set_execution_control(ControlScope* scope) { 90 inline void set_execution_control(ControlScope* scope) {
76 execution_control_ = scope; 91 execution_control_ = scope;
77 } 92 }
78 inline ContextScope* execution_context() const { return execution_context_; } 93 inline ContextScope* execution_context() const { return execution_context_; }
79 inline void set_execution_context(ContextScope* context) { 94 inline void set_execution_context(ContextScope* context) {
80 execution_context_ = context; 95 execution_context_ = context;
81 } 96 }
97 inline void set_result_scope(ExpressionResultScope* result_scope) {
98 result_scope_ = result_scope;
99 }
100 ExpressionResultScope* result_scope() const { return result_scope_; }
rmcilroy 2015/10/20 16:39:20 optional nit - should we call this execution_resul
oth 2015/10/20 20:58:42 Done.
82 101
83 ZoneVector<Handle<Object>>* globals() { return &globals_; } 102 ZoneVector<Handle<Object>>* globals() { return &globals_; }
84 inline LanguageMode language_mode() const; 103 inline LanguageMode language_mode() const;
85 Strength language_mode_strength() const; 104 Strength language_mode_strength() const;
86 int feedback_index(FeedbackVectorSlot slot) const; 105 int feedback_index(FeedbackVectorSlot slot) const;
87 106
88 Isolate* isolate_; 107 Isolate* isolate_;
89 Zone* zone_; 108 Zone* zone_;
90 BytecodeArrayBuilder builder_; 109 BytecodeArrayBuilder builder_;
91 CompilationInfo* info_; 110 CompilationInfo* info_;
92 Scope* scope_; 111 Scope* scope_;
93 ZoneVector<Handle<Object>> globals_; 112 ZoneVector<Handle<Object>> globals_;
94 ControlScope* execution_control_; 113 ControlScope* execution_control_;
95 ContextScope* execution_context_; 114 ContextScope* execution_context_;
115 ExpressionResultScope* result_scope_;
116
117 int binary_expression_depth_;
118 ZoneSet<int> binary_expression_hazard_set_;
96 }; 119 };
97 120
98 } // namespace interpreter 121 } // namespace interpreter
99 } // namespace internal 122 } // namespace internal
100 } // namespace v8 123 } // namespace v8
101 124
102 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ 125 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698