Ignore:
Timestamp:
Mar 23, 2015, 10:37:19 PM (10 years ago)
Author:
[email protected]
Message:

JSC should have a low-cost asynchronous disassembler
https://bugs.webkit.org/show_bug.cgi?id=142997

Reviewed by Mark Lam.
Source/JavaScriptCore:


This adds a JSC_asyncDisassembly option that disassembles on a thread. Disassembly
doesn't block execution. Some code will live a little longer because of this, since the
work tasks hold a ref to the code, but other than that there is basically no overhead.

At present, this isn't really a replacement for JSC_showDisassembly, since it doesn't
provide contextual IR information for Baseline and DFG disassemblies, and it doesn't do
the separate IR dumps for FTL. Using JSC_showDisassembly and friends along with
JSC_asyncDisassembly has bizarre behavior - so just choose one.

A simple way of understanding how great this is, is to run a small benchmark like
V8Spider/earley-boyer.

Performance without any disassembly flags: 60ms
Performance with JSC_showDisassembly=true: 477ms
Performance with JSC_asyncDisassembly=true: 65ms

So, the overhead of disassembly goes from 8x to 8%.

Note that JSC_asyncDisassembly=true does make it incorrect to run "time" as a way of
measuring benchmark performance. This is because at VM exit, we wait for all async
disassembly requests to finish. For example, for earley-boyer, we spend an extra ~130ms
after the benchmark completely finishes to finish the disassemblies. This small weirdness
should be OK for the intended use-cases, since all you have to do to get around it is to
measure the execution time of the benchmark payload rather than the end-to-end time of
launching the VM.

  • assembler/LinkBuffer.cpp:

(JSC::LinkBuffer::finalizeCodeWithDisassembly):

  • assembler/LinkBuffer.h:

(JSC::LinkBuffer::wasAlreadyDisassembled):
(JSC::LinkBuffer::didAlreadyDisassemble):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::disassemble):

  • dfg/DFGJITFinalizer.cpp:

(JSC::DFG::JITFinalizer::finalize):
(JSC::DFG::JITFinalizer::finalizeFunction):

  • disassembler/Disassembler.cpp:

(JSC::disassembleAsynchronously):
(JSC::waitForAsynchronousDisassembly):

  • disassembler/Disassembler.h:
  • ftl/FTLCompile.cpp:

(JSC::FTL::mmAllocateDataSection):

  • ftl/FTLLink.cpp:

(JSC::FTL::link):

  • jit/JIT.cpp:

(JSC::JIT::privateCompile):

  • jsc.cpp:
  • runtime/Options.h:
  • runtime/VM.cpp:

(JSC::VM::~VM):

Source/WTF:

  • wtf/StringPrintStream.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jsc.cpp

    r181326 r181887  
    2929#include "Completion.h"
    3030#include "CopiedSpaceInlines.h"
     31#include "Disassembler.h"
    3132#include "ExceptionHelpers.h"
    3233#include "HeapStatistics.h"
     
    105106NO_RETURN_WITH_VALUE static void jscExit(int status)
    106107{
     108    waitForAsynchronousDisassembly();
     109   
    107110#if ENABLE(DFG_JIT)
    108111    if (DFG::isCrashing()) {
Note: See TracChangeset for help on using the changeset viewer.