• stanisc's avatar
    Optimized layout padding in 4 classes in ast.h · 6408032e
    stanisc authored
    This reduces sizeof of these classes by 8 bytes on 64-bit
    (16 bytes considering allocation size granularity for some of these classes).
    
    I don't know how many instances remain at the end of loading a page. These objects are Zone objects which makes it more difficult to count the number
    of instances. But looking at allocations only on cnn.com I've got 70K for
    BinaryOperation, 20K for CompareOperation, 1.5K for CaseClause. There aren't
    not many allocations of NativeFunctionLiteral but I decided to fix it too to
    keep the same layout pattern.
    
    Before:
        class v8::internal::CaseClause [sizeof = 56]
          : public v8::internal::Expression {
          [sizeof=12] v8::internal::Expression
          <padding> (4 bytes)
          [sizeof=8] v8::internal::Expression* label_
          [sizeof=8] v8::internal::Label body_target_
          [sizeof=8] v8::internal::ZoneList<v8::internal::Statement *>* statements_
          [sizeof=8] v8::internal::AstType* compare_type_
          [sizeof=4] v8::internal::FeedbackSlot feedback_slot_
          <padding> (4 bytes)
        }
    
    After:
        class v8::internal::CaseClause [sizeof = 48]
          : public v8::internal::Expression {
          [sizeof=12] v8::internal::Expression
          [sizeof=4] v8::internal::FeedbackSlot feedback_slot_
          [sizeof=8] v8::internal::Expression* label_
          [sizeof=8] v8::internal::Label body_target_
          [sizeof=8] v8::internal::ZoneList<v8::internal::Statement *>* statements_
          [sizeof=8] v8::internal::AstType* compare_type_
        }
    
    Before:
        class v8::internal::BinaryOperation [sizeof = 56]
          : public v8::internal::Expression {
          [sizeof=12] v8::internal::Expression
          [sizeof=1] bool has_fixed_right_arg_
          <padding> (3 bytes)
          [sizeof=4] int fixed_right_arg_value_
          <padding> (4 bytes)
          [sizeof=8] v8::internal::Expression* left_
          [sizeof=8] v8::internal::Expression* right_
          [sizeof=8] v8::internal::Handle<v8::internal::AllocationSite> allocation_site_
          [sizeof=4] v8::internal::FeedbackSlot feedback_slot_
          <padding> (4 bytes)
        }
    
    After:
        class v8::internal::BinaryOperation [sizeof = 48]
          : public v8::internal::Expression {
          [sizeof=12] v8::internal::Expression
          [sizeof=4] v8::internal::FeedbackSlot feedback_slot_
          [sizeof=8] v8::internal::Expression* left_
          [sizeof=8] v8::internal::Expression* right_
          [sizeof=8] v8::internal::Handle<v8::internal::AllocationSite> allocation_site_
          [sizeof=1] bool has_fixed_right_arg_
          <padding> (3 bytes)
          [sizeof=4] int fixed_right_arg_value_
        }
    
    Before:
        class v8::internal::CompareOperation [sizeof = 48]
          : public v8::internal::Expression {
          [sizeof=12] v8::internal::Expression
          <padding> (4 bytes)
          [sizeof=8] v8::internal::Expression* left_
          [sizeof=8] v8::internal::Expression* right_
          [sizeof=8] v8::internal::AstType* combined_type_
          [sizeof=4] v8::internal::FeedbackSlot feedback_slot_
          <padding> (4 bytes)
        }
    
    After:
        class v8::internal::CompareOperation [sizeof = 40]
          : public v8::internal::Expression {
          [sizeof=12] v8::internal::Expression
          [sizeof=4] v8::internal::FeedbackSlot feedback_slot_
          [sizeof=8] v8::internal::Expression* left_
          [sizeof=8] v8::internal::Expression* right_
          [sizeof=8] v8::internal::AstType* combined_type_
        }
    
    Before:
        class v8::internal::NativeFunctionLiteral [sizeof = 40]
          : public v8::internal::Expression {
          [sizeof=12] v8::internal::Expression
          <padding> (4 bytes)
          [sizeof=8] v8::internal::AstRawString* name_
          [sizeof=8] v8::Extension* extension_
          [sizeof=4] v8::internal::FeedbackSlot literal_feedback_slot_
          <padding> (4 bytes)
        }
    
    After:
        class v8::internal::NativeFunctionLiteral [sizeof = 32]
          : public v8::internal::Expression {
          [sizeof=12] v8::internal::Expression
          [sizeof=4] v8::internal::FeedbackSlot literal_feedback_slot_
          [sizeof=8] v8::internal::AstRawString* name_
          [sizeof=8] v8::Extension* extension_
        }
    
    BUG=chromium:710933
    
    Review-Url: https://codereview.chromium.org/2843293003
    Cr-Commit-Position: refs/heads/master@{#44989}
    6408032e
Name
Last commit
Last update
..
OWNERS Loading commit data...
ast-expression-rewriter.cc Loading commit data...
ast-expression-rewriter.h Loading commit data...
ast-function-literal-id-reindexer.cc Loading commit data...
ast-function-literal-id-reindexer.h Loading commit data...
ast-numbering.cc Loading commit data...
ast-numbering.h Loading commit data...
ast-traversal-visitor.h Loading commit data...
ast-type-bounds.h Loading commit data...
ast-types.cc Loading commit data...
ast-types.h Loading commit data...
ast-value-factory.cc Loading commit data...
ast-value-factory.h Loading commit data...
ast.cc Loading commit data...
ast.h Loading commit data...
compile-time-value.cc Loading commit data...
compile-time-value.h Loading commit data...
context-slot-cache.cc Loading commit data...
context-slot-cache.h Loading commit data...
modules.cc Loading commit data...
modules.h Loading commit data...
prettyprinter.cc Loading commit data...
prettyprinter.h Loading commit data...
scopes.cc Loading commit data...
scopes.h Loading commit data...
variables.cc Loading commit data...
variables.h Loading commit data...