From 53454d95d0f456fd1b285a85351a8afa9dcda210 Mon Sep 17 00:00:00 2001 From: "svenpanne@chromium.org" Date: Thu, 2 Oct 2014 11:52:54 +0000 Subject: [PATCH] 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 R=mvstanton@chromium.org Review URL: https://codereview.chromium.org/615423006 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24393 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/ast.cc | 2 +- src/ast.h | 17 +++++++++++------ src/parser.cc | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/ast.cc b/src/ast.cc index 3e86551..d7724f9 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())); } diff --git a/src/ast.h b/src/ast.h index c55505f..4bd65ae 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_; diff --git a/src/parser.cc b/src/parser.cc index ed04d24..ec7605b 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) => ... -- 2.7.4