Skip to content
  • wingo@igalia.com's avatar
    Explictly mark stubs called by JIT as being internal · 332e9bfa
    wingo@igalia.com authored
    https://bugs.webkit.org/show_bug.cgi?id=88552
    
    Reviewed by Filip Pizlo.
    
    Source/JavaScriptCore:
    
    * dfg/DFGOSRExitCompiler.h:
    * dfg/DFGOperations.cpp:
    * dfg/DFGOperations.h:
    * jit/HostCallReturnValue.h:
    * jit/JITStubs.cpp:
    * jit/JITStubs.h:
    * jit/ThunkGenerators.cpp:
    * llint/LLIntSlowPaths.h: Mark a bunch of stubs as being
    WTF_INTERNAL.  Change most calls to SYMBOL_STRING_RELOCATION to
    LOCAL_REFERENCE, or GLOBAL_REFERENCE in the case of the wrappers
    to truly global symbols.
    * offlineasm/asm.rb: Generate LOCAL_REFERENCE instead of
    SYMBOL_STRING_RELOCATION.
    
    Don't rely on weak pointers for eager CodeBlock finalization
    https://bugs.webkit.org/show_bug.cgi?id=88465
    
    Reviewed by Gavin Barraclough.
    
    This is incompatible with lazy weak pointer finalization.
    
    I considered just making CodeBlock finalization lazy-friendly, but it
    turns out that the heap is already way up in CodeBlock's business when
    it comes to finalization, so I decided to finish the job and move full
    responsibility for CodeBlock finalization into the heap.
    
    * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Maybe this
    will build.
    
    * debugger/Debugger.cpp: Updated for rename.
    
    * heap/Heap.cpp:
    (JSC::Heap::deleteAllCompiledCode): Renamed for consistency. Fixed a bug
    where we would not delete code for a code block that had been previously
    jettisoned. I don't know if this happens in practice -- I mostly did
    this to improve consistency with deleteUnmarkedCompiledCode.
    
    (JSC::Heap::deleteUnmarkedCompiledCode): New function, responsible for
    eager finalization of unmarked code blocks.
    
    (JSC::Heap::collect): Updated for rename. Updated to call
    deleteUnmarkedCompiledCode(), which takes care of jettisoned DFG code
    blocks too.
    
    (JSC::Heap::addCompiledCode): Renamed, since this points to all code
    now, not just functions.
    
    * heap/Heap.h:
    (Heap): Keep track of all user code, not just functions. This is a
    negligible additional overhead, since most code is function code.
    
    * runtime/Executable.cpp:
    (JSC::*::finalize): Removed these functions, since we don't rely on
    weak pointer finalization anymore.
    
    (JSC::FunctionExecutable::FunctionExecutable): Moved linked-list stuff
    into base class so all executables can be in the list.
    
    (JSC::EvalExecutable::clearCode):
    (JSC::ProgramExecutable::clearCode):
    (JSC::FunctionExecutable::clearCode): All we need to do is delete our
    CodeBlock -- that will delete all of its internal data structures.
    
    (JSC::FunctionExecutable::clearCodeIfNotCompiling): Factored out a helper
    function to improve clarity.
    
    * runtime/Executable.h:
    (JSC::ExecutableBase): Moved linked-list stuff
    into base class so all executables can be in the list.
    
    (JSC::NativeExecutable::create):
    (NativeExecutable):
    (ScriptExecutable):
    (JSC::ScriptExecutable::finishCreation):
    (JSC::EvalExecutable::create):
    (EvalExecutable):
    (JSC::ProgramExecutable::create):
    (ProgramExecutable):
    (FunctionExecutable):
    (JSC::FunctionExecutable::create): Don't use a finalizer -- the heap
    will call us back to destroy our code block.
    
    (JSC::FunctionExecutable::discardCode): Renamed to clearCodeIfNotCompiling()
    for clarity.
    
    (JSC::FunctionExecutable::isCompiling): New helper function, for clarity.
    
    (JSC::ScriptExecutable::clearCodeVirtual): New helper function, since
    the heap needs to make polymorphic calls to clear code.
    
    * runtime/JSGlobalData.cpp:
    (JSC::StackPreservingRecompiler::operator()):
    * runtime/JSGlobalObject.cpp:
    (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Updated for
    renames.
    
    Source/WTF:
    
    * wtf/ExportMacros.h (WTF_INTERNAL, HAVE_INTERNAL_VISIBILITY): New
    defines.  Regardless of what the port does about visibility in
    general, for code referenced only from assembly it is useful to
    give it internal visibility.
    * wtf/InlineASM.h: Split SYMBOL_STRING_RELOCATION into
    LOCAL_REFERENCE and GLOBAL_REFERENCE; the former will try to avoid
    indirection if HAVE(INTERNAL_VISIBILITY).
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@119857 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    332e9bfa