• ggaren@apple.com's avatar
    Shrink activation objects by half · 0b44fca6
    ggaren@apple.com authored
    Reviewed by Sam Weinig.
    Removed the global object, global data, and global this pointers from
    JSScope, and changed an int to a bitfield. This gets the JSActivation
    class down to 64 bytes, which in practice cuts it in half by getting it
    out of the 128 byte size class.
    Now, it's one extra indirection to get these pointers. These pointers
    aren't accessed by JIT code, so I thought there would be no cost to the
    extra indirection. However, some C++-heavy SunSpider tests regressed a
    bit in an early version of the patch, which added even more indirection.
    This suggests that calls to exec->globalData() and/or exec->lexicalGlobalObject()
    are common and probably duplicated in lots of places, and could stand
    further optimization in C++.
    * dfg/DFGAbstractState.cpp:
    (JSC::DFG::AbstractState::execute): Test against the specific activation
    for our global object, since there's no VM-shared activation structure
    anymore. This is guaranteed to have the same success rate as the old test
    because activation scope is fixed at compile time.
    * heap/MarkedBlock.cpp:
    * heap/MarkedBlock.h:
    * heap/WeakSet.cpp:
    * heap/WeakSet.h:
    (JSC::WeakSet::globalData): Store a JSGlobalData* instead of a Heap*
    because JSGlobalData->Heap is just a constant fold in the addressing
    mode, while Heap->JSGlobalData is an extra pointer dereference. (These
    objects should eventually just merge.)
    * jit/JITOpcodes.cpp:
    (JSC::JIT::emit_op_resolve_global_dynamic): See DFGAbstractState.cpp.
    * llint/LowLevelInterpreter32_64.asm:
    * llint/LowLevelInterpreter64.asm: Load the activation structure from
    the code block instead of the global data because the structure is not
    VM-shared anymore. (See DFGAbstractState.cpp.)
    * runtime/JSActivation.cpp:
    * runtime/JSActivation.h:
    (JSActivation): This is the point of the patch: Remove the data.
    * runtime/JSGlobalData.cpp:
    * runtime/JSGlobalData.h:
    (JSGlobalData): No longer VM-shared. (See DFGAbstractState.cpp.)
    (JSC::WeakSet::heap): (See WeakSet.h.)
    * runtime/JSGlobalObject.cpp:
    * runtime/JSGlobalObject.h:
    (JSC::JSGlobalObject::globalThis): Data that used to be in the JSScope
    class goes here now, so it's not duplicated across all activations.
    * runtime/JSNameScope.h:
    * runtime/JSScope.cpp:
    (JSC::JSScope::visitChildren): This is the point of the patch: Remove the data.
    * runtime/JSScope.h:
    * runtime/JSSegmentedVariableObject.h:
    * runtime/JSSymbolTableObject.h:
    * runtime/JSVariableObject.h:
    * runtime/JSWithScope.h:
    * runtime/StrictEvalActivation.cpp:
    (JSC::StrictEvalActivation::StrictEvalActivation): Simplified now that
    we don't need to pass so much data to JSScope.
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127293 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSGlobalObject.h 21 KB