haikuwebkit/JSTests/stress/sampling-profiler-wasm.js

13 lines
488 B
JavaScript
Raw Permalink Normal View History

[JSC] Support WebAssembly in SamplingProfiler https://bugs.webkit.org/show_bug.cgi?id=200329 Reviewed by Saam Barati. JSTests: * stress/sampling-profiler-wasm-name-section.js: Added. (const.compile): (platformSupportsSamplingProfiler.vm.isWasmSupported.wasmEntry): (platformSupportsSamplingProfiler.vm.isWasmSupported): * stress/sampling-profiler-wasm.js: Added. (platformSupportsSamplingProfiler.vm.isWasmSupported.wasmEntry): (platformSupportsSamplingProfiler.vm.isWasmSupported): * stress/sampling-profiler/loop.wasm: Added. * stress/sampling-profiler/loop.wast: Added. * stress/sampling-profiler/nameSection.wasm: Added. Source/JavaScriptCore: The sampling profiler support is critical to investigate what is actually time-consuming. This patch adds the sampling profiler support for Wasm functions to list up hot Wasm functions with compilation mode (BBQ or OMG). This allows us to investigate the hot functions in JetStream2 wasm tests. In order to retrieve wasm function information from the sampling profiler safely, we need to know whether the given Wasm CalleeBits is valid in the call frame. To achieve this, we start collecting valid Wasm::Callee pointers in a global hash set. Previously, each Wasm::Callee registered its code region to a hash set for wasm fault signal handler to know whether the faulted program-counter is in wasm region. We reuse and change this mechanism. Instead of registering code region, we register Wasm::Callee* to a hash set. The sampling profiler reuses this hash set to determine whether the given bits is a valid Wasm::Callee. The sampling profiler retrieves the information safely from valid Wasm::Callee* pointer. It is possible that this Wasm::Callee is about to be dead: ref-count is 0, now in the middle of the destructor of Wasm::Callee. Even in that case, fields of Wasm::Callee are still valid and can be accessed since destroying these fields happens after we unregister Wasm::Callee from the global hash set. We retrieve Wasm::IndexOrName and Wasm::CompilationMode. Copying them does not involve any allocations, locking etc. So we can safely copy them while some of threads are suspended. This patch also fixes the issue that we never called `unregisterCode` while every Wasm::Calllee registers its code region through `registerCode`. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/SamplingProfiler.cpp: (JSC::FrameWalker::FrameWalker): (JSC::FrameWalker::recordJSFrame): (JSC::CFrameWalker::CFrameWalker): (JSC::SamplingProfiler::takeSample): (JSC::SamplingProfiler::processUnverifiedStackTraces): (JSC::SamplingProfiler::StackFrame::displayName): (JSC::SamplingProfiler::StackFrame::displayNameForJSONTests): (JSC::SamplingProfiler::StackFrame::functionStartLine): (JSC::SamplingProfiler::StackFrame::functionStartColumn): (JSC::SamplingProfiler::StackFrame::sourceID): (JSC::SamplingProfiler::StackFrame::url): (JSC::SamplingProfiler::reportTopBytecodes): (WTF::printInternal): * runtime/SamplingProfiler.h: * tools/JSDollarVM.cpp: (JSC::functionIsWasmSupported): (JSC::JSDollarVM::finishCreation): * wasm/WasmB3IRGenerator.h: * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::complete): * wasm/WasmBBQPlanInlines.h: (JSC::Wasm::BBQPlan::initializeCallees): * wasm/WasmCallee.cpp: (JSC::Wasm::Callee::Callee): (JSC::Wasm::Callee::~Callee): * wasm/WasmCallee.h: (JSC::Wasm::Callee::create): Deleted. (JSC::Wasm::Callee::entrypoint const): Deleted. (JSC::Wasm::Callee::calleeSaveRegisters): Deleted. (JSC::Wasm::Callee::indexOrName const): Deleted. * wasm/WasmCalleeRegistry.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. (JSC::Wasm::CalleeRegistry::initialize): (JSC::Wasm::CalleeRegistry::singleton): * wasm/WasmCalleeRegistry.h: Copied from Source/JavaScriptCore/wasm/WasmCallee.cpp. (JSC::Wasm::CalleeRegistry::getLock): (JSC::Wasm::CalleeRegistry::registerCallee): (JSC::Wasm::CalleeRegistry::unregisterCallee): (JSC::Wasm::CalleeRegistry::isValidCallee): * wasm/WasmCompilationMode.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. (JSC::Wasm::makeString): * wasm/WasmCompilationMode.h: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. * wasm/WasmFaultSignalHandler.cpp: (JSC::Wasm::trapHandler): (JSC::Wasm::enableFastMemory): (JSC::Wasm::registerCode): Deleted. (JSC::Wasm::unregisterCode): Deleted. * wasm/WasmFaultSignalHandler.h: * wasm/WasmIndexOrName.h: * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::work): Canonical link: https://commits.webkit.org/214183@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248187 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-02 22:58:09 +00:00
//@ runDefault
if (platformSupportsSamplingProfiler() && $vm.isWasmSupported()) {
Clean up SourceProvider and add caller relative load script to jsc.cpp https://bugs.webkit.org/show_bug.cgi?id=214205 Reviewed by Yusuke Suzuki. JSTests: There are two main changes here. The first is converting most invocations of load to also pass "caller relative" as the second parameter. This lets those tests be run from any working directory rather than only the same directory as the test script. The second change is to prohibit "bare-name" specifiers in our CLI's module loader. This matches pretty much all other module loaders, including WebCore and our Obj-C API. * modules/aliased-names.js: * modules/aliasing/drink.js: * modules/caching-should-not-make-ambiguous.js: * modules/default-error/main.js: * modules/execution-order-cyclic/5.js: * modules/execution-order-dag/5.js: * modules/execution-order-tree/5.js: * modules/indirect-export-error/indirect-export-default-2.js: * modules/namespace-ambiguous/ambiguous-2.js: * modules/namespace-ambiguous/ambiguous.js: * modules/namespace-re-export.js: * modules/uncacheable-when-see-star.js: * stress/global-const-redeclaration-setting-2.js: * stress/global-const-redeclaration-setting-3.js: * stress/global-const-redeclaration-setting-4.js: * stress/global-const-redeclaration-setting-5.js: * stress/global-const-redeclaration-setting.js: * stress/global-lexical-redeclare-variable.js: * stress/global-lexical-redefine-const.js: * stress/global-lexical-variable-tdz.js: * stress/global-lexical-variable-unresolved-property.js: * stress/global-property-into-variable-get-from-scope.js: * stress/import-with-empty-string.js: * stress/jsonp-literal-parser-semicolon-is-not-assignment.js: * stress/op_add.js: * stress/op_bitand.js: * stress/op_bitor.js: * stress/op_bitxor.js: * stress/op_div-ConstVar.js: * stress/op_div-VarConst.js: * stress/op_div-VarVar.js: * stress/op_lshift-ConstVar.js: * stress/op_lshift-VarConst.js: * stress/op_lshift-VarVar.js: * stress/op_mod-ConstVar.js: * stress/op_mod-VarConst.js: * stress/op_mod-VarVar.js: * stress/op_mul-ConstVar.js: * stress/op_mul-VarConst.js: * stress/op_mul-VarVar.js: * stress/op_negate.js: * stress/op_postdec.js: * stress/op_postinc.js: * stress/op_predec.js: * stress/op_preinc.js: * stress/op_rshift-ConstVar.js: * stress/op_rshift-VarConst.js: * stress/op_rshift-VarVar.js: * stress/op_sub-ConstVar.js: * stress/op_sub-VarConst.js: * stress/op_sub-VarVar.js: * stress/op_urshift-ConstVar.js: * stress/op_urshift-VarConst.js: * stress/op_urshift-VarVar.js: * stress/regress-159779-1.js: (makeUseRegressionTest): * stress/regress-159779-2.js: (makeUseRegressionTest): * stress/resources/typedarray-constructor-helper-functions.js: * stress/resources/typedarray-test-helper-functions.js: * stress/sampling-profiler-anonymous-function.js: * stress/sampling-profiler-basic.js: * stress/sampling-profiler-bound-function-name.js: * stress/sampling-profiler-deep-stack.js: * stress/sampling-profiler-display-name.js: * stress/sampling-profiler-internal-function-name.js: * stress/sampling-profiler-microtasks.js: * stress/sampling-profiler-wasm-name-section.js: * stress/sampling-profiler-wasm.js: * stress/shadow-chicken-disabled.js: * stress/shadow-chicken-enabled.js: * stress/typedarray-constructor.js: * stress/typedarray-copyWithin.js: * stress/typedarray-every.js: * stress/typedarray-fill.js: * stress/typedarray-filter.js: * stress/typedarray-find.js: * stress/typedarray-findIndex.js: * stress/typedarray-forEach.js: * stress/typedarray-from.js: * stress/typedarray-includes.js: * stress/typedarray-indexOf.js: * stress/typedarray-lastIndexOf.js: * stress/typedarray-map.js: * stress/typedarray-of.js: * stress/typedarray-reduce.js: * stress/typedarray-reduceRight.js: * stress/typedarray-set.js: * stress/typedarray-slice.js: * stress/typedarray-some.js: * stress/typedarray-sort.js: * stress/typedarray-subarray.js: * wasm/Builder.js: * wasm/Builder_WebAssemblyBinary.js: * wasm/LowLevelBinary.js: * wasm/README.md: * wasm/WASM.js: * wasm/regress/selectf64.js: * wasm/spec-harness.js: (import.string_appeared_here.then): LayoutTests/imported/w3c: Rebaseline module loader error messages against the new string. * web-platform-tests/html/semantics/scripting-1/the-script-element/module/specifier-error-expected.txt: Source/JavaScriptCore: This patch originally was just to add an optional parameter to our load function so that any relative path is computed with respect to calling script. Rather than computing the path relative to the current working directory. The main advantage of this is now you can run all the JSTests/stress scripts from anywhere rather than only from the stress directory. This also matches jsc.cpp's module loader implementation. To make this possible a surprising number of changes were needed. Specifically, it was much easier to get this to work if we converted SourceOrigin's url to a WTF::URL rather than just a WTF::String. At the same time it became clear that SourceProvider's m_sourceURL is really not a URL but more of a file name, which can sometimes be a URL. It's possible that we don't need m_sourceURL at all but we should do that in a different patch. Additionally, jsc.cpp now uses WTF::URL for handling file paths. This is cleaner than managing trying to do it ourselves and should work across all the ports. Lastly, the JSC CLI no longer accepts "bare-name" specifiers. i.e. all specifiers must start with "/", "./", or "../". This matches what we do in our Obj-C API and in WebCore. While fixing tests I also noticed that the error message was almost useless since it didn't tell you what the specifier or referrer in question so that information is now part of the user visible error. * API/JSAPIGlobalObject.mm: (JSC::computeValidImportSpecifier): (JSC::JSAPIGlobalObject::moduleLoaderImportModule): * API/JSBase.cpp: (JSEvaluateScript): (JSCheckScriptSyntax): * API/JSObjectRef.cpp: (JSObjectMakeFunction): * API/JSScript.mm: (-[JSScript sourceCode]): * API/JSScriptRef.cpp: * API/glib/JSCContext.cpp: (jsc_context_check_syntax): * builtins/BuiltinExecutables.cpp: (JSC::BuiltinExecutables::BuiltinExecutables): * debugger/DebuggerLocation.cpp: (JSC::DebuggerLocation::DebuggerLocation): * debugger/DebuggerLocation.h: (JSC::DebuggerLocation::DebuggerLocation): * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::sourceParsed): * jsc.cpp: (currentWorkingDirectory): (absolutePath): (GlobalObject::moduleLoaderImportModule): (GlobalObject::moduleLoaderResolve): (jscSource): (fetchModuleFromLocalFileSystem): (GlobalObject::moduleLoaderFetch): (functionLoad): (functionCallerSourceOrigin): (functionDollarAgentStart): (functionCheckModuleSyntax): (runWithOptions): (runInteractive): (ModuleName::startsWithRoot const): Deleted. (ModuleName::ModuleName): Deleted. (extractDirectoryName): Deleted. (resolvePath): Deleted. * parser/Nodes.h: (JSC::ScopeNode::source const): (JSC::ScopeNode::sourceURL const): Deleted. * parser/SourceCode.h: (JSC::makeSource): * parser/SourceCodeKey.h: (JSC::SourceCodeKey::host const): * parser/SourceProvider.cpp: (JSC::SourceProvider::SourceProvider): * parser/SourceProvider.h: (JSC::SourceProvider::sourceURL const): (JSC::StringSourceProvider::create): (JSC::StringSourceProvider::StringSourceProvider): (JSC::SourceProvider::url const): Deleted. * runtime/CachedTypes.cpp: (JSC::CachedSourceOrigin::encode): (JSC::CachedSourceOrigin::decode const): (JSC::CachedSourceProviderShape::encode): (JSC::CachedStringSourceProvider::decode const): (JSC::CachedWebAssemblySourceProvider::decode const): * runtime/Error.cpp: (JSC::addErrorInfo): * runtime/FunctionConstructor.cpp: (JSC::constructFunctionSkippingEvalEnabledCheck): * runtime/ScriptExecutable.h: (JSC::ScriptExecutable::sourceURL const): * runtime/SourceOrigin.h: (JSC::SourceOrigin::SourceOrigin): (JSC::SourceOrigin::url const): (JSC::SourceOrigin::string const): (JSC::SourceOrigin::isNull const): * runtime/ThrowScope.cpp: (JSC::ThrowScope::throwException): * runtime/ThrowScope.h: (JSC::ThrowScope::throwException): (JSC::throwVMException): * tools/FunctionOverrides.cpp: (JSC::initializeOverrideInfo): * tools/JSDollarVM.cpp: (JSC::doPrint): (JSC::functionCrash): Source/WebCore: Refactor WebCore <-> JSC binding layer now that JSC uses WTF::URLs for SourceOrigins. Also, improve module loading error messages to include the specifier and referrer when producing errors around bare-name specifiers. New error message behavior is already tested so existing tests have been updated. * bindings/js/CachedScriptSourceProvider.h: (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider): * bindings/js/JSEventListener.cpp: (WebCore::JSEventListener::handleEvent): * bindings/js/JSEventListener.h: (WebCore::JSEventListener::sourceURL const): * bindings/js/JSLazyEventListener.cpp: (WebCore::JSLazyEventListener::JSLazyEventListener): (WebCore::JSLazyEventListener::initializeJSFunction const): (WebCore::JSLazyEventListener::create): * bindings/js/JSLazyEventListener.h: * bindings/js/ScriptController.cpp: (WebCore::ScriptController::evaluateInWorld): (WebCore::ScriptController::evaluateModule): (WebCore::ScriptController::callInWorld): * bindings/js/ScriptController.h: (WebCore::ScriptController::sourceURL const): * bindings/js/ScriptModuleLoader.cpp: (WebCore::resolveModuleSpecifier): (WebCore::rejectPromise): * bindings/js/ScriptSourceCode.h: (WebCore::ScriptSourceCode::ScriptSourceCode): (WebCore::ScriptSourceCode::url const): Source/WebKitLegacy/mac: Use the source origin's URL for the debugger since it's the true URL for the script. * WebView/WebScriptDebugger.mm: (WebScriptDebugger::sourceParsed): Source/WTF: Using a URL as a boolean in a conditional should be a compile error. Currently, it "works" because it actually calls `operator NSURL*()`... which is likely NOT what you wanted. Until we decide what it means to have a URL in a conditional it will be a compile error. * wtf/URL.cpp: (WTF::URL::fileSystemPath const): * wtf/URL.h: LayoutTests: js-test-pre needs to strip the parts of file urls between file:/// and LayoutTests because that is dependent on the system running the tests. Tests using these harnesses may not be using a server to host the test files. Rebaseline module loader error messages against the new string. * http/tests/resources/js-test-pre.js: (escapeHTMLAndStripFileURLs): (testFailed): (escapeHTML): Deleted. (testPassed): Deleted. * js/dom/modules/import-incorrect-relative-specifier-expected.txt: * js/dom/modules/module-incorrect-relative-specifier-expected.txt: * resources/js-test-pre.js: (escapeHTMLAndStripFileURLs): (testFailed): (escapeHTML): Deleted. (testPassed): Deleted. Canonical link: https://commits.webkit.org/227069@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@264304 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-07-13 17:35:35 +00:00
load("./sampling-profiler/samplingProfiler.js", "caller relative");
[JSC] Support WebAssembly in SamplingProfiler https://bugs.webkit.org/show_bug.cgi?id=200329 Reviewed by Saam Barati. JSTests: * stress/sampling-profiler-wasm-name-section.js: Added. (const.compile): (platformSupportsSamplingProfiler.vm.isWasmSupported.wasmEntry): (platformSupportsSamplingProfiler.vm.isWasmSupported): * stress/sampling-profiler-wasm.js: Added. (platformSupportsSamplingProfiler.vm.isWasmSupported.wasmEntry): (platformSupportsSamplingProfiler.vm.isWasmSupported): * stress/sampling-profiler/loop.wasm: Added. * stress/sampling-profiler/loop.wast: Added. * stress/sampling-profiler/nameSection.wasm: Added. Source/JavaScriptCore: The sampling profiler support is critical to investigate what is actually time-consuming. This patch adds the sampling profiler support for Wasm functions to list up hot Wasm functions with compilation mode (BBQ or OMG). This allows us to investigate the hot functions in JetStream2 wasm tests. In order to retrieve wasm function information from the sampling profiler safely, we need to know whether the given Wasm CalleeBits is valid in the call frame. To achieve this, we start collecting valid Wasm::Callee pointers in a global hash set. Previously, each Wasm::Callee registered its code region to a hash set for wasm fault signal handler to know whether the faulted program-counter is in wasm region. We reuse and change this mechanism. Instead of registering code region, we register Wasm::Callee* to a hash set. The sampling profiler reuses this hash set to determine whether the given bits is a valid Wasm::Callee. The sampling profiler retrieves the information safely from valid Wasm::Callee* pointer. It is possible that this Wasm::Callee is about to be dead: ref-count is 0, now in the middle of the destructor of Wasm::Callee. Even in that case, fields of Wasm::Callee are still valid and can be accessed since destroying these fields happens after we unregister Wasm::Callee from the global hash set. We retrieve Wasm::IndexOrName and Wasm::CompilationMode. Copying them does not involve any allocations, locking etc. So we can safely copy them while some of threads are suspended. This patch also fixes the issue that we never called `unregisterCode` while every Wasm::Calllee registers its code region through `registerCode`. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/SamplingProfiler.cpp: (JSC::FrameWalker::FrameWalker): (JSC::FrameWalker::recordJSFrame): (JSC::CFrameWalker::CFrameWalker): (JSC::SamplingProfiler::takeSample): (JSC::SamplingProfiler::processUnverifiedStackTraces): (JSC::SamplingProfiler::StackFrame::displayName): (JSC::SamplingProfiler::StackFrame::displayNameForJSONTests): (JSC::SamplingProfiler::StackFrame::functionStartLine): (JSC::SamplingProfiler::StackFrame::functionStartColumn): (JSC::SamplingProfiler::StackFrame::sourceID): (JSC::SamplingProfiler::StackFrame::url): (JSC::SamplingProfiler::reportTopBytecodes): (WTF::printInternal): * runtime/SamplingProfiler.h: * tools/JSDollarVM.cpp: (JSC::functionIsWasmSupported): (JSC::JSDollarVM::finishCreation): * wasm/WasmB3IRGenerator.h: * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::complete): * wasm/WasmBBQPlanInlines.h: (JSC::Wasm::BBQPlan::initializeCallees): * wasm/WasmCallee.cpp: (JSC::Wasm::Callee::Callee): (JSC::Wasm::Callee::~Callee): * wasm/WasmCallee.h: (JSC::Wasm::Callee::create): Deleted. (JSC::Wasm::Callee::entrypoint const): Deleted. (JSC::Wasm::Callee::calleeSaveRegisters): Deleted. (JSC::Wasm::Callee::indexOrName const): Deleted. * wasm/WasmCalleeRegistry.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. (JSC::Wasm::CalleeRegistry::initialize): (JSC::Wasm::CalleeRegistry::singleton): * wasm/WasmCalleeRegistry.h: Copied from Source/JavaScriptCore/wasm/WasmCallee.cpp. (JSC::Wasm::CalleeRegistry::getLock): (JSC::Wasm::CalleeRegistry::registerCallee): (JSC::Wasm::CalleeRegistry::unregisterCallee): (JSC::Wasm::CalleeRegistry::isValidCallee): * wasm/WasmCompilationMode.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. (JSC::Wasm::makeString): * wasm/WasmCompilationMode.h: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. * wasm/WasmFaultSignalHandler.cpp: (JSC::Wasm::trapHandler): (JSC::Wasm::enableFastMemory): (JSC::Wasm::registerCode): Deleted. (JSC::Wasm::unregisterCode): Deleted. * wasm/WasmFaultSignalHandler.h: * wasm/WasmIndexOrName.h: * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::work): Canonical link: https://commits.webkit.org/214183@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248187 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-02 22:58:09 +00:00
let buf = read("./sampling-profiler/loop.wasm", "binary");
let module = new WebAssembly.Module(buf);
let instance = new WebAssembly.Instance(module);
var wasmEntry = function() {
return instance.exports.loop(10000000);
};
runTest(wasmEntry, ["<?>.wasm-function[0]", "wasm-stub", "0", "wasmEntry"]);
[JSC] Support WebAssembly in SamplingProfiler https://bugs.webkit.org/show_bug.cgi?id=200329 Reviewed by Saam Barati. JSTests: * stress/sampling-profiler-wasm-name-section.js: Added. (const.compile): (platformSupportsSamplingProfiler.vm.isWasmSupported.wasmEntry): (platformSupportsSamplingProfiler.vm.isWasmSupported): * stress/sampling-profiler-wasm.js: Added. (platformSupportsSamplingProfiler.vm.isWasmSupported.wasmEntry): (platformSupportsSamplingProfiler.vm.isWasmSupported): * stress/sampling-profiler/loop.wasm: Added. * stress/sampling-profiler/loop.wast: Added. * stress/sampling-profiler/nameSection.wasm: Added. Source/JavaScriptCore: The sampling profiler support is critical to investigate what is actually time-consuming. This patch adds the sampling profiler support for Wasm functions to list up hot Wasm functions with compilation mode (BBQ or OMG). This allows us to investigate the hot functions in JetStream2 wasm tests. In order to retrieve wasm function information from the sampling profiler safely, we need to know whether the given Wasm CalleeBits is valid in the call frame. To achieve this, we start collecting valid Wasm::Callee pointers in a global hash set. Previously, each Wasm::Callee registered its code region to a hash set for wasm fault signal handler to know whether the faulted program-counter is in wasm region. We reuse and change this mechanism. Instead of registering code region, we register Wasm::Callee* to a hash set. The sampling profiler reuses this hash set to determine whether the given bits is a valid Wasm::Callee. The sampling profiler retrieves the information safely from valid Wasm::Callee* pointer. It is possible that this Wasm::Callee is about to be dead: ref-count is 0, now in the middle of the destructor of Wasm::Callee. Even in that case, fields of Wasm::Callee are still valid and can be accessed since destroying these fields happens after we unregister Wasm::Callee from the global hash set. We retrieve Wasm::IndexOrName and Wasm::CompilationMode. Copying them does not involve any allocations, locking etc. So we can safely copy them while some of threads are suspended. This patch also fixes the issue that we never called `unregisterCode` while every Wasm::Calllee registers its code region through `registerCode`. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/SamplingProfiler.cpp: (JSC::FrameWalker::FrameWalker): (JSC::FrameWalker::recordJSFrame): (JSC::CFrameWalker::CFrameWalker): (JSC::SamplingProfiler::takeSample): (JSC::SamplingProfiler::processUnverifiedStackTraces): (JSC::SamplingProfiler::StackFrame::displayName): (JSC::SamplingProfiler::StackFrame::displayNameForJSONTests): (JSC::SamplingProfiler::StackFrame::functionStartLine): (JSC::SamplingProfiler::StackFrame::functionStartColumn): (JSC::SamplingProfiler::StackFrame::sourceID): (JSC::SamplingProfiler::StackFrame::url): (JSC::SamplingProfiler::reportTopBytecodes): (WTF::printInternal): * runtime/SamplingProfiler.h: * tools/JSDollarVM.cpp: (JSC::functionIsWasmSupported): (JSC::JSDollarVM::finishCreation): * wasm/WasmB3IRGenerator.h: * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::complete): * wasm/WasmBBQPlanInlines.h: (JSC::Wasm::BBQPlan::initializeCallees): * wasm/WasmCallee.cpp: (JSC::Wasm::Callee::Callee): (JSC::Wasm::Callee::~Callee): * wasm/WasmCallee.h: (JSC::Wasm::Callee::create): Deleted. (JSC::Wasm::Callee::entrypoint const): Deleted. (JSC::Wasm::Callee::calleeSaveRegisters): Deleted. (JSC::Wasm::Callee::indexOrName const): Deleted. * wasm/WasmCalleeRegistry.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. (JSC::Wasm::CalleeRegistry::initialize): (JSC::Wasm::CalleeRegistry::singleton): * wasm/WasmCalleeRegistry.h: Copied from Source/JavaScriptCore/wasm/WasmCallee.cpp. (JSC::Wasm::CalleeRegistry::getLock): (JSC::Wasm::CalleeRegistry::registerCallee): (JSC::Wasm::CalleeRegistry::unregisterCallee): (JSC::Wasm::CalleeRegistry::isValidCallee): * wasm/WasmCompilationMode.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. (JSC::Wasm::makeString): * wasm/WasmCompilationMode.h: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. * wasm/WasmFaultSignalHandler.cpp: (JSC::Wasm::trapHandler): (JSC::Wasm::enableFastMemory): (JSC::Wasm::registerCode): Deleted. (JSC::Wasm::unregisterCode): Deleted. * wasm/WasmFaultSignalHandler.h: * wasm/WasmIndexOrName.h: * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::work): Canonical link: https://commits.webkit.org/214183@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248187 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-02 22:58:09 +00:00
}