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

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: Incorporate comments from mstarzinger. 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 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 // Methods marking the start and end of binary expressions.
74 void PrepareForBinaryExpression();
75 void CompleteBinaryExpression();
76
77 // Methods for tracking and remapping register.
78 void RecordStoreToRegister(Register reg);
79 Register LoadFromAliasedRegister(Register reg);
80
64 inline BytecodeArrayBuilder* builder() { return &builder_; } 81 inline BytecodeArrayBuilder* builder() { return &builder_; }
65 82
66 inline Isolate* isolate() const { return isolate_; } 83 inline Isolate* isolate() const { return isolate_; }
67 inline Zone* zone() const { return zone_; } 84 inline Zone* zone() const { return zone_; }
68 85
69 inline Scope* scope() const { return scope_; } 86 inline Scope* scope() const { return scope_; }
70 inline void set_scope(Scope* scope) { scope_ = scope; } 87 inline void set_scope(Scope* scope) { scope_ = scope; }
71 inline CompilationInfo* info() const { return info_; } 88 inline CompilationInfo* info() const { return info_; }
72 inline void set_info(CompilationInfo* info) { info_ = info; } 89 inline void set_info(CompilationInfo* info) { info_ = info; }
73 90
74 inline ControlScope* execution_control() const { return execution_control_; } 91 inline ControlScope* execution_control() const { return execution_control_; }
75 inline void set_execution_control(ControlScope* scope) { 92 inline void set_execution_control(ControlScope* scope) {
76 execution_control_ = scope; 93 execution_control_ = scope;
77 } 94 }
78 inline ContextScope* execution_context() const { return execution_context_; } 95 inline ContextScope* execution_context() const { return execution_context_; }
79 inline void set_execution_context(ContextScope* context) { 96 inline void set_execution_context(ContextScope* context) {
80 execution_context_ = context; 97 execution_context_ = context;
81 } 98 }
99 inline void set_execution_result(ExpressionResultScope* execution_result) {
100 execution_result_ = execution_result;
101 }
102 ExpressionResultScope* execution_result() const { return execution_result_; }
82 103
83 ZoneVector<Handle<Object>>* globals() { return &globals_; } 104 ZoneVector<Handle<Object>>* globals() { return &globals_; }
84 inline LanguageMode language_mode() const; 105 inline LanguageMode language_mode() const;
85 Strength language_mode_strength() const; 106 Strength language_mode_strength() const;
86 int feedback_index(FeedbackVectorSlot slot) const; 107 int feedback_index(FeedbackVectorSlot slot) const;
87 108
88 Isolate* isolate_; 109 Isolate* isolate_;
89 Zone* zone_; 110 Zone* zone_;
90 BytecodeArrayBuilder builder_; 111 BytecodeArrayBuilder builder_;
91 CompilationInfo* info_; 112 CompilationInfo* info_;
92 Scope* scope_; 113 Scope* scope_;
93 ZoneVector<Handle<Object>> globals_; 114 ZoneVector<Handle<Object>> globals_;
94 ControlScope* execution_control_; 115 ControlScope* execution_control_;
95 ContextScope* execution_context_; 116 ContextScope* execution_context_;
117 ExpressionResultScope* execution_result_;
118
119 int binary_expression_depth_;
120 ZoneSet<int> binary_expression_hazard_set_;
96 }; 121 };
97 122
98 } // namespace interpreter 123 } // namespace interpreter
99 } // namespace internal 124 } // namespace internal
100 } // namespace v8 125 } // namespace v8
101 126
102 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ 127 #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