Ignore:
Timestamp:
Mar 14, 2017, 12:33:08 AM (8 years ago)
Author:
Yusuke Suzuki
Message:

[JSC][Linux] Implement VMTrap in Linux ports
https://bugs.webkit.org/show_bug.cgi?id=169436

Reviewed by Mark Lam.

Source/JavaScriptCore:

This patch port VMTrap to Linux ports.
We extract MachineContext accessors from various places (wasm/, heap/ and tools/)
and use them in all the JSC code.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • heap/MachineStackMarker.cpp:

(JSC::MachineThreads::Thread::Registers::stackPointer):
(JSC::MachineThreads::Thread::Registers::framePointer):
(JSC::MachineThreads::Thread::Registers::instructionPointer):
(JSC::MachineThreads::Thread::Registers::llintPC):

  • heap/MachineStackMarker.h:
  • runtime/MachineContext.h: Added.

(JSC::MachineContext::stackPointer):
(JSC::MachineContext::framePointer):
(JSC::MachineContext::instructionPointer):
(JSC::MachineContext::argumentPointer<1>):
(JSC::MachineContext::argumentPointer):
(JSC::MachineContext::llintInstructionPointer):

  • runtime/PlatformThread.h:

(JSC::platformThreadSignal):

  • runtime/VMTraps.cpp:

(JSC::SignalContext::SignalContext):
(JSC::SignalContext::adjustPCToPointToTrappingInstruction):

  • tools/CodeProfiling.cpp:

(JSC::profilingTimer):

  • tools/SigillCrashAnalyzer.cpp:

(JSC::SignalContext::SignalContext):
(JSC::SignalContext::dump):

  • tools/VMInspector.cpp:
  • wasm/WasmFaultSignalHandler.cpp:

(JSC::Wasm::trapHandler):

Source/WTF:

Enable VMTrap mechanism for Linux and FreeBSD.

  • wtf/Platform.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/tools/CodeProfiling.cpp

    r212464 r213886  
    2828
    2929#include "CodeProfile.h"
     30#include "MachineContext.h"
    3031#include <wtf/MetaAllocator.h>
    3132
     
    6768#endif
    6869
    69 #if OS(DARWIN) && !PLATFORM(GTK) && CPU(X86_64)
     70#if (OS(DARWIN) && !PLATFORM(GTK) && CPU(X86_64)) || (OS(LINUX) && CPU(X86))
    7071static void profilingTimer(int, siginfo_t*, void* uap)
    7172{
    7273    mcontext_t context = static_cast<ucontext_t*>(uap)->uc_mcontext;
    73     CodeProfiling::sample(reinterpret_cast<void*>(context->__ss.__rip),
    74                           reinterpret_cast<void**>(context->__ss.__rbp));
    75 }
    76 #elif OS(LINUX) && CPU(X86)
    77 static void profilingTimer(int, siginfo_t*, void* uap)
    78 {
    79     mcontext_t context = static_cast<ucontext_t*>(uap)->uc_mcontext;
    80     CodeProfiling::sample(reinterpret_cast<void*>(context.gregs[REG_EIP]),
    81                           reinterpret_cast<void**>(context.gregs[REG_EBP]));
     74    CodeProfiling::sample(
     75        MachineContext::instructionPointer(context),
     76        reinterpret_cast<void**>(MachineContext::framePointer(context)));
    8277}
    8378#endif
Note: See TracChangeset for help on using the changeset viewer.