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

Unified 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: Update comment in BytecodeGenerator::VisitCall(). 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/interpreter/bytecode-generator.cc » ('j') | src/interpreter/bytecode-generator.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-generator.h
diff --git a/src/interpreter/bytecode-generator.h b/src/interpreter/bytecode-generator.h
index 3ce65322cc4314c81798e37397b6531d70583451..1fa34ae7ea160287ba717aa478ebf7bfebc48558 100644
--- a/src/interpreter/bytecode-generator.h
+++ b/src/interpreter/bytecode-generator.h
@@ -30,6 +30,10 @@ class BytecodeGenerator : public AstVisitor {
private:
class ControlScope;
class ControlScopeForIteration;
+ class ExpressionResultScope;
+ class AccumulatorResultScope;
+ class EffectResultScope;
+ class RegisterResultScope;
DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
@@ -43,6 +47,17 @@ class BytecodeGenerator : public AstVisitor {
void VisitTypeOf(UnaryOperation* expr);
void VisitNot(UnaryOperation* expr);
+ // Visitors for obtaining expression result in the accumulator, in a
+ // register, or just getting the effect.
+ void VisitForAccumulatorValue(Expression* expression);
+ MUST_USE_RESULT Register VisitForRegisterValue(
+ Expression* expression, TemporaryRegisterScope* temporary_register_scope);
+ void VisitForEffect(Expression* node);
+
+ void SetResultRegister(Register reg);
+ Register GetResultRegister();
+ bool ResultRegisterIsEmpty() const;
+
inline BytecodeArrayBuilder* builder() { return &builder_; }
inline Scope* scope() const { return scope_; }
inline void set_scope(Scope* scope) { scope_ = scope; }
@@ -51,6 +66,10 @@ class BytecodeGenerator : public AstVisitor {
inline CompilationInfo* info() const { return info_; }
inline void set_info(CompilationInfo* info) { info_ = info; }
ZoneVector<Handle<Object>>* globals() { return &globals_; }
+ inline void set_result_scope(ExpressionResultScope* result_scope) {
+ result_scope_ = result_scope;
+ }
+ inline ExpressionResultScope* result_scope() const { return result_scope_; }
LanguageMode language_mode() const;
Strength language_mode_strength() const;
@@ -65,6 +84,8 @@ class BytecodeGenerator : public AstVisitor {
// TODO(rmcilroy): Encapsulate this in an environment object.
Register current_context_;
+ ExpressionResultScope* result_scope_;
+ Maybe<Register> result_register_;
};
} // namespace interpreter
« no previous file with comments | « no previous file | src/interpreter/bytecode-generator.cc » ('j') | src/interpreter/bytecode-generator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698