Reviewers: mvstanton,

Description:
Squeeze the layout of expression nodes a bit.

Again 112MB less peak memory usage in the bug mentioned below. :-)
Routed all writes to to_boolean_types_ through its setter on the way.

BUG=417697
LOG=y

Please review this at https://codereview.chromium.org/615423006/

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

Affected files (+13, -8 lines):
  M src/ast.h
  M src/ast.cc
  M src/parser.cc


Index: src/ast.cc
diff --git a/src/ast.cc b/src/ast.cc
index 3e8655124b8a847dad531bc063bdcab747c4cd22..d7724f9027380450758aeb553804727e00561330 100644
--- a/src/ast.cc
+++ b/src/ast.cc
@@ -560,7 +560,7 @@ bool FunctionDeclaration::IsInlineable() const {
 // once we use the common type field in the AST consistently.

 void Expression::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) {
-  to_boolean_types_ = oracle->ToBooleanTypes(test_id());
+  set_to_boolean_types(oracle->ToBooleanTypes(test_id()));
 }


Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index c55505ffd7fe8d231924cc96235e167bd1bb782c..4bd65aee205cad8a5e463a3809fe0e34dd3d24b3 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -363,9 +363,12 @@ class Expression : public AstNode {
   void set_bounds(Bounds bounds) { bounds_ = bounds; }

   // Whether the expression is parenthesized
- unsigned parenthesization_level() const { return parenthesization_level_; }
-  bool is_parenthesized() const { return parenthesization_level_ > 0; }
-  void increase_parenthesization_level() { ++parenthesization_level_; }
+  bool is_parenthesized() const { return is_parenthesized_; }
+  bool is_multi_parenthesized() const { return is_multi_parenthesized_; }
+  void increase_parenthesization_level() {
+    is_multi_parenthesized_ = is_parenthesized_;
+    is_parenthesized_ = true;
+  }

   // Type feedback information for assignments and properties.
   virtual bool IsMonomorphic() {
@@ -391,16 +394,18 @@ class Expression : public AstNode {
  protected:
   Expression(Zone* zone, int pos, IdGen* id_gen)
       : AstNode(pos),
+        is_parenthesized_(false),
+        is_multi_parenthesized_(false),
         bounds_(Bounds::Unbounded(zone)),
-        parenthesization_level_(0),
         id_(id_gen->GetNextId()),
         test_id_(id_gen->GetNextId()) {}
   void set_to_boolean_types(byte types) { to_boolean_types_ = types; }

  private:
-  Bounds bounds_;
   byte to_boolean_types_;
-  unsigned parenthesization_level_;
+  bool is_parenthesized_ : 1;
+  bool is_multi_parenthesized_ : 1;
+  Bounds bounds_;

   const BailoutId id_;
   const TypeFeedbackId test_id_;
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index ed04d248d0f49e4befe505cddf3bd22b22da5cbe..ec7605b5404eb214c96dc4b7473b842c55f4d763 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -3381,7 +3381,7 @@ bool CheckAndDeclareArrowParameter(ParserTraits* traits, Expression* expression,

   // Too many parentheses around expression:
   //   (( ... )) => ...
-  if (expression->parenthesization_level() > 1) return false;
+  if (expression->is_multi_parenthesized()) return false;

   // Case for a single parameter:
   //   (foo) => ...


--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to