⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 181828 in webkit


Ignore:
Timestamp:
Mar 21, 2015, 5:07:46 PM (11 years ago)
Author:
akling@apple.com
Message:

Make UnlinkedFunctionExecutable fit in a 128-byte cell.
<https://webkit.org/b/142939>

Reviewed by Mark Hahnenberg.

Re-arrange the members of UnlinkedFunctionExecutable so it can fit inside
a 128-byte heap cell instead of requiring a 256-byte one.

Threw in a static_assert to catch anyone pushing it over the limit again.

  • bytecode/UnlinkedCodeBlock.cpp:

(JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):

  • bytecode/UnlinkedCodeBlock.h:

(JSC::UnlinkedFunctionExecutable::functionMode):

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r181821 r181828  
     12015-03-21  Andreas Kling  <akling@apple.com>
     2
     3        Make UnlinkedFunctionExecutable fit in a 128-byte cell.
     4        <https://webkit.org/b/142939>
     5
     6        Reviewed by Mark Hahnenberg.
     7
     8        Re-arrange the members of UnlinkedFunctionExecutable so it can fit inside
     9        a 128-byte heap cell instead of requiring a 256-byte one.
     10
     11        Threw in a static_assert to catch anyone pushing it over the limit again.
     12
     13        * bytecode/UnlinkedCodeBlock.cpp:
     14        (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
     15        * bytecode/UnlinkedCodeBlock.h:
     16        (JSC::UnlinkedFunctionExecutable::functionMode):
     17
    1182015-03-20  Mark Hahnenberg  <mhahnenb@gmail.com>
    219
  • trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp

    r181810 r181828  
    4343namespace JSC {
    4444
     45static_assert(sizeof(UnlinkedFunctionExecutable) <= 128, "UnlinkedFunctionExecutable should fit in a 128-byte cell.");
     46
    4547const ClassInfo UnlinkedFunctionExecutable::s_info = { "UnlinkedFunctionExecutable", 0, 0, CREATE_METHOD_TABLE(UnlinkedFunctionExecutable) };
    4648const ClassInfo UnlinkedCodeBlock::s_info = { "UnlinkedCodeBlock", 0, 0, CREATE_METHOD_TABLE(UnlinkedCodeBlock) };
     
    9092UnlinkedFunctionExecutable::UnlinkedFunctionExecutable(VM* vm, Structure* structure, const SourceCode& source, RefPtr<SourceProvider>&& sourceOverride, FunctionBodyNode* node, UnlinkedFunctionKind kind)
    9193    : Base(*vm, structure)
    92     , m_isInStrictContext(node->isInStrictContext())
    93     , m_hasCapturedVariables(false)
    94     , m_isBuiltinFunction(kind == UnlinkedBuiltinFunction)
    95     , m_constructorKind(static_cast<unsigned>(node->constructorKind()))
    9694    , m_name(node->ident())
    9795    , m_inferredName(node->inferredName())
    9896    , m_parameters(node->parameters())
     97    , m_sourceOverride(WTF::move(sourceOverride))
    9998    , m_firstLineOffset(node->firstLine() - source.firstLine())
    10099    , m_lineCount(node->lastLine() - node->firstLine())
     
    106105    , m_typeProfilingStartOffset(node->functionKeywordStart())
    107106    , m_typeProfilingEndOffset(node->startStartOffset() + node->source().length() - 1)
    108     , m_sourceOverride(sourceOverride)
    109107    , m_features(0)
     108    , m_isInStrictContext(node->isInStrictContext())
     109    , m_hasCapturedVariables(false)
     110    , m_isBuiltinFunction(kind == UnlinkedBuiltinFunction)
     111    , m_constructorKind(static_cast<unsigned>(node->constructorKind()))
    110112    , m_functionMode(node->functionMode())
    111113{
  • trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h

    r181810 r181828  
    121121    size_t parameterCount() const;
    122122    bool isInStrictContext() const { return m_isInStrictContext; }
    123     FunctionMode functionMode() const { return m_functionMode; }
     123    FunctionMode functionMode() const { return static_cast<FunctionMode>(m_functionMode); }
    124124    ConstructorKind constructorKind() const { return static_cast<ConstructorKind>(m_constructorKind); }
    125125
     
    170170    WriteBarrier<UnlinkedFunctionCodeBlock> m_codeBlockForConstruct;
    171171
    172     unsigned m_isInStrictContext : 1;
    173     unsigned m_hasCapturedVariables : 1;
    174     unsigned m_isBuiltinFunction : 1;
    175     unsigned m_constructorKind : 2;
    176 
    177172    Identifier m_name;
    178173    Identifier m_inferredName;
     
    181176    WriteBarrier<SymbolTable> m_symbolTableForConstruct;
    182177    RefPtr<FunctionParameters> m_parameters;
     178    RefPtr<SourceProvider> m_sourceOverride;
    183179    unsigned m_firstLineOffset;
    184180    unsigned m_lineCount;
     
    190186    unsigned m_typeProfilingStartOffset;
    191187    unsigned m_typeProfilingEndOffset;
    192     RefPtr<SourceProvider> m_sourceOverride;
    193188
    194189    CodeFeatures m_features;
    195190
    196     FunctionMode m_functionMode;
     191    unsigned m_isInStrictContext : 1;
     192    unsigned m_hasCapturedVariables : 1;
     193    unsigned m_isBuiltinFunction : 1;
     194    unsigned m_constructorKind : 2;
     195    unsigned m_functionMode : 1; // FunctionMode
    197196
    198197protected:
Note: See TracChangeset for help on using the changeset viewer.