Reviewers: Mads Ager,

Description:
Compress Variable
Due to Variable class field order the sizeof(Variable)==36.
After the manual reorder the boolean fields are aligned better
by the C++ compiler with the resulting sizeof(Variable)==32.


BUG=
TEST=

Please review this at http://codereview.chromium.org/6246019/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/variables.h
  M src/variables.cc


Index: src/variables.cc
diff --git a/src/variables.cc b/src/variables.cc
index 7f580fc6f0c30b9a6501dfdfd559e7536e49f8e3..fa7ce1b0c550e15ae6fa4a1ba3b87e330c2283d3 100644
--- a/src/variables.cc
+++ b/src/variables.cc
@@ -112,12 +112,12 @@ Variable::Variable(Scope* scope,
   : scope_(scope),
     name_(name),
     mode_(mode),
-    is_valid_LHS_(is_valid_LHS),
     kind_(kind),
     local_if_not_shadowed_(NULL),
+    rewrite_(NULL),
+    is_valid_LHS_(is_valid_LHS),
     is_accessed_from_inner_scope_(false),
-    is_used_(false),
-    rewrite_(NULL) {
+    is_used_(false) {
   // names must be canonicalized for fast equality checks
   ASSERT(name->IsSymbol());
 }
Index: src/variables.h
diff --git a/src/variables.h b/src/variables.h
index 882a52ed828acfdebdd210006ac9971a0c657ef0..5d27a02d5375ec70b84934e637b0a18a0e621f41 100644
--- a/src/variables.h
+++ b/src/variables.h
@@ -187,21 +187,23 @@ class Variable: public ZoneObject {
   Scope* scope_;
   Handle<String> name_;
   Mode mode_;
-  bool is_valid_LHS_;
   Kind kind_;

   Variable* local_if_not_shadowed_;

-  // Usage info.
-  bool is_accessed_from_inner_scope_;  // set by variable resolver
-  bool is_used_;
-
   // Static type information
   StaticType type_;

   // Code generation.
   // rewrite_ is usually a Slot or a Property, but may be any expression.
   Expression* rewrite_;
+
+  // Valid as a LHS? (const and this are not valid LHS, for example)
+  bool is_valid_LHS_;
+
+  // Usage info.
+  bool is_accessed_from_inner_scope_;  // set by variable resolver
+  bool is_used_;
 };




--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to