Ignore:
Timestamp:
Jun 8, 2012, 12:57:40 PM (13 years ago)
Author:
[email protected]
Message:

Explictly mark stubs called by JIT as being internal
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.

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).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp

    r119647 r119857  
    5252    SYMBOL_STRING(function) ":" "\n" \
    5353        "mov (%rsp), %" STRINGIZE(register) "\n" \
    54         "jmp " SYMBOL_STRING_RELOCATION(function##WithReturnAddress) "\n" \
     54        "jmp " LOCAL_REFERENCE(function##WithReturnAddress) "\n" \
    5555    );
    5656#define FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_E(function)    FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, rsi)
     
    6969        "mov (%esp), %eax\n" \
    7070        "mov %eax, " STRINGIZE(offset) "(%esp)\n" \
    71         "jmp " SYMBOL_STRING_RELOCATION(function##WithReturnAddress) "\n" \
     71        "jmp " LOCAL_REFERENCE(function##WithReturnAddress) "\n" \
    7272    );
    7373#define FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_E(function)    FUNCTION_WRAPPER_WITH_RETURN_ADDRESS(function, 8)
     
    8888    SYMBOL_STRING(function) ":" "\n" \
    8989        "mov a2, lr" "\n" \
    90         "b " SYMBOL_STRING_RELOCATION(function) "WithReturnAddress" "\n" \
     90        "b " LOCAL_REFERENCE(function) "WithReturnAddress" "\n" \
    9191    );
    9292
     
    101101    SYMBOL_STRING(function) ":" "\n" \
    102102        "mov a4, lr" "\n" \
    103         "b " SYMBOL_STRING_RELOCATION(function) "WithReturnAddress" "\n" \
     103        "b " LOCAL_REFERENCE(function) "WithReturnAddress" "\n" \
    104104    );
    105105
     
    124124    SYMBOL_STRING(function) ":" "\n" \
    125125        INSTRUCTION_STORE_RETURN_ADDRESS_EJI "\n" \
    126         "b " SYMBOL_STRING_RELOCATION(function) "WithReturnAddress" "\n" \
     126        "b " LOCAL_REFERENCE(function) "WithReturnAddress" "\n" \
    127127    );
    128128
     
    137137    SYMBOL_STRING(function) ":" "\n" \
    138138        INSTRUCTION_STORE_RETURN_ADDRESS_EJCI "\n" \
    139         "b " SYMBOL_STRING_RELOCATION(function) "WithReturnAddress" "\n" \
     139        "b " LOCAL_REFERENCE(function) "WithReturnAddress" "\n" \
    140140    );
    141141
     
    143143
    144144#define P_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_E(function) \
    145 void* DFG_OPERATION function##WithReturnAddress(ExecState*, ReturnAddressPtr) REFERENCED_FROM_ASM; \
     145void* DFG_OPERATION function##WithReturnAddress(ExecState*, ReturnAddressPtr) REFERENCED_FROM_ASM WTF_INTERNAL; \
    146146FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_E(function)
    147147
    148148#define J_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_ECI(function) \
    149 EncodedJSValue DFG_OPERATION function##WithReturnAddress(ExecState*, JSCell*, Identifier*, ReturnAddressPtr) REFERENCED_FROM_ASM; \
     149EncodedJSValue DFG_OPERATION function##WithReturnAddress(ExecState*, JSCell*, Identifier*, ReturnAddressPtr) REFERENCED_FROM_ASM WTF_INTERNAL; \
    150150FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_ECI(function)
    151151
    152152#define J_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJI(function) \
    153 EncodedJSValue DFG_OPERATION function##WithReturnAddress(ExecState*, EncodedJSValue, Identifier*, ReturnAddressPtr) REFERENCED_FROM_ASM; \
     153EncodedJSValue DFG_OPERATION function##WithReturnAddress(ExecState*, EncodedJSValue, Identifier*, ReturnAddressPtr) REFERENCED_FROM_ASM WTF_INTERNAL; \
    154154FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJI(function)
    155155
    156156#define V_FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJCI(function) \
    157 void DFG_OPERATION function##WithReturnAddress(ExecState*, EncodedJSValue, JSCell*, Identifier*, ReturnAddressPtr) REFERENCED_FROM_ASM; \
     157void DFG_OPERATION function##WithReturnAddress(ExecState*, EncodedJSValue, JSCell*, Identifier*, ReturnAddressPtr) REFERENCED_FROM_ASM WTF_INTERNAL; \
    158158FUNCTION_WRAPPER_WITH_RETURN_ADDRESS_EJCI(function)
    159159
     
    12651265    "mov -40(%r13), %r13\n"
    12661266    "mov %r13, %rdi\n"
    1267     "jmp " SYMBOL_STRING_RELOCATION(getHostCallReturnValueWithExecState) "\n"
     1267    "jmp " LOCAL_REFERENCE(getHostCallReturnValueWithExecState) "\n"
    12681268);
    12691269#elif CPU(X86)
     
    12751275    "mov -40(%edi), %edi\n"
    12761276    "mov %edi, 4(%esp)\n"
    1277     "jmp " SYMBOL_STRING_RELOCATION(getHostCallReturnValueWithExecState) "\n"
     1277    "jmp " LOCAL_REFERENCE(getHostCallReturnValueWithExecState) "\n"
    12781278);
    12791279#elif CPU(ARM_THUMB2)
     
    12881288    "ldr r5, [r5, #-40]" "\n"
    12891289    "mov r0, r5" "\n"
    1290     "b " SYMBOL_STRING_RELOCATION(getHostCallReturnValueWithExecState) "\n"
     1290    "b " LOCAL_REFERENCE(getHostCallReturnValueWithExecState) "\n"
    12911291);
    12921292#endif
Note: See TracChangeset for help on using the changeset viewer.