Bug 192935

Summary: clang-tidy: Could remove up to 32 padding bytes in class JSC::BytecodeGenerator
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal CC: fpizlo, keith_miller, msaboff, sbarati, ysuzuki
Priority: P2    
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   

Description David Kilzer (:ddkilzer) 2018-12-20 09:06:26 PST
Running `clang-tidy -header-filter=.* -checks='-*,clang-analyzer-optin.performance.*' ...` on JavaScriptCore source files found unneeded padding bytes in the JSC::BytecodeGenerator class.

Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h:362:11: warning: Excessive padding in 'class JSC::BytecodeGenerator' (39 padding bytes, where 7 is optimal). 
Optimal fields order: 
m_scopeNode, 
m_codeBlock, 
m_scopeRegister, 
m_topMostScope, 
m_argumentsRegister, 
m_lexicalEnvironmentRegister, 
m_generatorRegister, 
m_emptyValueRegister, 
m_globalObjectRegister, 
m_newTargetRegister, 
m_isDerivedConstuctor, 
m_linkTimeConstantRegisters, 
m_arrowFunctionContextLexicalEnvironmentRegister, 
m_promiseCapabilityRegister, 
m_completionTypeRegister, 
m_completionValueRegister, 
m_currentFinallyContext, 
m_generatorFrameSymbolTable, 
m_restParameter, 
m_vm, 
m_lexicalScopeStack, 
m_TDZStack, 
m_varScopeLexicalScopeStackIndex, 
m_switchContextStack, 
m_forInContextStack, 
m_tryContextStack, 
m_functionsToInitialize, 
m_tryRanges, 
m_lastInstruction, 
m_catchesToEmit, 
m_writer, 
m_functions, 
m_localRegistersForCalleeSaveRegisters, 
m_constantPoolRegisters, 
m_calleeLocals, 
m_parameters, 
m_labels, 
m_labelScopes, 
m_controlFlowScopeStack, 
m_tryData, 
m_functionOffsets, 
m_identifierMap, 
m_jsValueMap, 
m_stringMap, 
m_bigIntMap, 
m_templateObjectDescriptorMap, 
m_staticPropertyAnalyzer, 
m_finallyDepth, 
m_localScopeDepth, 
m_codeType, 
m_yieldPoints, 
m_generatorFrameSymbolTableIndex, 
m_nextConstantOffset, 
m_lastOpcodeID, 
m_ignoredResultRegister, 
m_thisRegister, 
m_calleeRegister, 
m_shouldEmitDebugHooks, 
m_needToInitializeArguments, 
m_usesExceptions, 
m_expressionTooDeep, 
m_isBuiltinFunction, 
m_usesNonStrictEval, 
m_inTailPosition, 
m_needsToUpdateArrowFunctionContext, 
m_derivedContextType, 
consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
    class BytecodeGenerator {
          ^
Comment 1 David Kilzer (:ddkilzer) 2018-12-20 09:14:50 PST
$ ./Tools/Scripts/dump-class-layout -c Release -a x86_64 -b $BUILD_DIR JavaScriptCore JSC::BytecodeGenerator

  +0 <840> BytecodeGenerator
  +0 < 24>     JSC::InstructionStreamWriter m_writer
  +0 < 16>         JSC::InstructionStream JSC::InstructionStream
  +0 < 16>             JSC::InstructionStream::InstructionBuffer m_instructions
  +0 < 16>                 WTF::VectorBuffer<unsigned char, 0> WTF::VectorBuffer<unsigned char, 0>
  +0 < 16>                     WTF::VectorBufferBase<unsigned char> WTF::VectorBufferBase<unsigned char>
  +0 <  8>                       unsigned char * m_buffer
  +8 <  4>                       unsigned int m_capacity
 +12 <  4>                       unsigned int m_size
 +16 <  4>       unsigned int m_position
 +20 <  1>       bool m_finalized
 +21 <  3>   <PADDING: 3 bytes>
 +24 <  1>   bool m_shouldEmitDebugHooks
 +25 <  7>   <PADDING: 7 bytes>
 +32 < 16>     WTF::Vector<JSC::BytecodeGenerator::LexicalScopeStackEntry, 0, WTF::CrashOnOverflow, 16> m_lexicalScopeStack
 +32 < 16>         WTF::VectorBuffer<JSC::BytecodeGenerator::LexicalScopeStackEntry, 0> WTF::VectorBuffer<JSC::BytecodeGenerator::LexicalScopeStackEntry, 0>
 +32 < 16>             WTF::VectorBufferBase<JSC::BytecodeGenerator::LexicalScopeStackEntry> WTF::VectorBufferBase<JSC::BytecodeGenerator::LexicalScopeStackEntry>
 +32 <  8>               JSC::BytecodeGenerator::LexicalScopeStackEntry * m_buffer
 +40 <  4>               unsigned int m_capacity
 +44 <  4>               unsigned int m_size
 +48 < 16>     WTF::Vector<WTF::HashMap<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> >, TDZNecessityLevel, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> > >, WTF::HashTraits<TDZNecessityLevel> >, 0, WTF::CrashOnOverflow, 16> m_TDZStack
 +48 < 16>         WTF::VectorBuffer<WTF::HashMap<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> >, TDZNecessityLevel, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> > >, WTF::HashTraits<TDZNecessityLevel> >, 0> WTF::VectorBuffer<WTF::HashMap<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> >, TDZNecessityLevel, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> > >, WTF::HashTraits<TDZNecessityLevel> >, 0>
 +48 < 16>             WTF::VectorBufferBase<WTF::HashMap<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> >, TDZNecessityLevel, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> > >, WTF::HashTraits<TDZNecessityLevel> > > WTF::VectorBufferBase<WTF::HashMap<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> >, TDZNecessityLevel, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> > >, WTF::HashTraits<TDZNecessityLevel> > >
 +48 <  8>               WTF::HashMap<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> >, TDZNecessityLevel, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> > >, WTF::HashTraits<TDZNecessityLevel> > * m_buffer
 +56 <  4>               unsigned int m_capacity
 +60 <  4>               unsigned int m_size
 +64 < 16>     std::optional<unsigned long> m_varScopeLexicalScopeStackIndex
 +64 < 16>         std::OptionalBase<unsigned long> std::OptionalBase<unsigned long>
 +64 <  1>           bool init_
 +65 <  7>           <PADDING: 7 bytes>
 +72 <  8>           std::constexpr_storage_t<unsigned long> storage_
 +80 <  8>   JSC::ScopeNode *const m_scopeNode
 +88 <  8>     JSC::Strong<JSC::UnlinkedCodeBlock> m_codeBlock
 +88 <  8>         JSC::Handle<JSC::UnlinkedCodeBlock> JSC::Handle<JSC::UnlinkedCodeBlock>
 +88 <  8>             JSC::HandleBase JSC::HandleBase
 +88 <  8>               JSC::HandleSlot m_slot
 +88 <  1>             JSC::HandleConverter<JSC::Handle<JSC::UnlinkedCodeBlock>, JSC::UnlinkedCodeBlock> JSC::HandleConverter<JSC::Handle<JSC::UnlinkedCodeBlock>, JSC::UnlinkedCodeBlock>
 +96 < 24>     WTF::HashSet<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> >, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> > > > m_functions
 +96 < 24>         WTF::HashSet<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> >, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> > > >::HashTableType m_impl
 +96 <  8>           WTF::HashTable<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> >, WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> >, WTF::IdentityExtractor, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> > >, WTF::HashTraits<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> > > >::ValueType * m_table
+104 <  4>           unsigned int m_tableSize
+108 <  4>           unsigned int m_tableSizeMask
+112 <  4>           unsigned int m_keyCount
+116 <  4>           unsigned int m_deletedCount
+120 < 12>     JSC::RegisterID m_ignoredResultRegister
+120 <  4>       int m_refCount
+124 <  4>         JSC::VirtualRegister m_virtualRegister
+124 <  4>           int m_virtualRegister
+128 <  1>       bool m_isTemporary
+129 <  3>   <PADDING: 3 bytes>
+132 < 12>     JSC::RegisterID m_thisRegister
+132 <  4>       int m_refCount
+136 <  4>         JSC::VirtualRegister m_virtualRegister
+136 <  4>           int m_virtualRegister
+140 <  1>       bool m_isTemporary
+141 <  3>   <PADDING: 3 bytes>
+144 < 12>     JSC::RegisterID m_calleeRegister
+144 <  4>       int m_refCount
+148 <  4>         JSC::VirtualRegister m_virtualRegister
+148 <  4>           int m_virtualRegister
+152 <  1>       bool m_isTemporary
+153 <  7>   <PADDING: 7 bytes>
+160 <  8>   JSC::RegisterID * m_scopeRegister
+168 <  8>   JSC::RegisterID * m_topMostScope
+176 <  8>   JSC::RegisterID * m_argumentsRegister
+184 <  8>   JSC::RegisterID * m_lexicalEnvironmentRegister
+192 <  8>   JSC::RegisterID * m_generatorRegister
+200 <  8>   JSC::RegisterID * m_emptyValueRegister
+208 <  8>   JSC::RegisterID * m_globalObjectRegister
+216 <  8>   JSC::RegisterID * m_newTargetRegister
+224 <  8>   JSC::RegisterID * m_isDerivedConstuctor
+232 <  8>   JSC::RegisterID *[1] m_linkTimeConstantRegisters
+240 <  8>   JSC::RegisterID * m_arrowFunctionContextLexicalEnvironmentRegister
+248 <  8>   JSC::RegisterID * m_promiseCapabilityRegister
+256 <  8>     WTF::RefPtr<JSC::RegisterID, WTF::DumbPtrTraits<JSC::RegisterID> > m_completionTypeRegister
+256 <  8>       WTF::DumbPtrTraits<JSC::RegisterID>::StorageType m_ptr
+264 <  8>     WTF::RefPtr<JSC::RegisterID, WTF::DumbPtrTraits<JSC::RegisterID> > m_completionValueRegister
+264 <  8>       WTF::DumbPtrTraits<JSC::RegisterID>::StorageType m_ptr
+272 <  8>   JSC::FinallyContext * m_currentFinallyContext
+280 < 24>     WTF::SegmentedVector<JSC::RegisterID *, 16> m_localRegistersForCalleeSaveRegisters
+280 <  8>       size_t m_size
+288 < 16>         WTF::Vector<Segment *, 0, WTF::CrashOnOverflow, 16> m_segments
+288 < 16>             WTF::VectorBuffer<Segment *, 0> WTF::VectorBuffer<Segment *, 0>
+288 < 16>                 WTF::VectorBufferBase<Segment *> WTF::VectorBufferBase<Segment *>
+288 <  8>                   Segment ** m_buffer
+296 <  4>                   unsigned int m_capacity
+300 <  4>                   unsigned int m_size
+304 < 24>     WTF::SegmentedVector<JSC::RegisterID, 32> m_constantPoolRegisters
+304 <  8>       size_t m_size
+312 < 16>         WTF::Vector<WTF::SegmentedVector<JSC::RegisterID, 32>::Segment *, 0, WTF::CrashOnOverflow, 16> m_segments
+312 < 16>             WTF::VectorBuffer<WTF::SegmentedVector<JSC::RegisterID, 32>::Segment *, 0> WTF::VectorBuffer<WTF::SegmentedVector<JSC::RegisterID, 32>::Segment *, 0>
+312 < 16>                 WTF::VectorBufferBase<WTF::SegmentedVector<JSC::RegisterID, 32>::Segment *> WTF::VectorBufferBase<WTF::SegmentedVector<JSC::RegisterID, 32>::Segment *>
+312 <  8>                   WTF::SegmentedVector<JSC::RegisterID, 32>::Segment ** m_buffer
+320 <  4>                   unsigned int m_capacity
+324 <  4>                   unsigned int m_size
+328 < 24>     WTF::SegmentedVector<JSC::RegisterID, 32> m_calleeLocals
+328 <  8>       size_t m_size
+336 < 16>         WTF::Vector<WTF::SegmentedVector<JSC::RegisterID, 32>::Segment *, 0, WTF::CrashOnOverflow, 16> m_segments
+336 < 16>             WTF::VectorBuffer<WTF::SegmentedVector<JSC::RegisterID, 32>::Segment *, 0> WTF::VectorBuffer<WTF::SegmentedVector<JSC::RegisterID, 32>::Segment *, 0>
+336 < 16>                 WTF::VectorBufferBase<WTF::SegmentedVector<JSC::RegisterID, 32>::Segment *> WTF::VectorBufferBase<WTF::SegmentedVector<JSC::RegisterID, 32>::Segment *>
+336 <  8>                   WTF::SegmentedVector<JSC::RegisterID, 32>::Segment ** m_buffer
+344 <  4>                   unsigned int m_capacity
+348 <  4>                   unsigned int m_size
+352 < 24>     WTF::SegmentedVector<JSC::RegisterID, 32> m_parameters
+352 <  8>       size_t m_size
+360 < 16>         WTF::Vector<WTF::SegmentedVector<JSC::RegisterID, 32>::Segment *, 0, WTF::CrashOnOverflow, 16> m_segments
+360 < 16>             WTF::VectorBuffer<WTF::SegmentedVector<JSC::RegisterID, 32>::Segment *, 0> WTF::VectorBuffer<WTF::SegmentedVector<JSC::RegisterID, 32>::Segment *, 0>
+360 < 16>                 WTF::VectorBufferBase<WTF::SegmentedVector<JSC::RegisterID, 32>::Segment *> WTF::VectorBufferBase<WTF::SegmentedVector<JSC::RegisterID, 32>::Segment *>
+360 <  8>                   WTF::SegmentedVector<JSC::RegisterID, 32>::Segment ** m_buffer
+368 <  4>                   unsigned int m_capacity
+372 <  4>                   unsigned int m_size
+376 < 24>     WTF::SegmentedVector<JSC::Label, 32> m_labels
+376 <  8>       size_t m_size
+384 < 16>         WTF::Vector<Segment *, 0, WTF::CrashOnOverflow, 16> m_segments
+384 < 16>             WTF::VectorBuffer<Segment *, 0> WTF::VectorBuffer<Segment *, 0>
+384 < 16>                 WTF::VectorBufferBase<Segment *> WTF::VectorBufferBase<Segment *>
+384 <  8>                   Segment ** m_buffer
+392 <  4>                   unsigned int m_capacity
+396 <  4>                   unsigned int m_size
+400 < 24>     WTF::SegmentedVector<JSC::LabelScope, 32> m_labelScopes
+400 <  8>       size_t m_size
+408 < 16>         WTF::Vector<Segment *, 0, WTF::CrashOnOverflow, 16> m_segments
+408 < 16>             WTF::VectorBuffer<Segment *, 0> WTF::VectorBuffer<Segment *, 0>
+408 < 16>                 WTF::VectorBufferBase<Segment *> WTF::VectorBufferBase<Segment *>
+408 <  8>                   Segment ** m_buffer
+416 <  4>                   unsigned int m_capacity
+420 <  4>                   unsigned int m_size
+424 <  4>   unsigned int m_finallyDepth
+428 <  4>   int m_localScopeDepth
+432 <  4>   const JSC::CodeType m_codeType
+436 <  4>   <PADDING: 4 bytes>
+440 < 24>     WTF::SegmentedVector<JSC::ControlFlowScope, 16> m_controlFlowScopeStack
+440 <  8>       size_t m_size
+448 < 16>         WTF::Vector<Segment *, 0, WTF::CrashOnOverflow, 16> m_segments
+448 < 16>             WTF::VectorBuffer<Segment *, 0> WTF::VectorBuffer<Segment *, 0>
+448 < 16>                 WTF::VectorBufferBase<Segment *> WTF::VectorBufferBase<Segment *>
+448 <  8>                   Segment ** m_buffer
+456 <  4>                   unsigned int m_capacity
+460 <  4>                   unsigned int m_size
+464 < 16>     WTF::Vector<JSC::SwitchInfo, 0, WTF::CrashOnOverflow, 16> m_switchContextStack
+464 < 16>         WTF::VectorBuffer<JSC::SwitchInfo, 0> WTF::VectorBuffer<JSC::SwitchInfo, 0>
+464 < 16>             WTF::VectorBufferBase<JSC::SwitchInfo> WTF::VectorBufferBase<JSC::SwitchInfo>
+464 <  8>               JSC::SwitchInfo * m_buffer
+472 <  4>               unsigned int m_capacity
+476 <  4>               unsigned int m_size
+480 < 16>     WTF::Vector<WTF::Ref<JSC::ForInContext, WTF::DumbPtrTraits<JSC::ForInContext> >, 0, WTF::CrashOnOverflow, 16> m_forInContextStack
+480 < 16>         WTF::VectorBuffer<WTF::Ref<JSC::ForInContext, WTF::DumbPtrTraits<JSC::ForInContext> >, 0> WTF::VectorBuffer<WTF::Ref<JSC::ForInContext, WTF::DumbPtrTraits<JSC::ForInContext> >, 0>
+480 < 16>             WTF::VectorBufferBase<WTF::Ref<JSC::ForInContext, WTF::DumbPtrTraits<JSC::ForInContext> > > WTF::VectorBufferBase<WTF::Ref<JSC::ForInContext, WTF::DumbPtrTraits<JSC::ForInContext> > >
+480 <  8>               WTF::Ref<JSC::ForInContext, WTF::DumbPtrTraits<JSC::ForInContext> > * m_buffer
+488 <  4>               unsigned int m_capacity
+492 <  4>               unsigned int m_size
+496 < 16>     WTF::Vector<JSC::TryContext, 0, WTF::CrashOnOverflow, 16> m_tryContextStack
+496 < 16>         WTF::VectorBuffer<JSC::TryContext, 0> WTF::VectorBuffer<JSC::TryContext, 0>
+496 < 16>             WTF::VectorBufferBase<JSC::TryContext> WTF::VectorBufferBase<JSC::TryContext>
+496 <  8>               JSC::TryContext * m_buffer
+504 <  4>               unsigned int m_capacity
+508 <  4>               unsigned int m_size
+512 <  4>   unsigned int m_yieldPoints
+516 <  4>   <PADDING: 4 bytes>
+520 <  8>     JSC::Strong<JSC::SymbolTable> m_generatorFrameSymbolTable
+520 <  8>         JSC::Handle<JSC::SymbolTable> JSC::Handle<JSC::SymbolTable>
+520 <  8>             JSC::HandleBase JSC::HandleBase
+520 <  8>               JSC::HandleSlot m_slot
+520 <  1>             JSC::HandleConverter<JSC::Handle<JSC::SymbolTable>, JSC::SymbolTable> JSC::HandleConverter<JSC::Handle<JSC::SymbolTable>, JSC::SymbolTable>
+528 <  4>   int m_generatorFrameSymbolTableIndex
+532 <  4>   <PADDING: 4 bytes>
+536 < 16>     WTF::Vector<std::__1::pair<JSC::FunctionMetadataNode *, FunctionVariableType>, 0, WTF::CrashOnOverflow, 16> m_functionsToInitialize
+536 < 16>         WTF::VectorBuffer<std::__1::pair<JSC::FunctionMetadataNode *, FunctionVariableType>, 0> WTF::VectorBuffer<std::__1::pair<JSC::FunctionMetadataNode *, FunctionVariableType>, 0>
+536 < 16>             WTF::VectorBufferBase<std::__1::pair<JSC::FunctionMetadataNode *, FunctionVariableType> > WTF::VectorBufferBase<std::__1::pair<JSC::FunctionMetadataNode *, FunctionVariableType> >
+536 <  8>               std::__1::pair<JSC::FunctionMetadataNode *, FunctionVariableType> * m_buffer
+544 <  4>               unsigned int m_capacity
+548 <  4>               unsigned int m_size
+552 <  1>   bool m_needToInitializeArguments
+553 <  7>   <PADDING: 7 bytes>
+560 <  8>   JSC::RestParameterNode * m_restParameter
+568 < 16>     WTF::Vector<JSC::TryRange, 0, WTF::CrashOnOverflow, 16> m_tryRanges
+568 < 16>         WTF::VectorBuffer<JSC::TryRange, 0> WTF::VectorBuffer<JSC::TryRange, 0>
+568 < 16>             WTF::VectorBufferBase<JSC::TryRange> WTF::VectorBufferBase<JSC::TryRange>
+568 <  8>               JSC::TryRange * m_buffer
+576 <  4>               unsigned int m_capacity
+580 <  4>               unsigned int m_size
+584 < 24>     WTF::SegmentedVector<JSC::TryData, 8> m_tryData
+584 <  8>       size_t m_size
+592 < 16>         WTF::Vector<Segment *, 0, WTF::CrashOnOverflow, 16> m_segments
+592 < 16>             WTF::VectorBuffer<Segment *, 0> WTF::VectorBuffer<Segment *, 0>
+592 < 16>                 WTF::VectorBufferBase<Segment *> WTF::VectorBufferBase<Segment *>
+592 <  8>                   Segment ** m_buffer
+600 <  4>                   unsigned int m_capacity
+604 <  4>                   unsigned int m_size
+608 <  4>   int m_nextConstantOffset
+612 <  4>   <PADDING: 4 bytes>
+616 < 24>     JSC::BytecodeGenerator::FunctionOffsetMap m_functionOffsets
+616 < 24>         WTF::HashMap<JSC::FunctionMetadataNode *, unsigned int, WTF::PtrHash<JSC::FunctionMetadataNode *>, WTF::HashTraits<JSC::FunctionMetadataNode *>, WTF::HashTraits<unsigned int> >::HashTableType m_impl
+616 <  8>           WTF::HashTable<JSC::FunctionMetadataNode *, WTF::KeyValuePair<JSC::FunctionMetadataNode *, unsigned int>, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<JSC::FunctionMetadataNode *, unsigned int> >, WTF::PtrHash<JSC::FunctionMetadataNode *>, WTF::HashMap<JSC::FunctionMetadataNode *, unsigned int, WTF::PtrHash<JSC::FunctionMetadataNode *>, WTF::HashTraits<JSC::FunctionMetadataNode *>, WTF::HashTraits<unsigned int> >::KeyValuePairTraits, WTF::HashTraits<JSC::FunctionMetadataNode *> >::ValueType * m_table
+624 <  4>           unsigned int m_tableSize
+628 <  4>           unsigned int m_tableSizeMask
+632 <  4>           unsigned int m_keyCount
+636 <  4>           unsigned int m_deletedCount
+640 < 24>     JSC::IdentifierMap m_identifierMap
+640 < 24>         WTF::HashMap<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> >, int, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> > >, JSC::IdentifierMapIndexHashTraits>::HashTableType m_impl
+640 <  8>           WTF::HashTable<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> >, WTF::KeyValuePair<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> >, int>, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> >, int> >, JSC::IdentifierRepHash, WTF::HashMap<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> >, int, JSC::IdentifierRepHash, WTF::HashTraits<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> > >, JSC::IdentifierMapIndexHashTraits>::KeyValuePairTraits, WTF::HashTraits<WTF::RefPtr<WTF::UniquedStringImpl, WTF::DumbPtrTraits<WTF::UniquedStringImpl> > > >::ValueType * m_table
+648 <  4>           unsigned int m_tableSize
+652 <  4>           unsigned int m_tableSizeMask
+656 <  4>           unsigned int m_keyCount
+660 <  4>           unsigned int m_deletedCount
+664 < 24>     JSC::BytecodeGenerator::JSValueMap m_jsValueMap
+664 < 24>         WTF::HashMap<std::__1::pair<long long, JSC::SourceCodeRepresentation>, unsigned int, JSC::EncodedJSValueWithRepresentationHash, JSC::EncodedJSValueWithRepresentationHashTraits, WTF::HashTraits<unsigned int> >::HashTableType m_impl
+664 <  8>           WTF::HashTable<std::__1::pair<long long, JSC::SourceCodeRepresentation>, WTF::KeyValuePair<std::__1::pair<long long, JSC::SourceCodeRepresentation>, unsigned int>, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<std::__1::pair<long long, JSC::SourceCodeRepresentation>, unsigned int> >, JSC::EncodedJSValueWithRepresentationHash, WTF::HashMap<std::__1::pair<long long, JSC::SourceCodeRepresentation>, unsigned int, JSC::EncodedJSValueWithRepresentationHash, JSC::EncodedJSValueWithRepresentationHashTraits, WTF::HashTraits<unsigned int> >::KeyValuePairTraits, JSC::EncodedJSValueWithRepresentationHashTraits>::ValueType * m_table
+672 <  4>           unsigned int m_tableSize
+676 <  4>           unsigned int m_tableSizeMask
+680 <  4>           unsigned int m_keyCount
+684 <  4>           unsigned int m_deletedCount
+688 < 24>     JSC::BytecodeGenerator::IdentifierStringMap m_stringMap
+688 < 24>         WTF::HashMap<WTF::UniquedStringImpl *, JSC::JSString *, JSC::IdentifierRepHash, WTF::HashTraits<WTF::UniquedStringImpl *>, WTF::HashTraits<JSC::JSString *> >::HashTableType m_impl
+688 <  8>           WTF::HashTable<WTF::UniquedStringImpl *, WTF::KeyValuePair<WTF::UniquedStringImpl *, JSC::JSString *>, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<WTF::UniquedStringImpl *, JSC::JSString *> >, JSC::IdentifierRepHash, WTF::HashMap<WTF::UniquedStringImpl *, JSC::JSString *, JSC::IdentifierRepHash, WTF::HashTraits<WTF::UniquedStringImpl *>, WTF::HashTraits<JSC::JSString *> >::KeyValuePairTraits, WTF::HashTraits<WTF::UniquedStringImpl *> >::ValueType * m_table
+696 <  4>           unsigned int m_tableSize
+700 <  4>           unsigned int m_tableSizeMask
+704 <  4>           unsigned int m_keyCount
+708 <  4>           unsigned int m_deletedCount
+712 < 24>     JSC::BytecodeGenerator::IdentifierBigIntMap m_bigIntMap
+712 < 24>         WTF::HashMap<std::__1::tuple<WTF::UniquedStringImpl *, unsigned char, bool>, JSC::JSBigInt *, WTF::TupleHash<WTF::UniquedStringImpl *, unsigned char, bool>, WTF::HashTraits<std::__1::tuple<WTF::UniquedStringImpl *, unsigned char, bool> >, WTF::HashTraits<JSC::JSBigInt *> >::HashTableType m_impl
+712 <  8>           WTF::HashTable<std::__1::tuple<WTF::UniquedStringImpl *, unsigned char, bool>, WTF::KeyValuePair<std::__1::tuple<WTF::UniquedStringImpl *, unsigned char, bool>, JSC::JSBigInt *>, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<std::__1::tuple<WTF::UniquedStringImpl *, unsigned char, bool>, JSC::JSBigInt *> >, WTF::TupleHash<WTF::UniquedStringImpl *, unsigned char, bool>, WTF::HashMap<std::__1::tuple<WTF::UniquedStringImpl *, unsigned char, bool>, JSC::JSBigInt *, WTF::TupleHash<WTF::UniquedStringImpl *, unsigned char, bool>, WTF::HashTraits<std::__1::tuple<WTF::UniquedStringImpl *, unsigned char, bool> >, WTF::HashTraits<JSC::JSBigInt *> >::KeyValuePairTraits, WTF::HashTraits<std::__1::tuple<WTF::UniquedStringImpl *, unsigned char, bool> > >::ValueType * m_table
+720 <  4>           unsigned int m_tableSize
+724 <  4>           unsigned int m_tableSizeMask
+728 <  4>           unsigned int m_keyCount
+732 <  4>           unsigned int m_deletedCount
+736 < 24>     JSC::BytecodeGenerator::TemplateObjectDescriptorMap m_templateObjectDescriptorMap
+736 < 24>         WTF::HashMap<WTF::Ref<JSC::TemplateObjectDescriptor, WTF::DumbPtrTraits<JSC::TemplateObjectDescriptor> >, JSC::JSTemplateObjectDescriptor *, WTF::PtrHash<WTF::Ref<JSC::TemplateObjectDescriptor, WTF::DumbPtrTraits<JSC::TemplateObjectDescriptor> > >, WTF::HashTraits<WTF::Ref<JSC::TemplateObjectDescriptor, WTF::DumbPtrTraits<JSC::TemplateObjectDescriptor> > >, WTF::HashTraits<JSC::JSTemplateObjectDescriptor *> >::HashTableType m_impl
+736 <  8>           WTF::HashTable<WTF::Ref<JSC::TemplateObjectDescriptor, WTF::DumbPtrTraits<JSC::TemplateObjectDescriptor> >, WTF::KeyValuePair<WTF::Ref<JSC::TemplateObjectDescriptor, WTF::DumbPtrTraits<JSC::TemplateObjectDescriptor> >, JSC::JSTemplateObjectDescriptor *>, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<WTF::Ref<JSC::TemplateObjectDescriptor, WTF::DumbPtrTraits<JSC::TemplateObjectDescriptor> >, JSC::JSTemplateObjectDescriptor *> >, WTF::PtrHash<WTF::Ref<JSC::TemplateObjectDescriptor, WTF::DumbPtrTraits<JSC::TemplateObjectDescriptor> > >, WTF::HashMap<WTF::Ref<JSC::TemplateObjectDescriptor, WTF::DumbPtrTraits<JSC::TemplateObjectDescriptor> >, JSC::JSTemplateObjectDescriptor *, WTF::PtrHash<WTF::Ref<JSC::TemplateObjectDescriptor, WTF::DumbPtrTraits<JSC::TemplateObjectDescriptor> > >, WTF::HashTraits<WTF::Ref<JSC::TemplateObjectDescriptor, WTF::DumbPtrTraits<JSC::TemplateObjectDescriptor> > >, WTF::HashTraits<JSC::JSTemplateObjectDescriptor *> >::KeyValuePairTraits, WTF::HashTraits<WTF::Ref<JSC::TemplateObjectDescriptor, WTF::DumbPtrTraits<JSC::TemplateObjectDescriptor> > > >::ValueType * m_table
+744 <  4>           unsigned int m_tableSize
+748 <  4>           unsigned int m_tableSizeMask
+752 <  4>           unsigned int m_keyCount
+756 <  4>           unsigned int m_deletedCount
+760 < 24>     JSC::StaticPropertyAnalyzer m_staticPropertyAnalyzer
+760 < 24>         JSC::StaticPropertyAnalyzer::AnalysisMap m_analyses
+760 < 24>             WTF::HashMap<int, WTF::RefPtr<JSC::StaticPropertyAnalysis, WTF::DumbPtrTraits<JSC::StaticPropertyAnalysis> >, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>, WTF::HashTraits<WTF::RefPtr<JSC::StaticPropertyAnalysis, WTF::DumbPtrTraits<JSC::StaticPropertyAnalysis> > > >::HashTableType m_impl
+760 <  8>               WTF::HashTable<int, WTF::KeyValuePair<int, WTF::RefPtr<JSC::StaticPropertyAnalysis, WTF::DumbPtrTraits<JSC::StaticPropertyAnalysis> > >, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<int, WTF::RefPtr<JSC::StaticPropertyAnalysis, WTF::DumbPtrTraits<JSC::StaticPropertyAnalysis> > > >, WTF::IntHash<int>, WTF::HashMap<int, WTF::RefPtr<JSC::StaticPropertyAnalysis, WTF::DumbPtrTraits<JSC::StaticPropertyAnalysis> >, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>, WTF::HashTraits<WTF::RefPtr<JSC::StaticPropertyAnalysis, WTF::DumbPtrTraits<JSC::StaticPropertyAnalysis> > > >::KeyValuePairTraits, WTF::UnsignedWithZeroKeyHashTraits<int> >::ValueType * m_table
+768 <  4>               unsigned int m_tableSize
+772 <  4>               unsigned int m_tableSizeMask
+776 <  4>               unsigned int m_keyCount
+780 <  4>               unsigned int m_deletedCount
+784 <  8>   JSC::VM * m_vm
+792 <  4>   JSC::OpcodeID m_lastOpcodeID
+796 <  4>   <PADDING: 4 bytes>
+800 < 16>     JSC::InstructionStream::MutableRef m_lastInstruction
+800 < 16>         JSC::InstructionStream::BaseRef<WTF::Vector<unsigned char, 0, WTF::UnsafeVectorOverflow, 16> > JSC::InstructionStream::BaseRef<WTF::Vector<unsigned char, 0, WTF::UnsafeVectorOverflow, 16> >
+800 <  8>           WTF::Vector<unsigned char, 0, WTF::UnsafeVectorOverflow, 16> & m_instructions
+808 <  4>           JSC::InstructionStream::Offset m_index
+812 <  4>   <PADDING: 4 bytes>
+816 <  1>   bool m_usesExceptions
+817 <  1>   bool m_expressionTooDeep
+818 <  1>   bool m_isBuiltinFunction
+819 <  1>   bool m_usesNonStrictEval
+820 <  1>   bool m_inTailPosition
+821 <  1>   bool m_needsToUpdateArrowFunctionContext
+822 <  1>   JSC::DerivedContextType m_derivedContextType
+823 <  1>   <PADDING: 1 byte>
+824 < 16>     WTF::Vector<std::__1::tuple<JSC::TryData *, JSC::VirtualRegister, JSC::VirtualRegister>, 0, WTF::CrashOnOverflow, 16> m_catchesToEmit
+824 < 16>         WTF::VectorBuffer<std::__1::tuple<JSC::TryData *, JSC::VirtualRegister, JSC::VirtualRegister>, 0> WTF::VectorBuffer<std::__1::tuple<JSC::TryData *, JSC::VirtualRegister, JSC::VirtualRegister>, 0>
+824 < 16>             WTF::VectorBufferBase<std::__1::tuple<JSC::TryData *, JSC::VirtualRegister, JSC::VirtualRegister> > WTF::VectorBufferBase<std::__1::tuple<JSC::TryData *, JSC::VirtualRegister, JSC::VirtualRegister> >
+824 <  8>               std::__1::tuple<JSC::TryData *, JSC::VirtualRegister, JSC::VirtualRegister> * m_buffer
+832 <  4>               unsigned int m_capacity
+836 <  4>               unsigned int m_size
Total byte size: 840
Total pad bytes: 62
Padding percentage: 7.38 %
Comment 2 David Kilzer (:ddkilzer) 2018-12-20 09:21:37 PST
Total size of class JSC::BytecodeGenerator is 840 bytes, so this would shave it down to 808 bytes.  Not sure if it's worth it at this point to make any changes.
Comment 3 David Kilzer (:ddkilzer) 2018-12-20 09:24:45 PST
I'm just going to move this to RESOLVED/WONTFIX.  Not sure it's worth doing based on the size of the class.
Comment 4 Saam Barati 2018-12-22 14:41:29 PST
(In reply to David Kilzer (:ddkilzer) from comment #3)
> I'm just going to move this to RESOLVED/WONTFIX.  Not sure it's worth doing
> based on the size of the class.

Agreed. This class is only ever stack allocated, too. And pretty infrequently at that. So it’s probably not worth much to do this.
Comment 5 Yusuke Suzuki 2018-12-24 04:07:49 PST
(In reply to Saam Barati from comment #4)
> (In reply to David Kilzer (:ddkilzer) from comment #3)
> > I'm just going to move this to RESOLVED/WONTFIX.  Not sure it's worth doing
> > based on the size of the class.
> 
> Agreed. This class is only ever stack allocated, too. And pretty
> infrequently at that. So it’s probably not worth much to do this.

I think this is heap allocated by using std::make_unique<> (but yeah right, it is not frequently, and immediately discarded just after generating the bytecode)