• 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
ast.h 125 KB