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

Unified Diff: src/ast.h

Issue 629983002: Squeeze the layout of variable proxy nodes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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/ast.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index 5ef471377bf11e6000b274948b603d6f7a21ea6e..11dda68879962254d1a998c001b178ed6f3c76ec 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -1636,20 +1636,36 @@ class VariableProxy FINAL : public Expression {
DECLARE_NODE_TYPE(VariableProxy)
virtual bool IsValidReferenceExpression() const OVERRIDE {
- return var_ == NULL ? true : var_->IsValidReference();
+ return !is_resolved() || var()->IsValidReference();
}
- bool IsArguments() const { return var_ != NULL && var_->is_arguments(); }
+ bool IsArguments() const { return is_resolved() && var()->is_arguments(); }
+
+ Handle<String> name() const { return raw_name()->string(); }
+ const AstRawString* raw_name() const {
+ return is_resolved() ? var_->raw_name() : raw_name_;
+ }
+
+ Variable* var() const {
+ DCHECK(is_resolved());
+ return var_;
+ }
+ void set_var(Variable* v) {
+ DCHECK(!is_resolved());
+ DCHECK_NOT_NULL(v);
+ var_ = v;
+ }
- Handle<String> name() const { return name_->string(); }
- const AstRawString* raw_name() const { return name_; }
- Variable* var() const { return var_; }
bool is_this() const { return is_this_; }
- Interface* interface() const { return interface_; }
bool is_assigned() const { return is_assigned_; }
void set_is_assigned() { is_assigned_ = true; }
+ bool is_resolved() const { return is_resolved_; }
+ void set_is_resolved() { is_resolved_ = true; }
+
+ Interface* interface() const { return interface_; }
+
// Bind this proxy to the variable var. Interfaces must match.
void BindTo(Variable* var);
@@ -1666,12 +1682,15 @@ class VariableProxy FINAL : public Expression {
VariableProxy(Zone* zone, const AstRawString* name, bool is_this,
Interface* interface, int position, IdGen* id_gen);
- const AstRawString* name_;
- Variable* var_; // resolved variable, or NULL
- bool is_this_;
- bool is_assigned_;
+ union {
+ const AstRawString* raw_name_; // if !is_resolved_
+ Variable* var_; // if is_resolved_
+ };
Interface* interface_;
int variable_feedback_slot_;
+ bool is_this_ : 1;
+ bool is_assigned_ : 1;
+ bool is_resolved_ : 1;
};
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698