Ignore:
Timestamp:
May 16, 2010, 6:02:33 PM (15 years ago)
Author:
Simon Fraser
Message:

2010-05-16 Simon Fraser <Simon Fraser>

Reviewed by Darin Adler.

Reduce the size of FunctionExecutable
https://bugs.webkit.org/show_bug.cgi?id=39180

Change m_numVariables from a size_t to 31 bits in a bitfield,
packed with another bit for m_forceUsesArguments (which in turn
get packed with the base class).

Reduces the size of FunctionExecutable from 160 to 152 bytes.

  • runtime/Executable.h: (JSC::FunctionExecutable::variableCount): (JSC::FunctionExecutable::FunctionExecutable):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/Executable.h

    r59339 r59587  
    320320        const Identifier& name() { return m_name; }
    321321        size_t parameterCount() const { return m_parameters->size(); }
    322         size_t variableCount() const { return m_numVariables; }
     322        unsigned variableCount() const { return m_numVariables; }
    323323        UString paramString() const;
    324324        SharedSymbolTable* symbolTable() const { return m_symbolTable; }
     
    332332        FunctionExecutable(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine)
    333333            : ScriptExecutable(globalData, source)
     334            , m_numVariables(0)
    334335            , m_forceUsesArguments(forceUsesArguments)
    335336            , m_parameters(parameters)
     
    337338            , m_codeBlockForConstruct(0)
    338339            , m_name(name)
    339             , m_numVariables(0)
    340340            , m_symbolTable(0)
    341341        {
     
    346346        FunctionExecutable(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine)
    347347            : ScriptExecutable(exec, source)
     348            , m_numVariables(0)
    348349            , m_forceUsesArguments(forceUsesArguments)
    349350            , m_parameters(parameters)
     
    351352            , m_codeBlockForConstruct(0)
    352353            , m_name(name)
    353             , m_numVariables(0)
    354354            , m_symbolTable(0)
    355355        {
     
    361361        void compileForConstruct(ExecState*, ScopeChainNode*);
    362362
    363         bool m_forceUsesArguments;
     363        unsigned m_numVariables : 31;
     364        bool m_forceUsesArguments : 1;
     365
    364366        RefPtr<FunctionParameters> m_parameters;
    365367        FunctionCodeBlock* m_codeBlockForCall;
    366368        FunctionCodeBlock* m_codeBlockForConstruct;
    367369        Identifier m_name;
    368         size_t m_numVariables;
    369370        SharedSymbolTable* m_symbolTable;
    370371
Note: See TracChangeset for help on using the changeset viewer.