Changeset 262161 in webkit


Ignore:
Timestamp:
May 26, 2020 2:32:50 PM (4 years ago)
Author:
mark.lam@apple.com
Message:

SamplingProfiler::takeSample() should not assume that ENABLE(WEBASSEMBLY) means Wasm is enabled.
https://bugs.webkit.org/show_bug.cgi?id=212382

Reviewed by Saam Barati.

Wasm can still be disabled at runtime with JSC options. Fixing this will allow
sampling profiler tests to run with JSC_useJIT=0 without crashing.

  • runtime/SamplingProfiler.cpp:

(JSC::FrameWalker::FrameWalker):
(JSC::FrameWalker::recordJITFrame):
(JSC::CFrameWalker::CFrameWalker):
(JSC::SamplingProfiler::takeSample):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r262147 r262161  
     12020-05-26  Mark Lam  <mark.lam@apple.com>
     2
     3        SamplingProfiler::takeSample() should not assume that ENABLE(WEBASSEMBLY) means Wasm is enabled.
     4        https://bugs.webkit.org/show_bug.cgi?id=212382
     5
     6        Reviewed by Saam Barati.
     7
     8        Wasm can still be disabled at runtime with JSC options.  Fixing this will allow
     9        sampling profiler tests to run with JSC_useJIT=0 without crashing.
     10
     11        * runtime/SamplingProfiler.cpp:
     12        (JSC::FrameWalker::FrameWalker):
     13        (JSC::FrameWalker::recordJITFrame):
     14        (JSC::CFrameWalker::CFrameWalker):
     15        (JSC::SamplingProfiler::takeSample):
     16
    1172020-05-26  Keith Rollin  <krollin@apple.com>
    218
  • trunk/Source/JavaScriptCore/runtime/SamplingProfiler.cpp

    r261895 r262161  
    11/*
    2  * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2016-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4343#include "WasmCallee.h"
    4444#include "WasmCalleeRegistry.h"
     45#include "WasmCapabilities.h"
    4546#include <wtf/FilePrintStream.h>
    4647#include <wtf/HashSet.h>
     
    7475class FrameWalker {
    7576public:
    76     FrameWalker(VM& vm, CallFrame* callFrame, const AbstractLocker& codeBlockSetLocker, const AbstractLocker& machineThreadsLocker, const AbstractLocker& wasmCalleeLocker)
     77    FrameWalker(VM& vm, CallFrame* callFrame, const AbstractLocker& codeBlockSetLocker, const AbstractLocker& machineThreadsLocker, const Optional<LockHolder>& wasmCalleeLocker)
    7778        : m_vm(vm)
    7879        , m_callFrame(callFrame)
     
    122123        stackTrace[m_depth] = UnprocessedStackFrame(codeBlock, unsafeCallee, callSiteIndex);
    123124#if ENABLE(WEBASSEMBLY)
    124         if (unsafeCallee.isWasm()) {
     125        if (Wasm::isSupported() && unsafeCallee.isWasm()) {
    125126            auto* wasmCallee = unsafeCallee.asWasmCallee();
    126             if (Wasm::CalleeRegistry::singleton().isValidCallee(m_wasmCalleeLocker, wasmCallee)) {
     127            if (Wasm::CalleeRegistry::singleton().isValidCallee(*m_wasmCalleeLocker, wasmCallee)) {
    127128                // At this point, Wasm::Callee would be dying (ref count is 0), but its fields are still live.
    128129                // And we can safely copy Wasm::IndexOrName even when any lock is held by suspended threads.
     
    200201    const AbstractLocker& m_codeBlockSetLocker;
    201202    const AbstractLocker& m_machineThreadsLocker;
    202     const AbstractLocker& m_wasmCalleeLocker;
     203    const Optional<LockHolder>& m_wasmCalleeLocker;
    203204    bool m_bailingOut { false };
    204205    size_t m_depth { 0 };
     
    209210    typedef FrameWalker Base;
    210211
    211     CFrameWalker(VM& vm, void* machineFrame, CallFrame* callFrame, const AbstractLocker& codeBlockSetLocker, const AbstractLocker& machineThreadsLocker, const AbstractLocker& wasmCalleeLocker)
     212    CFrameWalker(VM& vm, void* machineFrame, CallFrame* callFrame, const AbstractLocker& codeBlockSetLocker, const AbstractLocker& machineThreadsLocker, const Optional<LockHolder>& wasmCalleeLocker)
    212213        : Base(vm, callFrame, codeBlockSetLocker, machineThreadsLocker, wasmCalleeLocker)
    213214        , m_machineFrame(machineFrame)
     
    352353        auto codeBlockSetLocker = holdLock(m_vm.heap.codeBlockSet().getLock());
    353354        auto executableAllocatorLocker = holdLock(ExecutableAllocator::singleton().getLock());
     355        Optional<LockHolder> wasmCalleesLocker;
    354356#if ENABLE(WEBASSEMBLY)
    355         auto wasmCalleesLocker = holdLock(Wasm::CalleeRegistry::singleton().getLock());
    356 #else
    357         LockHolder wasmCalleesLocker(NoLockingNecessary);
     357        if (Wasm::isSupported())
     358            wasmCalleesLocker = holdLock(Wasm::CalleeRegistry::singleton().getLock());
    358359#endif
    359360
Note: See TracChangeset for help on using the changeset viewer.