haikuwebkit/Source/JavaScriptCore/Sources.txt

1148 lines
32 KiB
Plaintext
Raw Permalink Normal View History

Merge all the JIT worklists into a shared worklist https://bugs.webkit.org/show_bug.cgi?id=226207 Reviewed by Saam Barati. Delete the DFG and FTL worklists and refactor JITWorklist to handle the compilation for all tiers. This reduces the total number of compiler threads while allowing each tier to use more threads whenever necessary. The default configuration is for the worklist to have 3 threads, baseline can use up to all 3 threads and DFG and FTL follow the previous limits set through JSC::Options. Right now, the worklist will only do work on upper tiers when all lower tiers have no pending tasks or have exceeded the maximum number of concurrent compilations. i.e. by default we only DFG compile when there are no baseline tasks in the queue and we only FTL compile when we either have no DFG tasks in the queue OR there are already 2 DFG compilations in progress. * API/JSVirtualMachine.mm: (+[JSVirtualMachine setNumberOfDFGCompilerThreads:]): (+[JSVirtualMachine setNumberOfFTLCompilerThreads:]): * API/tests/testapi.mm: (runJITThreadLimitTests): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::checkIfOptimizationThresholdReached): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCommon.h: (JSC::DFG::verboseCompilationEnabled): (JSC::DFG::logCompilationChanges): (JSC::DFG::shouldDumpGraphAtEachPhase): (JSC::DFG::shouldDumpDisassembly): * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): (JSC::DFG::compile): * dfg/DFGDriver.h: * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.h: * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: (JSC::DFG::OSRAvailabilityAnalysisPhase::run): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOperations.cpp: (JSC::DFG::triggerFTLReplacementCompile): (JSC::DFG::tierUpCommon): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::Plan): (JSC::DFG::Plan::codeSize const): (JSC::DFG::Plan::finalizeInGC): (JSC::DFG::Plan::notifyReady): (JSC::DFG::Plan::cancel): (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::finalize): (JSC::DFG::Plan::iterateCodeBlocksForGC): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::isKnownToBeLiveDuringGC): (JSC::DFG::Plan::isKnownToBeLiveAfterGC): * dfg/DFGPlan.h: * dfg/DFGPlanInlines.h: Removed. * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): * dfg/DFGWorklist.cpp: Removed. * dfg/DFGWorklist.h: Removed. * dfg/DFGWorklistInlines.h: Removed. * ftl/FTLCompile.h: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::buildExitArguments): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (JSC::FTL::verboseCompilationEnabled): (JSC::FTL::shouldDumpDisassembly): * heap/Heap.cpp: (JSC::Heap::completeAllJITPlans): (JSC::Heap::iterateExecutingAndCompilingCodeBlocks): (JSC::Heap::removeDeadCompilerWorklistEntries): (JSC::Heap::stopThePeriphery): (JSC::Heap::suspendCompilerThreads): (JSC::Heap::resumeCompilerThreads): (JSC::Heap::addCoreConstraints): * heap/Heap.h: * heap/RootMarkReason.h: * jit/JIT.cpp: (JSC::JIT::compileAndLinkWithoutFinalizing): (JSC::JIT::codeSize const): (JSC::JIT::compileTimeStats): * jit/JIT.h: * jit/JITBaselinePlan.cpp: Copied from Source/JavaScriptCore/ftl/FTLState.cpp. (JSC::JITBaselinePlan::JITBaselinePlan): (JSC::JITBaselinePlan::compileInThreadImpl): (JSC::JITBaselinePlan::codeSize const): (JSC::JITBaselinePlan::finalize): * jit/JITBaselinePlan.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITCompilationKey.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.cpp. (JSC::JITCompilationKey::dump const): * jit/JITCompilationKey.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.h. (JSC::JITCompilationKey::JITCompilationKey): (JSC::JITCompilationKey::operator! const): (JSC::JITCompilationKey::isHashTableDeletedValue const): (JSC::JITCompilationKey::mode const): (JSC::JITCompilationKey::operator== const): (JSC::JITCompilationKey::hash const): (JSC::JITCompilationKeyHash::hash): (JSC::JITCompilationKeyHash::equal): * jit/JITCompilationMode.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.cpp. (WTF::printInternal): * jit/JITCompilationMode.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.h. (JSC::isFTL): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITPlan.cpp: Added. (JSC::JITPlan::JITPlan): (JSC::JITPlan::cancel): (JSC::JITPlan::notifyCompiling): (JSC::JITPlan::notifyReady): (JSC::JITPlan::tier const): (JSC::JITPlan::key): (JSC::JITPlan::isKnownToBeLiveAfterGC): (JSC::JITPlan::isKnownToBeLiveDuringGC): (JSC::JITPlan::iterateCodeBlocksForGC): (JSC::JITPlan::checkLivenessAndVisitChildren): (JSC::JITPlan::computeCompileTimes const): (JSC::JITPlan::reportCompileTimes const): (JSC::JITPlan::compileInThread): * jit/JITPlan.h: Added. (JSC::JITPlan::~JITPlan): (JSC::JITPlan::vm const): (JSC::JITPlan::codeBlock const): (JSC::JITPlan::thread const): (JSC::JITPlan::mode const): (JSC::JITPlan::stage const): (JSC::JITPlan::isFTL const): (JSC::JITPlan::finalizeInGC): * jit/JITPlanStage.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.cpp. * jit/JITSafepoint.cpp: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.cpp. (JSC::Safepoint::Safepoint): (JSC::Safepoint::~Safepoint): (JSC::Safepoint::begin): (JSC::Safepoint::cancel): * jit/JITSafepoint.h: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.h. * jit/JITScannable.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITWorklist.cpp: (JSC::JITWorklist::JITWorklist): (JSC::JITWorklist::~JITWorklist): (JSC::JITWorklist::existingGlobalWorklistOrNull): (JSC::JITWorklist::ensureGlobalWorklist): (JSC::JITWorklist::enqueue): (JSC::JITWorklist::queueLength const): (JSC::JITWorklist::suspendAllThreads): (JSC::JITWorklist::resumeAllThreads): (JSC::JITWorklist::compilationState): (JSC::JITWorklist::completeAllReadyPlansForVM): (JSC::JITWorklist::waitUntilAllPlansForVMAreReady): (JSC::JITWorklist::completeAllPlansForVM): (JSC::JITWorklist::cancelAllPlansForVM): (JSC::JITWorklist::removeDeadPlans): (JSC::JITWorklist::setMaximumNumberOfConcurrentDFGCompilations): (JSC::JITWorklist::setMaximumNumberOfConcurrentFTLCompilations): (JSC::JITWorklist::visitWeakReferences): (JSC::JITWorklist::dump const): (JSC::JITWorklist::removeAllReadyPlansForVM): (JSC::JITWorklist::removeMatchingPlansForVM): * jit/JITWorklist.h: (JSC::JITWorklist::static_cast<size_t>): * jit/JITWorklistInlines.h: Renamed from Source/JavaScriptCore/dfg/DFGScannable.h. (JSC::JITWorklist::iterateCodeBlocksForGC): * jit/JITWorklistThread.cpp: Added. (JSC::JITWorklistThread::JITWorklistThread): (JSC::JITWorklistThread::name const): (JSC::JITWorklistThread::poll): (JSC::JITWorklistThread::work): (JSC::JITWorklistThread::threadDidStart): (JSC::JITWorklistThread::threadIsStopping): * jit/JITWorklistThread.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.h. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::jitCompileAndSetHeuristics): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::~VM): Canonical link: https://commits.webkit.org/238161@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 15:15:22 +00:00
// Copyright (C) 2017-2021 Apple Inc. All rights reserved.
Setup WebCore build to start using unified sources. https://bugs.webkit.org/show_bug.cgi?id=178362 Reviewed by Tim Horton. .: Pass features to the unified source bundler script. * Source/cmake/WebKitCommon.cmake: * Source/cmake/WebKitFeatures.cmake: * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: Change comments in source list files. Also, pass explicit names for build files. * CMakeLists.txt: * PlatformGTK.cmake: * PlatformMac.cmake: * Sources.txt: * SourcesGTK.txt: * SourcesMac.txt: Source/WebCore: This patch adds all the long tooling needed to start adding unified sources to WebCore. Most of the source list files are empty to start but will be filled over the next few days. I started by moving all the non-derived bindings code to unified sources to make sure everything worked correctly. * CMakeLists.txt: * Configurations/GenerateUnifiedSources.xcconfig: Added. * Configurations/WebCore.xcconfig: * PlatformMac.cmake: * Sources.txt: Added. * SourcesCocoa.txt: Added. * SourcesIOS.txt: Added. * SourcesMac.txt: Added. * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSMediaStreamCapabilitiesCustom.cpp: Removed. No one seems to use this... Source/WTF: There are a number of changes to the bundler script. First, it is now possible to enable or disable building files based on if the associated feature flag is enabled or not. The syntax for this is similar to how we do #ifs in C++ code. e.g. #if ENABLE_APPLE_PAY myApplePayFile.cpp #endif would enable myApplePayFile.cpp if and only if the APPLE_PAY feature define is set. I also changed comments from # to // to make it less likely they would be confused with a #if. Finally, this patch enables bundling files in the same relative directory across source list files. Previously, if SourcesCocoa.txt had platform/cf/foo.cpp and SourcesMac.txt had platform/cf/bar.cpp those files would not be put in the same unified source bundle. Now, those files will be put into the same bundle but bar.cpp will always follow foo.cpp. The idea is that by putting more specific files after more general files we can avoid random build failures. * Scripts/generate-unified-source-bundles.rb: Canonical link: https://commits.webkit.org/194673@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223621 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-18 19:14:51 +00:00
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
// THE POSSIBILITY OF SUCH DAMAGE.
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
JSC should have a module loader API https://bugs.webkit.org/show_bug.cgi?id=191121 Reviewed by Michael Saboff. This patch adds a new delegate to JSContext that is called to fetch any resolved module. The resolution of a module identifier is computed as if it were a URL on the web with the caveat that it must be a file URL. A new class JSScript has also been added that is similar to JSScriptRef. Right now all JSScripts are copied into memory. In the future we should mmap the provided file into memory so the OS can evict it to disk under pressure. Additionally, the API does not make use of the code signing path nor the bytecode caching path, which we will add in subsequent patches. Lastly, a couple of new convenience methods have been added. C API conversion, can now toRef a JSValue with just a vm rather than requiring an ExecState. Secondly, there is now a call wrapper that does not require CallData and CallType since many places don't care about this. * API/APICast.h: (toRef): * API/JSAPIGlobalObject.cpp: Copied from Source/JavaScriptCore/API/JSVirtualMachineInternal.h. * API/JSAPIGlobalObject.h: Added. (JSC::JSAPIGlobalObject::create): (JSC::JSAPIGlobalObject::createStructure): (JSC::JSAPIGlobalObject::JSAPIGlobalObject): * API/JSAPIGlobalObject.mm: Added. (JSC::JSAPIGlobalObject::moduleLoaderResolve): (JSC::JSAPIGlobalObject::moduleLoaderImportModule): (JSC::JSAPIGlobalObject::moduleLoaderFetch): (JSC::JSAPIGlobalObject::moduleLoaderCreateImportMetaProperties): * API/JSAPIValueWrapper.h: (JSC::jsAPIValueWrapper): Deleted. * API/JSContext.h: * API/JSContext.mm: (-[JSContext moduleLoaderDelegate]): (-[JSContext setModuleLoaderDelegate:]): * API/JSContextInternal.h: * API/JSContextPrivate.h: * API/JSContextRef.cpp: (JSGlobalContextCreateInGroup): * API/JSScript.h: Added. * API/JSScript.mm: Added. (+[JSScript scriptWithSource:inVirtualMachine:]): (fillBufferWithContentsOfFile): (+[JSScript scriptFromUTF8File:inVirtualMachine:withCodeSigning:andBytecodeCache:]): (getJSScriptSourceCode): * API/JSScriptInternal.h: Copied from Source/JavaScriptCore/API/JSVirtualMachineInternal.h. * API/JSValueInternal.h: * API/JSVirtualMachineInternal.h: * API/tests/testapi.mm: (+[JSContextFetchDelegate contextWithBlockForFetch:]): (-[JSContextFetchDelegate context:fetchModuleForIdentifier:withResolveHandler:andRejectHandler:]): (checkModuleCodeRan): (checkModuleWasRejected): (testFetch): (testFetchWithTwoCycle): (testFetchWithThreeCycle): (testLoaderResolvesAbsoluteScriptURL): (testLoaderRejectsNilScriptURL): (testLoaderRejectsFailedFetch): (testImportModuleTwice): (+[JSContextFileLoaderDelegate newContext]): (resolvePathToScripts): (-[JSContextFileLoaderDelegate context:fetchModuleForIdentifier:withResolveHandler:andRejectHandler:]): (testLoadBasicFile): (testObjectiveCAPI): * API/tests/testapiScripts/basic.js: Copied from Source/JavaScriptCore/API/JSVirtualMachineInternal.h. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * SourcesCocoa.txt: * config.h: * postprocess-headers.sh: * runtime/CallData.cpp: (JSC::call): * runtime/CallData.h: * runtime/Completion.cpp: (JSC::loadAndEvaluateModule): * runtime/Completion.h: * runtime/JSCast.h: (JSC::jsSecureCast): * runtime/JSGlobalObject.cpp: (JSC::createProxyProperty): Canonical link: https://commits.webkit.org/207912@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239933 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-14 20:27:17 +00:00
API/JSAPIGlobalObject.cpp
API/JSAPIValueWrapper.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
API/JSBase.cpp
API/JSCTestRunnerUtils.cpp
API/JSCallbackConstructor.cpp
API/JSCallbackFunction.cpp
API/JSCallbackObject.cpp
API/JSClassRef.cpp
API/JSContextRef.cpp
API/JSHeapFinalizerPrivate.cpp
Add a JSC API to allow acquiring the JSLock https://bugs.webkit.org/show_bug.cgi?id=219663 Reviewed by Filip Pizlo. PerformanceTests: This patch does 3 things: - Change how the geomean is calculated in api-bench to avoid overflowing - Allow linking against the local build we're benchmarking - Adopt the new JSLock API in the UpcomingAPI subtests Using the new API the score improves by ~13.5%. Here are the results for each of the "UpcomingAPI" subtests plus the total score: Before After RichardsMostlyC: 77ms 23ms RichardsMostlyObjC: 309ms 282ms RichardsMostlySwift 305ms 280ms RichardsSomeC: 101ms 95ms RichardsSomeObjC: 160ms 157ms RichardsSomeSwift: 201ms 202ms ------------------------------------------ Score: 29.5974 33.6404 * APIBench/UpcomingAPI/RichardsMostlyC/RichardsMostlyC/richards.c: (workfn): * APIBench/UpcomingAPI/RichardsMostlyObjC/RichardsMostlyObjC.xcodeproj/xcshareddata/xcschemes/RichardsMostlyObjC.xcscheme: Renamed from PerformanceTests/APIBench/UpcomingAPI/RichardsMostlyObjC/RichardsMostlyObjC.xcodeproj/xcshareddata/xcschemes/RichardsMostlySwift.xcscheme. * APIBench/UpcomingAPI/RichardsMostlyObjC/RichardsMostlyObjC/WorkerTask.m: (+[WorkerTask context]): * APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift.xcodeproj/project.pbxproj: * APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift/BridgingHeader.h: Copied from PerformanceTests/APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift/WorkerTask.swift. * APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift/WorkerTask.swift: * APIBench/UpcomingAPI/RichardsSomeC/RichardsSomeC/main.m: (main): * APIBench/UpcomingAPI/RichardsSomeObjC/RichardsSomeObjC/main.m: (main): * APIBench/UpcomingAPI/RichardsSomeSwift/RichardsSomeSwift.xcodeproj/project.pbxproj: * APIBench/UpcomingAPI/RichardsSomeSwift/RichardsSomeSwift/BridgingHeader.h: Copied from PerformanceTests/APIBench/UpcomingAPI/RichardsMostlySwift/RichardsMostlySwift/WorkerTask.swift. * APIBench/UpcomingAPI/RichardsSomeSwift/RichardsSomeSwift/main.swift: * APIBench/api-bench: Source/JavaScriptCore: Introduce two new functions to the C API: JSLock and JSUnlock. These functions allow users to take control of the JSContext's lock, which can greatly reduce the overhead of bridging between JS and native. * API/JSLockRef.cpp: Added. (JSLock): (JSUnlock): * API/JSLockRefPrivate.h: Added. * API/JSValueRef.cpp: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: Canonical link: https://commits.webkit.org/232323@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270659 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-12-10 23:10:36 +00:00
API/JSLockRef.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
API/JSMarkingConstraintPrivate.cpp
API/JSObjectRef.cpp
API/JSTypedArray.cpp
API/JSScriptRef.cpp
API/JSStringRef.cpp
API/JSValueRef.cpp
API/JSWeakObjectMapRefPrivate.cpp
API/JSWeakPrivate.cpp
API/JSWeakValue.cpp
Should not use variable-length-array (VLA) https://bugs.webkit.org/show_bug.cgi?id=209043 Reviewed by Mark Lam. PerformanceTests: * MediaTime/Configurations/Base.xcconfig: Source/bmalloc: * Configurations/Base.xcconfig: Source/JavaScriptCore: This patch disables variable-length-array (VLA). If this feature uses user-input, user can control the stack height consumed by C++ code. This patch avoids using VLA. To achieve that, 1. We set `-Wvla` warning option to trigger warnings if it is used. 2. Introduce MarkedJSValueRefArray for API. This replaces `JSValueRef arguments[variableLength]` use case. MarkedJSValueRefArray registers itself to JSC GC so that GC can mark it as a strong root. * API/JSContext.mm: (+[JSContext currentArguments]): * API/JSValue.mm: (-[JSValue callWithArguments:]): (-[JSValue constructWithArguments:]): (-[JSValue invokeMethod:withArguments:]): * API/MarkedJSValueRefArray.cpp: Added. (JSC::MarkedJSValueRefArray::MarkedJSValueRefArray): (JSC::MarkedJSValueRefArray::~MarkedJSValueRefArray): (JSC::MarkedJSValueRefArray::visitAggregate): * API/MarkedJSValueRefArray.h: Added. * API/tests/minidom.c: (print): * API/tests/testapi.cpp: (TestAPI::markedJSValueArrayAndGC): (testCAPIViaCpp): * Configurations/Base.xcconfig: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * heap/Heap.cpp: (JSC::Heap::addCoreConstraints): (JSC::Heap::addMarkedJSValueRefArray): * heap/Heap.h: * heap/MarkedSpace.h: (JSC::MarkedSpace::activeWeakSetsBegin): Deleted. (JSC::MarkedSpace::activeWeakSetsEnd): Deleted. (JSC::MarkedSpace::newActiveWeakSetsBegin): Deleted. (JSC::MarkedSpace::newActiveWeakSetsEnd): Deleted. * runtime/ArgList.h: Source/WebCore: * Configurations/Base.xcconfig: * crypto/mac/SerializedCryptoKeyWrapMac.mm: (WebCore::wrapSerializedCryptoKey): (WebCore::unwrapSerializedCryptoKey): * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::getInternalformatParameter): * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp: (WebCore::CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices): * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm: (WebCore::updateDisplayID): (WebCore::ScreenDisplayCaptureSourceMac::screenCaptureDevices): Source/WebCore/PAL: * Configurations/Base.xcconfig: Source/WebInspectorUI: * Configurations/Base.xcconfig: Source/WebKit: * Configurations/Base.xcconfig: * UIProcess/_WKTouchEventGenerator.mm: (-[_WKTouchEventGenerator touchDown:touchCount:]): (-[_WKTouchEventGenerator liftUp:touchCount:]): (-[_WKTouchEventGenerator moveToPoints:touchCount:duration:]): Source/WebKitLegacy/mac: * Configurations/Base.xcconfig: Source/WTF: * Configurations/Base.xcconfig: * wtf/UUID.cpp: (WTF::bootSessionUUIDString): Tools: * ContentExtensionTester/Configurations/Base.xcconfig: * lldb/lldbWebKitTester/Configurations/Base.xcconfig: Canonical link: https://commits.webkit.org/222020@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258478 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-15 10:16:52 +00:00
API/MarkedJSValueRefArray.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
API/OpaqueJSString.cpp
assembler/AbstractMacroAssembler.cpp
Experiment: create lots of different malloc zones for easier accounting of memory use https://bugs.webkit.org/show_bug.cgi?id=186422 Patch by Yusuke Suzuki <ysuzuki@apple.com> and Simon Fraser <simon.fraser@apple.com> on 2020-01-02 Reviewed by Saam Barati. Source/bmalloc: * bmalloc/BPlatform.h: * bmalloc/Environment.cpp: (bmalloc::Environment::computeIsDebugHeapEnabled): * bmalloc/IsoHeap.h: (bmalloc::api::IsoHeap::IsoHeap): * bmalloc/IsoHeapInlines.h: (bmalloc::api::IsoHeap<Type>::IsoHeap): * bmalloc/IsoTLSInlines.h: (bmalloc::IsoTLS::allocateSlow): (bmalloc::IsoTLS::deallocateSlow): Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/AssemblerBuffer.cpp: Copied from Source/JavaScriptCore/bytecode/InstructionStream.cpp. * assembler/AssemblerBuffer.h: (JSC::AssemblerData::AssemblerData): (JSC::AssemblerData::operator=): (JSC::AssemblerData::~AssemblerData): (JSC::AssemblerData::grow): * bytecode/AccessCase.cpp: * bytecode/AccessCase.h: * bytecode/BytecodeBasicBlock.cpp: * bytecode/BytecodeBasicBlock.h: * bytecode/CodeBlock.cpp: * bytecode/CodeBlock.h: * bytecode/InstructionStream.cpp: * bytecode/InstructionStream.h: * bytecode/PolymorphicAccess.cpp: * bytecode/PolymorphicAccess.h: * bytecode/UnlinkedMetadataTable.cpp: (JSC::UnlinkedMetadataTable::finalize): * bytecode/UnlinkedMetadataTable.h: * bytecode/UnlinkedMetadataTableInlines.h: (JSC::UnlinkedMetadataTable::UnlinkedMetadataTable): (JSC::UnlinkedMetadataTable::~UnlinkedMetadataTable): (JSC::UnlinkedMetadataTable::link): (JSC::UnlinkedMetadataTable::unlink): * bytecode/ValueProfile.h: (JSC::ValueProfileAndVirtualRegisterBuffer::ValueProfileAndVirtualRegisterBuffer): * bytecode/Watchpoint.cpp: * bytecode/Watchpoint.h: * dfg/DFGBasicBlock.cpp: * dfg/DFGBasicBlock.h: * dfg/DFGNode.cpp: * dfg/DFGNode.h: * dfg/DFGSpeculativeJIT.cpp: * dfg/DFGSpeculativeJIT.h: * heap/BlockDirectory.cpp: * heap/BlockDirectory.h: * heap/FastMallocAlignedMemoryAllocator.cpp: (JSC::FastMallocAlignedMemoryAllocator::FastMallocAlignedMemoryAllocator): (JSC::FastMallocAlignedMemoryAllocator::tryAllocateAlignedMemory): (JSC::FastMallocAlignedMemoryAllocator::freeAlignedMemory): (JSC::FastMallocAlignedMemoryAllocator::tryAllocateMemory): (JSC::FastMallocAlignedMemoryAllocator::freeMemory): (JSC::FastMallocAlignedMemoryAllocator::tryReallocateMemory): * heap/FastMallocAlignedMemoryAllocator.h: * heap/GCSegmentedArray.cpp: Copied from Source/JavaScriptCore/parser/SourceProviderCache.cpp. * heap/GCSegmentedArray.h: * heap/GCSegmentedArrayInlines.h: (JSC::GCArraySegment<T>::create): (JSC::GCArraySegment<T>::destroy): * heap/GigacageAlignedMemoryAllocator.cpp: (JSC::GigacageAlignedMemoryAllocator::GigacageAlignedMemoryAllocator): (JSC::GigacageAlignedMemoryAllocator::tryAllocateAlignedMemory): (JSC::GigacageAlignedMemoryAllocator::freeAlignedMemory): (JSC::GigacageAlignedMemoryAllocator::tryAllocateMemory): (JSC::GigacageAlignedMemoryAllocator::freeMemory): (JSC::GigacageAlignedMemoryAllocator::tryReallocateMemory): * heap/GigacageAlignedMemoryAllocator.h: * heap/IsoAlignedMemoryAllocator.cpp: (JSC::IsoAlignedMemoryAllocator::IsoAlignedMemoryAllocator): (JSC::IsoAlignedMemoryAllocator::~IsoAlignedMemoryAllocator): (JSC::IsoAlignedMemoryAllocator::tryAllocateAlignedMemory): (JSC::IsoAlignedMemoryAllocator::freeAlignedMemory): (JSC::IsoAlignedMemoryAllocator::tryAllocateMemory): (JSC::IsoAlignedMemoryAllocator::freeMemory): * heap/IsoAlignedMemoryAllocator.h: * heap/IsoSubspace.cpp: (JSC::IsoSubspace::IsoSubspace): * heap/MarkedBlock.cpp: * heap/MarkedBlock.h: * heap/WeakBlock.cpp: (JSC::WeakBlock::create): (JSC::WeakBlock::destroy): * heap/WeakBlock.h: * jit/JITCode.cpp: * jit/JITCode.h: * jit/RegisterAtOffsetList.cpp: * jit/RegisterAtOffsetList.h: * parser/Nodes.cpp: * parser/Nodes.h: * parser/ParserArena.cpp: (JSC::ParserArena::deallocateObjects): (JSC::ParserArena::allocateFreeablePool): * parser/ParserArena.h: * parser/SourceProvider.cpp: * parser/SourceProvider.h: * parser/SourceProviderCache.cpp: * parser/SourceProviderCache.h: * parser/SourceProviderCacheItem.h: (JSC::SourceProviderCacheItem::create): * runtime/CachePayload.cpp: (JSC::CachePayload::makeMallocPayload): * runtime/CachePayload.h: * runtime/CachedBytecode.h: (JSC::CachedBytecode::create): * runtime/CachedTypes.cpp: (JSC::Encoder::release): (JSC::Encoder::Page::Page): (JSC::CachedVector::encode): (JSC::CachedVector::decode const): (JSC::CachedInstructionStream::decode const): * runtime/PropertyMapHashTable.h: (JSC::PropertyTable::rehash): * runtime/PropertyTable.cpp: (JSC::PropertyTable::PropertyTable): (JSC::PropertyTable::~PropertyTable): * runtime/SymbolTable.cpp: * runtime/SymbolTable.h: * runtime/VM.cpp: (JSC::VM::~VM): * runtime/VM.h: (JSC::ScratchBuffer::create): (JSC::VM::exceptionFuzzingBuffer): * wasm/WasmInstance.cpp: (JSC::Wasm::Instance::Instance): * wasm/WasmInstance.h: * wasm/WasmTable.cpp: (JSC::Wasm::Table::Table): (JSC::Wasm::FuncRefTable::FuncRefTable): * wasm/WasmTable.h: Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/SerializedScriptValue.cpp: * bindings/js/SerializedScriptValue.h: * css/CSSFontFace.cpp: * css/CSSFontFace.h: * css/CSSSelector.cpp: * css/CSSSelector.h: * css/CSSValue.cpp: * css/CSSValue.h: * css/StyleProperties.cpp: (WebCore::ImmutableStyleProperties::create): * css/StyleProperties.h: * css/StyleRule.cpp: * css/StyleRule.h: * dom/ElementData.cpp: (WebCore::ShareableElementData::createWithAttributes): (WebCore::UniqueElementData::makeShareableCopy const): * dom/ElementData.h: * dom/NodeRareData.cpp: * dom/NodeRareData.h: * dom/QualifiedName.cpp: * dom/QualifiedName.h: * html/parser/HTMLDocumentParser.cpp: * html/parser/HTMLDocumentParser.h: * loader/DocumentLoader.cpp: * loader/DocumentLoader.h: * loader/ResourceLoader.cpp: * loader/ResourceLoader.h: * loader/cache/CachedResource.cpp: * loader/cache/CachedResource.h: * page/PerformanceEntry.cpp: * page/PerformanceEntry.h: * platform/graphics/Font.cpp: * platform/graphics/Font.h: * platform/graphics/FontCascadeFonts.cpp: * platform/graphics/FontCascadeFonts.h: * platform/graphics/Region.cpp: * platform/graphics/Region.h: * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: (WebCore::releaseUint8Vector): * platform/graphics/cg/ImageBufferCG.cpp: (WebCore::ImageBuffer::ImageBuffer): * platform/graphics/nicosia/NicosiaBuffer.cpp: (Nicosia::Buffer::Buffer): * platform/network/ResourceHandle.cpp: * platform/network/ResourceHandleInternal.h: * platform/network/cf/FormDataStreamCFNet.cpp: (WebCore::closeCurrentStream): (WebCore::advanceCurrentStream): * rendering/RenderLayer.cpp: * rendering/RenderLayer.h: * rendering/TableLayout.cpp: Copied from Source/JavaScriptCore/parser/SourceProviderCache.cpp. * rendering/TableLayout.h: * rendering/style/RenderStyle.cpp: * rendering/style/RenderStyle.h: * rendering/style/SVGRenderStyle.cpp: * rendering/style/SVGRenderStyle.h: * rendering/style/SVGRenderStyleDefs.cpp: * rendering/style/SVGRenderStyleDefs.h: * rendering/style/StyleBoxData.cpp: * rendering/style/StyleBoxData.h: * rendering/style/StyleInheritedData.cpp: * rendering/style/StyleInheritedData.h: * rendering/style/StyleRareInheritedData.cpp: * rendering/style/StyleRareInheritedData.h: * rendering/style/StyleRareNonInheritedData.cpp: * rendering/style/StyleRareNonInheritedData.h: * rendering/style/StyleSurroundData.cpp: * rendering/style/StyleSurroundData.h: * rendering/style/StyleTransformData.cpp: * rendering/style/StyleTransformData.h: * style/StyleTreeResolver.cpp: * style/StyleTreeResolver.h: * svg/animation/SMILTimeContainer.cpp: * svg/animation/SMILTimeContainer.h: Source/WebKit: * Shared/ShareableBitmap.cpp: (WebKit::ShareableBitmap::create): (WebKit::ShareableBitmap::~ShareableBitmap): * UIProcess/mac/LegacySessionStateCoding.cpp: (WebKit::HistoryEntryDataEncoder::HistoryEntryDataEncoder): (WebKit::HistoryEntryDataEncoder::finishEncoding): (WebKit::encodeSessionHistoryEntryData): (WebKit::encodeLegacySessionState): Source/WTF: This patch introduces ENABLE(MALLOC_HEAP_BREAKDOWN). If this is enabled, we allocate malloc_zone per malloc kind. This offers the way to investigate the usage of memory per kind by using vmmap, like the following. VIRTUAL RESIDENT DIRTY SWAPPED ALLOCATION BYTES DIRTY+SWAP REGION MALLOC ZONE SIZE SIZE SIZE SIZE COUNT ALLOCATED FRAG SIZE % FRAG COUNT =========== ======= ========= ========= ========= ========= ========= ========= ====== ====== StringImpl_0x116efd000 188.0M 69.3M 30.9M 0K 139456 18.0M 12.9M 42% 34 DefaultMallocZone_0x10f487000 176.0M 53.9M 14.1M 0K 115956 9955K 4497K 32% 22 Vector_0x116eff000 162.0M 56.3M 55.3M 0K 140715 17.3M 37.9M 69% 36 MetadataTable_0x11843b000 152.0M 17.5M 17.5M 0K 14200 2353K 15.2M 87% 26 WebKit Using System Malloc_0x114cbe000 150.0M 31.6M 21.8M 0K 87422 16.7M 5278K 24% 23 InstructionStream_0x118469000 150.0M 5764K 5764K 0K 14470 4688K 1076K 19% 24 AssemblerData_0x117ee6000 150.0M 1928K 1928K 0K 1 16 1928K 100% 24 To achieve this goal without making very large change, we put a template type in various containers. For example, Vector will take Malloc parameter (the default one is FastMalloc allocator). If ENABLE(MALLOC_HEAP_BREAKDOWN) is enabled, we change this to specific VectorMalloc allocator, and vmmap can show memory usage of this allocator. This patch also supports malloc_zone per IsoHeap. So we can see memory allocation per IsoHeap in vmmap. To use this feature, we need to flip two compile time flags, ENABLE(MALLOC_HEAP_BREAKDOWN) in WTF and BENABLE_MALLOC_HEAP_BREAKDOWN in bmalloc. And use `vmmap $PID` to dump malloc zones. To allocate objects of a class with a specific malloc-zone, use WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(HeapIdentifier) for the class, and define allocator by DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(HeapIdentifier) in a header and DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(HeapIdentifier) in a cpp file. This patch also introduce callstack collector for malloc. Vector, HashMap etc. are used to allocate various things, but the above malloc_zone feature only tells thing like "Vector takes XXX MB memory". But what we want to know in this case is what Vector is consuming memory. We collect StackShot for each malloc call, and combine these information to tell which callsite is consuming much memory, which tell us that what Vector is consuming memory. * WTF.xcodeproj/project.pbxproj: * wtf/Bag.cpp: Copied from Source/JavaScriptCore/parser/SourceProviderCache.cpp. * wtf/Bag.h: (WTF::Private::BagNode::BagNode): Deleted. * wtf/BitVector.cpp: (WTF::BitVector::OutOfLineBits::create): (WTF::BitVector::OutOfLineBits::destroy): * wtf/CMakeLists.txt: * wtf/ConcurrentBuffer.cpp: Copied from Source/JavaScriptCore/parser/SourceProviderCache.cpp. * wtf/ConcurrentBuffer.h: * wtf/DebugHeap.cpp: Copied from Source/JavaScriptCore/runtime/CachePayload.cpp. (WTF::DebugHeap::DebugHeap): (WTF::DebugHeap::malloc): (WTF::DebugHeap::calloc): (WTF::DebugHeap::memalign): (WTF::DebugHeap::realloc): (WTF::DebugHeap::free): * wtf/DebugHeap.h: Added. * wtf/FastBitVector.cpp: (WTF::FastBitVectorWordOwner::setEqualsSlow): (WTF::FastBitVectorWordOwner::resizeSlow): * wtf/FastBitVector.h: (WTF::FastBitVectorWordOwner::~FastBitVectorWordOwner): * wtf/FastMalloc.cpp: (WTF::fastMallocDumpMallocStats): (WTF::AvoidRecordingScope::AvoidRecordingScope): (WTF::AvoidRecordingScope::~AvoidRecordingScope): (WTF::MallocCallTracker::MallocSiteData::MallocSiteData): (WTF::MallocCallTracker::singleton): (WTF::MallocCallTracker::MallocCallTracker): (WTF::MallocCallTracker::recordMalloc): (WTF::MallocCallTracker::recordRealloc): (WTF::MallocCallTracker::recordFree): (WTF::MallocCallTracker::dumpStats): (WTF::fastMalloc): (WTF::fastRealloc): (WTF::fastFree): (WTF::fastAlignedMalloc): (WTF::tryFastAlignedMalloc): (WTF::fastAlignedFree): * wtf/FastMalloc.h: (WTF::FastMalloc::zeroedMalloc): (WTF::FastMalloc::tryZeroedMalloc): * wtf/Forward.h: * wtf/HashTable.cpp: * wtf/HashTable.h: (WTF::KeyTraits>::allocateTable): (WTF::KeyTraits>::deallocateTable): (WTF::KeyTraits>::rehash): * wtf/MallocPtr.h: (WTF::MallocPtr::MallocPtr): (WTF::MallocPtr::malloc): (WTF::MallocPtr::zeroedMalloc): (WTF::MallocPtr::tryMalloc): (WTF::MallocPtr::tryZeroedMalloc): (WTF::adoptMallocPtr): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::allocFreeSpaceNode): (WTF::MetaAllocator::freeFreeSpaceNode): * wtf/MetaAllocatorHandle.h: * wtf/Platform.h: * wtf/RefCountedArray.cpp: Copied from Source/JavaScriptCore/bytecode/InstructionStream.cpp. * wtf/RefCountedArray.h: (WTF::RefCountedArray::RefCountedArray): (WTF::RefCountedArray::~RefCountedArray): (WTF::RefCountedArray::assign): * wtf/SegmentedVector.cpp: Copied from Source/JavaScriptCore/bytecode/InstructionStream.cpp. * wtf/SegmentedVector.h: * wtf/SmallPtrSet.cpp: Copied from Source/JavaScriptCore/bytecode/InstructionStream.cpp. * wtf/SmallPtrSet.h: (WTF::SmallPtrSet::~SmallPtrSet): (WTF::SmallPtrSet::grow): * wtf/UniqueArray.cpp: Copied from Source/JavaScriptCore/bytecode/InstructionStream.cpp. * wtf/UniqueArray.h: (WTF::UniqueArrayFree::operator() const): (WTF::UniqueArrayFree<T::operator() const): * wtf/Vector.cpp: Copied from Source/JavaScriptCore/bytecode/InstructionStream.cpp. * wtf/Vector.h: (WTF::VectorBufferBase::allocateBuffer): (WTF::VectorBufferBase::tryAllocateBuffer): (WTF::VectorBufferBase::reallocateBuffer): (WTF::VectorBufferBase::deallocateBuffer): (WTF::VectorBufferBase::releaseBuffer): (WTF::VectorBuffer::releaseBuffer): (WTF::Vector::swap): (WTF::Malloc>::Vector): (WTF::=): (WTF::Malloc>::contains const): (WTF::Malloc>::findMatching const): (WTF::Malloc>::find const): (WTF::Malloc>::reverseFind const): (WTF::Malloc>::appendIfNotContains): (WTF::Malloc>::fill): (WTF::Malloc>::appendRange): (WTF::Malloc>::expandCapacity): (WTF::Malloc>::tryExpandCapacity): (WTF::Malloc>::resize): (WTF::Malloc>::resizeToFit): (WTF::Malloc>::shrink): (WTF::Malloc>::grow): (WTF::Malloc>::asanSetInitialBufferSizeTo): (WTF::Malloc>::asanSetBufferSizeToFullCapacity): (WTF::Malloc>::asanBufferSizeWillChangeTo): (WTF::Malloc>::reserveCapacity): (WTF::Malloc>::tryReserveCapacity): (WTF::Malloc>::reserveInitialCapacity): (WTF::Malloc>::shrinkCapacity): (WTF::Malloc>::append): (WTF::Malloc>::tryAppend): (WTF::Malloc>::constructAndAppend): (WTF::Malloc>::tryConstructAndAppend): (WTF::Malloc>::appendSlowCase): (WTF::Malloc>::constructAndAppendSlowCase): (WTF::Malloc>::tryConstructAndAppendSlowCase): (WTF::Malloc>::uncheckedAppend): (WTF::Malloc>::uncheckedConstructAndAppend): (WTF::Malloc>::appendVector): (WTF::Malloc>::insert): (WTF::Malloc>::insertVector): (WTF::Malloc>::remove): (WTF::Malloc>::removeFirst): (WTF::Malloc>::removeFirstMatching): (WTF::Malloc>::removeAll): (WTF::Malloc>::removeAllMatching): (WTF::Malloc>::reverse): (WTF::Malloc>::map const): (WTF::Malloc>::releaseBuffer): (WTF::Malloc>::checkConsistency): (WTF::swap): (WTF::operator==): (WTF::operator!=): (WTF::Malloc>::isolatedCopy const): (WTF::removeRepeatedElements): (WTF::minCapacity>::Vector): Deleted. (WTF::minCapacity>::contains const): Deleted. (WTF::minCapacity>::findMatching const): Deleted. (WTF::minCapacity>::find const): Deleted. (WTF::minCapacity>::reverseFind const): Deleted. (WTF::minCapacity>::appendIfNotContains): Deleted. (WTF::minCapacity>::fill): Deleted. (WTF::minCapacity>::appendRange): Deleted. (WTF::minCapacity>::expandCapacity): Deleted. (WTF::minCapacity>::tryExpandCapacity): Deleted. (WTF::minCapacity>::resize): Deleted. (WTF::minCapacity>::resizeToFit): Deleted. (WTF::minCapacity>::shrink): Deleted. (WTF::minCapacity>::grow): Deleted. (WTF::minCapacity>::asanSetInitialBufferSizeTo): Deleted. (WTF::minCapacity>::asanSetBufferSizeToFullCapacity): Deleted. (WTF::minCapacity>::asanBufferSizeWillChangeTo): Deleted. (WTF::minCapacity>::reserveCapacity): Deleted. (WTF::minCapacity>::tryReserveCapacity): Deleted. (WTF::minCapacity>::reserveInitialCapacity): Deleted. (WTF::minCapacity>::shrinkCapacity): Deleted. (WTF::minCapacity>::append): Deleted. (WTF::minCapacity>::tryAppend): Deleted. (WTF::minCapacity>::constructAndAppend): Deleted. (WTF::minCapacity>::tryConstructAndAppend): Deleted. (WTF::minCapacity>::appendSlowCase): Deleted. (WTF::minCapacity>::constructAndAppendSlowCase): Deleted. (WTF::minCapacity>::tryConstructAndAppendSlowCase): Deleted. (WTF::minCapacity>::uncheckedAppend): Deleted. (WTF::minCapacity>::uncheckedConstructAndAppend): Deleted. (WTF::minCapacity>::appendVector): Deleted. (WTF::minCapacity>::insert): Deleted. (WTF::minCapacity>::insertVector): Deleted. (WTF::minCapacity>::remove): Deleted. (WTF::minCapacity>::removeFirst): Deleted. (WTF::minCapacity>::removeFirstMatching): Deleted. (WTF::minCapacity>::removeAll): Deleted. (WTF::minCapacity>::removeAllMatching): Deleted. (WTF::minCapacity>::reverse): Deleted. (WTF::minCapacity>::map const): Deleted. (WTF::minCapacity>::releaseBuffer): Deleted. (WTF::minCapacity>::checkConsistency): Deleted. (WTF::minCapacity>::isolatedCopy const): Deleted. * wtf/text/CString.cpp: (WTF::CStringBuffer::createUninitialized): * wtf/text/CString.h: * wtf/text/StringBuffer.cpp: Copied from Source/JavaScriptCore/bytecode/InstructionStream.cpp. * wtf/text/StringBuffer.h: (WTF::StringBuffer::StringBuffer): (WTF::StringBuffer::~StringBuffer): (WTF::StringBuffer::resize): (WTF::StringBuffer::release): * wtf/text/StringImpl.cpp: (WTF::StringImpl::~StringImpl): (WTF::StringImpl::destroy): (WTF::StringImpl::createUninitializedInternalNonEmpty): (WTF::StringImpl::reallocateInternal): * wtf/text/StringImpl.h: (WTF::StringImpl::StringImpl): (WTF::StringImpl::createSubstringSharingImpl): (WTF::StringImpl::tryCreateUninitialized): (WTF::StringImpl::adopt): * wtf/text/cf/StringImplCF.cpp: (WTF::StringWrapperCFAllocator::allocate): (WTF::StringWrapperCFAllocator::reallocate): (WTF::StringWrapperCFAllocator::deallocate): Canonical link: https://commits.webkit.org/218863@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253987 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-03 02:36:43 +00:00
assembler/AssemblerBuffer.cpp
assembler/CPU.cpp
[JSC] Introduce JITOperationList to validate JIT-caged pointers https://bugs.webkit.org/show_bug.cgi?id=217261 Reviewed by Saam Barati. Source/JavaScriptCore: This patch adds JITOperationList, which manages all the host-function & jit-operation pointers. And we can now query whether the given pointer is registered in this table. Currently, as a test, we are verifying that host-function is registered in this table when creating NativeExecutable in debug build. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/JITOperationList.cpp: Added. (JSC::JITOperationList::initialize): (JSC::addPointers): (JSC::JITOperationList::populatePointersInJavaScriptCore): (JSC::JITOperationList::populatePointersInEmbedder): * assembler/JITOperationList.h: Added. (JSC::JITOperationList::contains const): (JSC::JITOperationList::assertIsHostFunction): (JSC::JITOperationList::assertIsJITOperation): (JSC::JITOperationList::instance): * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARMv7.cpp: * assembler/MacroAssemblerMIPS.cpp: * assembler/MacroAssemblerX86Common.cpp: * jsc.cpp: (jscmain): * runtime/InitializeThreading.cpp: (JSC::initialize): * runtime/JSGenericTypedArrayViewPrototypeFunctions.h: (JSC::genericTypedArrayViewProtoFuncSet): (JSC::genericTypedArrayViewProtoFuncCopyWithin): (JSC::genericTypedArrayViewProtoFuncIncludes): (JSC::genericTypedArrayViewProtoFuncIndexOf): (JSC::genericTypedArrayViewProtoFuncJoin): (JSC::genericTypedArrayViewProtoFuncLastIndexOf): (JSC::genericTypedArrayViewProtoGetterFuncBuffer): (JSC::genericTypedArrayViewProtoGetterFuncLength): (JSC::genericTypedArrayViewProtoGetterFuncByteLength): (JSC::genericTypedArrayViewProtoGetterFuncByteOffset): (JSC::genericTypedArrayViewProtoFuncReverse): (JSC::genericTypedArrayViewPrivateFuncSort): (JSC::genericTypedArrayViewProtoFuncSlice): (JSC::genericTypedArrayViewPrivateFuncSubarrayCreate): (JSC::JSC_DEFINE_HOST_FUNCTION): Deleted. * runtime/VM.cpp: (JSC::VM::getHostFunction): Source/WebCore: We should have WebCore::initialize(). It is filed in https://bugs.webkit.org/show_bug.cgi?id=217270. * Headers.cmake: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMBuiltinConstructor.h: * bindings/js/JSDOMConstructor.h: * bindings/js/JSDOMLegacyFactoryFunction.h: * bindings/js/ScriptController.cpp: (WebCore::ScriptController::initializeMainThread): * bindings/js/WebCoreJITOperations.cpp: Copied from Source/WebKit/Shared/WebKit2Initialize.cpp. (WebCore::populateJITOperations): * bindings/js/WebCoreJITOperations.h: Copied from Source/WebKit/Shared/WebKit2Initialize.cpp. * bindings/scripts/CodeGeneratorJS.pm: (GenerateConstructorDefinitions): * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: * bridge/objc/WebScriptObject.mm: (+[WebScriptObject initialize]): * domjit/JSDocumentDOMJIT.cpp: * platform/cocoa/SharedBufferCocoa.mm: (+[WebCoreSharedBufferData initialize]): * platform/ios/wak/WebCoreThread.mm: (RunWebThread): Source/WebKit: * Shared/API/c/WKString.cpp: (WKStringCopyJSString): * Shared/Cocoa/WebKit2InitializeCocoa.mm: (WebKit::runInitializationCode): * Shared/WebKit2Initialize.cpp: (WebKit::InitializeWebKit2): * Shared/WebKitJITOperations.cpp: Copied from Source/WebKit/Shared/WebKit2Initialize.cpp. (WebKit::populateJITOperations): * Shared/WebKitJITOperations.h: Copied from Source/WebKit/Shared/WebKit2Initialize.cpp. * Sources.txt: * WebKit.xcodeproj/project.pbxproj: Source/WebKitLegacy/mac: * History/WebBackForwardList.mm: (+[WebBackForwardList initialize]): * History/WebHistoryItem.mm: (+[WebHistoryItem initialize]): * Misc/WebCache.mm: (+[WebCache initialize]): * Misc/WebElementDictionary.mm: (+[WebElementDictionary initialize]): * Misc/WebIconDatabase.mm: * Misc/WebStringTruncator.mm: (+[WebStringTruncator initialize]): * Plugins/Hosted/WebHostedNetscapePluginView.mm: (+[WebHostedNetscapePluginView initialize]): * Plugins/WebBaseNetscapePluginView.mm: * Plugins/WebBasePluginPackage.mm: (+[WebBasePluginPackage initialize]): * Plugins/WebNetscapePluginView.mm: (+[WebNetscapePluginView initialize]): * WebCoreSupport/WebEditorClient.mm: (+[WebUndoStep initialize]): * WebCoreSupport/WebFrameLoaderClient.mm: (+[WebFramePolicyListener initialize]): * WebView/WebArchive.mm: (+[WebArchivePrivate initialize]): * WebView/WebDataSource.mm: (+[WebDataSource initialize]): * WebView/WebHTMLView.mm: (+[WebHTMLViewPrivate initialize]): (+[WebHTMLView initialize]): * WebView/WebPreferences.mm: (+[WebPreferences initialize]): * WebView/WebResource.mm: (+[WebResourcePrivate initialize]): * WebView/WebTextIterator.mm: (+[WebTextIteratorPrivate initialize]): * WebView/WebView.mm: (+[WebView initialize]): * WebView/WebViewData.mm: (+[WebViewPrivate initialize]): Source/WebKitLegacy/win: * WebKitClassFactory.cpp: (WebKitClassFactory::WebKitClassFactory): * WebView.cpp: (WebView::WebView): Source/WTF: * wtf/PlatformCallingConventions.h: * wtf/PlatformEnable.h: Canonical link: https://commits.webkit.org/230049@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267938 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-03 23:51:12 +00:00
assembler/JITOperationList.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
assembler/LinkBuffer.cpp
assembler/MacroAssembler.cpp
assembler/MacroAssemblerARM64.cpp
assembler/MacroAssemblerARMv7.cpp
assembler/MacroAssemblerCodeRef.cpp
assembler/MacroAssemblerMIPS.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
assembler/MacroAssemblerPrinter.cpp
assembler/MacroAssemblerX86Common.cpp
[JSC][Linux] Support Perf JITDump logging https://bugs.webkit.org/show_bug.cgi?id=189893 Reviewed by Mark Lam. Source/JavaScriptCore: This patch adds Linux `perf` command's JIT Dump support. It allows JSC to tell perf about JIT code information. We add a command line option, `--logJITCodeForPerf`, which dumps `jit-%pid.dump` in the current directory. By using this dump and perf.data output, we can annotate JIT code with profiling information. $ echo "(function f() { var s = 0; for (var i = 0; i < 1000000000; i++) { s += i; } return s; })();" > test.js $ perf record -k mono ../../WebKitBuild/perf/Release/bin/jsc test.js --logJITCodeForPerf=true [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.182 MB perf.data (4346 samples) ] $ perf inject --jit -i perf.data -o perf.jit.data $ perf report -i perf.jit.data * Sources.txt: * assembler/LinkBuffer.cpp: (JSC::LinkBuffer::finalizeCodeWithDisassemblyImpl): * assembler/LinkBuffer.h: (JSC::LinkBuffer::finalizeCodeWithDisassembly): * assembler/PerfLog.cpp: Added. (JSC::PerfLog::singleton): (JSC::generateTimestamp): (JSC::getCurrentThreadID): (JSC::PerfLog::PerfLog): (JSC::PerfLog::write): (JSC::PerfLog::flush): (JSC::PerfLog::log): * assembler/PerfLog.h: Added. * jit/ExecutableAllocator.cpp: (JSC::FixedVMPoolExecutableAllocator::FixedVMPoolExecutableAllocator): * runtime/Options.cpp: (JSC::Options::isAvailable): * runtime/Options.h: Source/WTF: * wtf/PageReservation.h: (WTF::PageReservation::reserveAndCommitWithGuardPages): Canonical link: https://commits.webkit.org/205278@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-05 19:59:04 +00:00
assembler/PerfLog.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
assembler/Printer.cpp
assembler/ProbeContext.cpp
assembler/ProbeStack.cpp
[WebAssembly] Write a new register allocator for Air O0 and make BBQ use it https://bugs.webkit.org/show_bug.cgi?id=194036 Reviewed by Yusuke Suzuki. JSTests: * stress/tail-call-many-arguments.js: Added. (foo): (bar): Source/JavaScriptCore: This patch adds a new Air-O0 backend. Air-O0 runs fewer passes and doesn't use linear scan for register allocation. Instead of linear scan, Air-O0 does mostly block-local register allocation, and it does this as it's emitting code directly. The register allocator uses liveness analysis to reduce the number of spills. Doing register allocation as we're emitting code allows us to skip editing the IR to insert spills, which saves a non trivial amount of compile time. For stack allocation, we give each Tmp its own slot. This is less than ideal. We probably want to do some trivial live range analysis in the future. The reason this isn't a deal breaker for Wasm is that this patch makes it so that we reuse Tmps as we're generating Air IR in the AirIRGenerator. Because Wasm is a stack machine, we trivially know when we kill a stack value (its last use). This patch is another 25% Wasm startup time speedup. It seems to be worth another 1% on JetStream2. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp: Added. (JSC::B3::Air::GenerateAndAllocateRegisters::GenerateAndAllocateRegisters): (JSC::B3::Air::GenerateAndAllocateRegisters::buildLiveRanges): (JSC::B3::Air::GenerateAndAllocateRegisters::insertBlocksForFlushAfterTerminalPatchpoints): (JSC::B3::Air::callFrameAddr): (JSC::B3::Air::GenerateAndAllocateRegisters::flush): (JSC::B3::Air::GenerateAndAllocateRegisters::spill): (JSC::B3::Air::GenerateAndAllocateRegisters::alloc): (JSC::B3::Air::GenerateAndAllocateRegisters::freeDeadTmpsIfNeeded): (JSC::B3::Air::GenerateAndAllocateRegisters::assignTmp): (JSC::B3::Air::GenerateAndAllocateRegisters::isDisallowedRegister): (JSC::B3::Air::GenerateAndAllocateRegisters::prepareForGeneration): (JSC::B3::Air::GenerateAndAllocateRegisters::generate): * b3/air/AirAllocateRegistersAndStackAndGenerateCode.h: Added. * b3/air/AirCode.cpp: * b3/air/AirCode.h: * b3/air/AirGenerate.cpp: (JSC::B3::Air::prepareForGeneration): (JSC::B3::Air::generateWithAlreadyAllocatedRegisters): (JSC::B3::Air::generate): * b3/air/AirHandleCalleeSaves.cpp: (JSC::B3::Air::handleCalleeSaves): * b3/air/AirHandleCalleeSaves.h: * b3/air/AirTmpMap.h: * runtime/Options.h: * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::didKill): (JSC::Wasm::AirIRGenerator::newTmp): (JSC::Wasm::AirIRGenerator::AirIRGenerator): (JSC::Wasm::parseAndCompileAir): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64TruncUF64>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64TruncUF32>): * wasm/WasmAirIRGenerator.h: * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::didKill): * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::compileFunctions): * wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser<Context>::parseBody): (JSC::Wasm::FunctionParser<Context>::parseExpression): * wasm/WasmValidate.cpp: (JSC::Wasm::Validate::didKill): Source/WTF: * wtf/IndexMap.h: (WTF::IndexMap::at): (WTF::IndexMap::at const): (WTF::IndexMap::operator[]): (WTF::IndexMap::operator[] const): Tools: * Scripts/run-jsc-stress-tests: Canonical link: https://commits.webkit.org/209077@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241579 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-02-15 08:26:17 +00:00
b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
b3/air/AirAllocateRegistersAndStackByLinearScan.cpp
b3/air/AirAllocateRegistersByGraphColoring.cpp
b3/air/AirAllocateStackByGraphColoring.cpp
b3/air/AirArg.cpp
b3/air/AirBasicBlock.cpp
b3/air/AirBlockInsertionSet.cpp
b3/air/AirBreakCriticalEdges.cpp
b3/air/AirCCallSpecial.cpp
b3/air/AirCCallingConvention.cpp
b3/air/AirCode.cpp
b3/air/AirCustom.cpp
b3/air/AirDisassembler.cpp
b3/air/AirEliminateDeadCode.cpp
b3/air/AirEmitShuffle.cpp
b3/air/AirFixObviousSpills.cpp
b3/air/AirFixPartialRegisterStalls.cpp
b3/air/AirFixSpillsAfterTerminals.cpp
b3/air/AirGenerate.cpp
b3/air/AirGenerated.cpp
b3/air/AirHandleCalleeSaves.cpp
b3/air/AirInsertionSet.cpp
b3/air/AirInst.cpp
b3/air/AirKind.cpp
b3/air/AirLogRegisterPressure.cpp
b3/air/AirLowerAfterRegAlloc.cpp
b3/air/AirLowerEntrySwitch.cpp
b3/air/AirLowerMacros.cpp
b3/air/AirLowerStackArgs.cpp
b3/air/AirOptimizeBlockOrder.cpp
b3/air/AirPadInterference.cpp
b3/air/AirPhaseInsertionSet.cpp
b3/air/AirPhaseScope.cpp
b3/air/AirPrintSpecial.cpp
b3/air/AirRegLiveness.cpp
b3/air/AirReportUsedRegisters.cpp
b3/air/AirSimplifyCFG.cpp
b3/air/AirSpecial.cpp
b3/air/AirStackAllocation.cpp
b3/air/AirStackSlot.cpp
b3/air/AirStackSlotKind.cpp
b3/air/AirTmp.cpp
b3/air/AirTmpWidth.cpp
b3/air/AirValidate.cpp
b3/B3ArgumentRegValue.cpp
b3/B3AtomicValue.cpp
b3/B3Bank.cpp
b3/B3BasicBlock.cpp
b3/B3BlockInsertionSet.cpp
[JSC] Add B3::BottomTupleValue node https://bugs.webkit.org/show_bug.cgi?id=214956 <rdar://problem/65192877> Reviewed by Keith Miller. JSTests: * wasm/stress/bottom-tuple.js: Added. (try.main): (catch): Source/JavaScriptCore: In B3 strength reduction, we convert B3 values to bottom value based on type after Oops kind, and then they are *typically* removed later. While we support bottom values for usual types, we do not have a bottom value for tuple type. So when replaceWithBottom is called, we fail to replace Patchpoints producing tuples with bottom values. This patch newly adds B3 BottomTupleValue, which is just a BottomValue for tuple. We can extend it to generate arbitrary constant tuple values, but for now, we just support bottom tuple values. We add a new node instead of generating patchpoint which generates bottom values since BottomTupleValues implementation is simpler: BottomTupleValue just emits bunch of zero clear for Air tmps and Air does everything automatically. On the other hand, implementing a patchpoint needs to add code which clears things with zero while checking the ValueRep. And since we have Const32, Const64, etc. values, having this kind of value for tuple too is natural. Plus, this design allows us to remove bunch of unnecessary instructions after lowering this to Air since Air knows what instructions will be emitted by this BottomTupleValue, and Air can remove a lot of zero clear instructions if they are not read later by Extract. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * b3/B3BottomTupleValue.cpp: Copied from Source/JavaScriptCore/b3/B3InsertionSet.cpp. (JSC::B3::BottomTupleValue::dumpMeta const): * b3/B3BottomTupleValue.h: Copied from Source/JavaScriptCore/b3/B3InsertionSet.cpp. * b3/B3InsertionSet.cpp: (JSC::B3::InsertionSet::insertBottom): * b3/B3LowerToAir.cpp: * b3/B3Opcode.cpp: (WTF::printInternal): * b3/B3Opcode.h: * b3/B3Procedure.cpp: (JSC::B3::Procedure::addBottom): * b3/B3TypeMap.h: (JSC::B3::TypeMap::TypeMap): Deleted. * b3/B3Validate.cpp: * b3/B3Value.cpp: (JSC::B3::Value::effects const): (JSC::B3::Value::key const): * b3/B3Value.h: * b3/B3ValueInlines.h: * b3/B3ValueKey.cpp: (JSC::B3::ValueKey::materialize const): * b3/testb3_7.cpp: (testBottomTupleValue): (addTupleTests): Canonical link: https://commits.webkit.org/227774@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-07-30 04:42:46 +00:00
b3/B3BottomTupleValue.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
b3/B3BreakCriticalEdges.cpp
Add Pre/Post-Indexed Address Mode to Air for ARM64 https://bugs.webkit.org/show_bug.cgi?id=228047 Reviewed by Phil Pizlo. Pre-indexed addressing means that the address is the sum of the value in the 64-bit base register and an offset, and the address is then written back to the base register. And post-indexed addressing means that the address is the value in the 64-bit base register, and the sum of the address and the offset is then written back to the base register. They are relatively common for loops to iterate over an array by increasing/decreasing a pointer into the array at each iteration. With such an addressing mode, the instruction selector can merge the increment and access the array. ##################################### ## Pre-Index Address Mode For Load ## ##################################### LDR Wt, [Xn, #imm]! In B3 Reduction Strength, since we have this reduction rule: Turn this: Load(Add(address, offset1), offset = offset2) Into this: Load(address, offset = offset1 + offset2) Then, the equivalent pattern is: address = Add(base, offset) ... memory = Load(base, offset) First, we convert it to the canonical form: address = Add(base, offset) newMemory = Load(base, offset) // move the memory to just after the address ... memory = Identity(newMemory) Next, lower to Air: Move %base, %address Move (%address, prefix(offset)), %newMemory ###################################### ## Post-Index Address Mode For Load ## ###################################### LDR Wt, [Xn], #imm Then, the equivalent pattern is: memory = Load(base, 0) ... address = Add(base, offset) First, we convert it to the canonical form: newOffset = Constant newAddress = Add(base, offset) memory = Load(base, 0) // move the offset and address to just before the memory ... offset = Identity(newOffset) address = Identity(newAddress) Next, lower to Air: Move %base, %newAddress Move (%newAddress, postfix(offset)), %memory ############################# ## Pattern Match Algorithm ## ############################# To detect the pattern for prefix/postfix increment address is tricky due to the structure in B3 IR. The algorithm used in this patch is to collect the first valid values (add/load), then search for any paired value (load/add) to match all of them. In worst case, the runtime complexity is O(n^2) when n is the number of all values. After collecting two sets of candidates, we match the prefix incremental address first since it seems more beneficial to the compiler (shown in the next section). And then, go for the postfix one. ############################################## ## Test for Pre/Post-Increment Address Mode ## ############################################## Given Loop with Pre-Increment: int64_t ldr_pre(int64_t *p) { int64_t res = 0; while (res < 10) res += *++p; return res; } B3 IR: ------------------------------------------------------ BB#0: ; frequency = 1.000000 Int64 b@0 = Const64(0) Int64 b@2 = ArgumentReg(%x0) Void b@20 = Upsilon($0(b@0), ^18, WritesLocalState) Void b@21 = Upsilon(b@2, ^19, WritesLocalState) Void b@4 = Jump(Terminal) Successors: #1 BB#1: ; frequency = 1.000000 Predecessors: #0, #2 Int64 b@18 = Phi(ReadsLocalState) Int64 b@19 = Phi(ReadsLocalState) Int64 b@7 = Const64(10) Int32 b@8 = AboveEqual(b@18, $10(b@7)) Void b@9 = Branch(b@8, Terminal) Successors: Then:#3, Else:#2 BB#2: ; frequency = 1.000000 Predecessors: #1 Int64 b@10 = Const64(8) Int64 b@11 = Add(b@19, $8(b@10)) Int64 b@13 = Load(b@11, ControlDependent|Reads:Top) Int64 b@14 = Add(b@18, b@13) Void b@22 = Upsilon(b@14, ^18, WritesLocalState) Void b@23 = Upsilon(b@11, ^19, WritesLocalState) Void b@16 = Jump(Terminal) Successors: #1 BB#3: ; frequency = 1.000000 Predecessors: #1 Void b@17 = Return(b@18, Terminal) Variables: Int64 var0 Int64 var1 ------------------------------------------------------ W/O Pre-Increment Address Mode: ------------------------------------------------------ ... BB#2: ; frequency = 1.000000 Predecessors: #1 Move $8, %x3, $8(b@12) Add64 $8, %x0, %x1, b@11 Move (%x0,%x3), %x0, b@13 Add64 %x0, %x2, %x2, b@14 Move %x1, %x0, b@23 Jump b@16 Successors: #1 ... ------------------------------------------------------ W/ Pre-Increment Address Mode: ------------------------------------------------------ ... BB#2: ; frequency = 1.000000 Predecessors: #1 MoveWithIncrement64 (%x0,Pre($8)), %x2, b@13 Add64 %x2, %x1, %x1, b@14 Jump b@16 Successors: #1 ... ------------------------------------------------------ Given Loop with Post-Increment: int64_t ldr_pre(int64_t *p) { int64_t res = 0; while (res < 10) res += *p++; return res; } B3 IR: ------------------------------------------------------ BB#0: ; frequency = 1.000000 Int64 b@0 = Const64(0) Int64 b@2 = ArgumentReg(%x0) Void b@20 = Upsilon($0(b@0), ^18, WritesLocalState) Void b@21 = Upsilon(b@2, ^19, WritesLocalState) Void b@4 = Jump(Terminal) Successors: #1 BB#1: ; frequency = 1.000000 Predecessors: #0, #2 Int64 b@18 = Phi(ReadsLocalState) Int64 b@19 = Phi(ReadsLocalState) Int64 b@7 = Const64(10) Int32 b@8 = AboveEqual(b@18, $10(b@7)) Void b@9 = Branch(b@8, Terminal) Successors: Then:#3, Else:#2 BB#2: ; frequency = 1.000000 Predecessors: #1 Int64 b@10 = Load(b@19, ControlDependent|Reads:Top) Int64 b@11 = Add(b@18, b@10) Int64 b@12 = Const64(8) Int64 b@13 = Add(b@19, $8(b@12)) Void b@22 = Upsilon(b@11, ^18, WritesLocalState) Void b@23 = Upsilon(b@13, ^19, WritesLocalState) Void b@16 = Jump(Terminal) Successors: #1 BB#3: ; frequency = 1.000000 Predecessors: #1 Void b@17 = Return(b@18, Terminal) Variables: Int64 var0 Int64 var1 ------------------------------------------------------ W/O Post-Increment Address Mode: ------------------------------------------------------ ... BB#2: ; frequency = 1.000000 Predecessors: #1 Move (%x0), %x2, b@10 Add64 %x2, %x1, %x1, b@11 Add64 $8, %x0, %x0, b@13 Jump b@16 Successors: #1 ... ------------------------------------------------------ W/ Post-Increment Address Mode: ------------------------------------------------------ ... BB#2: ; frequency = 1.000000 Predecessors: #1 MoveWithIncrement64 (%x0,Post($8)), %x2, b@10 Add64 %x2, %x1, %x1, b@11 Jump b@16 Successors: #1 ... ------------------------------------------------------ * Sources.txt: * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::PreIndexAddress::PreIndexAddress): (JSC::AbstractMacroAssembler::PostIndexAddress::PostIndexAddress): * assembler/MacroAssemblerARM64.h: (JSC::MacroAssemblerARM64::load64): (JSC::MacroAssemblerARM64::load32): (JSC::MacroAssemblerARM64::store64): (JSC::MacroAssemblerARM64::store32): * assembler/testmasm.cpp: (JSC::testStorePrePostIndex32): (JSC::testStorePrePostIndex64): (JSC::testLoadPrePostIndex32): (JSC::testLoadPrePostIndex64): * b3/B3CanonicalizePrePostIncrements.cpp: Added. (JSC::B3::canonicalizePrePostIncrements): * b3/B3CanonicalizePrePostIncrements.h: Copied from Source/JavaScriptCore/b3/B3ValueKeyInlines.h. * b3/B3Generate.cpp: (JSC::B3::generateToAir): * b3/B3LowerToAir.cpp: * b3/B3ValueKey.h: * b3/B3ValueKeyInlines.h: (JSC::B3::ValueKey::ValueKey): * b3/air/AirArg.cpp: (JSC::B3::Air::Arg::jsHash const): (JSC::B3::Air::Arg::dump const): (WTF::printInternal): * b3/air/AirArg.h: (JSC::B3::Air::Arg::preIndex): (JSC::B3::Air::Arg::postIndex): (JSC::B3::Air::Arg::isPreIndex const): (JSC::B3::Air::Arg::isPostIndex const): (JSC::B3::Air::Arg::isMemory const): (JSC::B3::Air::Arg::base const): (JSC::B3::Air::Arg::offset const): (JSC::B3::Air::Arg::isGP const): (JSC::B3::Air::Arg::isFP const): (JSC::B3::Air::Arg::isValidPreIndexForm): (JSC::B3::Air::Arg::isValidPostIndexForm): (JSC::B3::Air::Arg::isValidForm const): (JSC::B3::Air::Arg::forEachTmpFast): (JSC::B3::Air::Arg::forEachTmp): (JSC::B3::Air::Arg::asPreIndexAddress const): (JSC::B3::Air::Arg::asPostIndexAddress const): * b3/air/AirOpcode.opcodes: * b3/air/opcode_generator.rb: * b3/testb3.h: * b3/testb3_3.cpp: (testLoadPreIndex32): (testLoadPreIndex64): (testLoadPostIndex32): (testLoadPostIndex64): (addShrTests): * jit/ExecutableAllocator.cpp: (JSC::jitWriteThunkGenerator): Canonical link: https://commits.webkit.org/240125@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280493 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-07-30 20:44:47 +00:00
b3/B3CanonicalizePrePostIncrements.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
b3/B3CCallValue.cpp
b3/B3CaseCollection.cpp
b3/B3CheckSpecial.cpp
b3/B3CheckValue.cpp
b3/B3Common.cpp
b3/B3Commutativity.cpp
b3/B3Compile.cpp
b3/B3Const32Value.cpp
b3/B3Const64Value.cpp
b3/B3ConstDoubleValue.cpp
b3/B3ConstFloatValue.cpp
b3/B3ConstrainedValue.cpp
b3/B3DataSection.cpp
b3/B3DuplicateTails.cpp
b3/B3Effects.cpp
b3/B3EliminateCommonSubexpressions.cpp
B3 should use associativity to optimize expression trees https://bugs.webkit.org/show_bug.cgi?id=194081 Reviewed by Filip Pizlo. JSTests: Added three microbenchmarks: - add-tree should be the ideal case, but there is no speedup because we are currently unable to prove that the CheckAdd won't overflow - bit-xor-tree most closely matches the situation where the optimization triggers on the JetStream2 subtests where it triggers: an unbalanced expression tree of size 8 that can be balanced, with no other optimizations being unlocked. 16% speedup - bit-or-tree is an ideal case, where the reassociation also enables a ton of further simplifications. 42% speedup * microbenchmarks/add-tree.js: Added. * microbenchmarks/bit-or-tree.js: Added. * microbenchmarks/bit-xor-tree.js: Added. Source/JavaScriptCore: This patch adds a new B3 pass, that tries to find and optimize expression trees made purely of any one associative and commutative operator (Add/Mul/BitOr/BitAnd/BitXor). The pass only runs in O2, and runs once, after lowerMacros and just before a run of B3ReduceStrength (which helps clean up the dead code it tends to leave behind). I had to separate killDeadCode out of B3ReduceStrength (as a new B3EliminateDeadCode pass) to run it before B3OptimizeAssociativeExpressionTrees, as otherwise it is stopped by high use counts inherited from CSE. This extra run of DCE is by itself a win, most notably on microbenchmarks/instanceof-always-hit-two (1.5x faster), and on microbenchmarks/licm-dragons(-out-of-bounds) (both get 1.16x speedup). I suspect it is because it runs between CSE and tail-dedup, and as a result allows a lot more tail-dedup to occur. The pass is currently extremely conservative, not trying anything if it would cause _any_ code duplication. For this purpose, it starts by computing use counts for the potentially interesting nodes (those with the right opcodes), and segregate them into expression trees. The root of an expression tree is a node that is either used in multiple places, or is used by a value with a different opcode. The leaves of an expression tree are nodes that are either used in multiple places, or have a different opcode. All constant leaves of a tree are combined, as well as all leaves that are identical. What remains is then laid out into a balanced binary tree, hopefully maximizing ILP. This optimization was implemented as a stand-alone pass and not as part of B3ReduceStrength mostly because it needs use counts to avoid code duplication. It also benefits from finding all tree roots first, and not trying to repeatedly optimize subtrees. I added several tests to testB3 with varying patterns of trees. It is also tested in a less focused way by lots of older tests. In the future this pass could be expanded to allow some bounded amount of code duplication, and merging more leaves (e.g. Mul(a, 3) and a in an Add tree, into Mul(a, 4)) The latter will need exposing the peephole optimizations out of B3ReduceStrength to avoid duplicating code. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * b3/B3Common.cpp: (JSC::B3::shouldDumpIR): (JSC::B3::shouldDumpIRAtEachPhase): * b3/B3Common.h: * b3/B3EliminateDeadCode.cpp: Added. (JSC::B3::EliminateDeadCode::run): (JSC::B3::eliminateDeadCode): * b3/B3EliminateDeadCode.h: Added. (JSC::B3::EliminateDeadCode::EliminateDeadCode): * b3/B3Generate.cpp: (JSC::B3::generateToAir): * b3/B3OptimizeAssociativeExpressionTrees.cpp: Added. (JSC::B3::OptimizeAssociativeExpressionTrees::OptimizeAssociativeExpressionTrees): (JSC::B3::OptimizeAssociativeExpressionTrees::neutralElement): (JSC::B3::OptimizeAssociativeExpressionTrees::isAbsorbingElement): (JSC::B3::OptimizeAssociativeExpressionTrees::combineConstants): (JSC::B3::OptimizeAssociativeExpressionTrees::emitValue): (JSC::B3::OptimizeAssociativeExpressionTrees::optimizeRootedTree): (JSC::B3::OptimizeAssociativeExpressionTrees::run): (JSC::B3::optimizeAssociativeExpressionTrees): * b3/B3OptimizeAssociativeExpressionTrees.h: Added. * b3/B3ReduceStrength.cpp: * b3/B3Value.cpp: (JSC::B3::Value::replaceWithIdentity): * b3/testb3.cpp: (JSC::B3::testBitXorTreeArgs): (JSC::B3::testBitXorTreeArgsEven): (JSC::B3::testBitXorTreeArgImm): (JSC::B3::testAddTreeArg32): (JSC::B3::testMulTreeArg32): (JSC::B3::testBitAndTreeArg32): (JSC::B3::testBitOrTreeArg32): (JSC::B3::run): Canonical link: https://commits.webkit.org/210847@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243851 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-04 03:37:23 +00:00
b3/B3EliminateDeadCode.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
b3/B3EnsureLoopPreHeaders.cpp
B3 should support tuple types https://bugs.webkit.org/show_bug.cgi?id=200327 Reviewed by Filip Pizlo. As part of the Wasm multi-value proposal, we need to teach B3 that patchpoints can return more than one value. This is done by adding a new B3::Type called Tuple. Unlike, other B3 types Tuple is actually an encoded index into a numeric B3::Type vector on the procedure. This lets us distinguish any two tuples from each other, moreover, it's possible to get the vector of types with just the B3::Tuple type and the procedure. Since most B3 operations only expect to see a single numeric child there is a new Opcode, Extract, that takes yields the some, fixed, entry from a tuple value. Extract would be the only other change needed to make tuples work in B3 except that some optimizations expect to be able to take any non-Void value and stick it into a Variable of the same type. This means both Get/Set from a variable have to support Tuples as well. For simplicity and consistency, the ability to accept tuples is also applied to Phi and Upsilon. In order to lower a Tuple, B3Lowering needs to have a Tmp for each nested type in a Tuple. While we could reuse the existing IndexedTables to hold the extra information we need to lower Tuples, we instead use a two new HashTables for Value->Tmp(s) and Phi->Tmp(s). It's expected that Tuples will be sufficiently uncommon the overhead of tracking everything together would be prohibitive. On the other hand, we don't worry about this for Variables because we don't expect those to make it to lowering. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * b3/B3Bank.h: (JSC::B3::bankForType): * b3/B3CheckValue.cpp: (JSC::B3::CheckValue::CheckValue): * b3/B3ExtractValue.cpp: Copied from Source/JavaScriptCore/b3/B3ProcedureInlines.h. (JSC::B3::ExtractValue::~ExtractValue): (JSC::B3::ExtractValue::dumpMeta const): * b3/B3ExtractValue.h: Copied from Source/JavaScriptCore/b3/B3FixSSA.h. * b3/B3FixSSA.h: * b3/B3LowerMacros.cpp: * b3/B3LowerMacrosAfterOptimizations.cpp: * b3/B3LowerToAir.cpp: * b3/B3NativeTraits.h: * b3/B3Opcode.cpp: (JSC::B3::invertedCompare): (WTF::printInternal): * b3/B3Opcode.h: (JSC::B3::opcodeForConstant): * b3/B3PatchpointSpecial.cpp: (JSC::B3::PatchpointSpecial::forEachArg): (JSC::B3::PatchpointSpecial::isValid): (JSC::B3::PatchpointSpecial::admitsStack): (JSC::B3::PatchpointSpecial::generate): * b3/B3PatchpointValue.cpp: (JSC::B3::PatchpointValue::dumpMeta const): (JSC::B3::PatchpointValue::PatchpointValue): * b3/B3PatchpointValue.h: * b3/B3Procedure.cpp: (JSC::B3::Procedure::addTuple): (JSC::B3::Procedure::isValidTuple const): (JSC::B3::Procedure::tupleForType const): (JSC::B3::Procedure::addIntConstant): (JSC::B3::Procedure::addConstant): * b3/B3Procedure.h: (JSC::B3::Procedure::returnCount const): * b3/B3ProcedureInlines.h: (JSC::B3::Procedure::extractFromTuple const): * b3/B3ReduceStrength.cpp: * b3/B3StackmapSpecial.cpp: (JSC::B3::StackmapSpecial::isValidImpl): (JSC::B3::StackmapSpecial::isArgValidForType): (JSC::B3::StackmapSpecial::isArgValidForRep): (JSC::B3::StackmapSpecial::isArgValidForValue): Deleted. * b3/B3StackmapSpecial.h: * b3/B3StackmapValue.h: * b3/B3Type.cpp: (WTF::printInternal): * b3/B3Type.h: (JSC::B3::Type::Type): (JSC::B3::Type::tupleFromIndex): (JSC::B3::Type::kind const): (JSC::B3::Type::tupleIndex const): (JSC::B3::Type::hash const): (JSC::B3::Type::operator== const): (JSC::B3::Type::operator!= const): (JSC::B3::Type::isInt const): (JSC::B3::Type::isFloat const): (JSC::B3::Type::isNumeric const): (JSC::B3::Type::isTuple const): (JSC::B3::sizeofType): (JSC::B3::isInt): Deleted. (JSC::B3::isFloat): Deleted. * b3/B3TypeMap.h: (JSC::B3::TypeMap::at): * b3/B3Validate.cpp: * b3/B3Value.cpp: (JSC::B3::Value::isRounded const): (JSC::B3::Value::effects const): (JSC::B3::Value::typeFor): * b3/B3Value.h: * b3/B3ValueInlines.h: * b3/B3ValueKey.cpp: (JSC::B3::ValueKey::intConstant): * b3/B3ValueKey.h: (JSC::B3::ValueKey::hash const): * b3/B3ValueRep.h: * b3/B3Width.h: (JSC::B3::widthForType): * b3/air/AirArg.cpp: (JSC::B3::Air::Arg::canRepresent const): * b3/air/AirArg.h: * b3/air/AirCCallingConvention.cpp: (JSC::B3::Air::cCallResult): * b3/air/AirLowerMacros.cpp: (JSC::B3::Air::lowerMacros): * b3/testb3.h: (populateWithInterestingValues): * b3/testb3_1.cpp: (run): * b3/testb3_3.cpp: (testStorePartial8BitRegisterOnX86): * b3/testb3_5.cpp: (testPatchpointWithRegisterResult): (testPatchpointWithStackArgumentResult): (testPatchpointWithAnyResult): * b3/testb3_6.cpp: (testPatchpointDoubleRegs): (testSomeEarlyRegister): * b3/testb3_7.cpp: (testShuffleDoesntTrashCalleeSaves): (testReportUsedRegistersLateUseFollowedByEarlyDefDoesNotMarkUseAsDead): (testSimpleTuplePair): (testSimpleTuplePairUnused): (testSimpleTuplePairStack): (tailDupedTuplePair): (tuplePairVariableLoop): (tupleNestedLoop): (addTupleTests): * b3/testb3_8.cpp: (testLoad): (addLoadTests): * ftl/FTLAbbreviatedTypes.h: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstruct): (JSC::FTL::DFG::LowerDFGToB3::compileDirectCallOrConstruct): (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread): (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs): (JSC::FTL::DFG::LowerDFGToB3::compileCallEval): (JSC::FTL::DFG::LowerDFGToB3::compileCPUIntrinsic): (JSC::FTL::DFG::LowerDFGToB3::compileInstanceOf): (JSC::FTL::DFG::LowerDFGToB3::compileCallDOMGetter): (JSC::FTL::DFG::LowerDFGToB3::emitBinarySnippet): (JSC::FTL::DFG::LowerDFGToB3::emitBinaryBitOpSnippet): (JSC::FTL::DFG::LowerDFGToB3::emitRightShiftSnippet): (JSC::FTL::DFG::LowerDFGToB3::allocateHeapCell): * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::emitPatchpoint): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::B3IRGenerator): * wasm/WasmCallingConvention.h: (JSC::Wasm::CallingConvention::marshallArgument const): (JSC::Wasm::CallingConvention::setupFrameInPrologue const): (JSC::Wasm::CallingConvention::setupCall const): (JSC::Wasm::CallingConventionAir::setupCall const): Canonical link: https://commits.webkit.org/214174@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248178 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-02 21:02:05 +00:00
b3/B3ExtractValue.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
b3/B3FenceValue.cpp
b3/B3FixSSA.cpp
b3/B3FoldPathConstants.cpp
b3/B3FrequencyClass.cpp
b3/B3Generate.cpp
b3/B3HoistLoopInvariantValues.cpp
b3/B3InferSwitches.cpp
b3/B3InsertionSet.cpp
b3/B3Kind.cpp
b3/B3LegalizeMemoryOffsets.cpp
b3/B3LowerMacros.cpp
b3/B3LowerMacrosAfterOptimizations.cpp
b3/B3LowerToAir.cpp
b3/B3MathExtras.cpp
b3/B3MemoryValue.cpp
b3/B3MoveConstants.cpp
b3/B3Opcode.cpp
B3 should use associativity to optimize expression trees https://bugs.webkit.org/show_bug.cgi?id=194081 Reviewed by Filip Pizlo. JSTests: Added three microbenchmarks: - add-tree should be the ideal case, but there is no speedup because we are currently unable to prove that the CheckAdd won't overflow - bit-xor-tree most closely matches the situation where the optimization triggers on the JetStream2 subtests where it triggers: an unbalanced expression tree of size 8 that can be balanced, with no other optimizations being unlocked. 16% speedup - bit-or-tree is an ideal case, where the reassociation also enables a ton of further simplifications. 42% speedup * microbenchmarks/add-tree.js: Added. * microbenchmarks/bit-or-tree.js: Added. * microbenchmarks/bit-xor-tree.js: Added. Source/JavaScriptCore: This patch adds a new B3 pass, that tries to find and optimize expression trees made purely of any one associative and commutative operator (Add/Mul/BitOr/BitAnd/BitXor). The pass only runs in O2, and runs once, after lowerMacros and just before a run of B3ReduceStrength (which helps clean up the dead code it tends to leave behind). I had to separate killDeadCode out of B3ReduceStrength (as a new B3EliminateDeadCode pass) to run it before B3OptimizeAssociativeExpressionTrees, as otherwise it is stopped by high use counts inherited from CSE. This extra run of DCE is by itself a win, most notably on microbenchmarks/instanceof-always-hit-two (1.5x faster), and on microbenchmarks/licm-dragons(-out-of-bounds) (both get 1.16x speedup). I suspect it is because it runs between CSE and tail-dedup, and as a result allows a lot more tail-dedup to occur. The pass is currently extremely conservative, not trying anything if it would cause _any_ code duplication. For this purpose, it starts by computing use counts for the potentially interesting nodes (those with the right opcodes), and segregate them into expression trees. The root of an expression tree is a node that is either used in multiple places, or is used by a value with a different opcode. The leaves of an expression tree are nodes that are either used in multiple places, or have a different opcode. All constant leaves of a tree are combined, as well as all leaves that are identical. What remains is then laid out into a balanced binary tree, hopefully maximizing ILP. This optimization was implemented as a stand-alone pass and not as part of B3ReduceStrength mostly because it needs use counts to avoid code duplication. It also benefits from finding all tree roots first, and not trying to repeatedly optimize subtrees. I added several tests to testB3 with varying patterns of trees. It is also tested in a less focused way by lots of older tests. In the future this pass could be expanded to allow some bounded amount of code duplication, and merging more leaves (e.g. Mul(a, 3) and a in an Add tree, into Mul(a, 4)) The latter will need exposing the peephole optimizations out of B3ReduceStrength to avoid duplicating code. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * b3/B3Common.cpp: (JSC::B3::shouldDumpIR): (JSC::B3::shouldDumpIRAtEachPhase): * b3/B3Common.h: * b3/B3EliminateDeadCode.cpp: Added. (JSC::B3::EliminateDeadCode::run): (JSC::B3::eliminateDeadCode): * b3/B3EliminateDeadCode.h: Added. (JSC::B3::EliminateDeadCode::EliminateDeadCode): * b3/B3Generate.cpp: (JSC::B3::generateToAir): * b3/B3OptimizeAssociativeExpressionTrees.cpp: Added. (JSC::B3::OptimizeAssociativeExpressionTrees::OptimizeAssociativeExpressionTrees): (JSC::B3::OptimizeAssociativeExpressionTrees::neutralElement): (JSC::B3::OptimizeAssociativeExpressionTrees::isAbsorbingElement): (JSC::B3::OptimizeAssociativeExpressionTrees::combineConstants): (JSC::B3::OptimizeAssociativeExpressionTrees::emitValue): (JSC::B3::OptimizeAssociativeExpressionTrees::optimizeRootedTree): (JSC::B3::OptimizeAssociativeExpressionTrees::run): (JSC::B3::optimizeAssociativeExpressionTrees): * b3/B3OptimizeAssociativeExpressionTrees.h: Added. * b3/B3ReduceStrength.cpp: * b3/B3Value.cpp: (JSC::B3::Value::replaceWithIdentity): * b3/testb3.cpp: (JSC::B3::testBitXorTreeArgs): (JSC::B3::testBitXorTreeArgsEven): (JSC::B3::testBitXorTreeArgImm): (JSC::B3::testAddTreeArg32): (JSC::B3::testMulTreeArg32): (JSC::B3::testBitAndTreeArg32): (JSC::B3::testBitOrTreeArg32): (JSC::B3::run): Canonical link: https://commits.webkit.org/210847@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243851 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-04 03:37:23 +00:00
b3/B3OptimizeAssociativeExpressionTrees.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
b3/B3Origin.cpp
b3/B3OriginDump.cpp
b3/B3PatchpointSpecial.cpp
b3/B3PatchpointValue.cpp
b3/B3PhaseScope.cpp
b3/B3PhiChildren.cpp
b3/B3Procedure.cpp
b3/B3PureCSE.cpp
b3/B3ReduceDoubleToFloat.cpp
Identify memcpy loops in b3 https://bugs.webkit.org/show_bug.cgi?id=200181 Reviewed by Saam Barati. JSTests: * microbenchmarks/memcpy-loop.js: Added. (doTest): (let.arr1): * microbenchmarks/memcpy-typed-loop-large.js: Added. (doTest): (let.arr1.new.Int32Array.1000000.let.arr2.new.Int32Array.1000000): (arr2): * microbenchmarks/memcpy-typed-loop-small.js: Added. (doTest): (16.let.arr1.new.Int32Array.size.let.arr2.new.Int32Array.size): (16.arr2): * microbenchmarks/memcpy-typed-loop-speculative.js: Added. (doTest): (let.arr1.new.Int32Array.10.let.arr2.new.Int32Array.10): (arr2): * microbenchmarks/memcpy-wasm-large.js: Added. (typeof.WebAssembly.string_appeared_here.eq): (typeof.WebAssembly.string_appeared_here.const.1.new.WebAssembly.Instance.new.WebAssembly.Module.new.Uint8Array): * microbenchmarks/memcpy-wasm-medium.js: Added. (typeof.WebAssembly.string_appeared_here.eq): (typeof.WebAssembly.string_appeared_here.const.1.new.WebAssembly.Instance.new.WebAssembly.Module.new.Uint8Array): * microbenchmarks/memcpy-wasm-small.js: Added. (typeof.WebAssembly.string_appeared_here.eq): (typeof.WebAssembly.string_appeared_here.const.1.new.WebAssembly.Instance.new.WebAssembly.Module.new.Uint8Array): * microbenchmarks/memcpy-wasm.js: Added. (typeof.WebAssembly.string_appeared_here.eq): (typeof.WebAssembly.string_appeared_here.const.1.new.WebAssembly.Instance.new.WebAssembly.Module.new.Uint8Array): * stress/memcpy-typed-loops.js: Added. (noLoop): (invalidStart): (const.size.10.let.arr1.new.Int32Array.size.let.arr2.new.Int32Array.size): (arr2): * wasm/function-tests/memcpy-wasm-loop.js: Added. (0.GetLocal.3.I32Const.1.I32Add.SetLocal.3.Br.1.End.End.End.WebAssembly): (string_appeared_here): Source/JavaScriptCore: Add a new pass in B3 to identify one type of forward byte copy loop and replace it with a call to a custom version of memcpy that will not cause GC tearing and have the correct behaviour when overlapping regions are passed in. Microbenchmarks show memcpy-typed-loop-large is about 6x faster, and everything else is neutral. The optimization is disabled on arm for now, until we add a memcpy implementation for it. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * b3/B3Generate.cpp: (JSC::B3::generateToAir): * b3/B3ReduceLoopStrength.cpp: Added. (JSC::B3::fastForwardCopy32): (JSC::B3::ReduceLoopStrength::AddrInfo::appendAddr): (JSC::B3::ReduceLoopStrength::ReduceLoopStrength): (JSC::B3::ReduceLoopStrength::reduceByteCopyLoopsToMemcpy): (JSC::B3::ReduceLoopStrength::hoistValue): (JSC::B3::ReduceLoopStrength::run): (JSC::B3::reduceLoopStrength): * b3/B3ReduceLoopStrength.h: Added. * b3/testb3.h: * b3/testb3_1.cpp: (run): * b3/testb3_8.cpp: (testFastForwardCopy32): (testByteCopyLoop): (testByteCopyLoopStartIsLoopDependent): (testByteCopyLoopBoundIsLoopDependent): (addCopyTests): Canonical link: https://commits.webkit.org/214685@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248938 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-21 06:30:05 +00:00
b3/B3ReduceLoopStrength.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
b3/B3ReduceStrength.cpp
b3/B3SSACalculator.cpp
b3/B3SlotBaseValue.cpp
b3/B3StackmapGenerationParams.cpp
b3/B3StackmapSpecial.cpp
b3/B3StackmapValue.cpp
b3/B3SwitchCase.cpp
b3/B3SwitchValue.cpp
b3/B3Type.cpp
b3/B3UpsilonValue.cpp
b3/B3UseCounts.cpp
b3/B3Validate.cpp
b3/B3Value.cpp
b3/B3ValueKey.cpp
b3/B3ValueRep.cpp
b3/B3Variable.cpp
b3/B3VariableLiveness.cpp
b3/B3VariableValue.cpp
b3/B3WasmAddressValue.cpp
b3/B3WasmBoundsCheckValue.cpp
b3/B3Width.cpp
bindings/ScriptFunctionCall.cpp
bindings/ScriptObject.cpp
bindings/ScriptValue.cpp
builtins/BuiltinExecutables.cpp
builtins/BuiltinExecutableCreator.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
builtins/BuiltinNames.cpp
bytecode/AccessCase.cpp
bytecode/AccessCaseSnippetParams.cpp
bytecode/AdaptiveInferredPropertyValueWatchpointBase.cpp
bytecode/ArithProfile.cpp
bytecode/ArrayAllocationProfile.cpp
bytecode/ArrayProfile.cpp
bytecode/ByValInfo.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
bytecode/BytecodeBasicBlock.cpp
bytecode/BytecodeDumper.cpp
bytecode/BytecodeGeneratorification.cpp
BytecodeIndex should be a proper C++ class https://bugs.webkit.org/show_bug.cgi?id=203276 Reviewed by Mark Lam. This patch makes a change to how we refer to the bytecode index in a bytecode stream. Previously we just used an unsigned number to represent the index, this patch changes most of the code to use a BytecodeIndex class instead. The only places where this patch does not change this is for jump and switch targets / deltas. Additionally, this patch attempts to canonicalize the terminology around how we refer to bytecode indices. Now we use the word index to refer to the bytecode index class and offset to refer to the unsigned byte offset into the instruction stream. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/ByValInfo.h: (JSC::ByValInfo::ByValInfo): (JSC::getByValInfoBytecodeIndex): * bytecode/BytecodeBasicBlock.cpp: (JSC::BytecodeBasicBlock::computeImpl): * bytecode/BytecodeGeneratorification.cpp: (JSC::GeneratorLivenessAnalysis::run): * bytecode/BytecodeIndex.cpp: Added. (JSC::BytecodeIndex::dump const): * bytecode/BytecodeIndex.h: Added. (JSC::BytecodeIndex::BytecodeIndex): (JSC::BytecodeIndex::offset const): (JSC::BytecodeIndex::asBits const): (JSC::BytecodeIndex::hash const): (JSC::BytecodeIndex::deletedValue): (JSC::BytecodeIndex::isHashTableDeletedValue const): (JSC::BytecodeIndex::operator bool const): (JSC::BytecodeIndex::operator == const): (JSC::BytecodeIndex::operator != const): (JSC::BytecodeIndex::operator < const): (JSC::BytecodeIndex::operator > const): (JSC::BytecodeIndex::operator <= const): (JSC::BytecodeIndex::operator >= const): (JSC::BytecodeIndex::fromBits): (JSC::BytecodeIndexHash::hash): (JSC::BytecodeIndexHash::equal): * bytecode/BytecodeLivenessAnalysis.cpp: (JSC::BytecodeLivenessAnalysis::getLivenessInfoAtBytecodeIndex): (JSC::BytecodeLivenessAnalysis::computeFullLiveness): (JSC::BytecodeLivenessAnalysis::computeKills): (JSC::BytecodeLivenessAnalysis::dumpResults): (JSC::BytecodeLivenessAnalysis::getLivenessInfoAtBytecodeOffset): Deleted. * bytecode/BytecodeLivenessAnalysis.h: * bytecode/BytecodeLivenessAnalysisInlines.h: (JSC::BytecodeLivenessPropagation::stepOverInstruction): (JSC::BytecodeLivenessPropagation::computeLocalLivenessForBytecodeIndex): (JSC::BytecodeLivenessPropagation::computeLocalLivenessForBlock): (JSC::BytecodeLivenessPropagation::getLivenessInfoAtBytecodeIndex): (JSC::BytecodeLivenessPropagation::computeLocalLivenessForBytecodeOffset): Deleted. (JSC::BytecodeLivenessPropagation::getLivenessInfoAtBytecodeOffset): Deleted. * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeIndex): (JSC::computeDefsForBytecodeIndex): (JSC::computeUsesForBytecodeOffset): Deleted. (JSC::computeDefsForBytecodeOffset): Deleted. * bytecode/CallLinkStatus.cpp: (JSC::CallLinkStatus::computeFromLLInt): (JSC::CallLinkStatus::computeFor): (JSC::CallLinkStatus::computeExitSiteData): * bytecode/CallLinkStatus.h: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::getCallLinkInfoForBytecodeIndex): (JSC::CodeBlock::addRareCaseProfile): (JSC::CodeBlock::rareCaseProfileForBytecodeIndex): (JSC::CodeBlock::rareCaseProfileCountForBytecodeIndex): (JSC::CodeBlock::handlerForBytecodeIndex): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeIndex): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeIndexSlow): (JSC::CodeBlock::lineNumberForBytecodeIndex): (JSC::CodeBlock::columnNumberForBytecodeIndex): (JSC::CodeBlock::expressionRangeForBytecodeIndex const): (JSC::CodeBlock::hasOpDebugForLineAndColumn): (JSC::CodeBlock::getArrayProfile): (JSC::CodeBlock::tryGetValueProfileForBytecodeIndex): (JSC::CodeBlock::valueProfilePredictionForBytecodeIndex): (JSC::CodeBlock::valueProfileForBytecodeIndex): (JSC::CodeBlock::validate): (JSC::CodeBlock::arithProfileForBytecodeIndex): (JSC::CodeBlock::couldTakeSpecialArithFastCase): (JSC::CodeBlock::bytecodeIndexFromCallSiteIndex): (JSC::CodeBlock::rareCaseProfileForBytecodeOffset): Deleted. (JSC::CodeBlock::rareCaseProfileCountForBytecodeOffset): Deleted. (JSC::CodeBlock::handlerForBytecodeOffset): Deleted. (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffset): Deleted. (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffsetSlow): Deleted. (JSC::CodeBlock::lineNumberForBytecodeOffset): Deleted. (JSC::CodeBlock::columnNumberForBytecodeOffset): Deleted. (JSC::CodeBlock::expressionRangeForBytecodeOffset const): Deleted. (JSC::CodeBlock::tryGetValueProfileForBytecodeOffset): Deleted. (JSC::CodeBlock::valueProfilePredictionForBytecodeOffset): Deleted. (JSC::CodeBlock::valueProfileForBytecodeOffset): Deleted. (JSC::CodeBlock::arithProfileForBytecodeOffset): Deleted. (JSC::CodeBlock::couldTakeSpecialFastCase): Deleted. (JSC::CodeBlock::bytecodeOffsetFromCallSiteIndex): Deleted. * bytecode/CodeBlock.h: (JSC::CodeBlock::likelyToTakeSlowCase): (JSC::CodeBlock::couldTakeSlowCase): (JSC::CodeBlock::bytecodeIndex): * bytecode/CodeOrigin.cpp: (JSC::CodeOrigin::approximateHash const): (JSC::CodeOrigin::dump const): * bytecode/CodeOrigin.h: (JSC::CodeOrigin::CodeOrigin): (JSC::CodeOrigin::isSet const): (JSC::CodeOrigin::isHashTableDeletedValue const): (JSC::CodeOrigin::bytecodeIndex const): (JSC::CodeOrigin::OutOfLineCodeOrigin::OutOfLineCodeOrigin): (JSC::CodeOrigin::buildCompositeValue): (JSC::CodeOrigin::hash const): * bytecode/DFGExitProfile.cpp: (JSC::DFG::FrequentExitSite::dump const): (JSC::DFG::ExitProfile::exitSitesFor): * bytecode/DFGExitProfile.h: (JSC::DFG::FrequentExitSite::FrequentExitSite): (JSC::DFG::FrequentExitSite::operator== const): (JSC::DFG::FrequentExitSite::subsumes const): (JSC::DFG::FrequentExitSite::hash const): (JSC::DFG::FrequentExitSite::bytecodeIndex const): (JSC::DFG::FrequentExitSite::isHashTableDeletedValue const): (JSC::DFG::QueryableExitProfile::hasExitSite const): (JSC::DFG::FrequentExitSite::bytecodeOffset const): Deleted. * bytecode/DeferredSourceDump.cpp: (JSC::DeferredSourceDump::DeferredSourceDump): (JSC::DeferredSourceDump::dump): * bytecode/DeferredSourceDump.h: (): Deleted. * bytecode/FullBytecodeLiveness.h: (JSC::FullBytecodeLiveness::getLiveness const): (JSC::FullBytecodeLiveness::operandIsLive const): * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::computeFromLLInt): (JSC::GetByIdStatus::computeFor): (JSC::GetByIdStatus::computeForStubInfo): * bytecode/GetByIdStatus.h: * bytecode/ICStatusUtils.cpp: (JSC::hasBadCacheExitSite): * bytecode/ICStatusUtils.h: * bytecode/InByIdStatus.cpp: (JSC::InByIdStatus::computeFor): * bytecode/InByIdStatus.h: * bytecode/InlineCallFrame.cpp: (JSC::InlineCallFrame::dumpInContext const): * bytecode/InstanceOfStatus.cpp: (JSC::InstanceOfStatus::computeFor): * bytecode/InstanceOfStatus.h: * bytecode/InstructionStream.h: (JSC::InstructionStream::BaseRef::offset const): (JSC::InstructionStream::BaseRef::index const): (JSC::InstructionStream::at const): * bytecode/LazyOperandValueProfile.h: (JSC::LazyOperandValueProfileKey::LazyOperandValueProfileKey): (JSC::LazyOperandValueProfileKey::operator== const): (JSC::LazyOperandValueProfileKey::hash const): (JSC::LazyOperandValueProfileKey::bytecodeIndex const): (JSC::LazyOperandValueProfileKey::isHashTableDeletedValue const): (JSC::LazyOperandValueProfileKey::bytecodeOffset const): Deleted. * bytecode/MethodOfGettingAValueProfile.cpp: (JSC::MethodOfGettingAValueProfile::fromLazyOperand): * bytecode/MethodOfGettingAValueProfile.h: * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::computeFromLLInt): (JSC::PutByIdStatus::computeFor): * bytecode/PutByIdStatus.h: * bytecode/StructureStubInfo.cpp: (JSC::StructureStubInfo::StructureStubInfo): * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::lineNumberForBytecodeIndex): (JSC::UnlinkedCodeBlock::expressionRangeForBytecodeIndex const): (JSC::UnlinkedCodeBlock::handlerForBytecodeIndex): (JSC::UnlinkedCodeBlock::lineNumberForBytecodeOffset): Deleted. (JSC::UnlinkedCodeBlock::expressionRangeForBytecodeOffset const): Deleted. (JSC::UnlinkedCodeBlock::handlerForBytecodeOffset): Deleted. * bytecode/UnlinkedCodeBlock.h: * bytecode/ValueProfile.h: (JSC::RareCaseProfile::RareCaseProfile): (JSC::getRareCaseProfileBytecodeIndex): (JSC::getRareCaseProfileBytecodeOffset): Deleted. * bytecompiler/BytecodeGenerator.cpp: (JSC::ForInContext::finalize): * debugger/DebuggerCallFrame.cpp: (JSC::DebuggerCallFrame::currentPosition): * dfg/DFGBasicBlock.cpp: (JSC::DFG::BasicBlock::BasicBlock): * dfg/DFGBasicBlock.h: (JSC::DFG::getBytecodeBeginForBlock): (JSC::DFG::blockForBytecodeIndex): (JSC::DFG::blockForBytecodeOffset): Deleted. * dfg/DFGBlockInsertionSet.cpp: (JSC::DFG::BlockInsertionSet::insert): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::flushForTerminalImpl): (JSC::DFG::ByteCodeParser::flushIfTerminal): (JSC::DFG::ByteCodeParser::branchData): (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::getPrediction): (JSC::DFG::ByteCodeParser::getArrayMode): (JSC::DFG::ByteCodeParser::makeSafe): (JSC::DFG::ByteCodeParser::makeDivSafe): (JSC::DFG::ByteCodeParser::allocateTargetableBlock): (JSC::DFG::ByteCodeParser::allocateUntargetableBlock): (JSC::DFG::ByteCodeParser::makeBlockTargetable): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleRecursiveTailCall): (JSC::DFG::ByteCodeParser::inlineCall): (JSC::DFG::ByteCodeParser::handleCallVariant): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::linkBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCommonData.cpp: (JSC::DFG::CommonData::addCodeOrigin): (JSC::DFG::CommonData::addUniqueCallSiteIndex): (JSC::DFG::CommonData::lastCallSite const): * dfg/DFGCommonData.h: (JSC::DFG::CommonData::catchOSREntryDataForBytecodeIndex): (JSC::DFG::CommonData::appendCatchEntrypoint): * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): (JSC::DFG::compile): * dfg/DFGDriver.h: * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): (JSC::DFG::Graph::methodOfGettingAValueProfileFor): (JSC::DFG::Graph::willCatchExceptionInMachineFrame): * dfg/DFGGraph.h: * dfg/DFGJITCode.cpp: (JSC::DFG::JITCode::clearOSREntryBlockAndResetThresholds): * dfg/DFGJITCode.h: (JSC::DFG::JITCode::appendOSREntryData): (JSC::DFG::JITCode::osrEntryDataForBytecodeIndex): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::JITCompiler): (JSC::DFG::JITCompiler::compile): (JSC::DFG::JITCompiler::compileFunction): * dfg/DFGJITCompiler.h: (JSC::DFG::JITCompiler::setStartOfCode): * dfg/DFGLiveCatchVariablePreservationPhase.cpp: (JSC::DFG::LiveCatchVariablePreservationPhase::handleBlockForTryCatch): * dfg/DFGOSREntry.cpp: (JSC::DFG::OSREntryData::dumpInContext const): (JSC::DFG::prepareOSREntry): (JSC::DFG::prepareCatchOSREntry): * dfg/DFGOSREntry.h: (JSC::DFG::getOSREntryDataBytecodeIndex): (JSC::DFG::prepareOSREntry): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOSRExit.cpp: (JSC::DFG::OSRExit::executeOSRExit): (JSC::DFG::reifyInlinedCallFrames): (JSC::DFG::adjustAndJumpToTarget): (JSC::DFG::printOSRExit): (JSC::DFG::OSRExit::compileExit): (JSC::DFG::OSRExit::debugOperationPrintSpeculationFailure): * dfg/DFGOSRExit.h: * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::callerReturnPC): (JSC::DFG::reifyInlinedCallFrames): (JSC::DFG::adjustAndJumpToTarget): * dfg/DFGOSRExitCompilerCommon.h: * dfg/DFGOperations.cpp: * dfg/DFGOperations.h: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::Plan): (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::cleanMustHandleValuesIfNecessary): * dfg/DFGPlan.h: (JSC::DFG::Plan::osrEntryBytecodeIndex const): (JSC::DFG::Plan::tierUpInLoopHierarchy): (JSC::DFG::Plan::tierUpAndOSREnterBytecodes): * dfg/DFGSSAConversionPhase.cpp: (JSC::DFG::SSAConversionPhase::run): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCurrentBlock): (JSC::DFG::SpeculativeJIT::checkArgumentTypes): (JSC::DFG::SpeculativeJIT::compileValueAdd): (JSC::DFG::SpeculativeJIT::compileValueSub): (JSC::DFG::SpeculativeJIT::compileValueNegate): (JSC::DFG::SpeculativeJIT::compileValueMul): (JSC::DFG::SpeculativeJIT::emitSwitchCharStringJump): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): (JSC::DFG::TierUpCheckInjectionPhase::buildNaturalLoopToLoopHintMap): * dfg/DFGToFTLForOSREntryDeferredCompilationCallback.cpp: (JSC::DFG::ToFTLForOSREntryDeferredCompilationCallback::compilationDidComplete): * dfg/DFGValidate.cpp: * ftl/FTLCompile.cpp: (JSC::FTL::compile): * ftl/FTLForOSREntryJITCode.h: (JSC::FTL::ForOSREntryJITCode::setBytecodeIndex): (JSC::FTL::ForOSREntryJITCode::bytecodeIndex const): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::compileValueAdd): (JSC::FTL::DFG::LowerDFGToB3::compileValueSub): (JSC::FTL::DFG::LowerDFGToB3::compileValueMul): (JSC::FTL::DFG::LowerDFGToB3::compileArithAddOrSub): (JSC::FTL::DFG::LowerDFGToB3::compileValueNegate): * ftl/FTLOSREntry.cpp: (JSC::FTL::prepareOSREntry): * ftl/FTLOSREntry.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::callSiteIndex const): (JSC::CallFrame::unsafeCallSiteIndex const): (JSC::CallFrame::setCurrentVPC): (JSC::CallFrame::bytecodeIndex): (JSC::CallFrame::codeOrigin): (JSC::CallFrame::dump): (JSC::CallFrame::bytecodeOffset): Deleted. * interpreter/CallFrame.h: (JSC::CallSiteIndex::CallSiteIndex): (JSC::CallSiteIndex::operator bool const): (JSC::CallSiteIndex::operator== const): (JSC::CallSiteIndex::bits const): (JSC::CallSiteIndex::bytecodeIndex const): (JSC::DisposableCallSiteIndex::DisposableCallSiteIndex): (): Deleted. * interpreter/Interpreter.cpp: (JSC::GetStackTraceFunctor::operator() const): (JSC::findExceptionHandler): * interpreter/ShadowChicken.cpp: (JSC::ShadowChicken::update): * interpreter/StackVisitor.cpp: (JSC::StackVisitor::readNonInlinedFrame): (JSC::StackVisitor::readInlinedFrame): (JSC::StackVisitor::Frame::retrieveExpressionInfo const): (JSC::StackVisitor::Frame::dump const): * interpreter/StackVisitor.h: (JSC::StackVisitor::Frame::bytecodeIndex const): (JSC::StackVisitor::Frame::bytecodeOffset const): Deleted. * jit/JIT.cpp: (JSC::JIT::JIT): (JSC::JIT::emitEnterOptimizationCheck): (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::compileWithoutLinking): (JSC::JIT::link): (JSC::JIT::privateCompileExceptionHandlers): * jit/JIT.h: (JSC::CallRecord::CallRecord): (JSC::SlowCaseEntry::SlowCaseEntry): (JSC::SwitchRecord::SwitchRecord): (JSC::ByValCompilationInfo::ByValCompilationInfo): * jit/JITCall.cpp: (JSC::JIT::compileCallEvalSlowCase): (JSC::JIT::compileOpCall): * jit/JITCodeMap.h: (JSC::JITCodeMap::Entry::Entry): (JSC::JITCodeMap::Entry::bytecodeIndex const): (JSC::JITCodeMap::append): (JSC::JITCodeMap::find const): * jit/JITDisassembler.cpp: (JSC::JITDisassembler::dumpVectorForInstructions): (JSC::JITDisassembler::reportInstructions): * jit/JITDisassembler.h: * jit/JITInlines.h: (JSC::JIT::emitNakedCall): (JSC::JIT::emitNakedTailCall): (JSC::JIT::updateTopCallFrame): (JSC::JIT::linkAllSlowCasesForBytecodeIndex): (JSC::JIT::addSlowCase): (JSC::JIT::addJump): (JSC::JIT::emitJumpSlowToHot): (JSC::JIT::emitGetVirtualRegister): (JSC::JIT::linkAllSlowCasesForBytecodeOffset): Deleted. * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_instanceof): (JSC::JIT::emit_op_catch): (JSC::JIT::emit_op_switch_imm): (JSC::JIT::emit_op_switch_char): (JSC::JIT::emit_op_switch_string): (JSC::JIT::emitSlow_op_loop_hint): (JSC::JIT::emit_op_has_indexed_property): (JSC::JIT::emit_op_log_shadow_chicken_tail): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_instanceof): (JSC::JIT::emit_op_catch): (JSC::JIT::emit_op_switch_imm): (JSC::JIT::emit_op_switch_char): (JSC::JIT::emit_op_switch_string): (JSC::JIT::emit_op_has_indexed_property): * jit/JITOperations.cpp: (JSC::getByVal): (JSC::tryGetByValOptimize): * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_get_by_val): (JSC::JIT::emitGetByValWithCachedId): (JSC::JIT::emit_op_put_by_val): (JSC::JIT::emitPutByValWithCachedId): (JSC::JIT::emit_op_try_get_by_id): (JSC::JIT::emit_op_get_by_id_direct): (JSC::JIT::emit_op_get_by_id): (JSC::JIT::emit_op_get_by_id_with_this): (JSC::JIT::emit_op_put_by_id): (JSC::JIT::emit_op_in_by_id): * jit/JITWorklist.cpp: (JSC::JITWorklist::Plan::Plan): (JSC::JITWorklist::Plan::compileNow): (JSC::JITWorklist::compileLater): (JSC::JITWorklist::compileNow): * jit/JITWorklist.h: * jit/PCToCodeOriginMap.cpp: (JSC::PCToCodeOriginMap::PCToCodeOriginMap): (JSC::PCToCodeOriginMap::findPC const): * jit/PCToCodeOriginMap.h: (JSC::PCToCodeOriginMapBuilder::defaultCodeOrigin): * jit/SlowPathCall.h: (JSC::JITSlowPathCall::call): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::jitCompileAndSetHeuristics): (JSC::LLInt::LLINT_SLOW_PATH_DECL): * profiler/ProfilerOrigin.cpp: (JSC::Profiler::Origin::Origin): (JSC::Profiler::Origin::dump const): (JSC::Profiler::Origin::toJS const): * profiler/ProfilerOrigin.h: (JSC::Profiler::Origin::Origin): (JSC::Profiler::Origin::operator! const): (JSC::Profiler::Origin::bytecodeIndex const): (JSC::Profiler::Origin::hash const): (JSC::Profiler::Origin::isHashTableDeletedValue const): * runtime/Error.cpp: (JSC::getBytecodeIndex): (JSC::getBytecodeOffset): Deleted. * runtime/Error.h: * runtime/ErrorInstance.cpp: (JSC::appendSourceToError): (JSC::ErrorInstance::finishCreation): * runtime/SamplingProfiler.cpp: (JSC::tryGetBytecodeIndex): (JSC::SamplingProfiler::processUnverifiedStackTraces): (JSC::SamplingProfiler::reportTopBytecodes): * runtime/SamplingProfiler.h: (JSC::SamplingProfiler::StackFrame::CodeLocation::hasBytecodeIndex const): * runtime/StackFrame.cpp: (JSC::StackFrame::StackFrame): (JSC::StackFrame::computeLineAndColumn const): * runtime/StackFrame.h: (JSC::StackFrame::hasBytecodeIndex const): (JSC::StackFrame::bytecodeIndex): (JSC::StackFrame::hasBytecodeOffset const): Deleted. (JSC::StackFrame::bytecodeOffset): Deleted. * tools/VMInspector.cpp: (JSC::VMInspector::dumpRegisters): Canonical link: https://commits.webkit.org/216705@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251468 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-23 00:55:38 +00:00
bytecode/BytecodeIndex.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
bytecode/BytecodeIntrinsicRegistry.cpp
bytecode/BytecodeLivenessAnalysis.cpp
bytecode/BytecodeRewriter.cpp
Reduce JSC's binary size https://bugs.webkit.org/show_bug.cgi?id=204549 Reviewed by Saam Barati. The Wasm interpreter landed in r251886 and significantly increased JSC's binary size. To try and offset that, here and some easy fixes that get us ~200kb back: - We were generating 2 instances of dumpBytecode, at 30kb each. I changed the generator to emit a cpp file instead, avoiding the duplication. - We had 3 instances of computeUsesForBytecodeIndex at 11kb each. I kept the work that depended on the template type in the template function and moved the massive switch into computeUsesForBytecodeIndexImpl. I also did the same for computeDefsForBytecodeIndex. - We had 8 instances of emit_compareAndJump(Slow) at 8kb (7kb for Slow) each. I kept the code that extracts the data from the bytecode in the template, but moved the bulk of the function into emit_compareAndJump(Slow)Impl. * CMakeLists.txt: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumperBase::printLocationAndOp): (JSC::BytecodeDumperBase::dumpValue): * bytecode/BytecodeDumper.h: (JSC::BytecodeDumperBase::~BytecodeDumperBase): (JSC::BytecodeDumperBase::dumpValue): (JSC::BytecodeDumperBase::BytecodeDumperBase): (JSC::BytecodeDumper::BytecodeDumper): * bytecode/BytecodeUseDef.cpp: Copied from Source/JavaScriptCore/bytecode/BytecodeUseDef.h. (JSC::computeUsesForBytecodeIndexImpl): (JSC::computeDefsForBytecodeIndexImpl): * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeIndex): (JSC::computeDefsForBytecodeIndex): * generator/DSL.rb: * generator/Opcode.rb: * generator/Options.rb: * jit/JIT.h: * jit/JITArithmetic.cpp: (JSC::JIT::emit_compareAndJump): (JSC::JIT::emit_compareAndJumpImpl): (JSC::JIT::emit_compareUnsignedAndJump): (JSC::JIT::emit_compareUnsignedAndJumpImpl): (JSC::JIT::emit_compareUnsigned): (JSC::JIT::emit_compareUnsignedImpl): (JSC::JIT::emit_compareAndJumpSlow): (JSC::JIT::emit_compareAndJumpSlowImpl): Canonical link: https://commits.webkit.org/218278@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253335 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-12-10 19:41:40 +00:00
bytecode/BytecodeUseDef.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
bytecode/CallEdge.cpp
bytecode/CallLinkInfo.cpp
bytecode/CallLinkStatus.cpp
bytecode/CallMode.cpp
bytecode/CallVariant.cpp
[ESNext] Implement private methods https://bugs.webkit.org/show_bug.cgi?id=194434 Reviewed by Filip Pizlo. JSTests: * stress/private-brand-installed-after-super-call-from-arrow-function.js: Added. * stress/private-brand-installed-after-super-call-from-eval.js: Added. * stress/private-method-brand-check.js: Added. * stress/private-method-change-attribute-from-branded-structure.js: Added. * stress/private-method-change-prototype-from-branded-structure.js: Added. * stress/private-method-check-private-brand-ic.js: Added. * stress/private-method-check-structure-miss.js: Added. * stress/private-method-comparison.js: Added. * stress/private-method-delete-property-from-branded-structure.js: Added. * stress/private-method-extends-brand-check.js: Added. * stress/private-method-get-and-call.js: Added. * stress/private-method-invalid-multiple-brand-installation.js: Added. * stress/private-method-invalidate-compiled-with-constant-symbol.js: Added. * stress/private-method-nested-class.js: Added. * stress/private-method-on-sealed-objects.js: Added. * stress/private-method-on-uncacheable-dictionary.js: Added. * stress/private-method-polymorphic-with-constant-symbol.js: Added. * stress/private-method-set-brand-should-have-write-barrier.js: Added. * stress/private-method-untyped-use.js: Added. * stress/private-method-with-uncacheable-dictionary-transition.js: Added. * stress/private-methods-inline-cache.js: Added. * stress/private-methods-megamorphic-ic.js: Added. * stress/private-methods-on-proxy.js: Added. * stress/private-methods-poly-ic-multiple-classes.js: Added. * stress/private-methods-poly-ic-single-class.js: Added. * stress/private-names-available-on-direct-eval.js: Added. * test262/config.yaml: Source/JavaScriptCore: This patch is adding support to private methods following the specification on https://tc39.es/proposal-private-methods/. This is introducing a new way to declare private methods on class syntax. Private methods are only accessible within classes they were declared, and only can be called from objects that are instance of these classes. To guarantee such rules, the proposal presents the concept of Brand Check. During class evaluation, if a private method is present, a `brand` is installed in this class. Every instance of such class then gets this brand installed during `[[Construct]]` operation. It means that an object can have multiple brands (e.g when there is also private methods declared on super class). Before accessing a private method, there is a check to validate if the target of the call has the brand of callee method. The brand check mechanism is implemented using a `@privateBrand` stored on class scope. Here is a representation of how this mechanism works: ``` class C { #m() { return 3; } method() { return this.#m(); } } let c = new C(); console.log(c.method()); // prints 3 ``` Generated bytecode for the following representation: ``` { // class lexical scope const @privateBrand = @createPrivateSymbol(); const #m = function () { return 3; } C.prototype.method = function() { @check_private_brand(this, @privateBrand); return #m.call(this); } C = function() { @set_private_brand(this, @privateBrand); } } let c = new C(); console.log(c.method()); // prints 3 ``` # Resolving correct brand to check In the case of shadowing or nested scope, we need to emit brand checks to the right private brand. See code below: ``` class C { #m() { return 3; } method() { return this.#m();} A = class { #m2() { return 3; } foo(o) { return o.#m(); } } } ``` The call of "#m" in `foo` refers to "C::#m". In such case, we need to check C's private brand, instead of A's private brand. To perform the proper check, we first resolve scope of "#m" and then check the private brand of this scope (the scope where the private method and brand are stored is the same). So the bytecode to lookup the right brand is: ``` mov loc9, arg1 resolve_scope loc10, "#m" get_from_scope loc11, loc10, "@privateBrand" check_private_brand loc9, loc11 get_from_scope loc11, loc10, "#m" // setup call frame call loc11, ... // ... ``` # Brand check mechanism We are introducing in this patch 2 new bytecodes to allow brand check of objects: `op_set_brand` and `op_check_brand`. `op_set_brand` sets a new brand in an object, so we can perform the brand check later when accessing private methods. This operations throws when trying to add the same brand twice in an Object. `op_check_brand` checks if the given object contains the brand we are looking for. It traverses the brand chain to verify if the brand is present, and throws `TypeError` otherwise. We are also introducing a subclass for Structure called BrandedStructure. It is used to store brands and to allow brand check mechanism. BrandedStructure stores a brand and a parent pointer to another BrandedStructure that allow us traverse the brand chain. With `BrandedStructure`, we can then infer that a given object has the brand we are looking for just checking its structureId. This is a very good optimization, since we can reduce most of brand checks to structure checks. We created a new kind of transition called `SetBrand` that happens when `op_set_brand` is executed. This allow us to cache such kind of trasitions on trasition table using the key `<brand->uid, 0, TransitionKind::SetBrand>`. During this transition, we take previous structure and apply one of the following rules: 1. If it's a BrandedStructure, we then set it to `m_parentBrand`, to allow proper brand chain check. 2. If it's not a BrandedStructure, we set `m_parentBrand` to `nullptr`, meaning that this is the first brand being added to the object with this structure. For now, we are using the flag `isBrandedStructure` to identify that a given Structure is a BrandedStructure. This is done to avoid changes on places where we are checking for `vm.structureStructure()`. However, if we ever need space on Structure, this flag is a good candidate to be deleted and we can move to a solution that uses `vm.brandedStructureStructure()`; # JIT Support This patch also includes initial JIT support for `set_private_brand` and `check_private_brand`. On Baseline JIT, we are using `JITPravateBrandAccessGenerator` to support IC for both operands. On `DFGByteCodeParser` we are trying to inline brand access whenever possible, and fallbacking to `SetPrivateBrand` and `CheckPrivateBrand` otherwise. Those nodes are not being optimized at their full potential, but the code generated by them is also relying on `JITPrivateBrandAccessGenerator` to have IC support for both DFG and FTL. During DFG parsing, we try to reduce those access to `CheckIsConstant` and `CheckStructure` (with `PutStructure` for `set_private_brand` cases) based on available profiled data. This is meant to make brand checks almost free on DFG/FTL tiers when we have a single evaluation of a class, since the `CheckIsConstant` can be eliminated by the constant-folded scope load, and the `CheckStructure` is very likely to be redundant to any other `CheckStructure` that can be performed on receiver when we have a finite structure set. For instance, when we have a brand check on a path-of-no-return to a `GetByOffset` sequence on the same receiver, the `CheckStructure` for the brand check will enable CSE of the `CheckStructure` that would happen for that `GetByOffset`. Such design is possible because brand checks supports polymorphic access very similr to what we have for `GetByOffset` sequences. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/BuiltinExecutables.cpp: (JSC::BuiltinExecutables::createDefaultConstructor): (JSC::BuiltinExecutables::createExecutable): * builtins/BuiltinExecutables.h: We are adding a new parameter `PrivateBrandRequirement` to propagate when a default constructor needs to emit code to setup private brand on instances. * builtins/BuiltinNames.h: Adding `@privateBrand` that we use to store private brand on class's scope. * bytecode/AccessCase.cpp: (JSC::AccessCase::createCheckPrivateBrand): (JSC::AccessCase::createSetPrivateBrand): (JSC::AccessCase::requiresIdentifierNameMatch const): (JSC::AccessCase::requiresInt32PropertyCheck const): (JSC::AccessCase::needsScratchFPR const): (JSC::AccessCase::forEachDependentCell const): (JSC::AccessCase::doesCalls const): (JSC::AccessCase::canReplace const): (JSC::AccessCase::dump const): (JSC::AccessCase::generateWithGuard): (JSC::AccessCase::generateImpl): * bytecode/AccessCase.h: (JSC::AccessCase::structure const): (JSC::AccessCase::newStructure const): * bytecode/BytecodeList.rb: * bytecode/BytecodeUseDef.cpp: (JSC::computeUsesForBytecodeIndexImpl): (JSC::computeDefsForBytecodeIndexImpl): * bytecode/CheckPrivateBrandStatus.cpp: Added. (JSC::CheckPrivateBrandStatus::appendVariant): (JSC::CheckPrivateBrandStatus::computeForBaseline): (JSC::CheckPrivateBrandStatus::CheckPrivateBrandStatus): (JSC::CheckPrivateBrandStatus::computeForStubInfoWithoutExitSiteFeedback): (JSC::CheckPrivateBrandStatus::computeFor): (JSC::CheckPrivateBrandStatus::slowVersion const): (JSC::CheckPrivateBrandStatus::merge): (JSC::CheckPrivateBrandStatus::filter): (JSC::CheckPrivateBrandStatus::singleIdentifier const): (JSC::CheckPrivateBrandStatus::visitAggregate): (JSC::CheckPrivateBrandStatus::markIfCheap): (JSC::CheckPrivateBrandStatus::finalize): (JSC::CheckPrivateBrandStatus::dump const): * bytecode/CheckPrivateBrandStatus.h: Added. * bytecode/CheckPrivateBrandVariant.cpp: Added. (JSC::CheckPrivateBrandVariant::CheckPrivateBrandVariant): (JSC::CheckPrivateBrandVariant::~CheckPrivateBrandVariant): (JSC::CheckPrivateBrandVariant::attemptToMerge): (JSC::CheckPrivateBrandVariant::markIfCheap): (JSC::CheckPrivateBrandVariant::finalize): (JSC::CheckPrivateBrandVariant::visitAggregate): (JSC::CheckPrivateBrandVariant::dump const): (JSC::CheckPrivateBrandVariant::dumpInContext const): * bytecode/CheckPrivateBrandVariant.h: Added. (JSC::CheckPrivateBrandVariant::structureSet const): (JSC::CheckPrivateBrandVariant::structureSet): (JSC::CheckPrivateBrandVariant::identifier const): (JSC::CheckPrivateBrandVariant::overlaps): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::finalizeLLIntInlineCaches): * bytecode/ExecutableInfo.h: (JSC::ExecutableInfo::ExecutableInfo): (JSC::ExecutableInfo::privateBrandRequirement const): * bytecode/PolymorphicAccess.cpp: (JSC::PolymorphicAccess::regenerate): (WTF::printInternal): * bytecode/RecordedStatuses.cpp: (JSC::RecordedStatuses::operator=): (JSC::RecordedStatuses::addCheckPrivateBrandStatus): (JSC::RecordedStatuses::addSetPrivateBrandStatus): (JSC::RecordedStatuses::visitAggregate): (JSC::RecordedStatuses::markIfCheap): * bytecode/RecordedStatuses.h: (JSC::RecordedStatuses::forEachVector): * bytecode/SetPrivateBrandStatus.cpp: Added. (JSC::SetPrivateBrandStatus::appendVariant): (JSC::SetPrivateBrandStatus::computeForBaseline): (JSC::SetPrivateBrandStatus::SetPrivateBrandStatus): (JSC::SetPrivateBrandStatus::computeForStubInfoWithoutExitSiteFeedback): (JSC::SetPrivateBrandStatus::computeFor): (JSC::SetPrivateBrandStatus::slowVersion const): (JSC::SetPrivateBrandStatus::merge): (JSC::SetPrivateBrandStatus::filter): (JSC::SetPrivateBrandStatus::singleIdentifier const): (JSC::SetPrivateBrandStatus::visitAggregate): (JSC::SetPrivateBrandStatus::markIfCheap): (JSC::SetPrivateBrandStatus::finalize): (JSC::SetPrivateBrandStatus::dump const): * bytecode/SetPrivateBrandStatus.h: Added. * bytecode/SetPrivateBrandVariant.cpp: Added. (JSC::SetPrivateBrandVariant::SetPrivateBrandVariant): (JSC::SetPrivateBrandVariant::~SetPrivateBrandVariant): (JSC::SetPrivateBrandVariant::attemptToMerge): (JSC::SetPrivateBrandVariant::markIfCheap): (JSC::SetPrivateBrandVariant::finalize): (JSC::SetPrivateBrandVariant::visitAggregate): (JSC::SetPrivateBrandVariant::dump const): (JSC::SetPrivateBrandVariant::dumpInContext const): * bytecode/SetPrivateBrandVariant.h: Added. (JSC::SetPrivateBrandVariant::oldStructure const): (JSC::SetPrivateBrandVariant::newStructure const): (JSC::SetPrivateBrandVariant::identifier const): (JSC::SetPrivateBrandVariant::overlaps): * bytecode/StructureStubInfo.cpp: (JSC::StructureStubInfo::reset): * bytecode/StructureStubInfo.h: * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::privateBrandRequirement const): * bytecode/UnlinkedCodeBlockGenerator.h: (JSC::UnlinkedCodeBlockGenerator::privateBrandRequirement const): * bytecode/UnlinkedFunctionExecutable.cpp: (JSC::generateUnlinkedFunctionCodeBlock): (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable): * bytecode/UnlinkedFunctionExecutable.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): We changed BytecodeGenerator for FunctionNode and EvalNode to propagate parentScope PrivateNameEnvironment. These environments stores private name entries that are visible into the scope of the function/eval. This is required to identify the kind of access a private name is referring to, since it can be a private field or a private method. (JSC::BytecodeGenerator::instantiateLexicalVariables): (JSC::BytecodeGenerator::emitGetPrivateName): (JSC::BytecodeGenerator::emitCreatePrivateBrand): The process to create a private brand is as follows: 1. Create a PrivateSymbol using `@createPrivateSymbol`. 2. Store this symbol into a given scope (i.e class lexical scope) on `@privateBrand` variable. (JSC::BytecodeGenerator::emitInstallPrivateBrand): (JSC::BytecodeGenerator::emitGetPrivateBrand): We added `m_privateNamesStack` to BytecodeGenerator to represent the scope chain of available private names while generating bytecode. (JSC::BytecodeGenerator::emitCheckPrivateBrand): (JSC::BytecodeGenerator::isPrivateMethod): (JSC::BytecodeGenerator::pushPrivateAccessNames): (JSC::BytecodeGenerator::popPrivateAccessNames): (JSC::BytecodeGenerator::getAvailablePrivateAccessNames): (JSC::BytecodeGenerator::emitNewDefaultConstructor): (JSC::BytecodeGenerator::emitNewClassFieldInitializerFunction): (JSC::BytecodeGenerator::emitDirectGetByVal): Deleted. * bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::privateBrandRequirement const): (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::makeFunction): This change is required to properly propagate PrivateBrandRequirement to arrow functions that can potentially call `super()`. * bytecompiler/NodesCodegen.cpp: (JSC::PropertyListNode::emitDeclarePrivateFieldNames): (JSC::PropertyListNode::emitBytecode): (JSC::PropertyListNode::emitPutConstantProperty): (JSC::BaseDotNode::emitGetPropertyValue): Adding support to properly access private method. Since we store private methods on class lexical scope, we need a different set of instructions to access a private method. (JSC::BaseDotNode::emitPutProperty): In the case of we trying to write in a private method, we need to throw a TypeError according to specification (https://tc39.es/proposal-private-methods/#sec-privatefieldset). (JSC::FunctionCallValueNode::emitBytecode): (JSC::PostfixNode::emitDot): (JSC::PrefixNode::emitDot): (JSC::ClassExprNode::emitBytecode): * debugger/DebuggerCallFrame.cpp: (JSC::DebuggerCallFrame::evaluateWithScopeExtension): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): (JSC::DFG::AbstractInterpreter<AbstractStateType>::filterICStatus): * dfg/DFGArgumentsEliminationPhase.cpp: * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCapabilities.cpp: (JSC::DFG::capabilityLevel): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGClobbersExitState.cpp: (JSC::DFG::clobbersExitState): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGGraph.h: * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGJITCompiler.h: (JSC::DFG::JITCompiler::addPrivateBrandAccess): * dfg/DFGMayExit.cpp: * dfg/DFGNode.h: (JSC::DFG::Node::hasCheckPrivateBrandStatus): (JSC::DFG::Node::checkPrivateBrandStatus): (JSC::DFG::Node::hasSetPrivateBrandStatus): (JSC::DFG::Node::setPrivateBrandStatus): * dfg/DFGNodeType.h: * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCheckPrivateBrand): (JSC::DFG::SpeculativeJIT::compileSetPrivateBrand): * dfg/DFGSpeculativeJIT.h: * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStoreBarrierInsertionPhase.cpp: * dfg/DFGVarargsForwardingPhase.cpp: * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compilePrivateBrandAccess): (JSC::FTL::DFG::LowerDFGToB3::compileCheckPrivateBrand): (JSC::FTL::DFG::LowerDFGToB3::compileSetPrivateBrand): * interpreter/Interpreter.cpp: (JSC::eval): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::link): * jit/JIT.h: * jit/JITInlineCacheGenerator.cpp: (JSC::JITPrivateBrandAccessGenerator::JITPrivateBrandAccessGenerator): (JSC::JITPrivateBrandAccessGenerator::generateFastPath): (JSC::JITPrivateBrandAccessGenerator::finalize): * jit/JITInlineCacheGenerator.h: (JSC::JITPrivateBrandAccessGenerator::JITPrivateBrandAccessGenerator): (JSC::JITPrivateBrandAccessGenerator::slowPathJump const): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): (JSC::getPrivateName): * jit/JITOperations.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_set_private_brand): (JSC::JIT::emitSlow_op_set_private_brand): (JSC::JIT::emit_op_check_private_brand): (JSC::JIT::emitSlow_op_check_private_brand): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emit_op_set_private_brand): (JSC::JIT::emitSlow_op_set_private_brand): (JSC::JIT::emit_op_check_private_brand): (JSC::JIT::emitSlow_op_check_private_brand): * jit/Repatch.cpp: (JSC::tryCacheCheckPrivateBrand): (JSC::repatchCheckPrivateBrand): (JSC::tryCacheSetPrivateBrand): (JSC::repatchSetPrivateBrand): (JSC::resetCheckPrivateBrand): (JSC::resetSetPrivateBrand): * jit/Repatch.h: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * parser/Nodes.cpp: (JSC::FunctionMetadataNode::FunctionMetadataNode): * parser/Nodes.h: (JSC::BaseDotNode::isPrivateMember const): (JSC::BaseDotNode::isPrivateField const): Deleted. * parser/Parser.cpp: (JSC::Parser<LexerType>::parseClass): (JSC::Parser<LexerType>::parseMemberExpression): * parser/Parser.h: (JSC::Scope::declarePrivateMethod): (JSC::Scope::declarePrivateField): (JSC::Parser<LexerType>::parse): (JSC::parse): (JSC::Scope::declarePrivateName): Deleted. * parser/ParserModes.h: * parser/SyntaxChecker.h: (JSC::SyntaxChecker::createDotAccess): * parser/VariableEnvironment.cpp: (JSC::VariableEnvironment::declarePrivateMethod): * parser/VariableEnvironment.h: (JSC::VariableEnvironmentEntry::isPrivateField const): (JSC::VariableEnvironmentEntry::isPrivateMethod const): (JSC::VariableEnvironmentEntry::setIsPrivateField): (JSC::VariableEnvironmentEntry::setIsPrivateMethod): (JSC::PrivateNameEntry::isMethod const): (JSC::PrivateNameEntry::isPrivateMethodOrAcessor const): (JSC::VariableEnvironment::addPrivateName): (JSC::VariableEnvironment::declarePrivateField): (JSC::VariableEnvironment::declarePrivateMethod): (JSC::VariableEnvironment::privateNameEnvironment const): (JSC::VariableEnvironment::hasPrivateMethodOrAccessor const): (JSC::VariableEnvironment::addPrivateNamesFrom): (JSC::VariableEnvironmentEntry::isPrivateName const): Deleted. (JSC::VariableEnvironmentEntry::setIsPrivateName): Deleted. (JSC::VariableEnvironment::declarePrivateName): Deleted. * runtime/CachedTypes.cpp: (JSC::CachedCodeBlockRareData::encode): (JSC::CachedCodeBlockRareData::decode const): (JSC::CachedFunctionExecutableRareData::encode): (JSC::CachedFunctionExecutableRareData::decode const): (JSC::CachedFunctionExecutable::privateBrandRequirement const): (JSC::CachedCodeBlock::derivedContextType const): (JSC::CachedFunctionExecutable::encode): (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable): (JSC::CachedCodeBlock::needsClassFieldInitializer const): Deleted. * runtime/CodeCache.cpp: (JSC::generateUnlinkedCodeBlockImpl): (JSC::generateUnlinkedCodeBlock): (JSC::generateUnlinkedCodeBlockForDirectEval): (JSC::CodeCache::getUnlinkedGlobalFunctionExecutable): * runtime/CodeCache.h: * runtime/DirectEvalExecutable.cpp: (JSC::DirectEvalExecutable::create): (JSC::DirectEvalExecutable::DirectEvalExecutable): * runtime/DirectEvalExecutable.h: * runtime/EvalExecutable.cpp: (JSC::EvalExecutable::EvalExecutable): * runtime/EvalExecutable.h: (JSC::EvalExecutable::executableInfo const): (JSC::EvalExecutable::privateBrandRequirement const): * runtime/ExceptionHelpers.cpp: (JSC::createInvalidPrivateNameError): * runtime/IndirectEvalExecutable.cpp: (JSC::IndirectEvalExecutable::IndirectEvalExecutable): * runtime/JSObject.h: * runtime/JSObjectInlines.h: (JSC::JSObject::checkPrivateBrand): (JSC::JSObject::setPrivateBrand): * runtime/JSScope.cpp: (JSC::JSScope::collectClosureVariablesUnderTDZ): * runtime/JSScope.h: * runtime/ModuleProgramExecutable.h: * runtime/Options.cpp: (JSC::Options::recomputeDependentOptions): * runtime/OptionsList.h: * runtime/ProgramExecutable.h: * runtime/Structure.cpp: (JSC::Structure::materializePropertyTable): (JSC::BrandedStructure::BrandedStructure): (JSC::BrandedStructure::create): (JSC::BrandedStructure::checkBrand): (JSC::Structure::setBrandTransitionFromExistingStructureImpl): (JSC::Structure::setBrandTransitionFromExistingStructureConcurrently): (JSC::Structure::setBrandTransition): * runtime/Structure.h: (JSC::Structure::finishCreation): * runtime/StructureInlines.h: (JSC::Structure::create): (JSC::Structure::forEachPropertyConcurrently): * runtime/StructureTransitionTable.h: * runtime/SymbolTable.cpp: (JSC::SymbolTable::cloneScopePart): * runtime/SymbolTable.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Canonical link: https://commits.webkit.org/233852@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272580 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-09 16:30:24 +00:00
bytecode/CheckPrivateBrandStatus.cpp
bytecode/CheckPrivateBrandVariant.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
bytecode/CodeBlock.cpp
bytecode/CodeBlockHash.cpp
bytecode/CodeBlockJettisoningWatchpoint.cpp
bytecode/CodeOrigin.cpp
bytecode/CodeType.cpp
bytecode/ComplexGetStatus.cpp
bytecode/DFGExitProfile.cpp
bytecode/DataFormat.cpp
bytecode/DeferredCompilationCallback.cpp
bytecode/DeferredSourceDump.cpp
Allow deleteById to be cached in the DFG https://bugs.webkit.org/show_bug.cgi?id=208664 Reviewed by Saam Barati. JSTests: * microbenchmarks/delete-property-allocation-sinking.js: Added. (assert): (noInline.assert.blackbox): (noInline.blackbox.doAlloc1): (noInline.doAlloc1): * microbenchmarks/polyvariant-delete-property.js: Added. (assert): (blackbox): (noInline.blackbox.polyvariant): (doAlloc1): (noInline.doAlloc1.doAlloc2): (noInline.doAlloc2): * stress/delete-property-dfg-inline.js: Added. (assert): (noInline.assert.assert_throws): (noInline.assert_throws.blackbox): (noInline.blackbox.testSingleStructure.doAlloc1): (noInline.blackbox.testSingleStructure): (noInline.testSingleStructure.testInlineSingleStructure.doDelete2): (noInline.testSingleStructure.testInlineSingleStructure.doAlloc2): (noInline.testSingleStructure.testInlineSingleStructure): (noInline.testInlineSingleStructure.testExit.doDelete3): (noInline.testInlineSingleStructure.testExit): (noInline.testExit.testSingleStructureMiss.doAlloc4): (noInline.testExit.testSingleStructureMiss): (noInline.testSingleStructureMiss.testSingleStructureMissStrict.string_appeared_here.doAlloc5): (noInline.testSingleStructureMiss.testSingleStructureMissStrict): (noInline.testSingleStructureMissStrict.testSingleStructureMissNonConfigurable.doAlloc6): (noInline.testSingleStructureMissStrict.testSingleStructureMissNonConfigurable): (noInline.testSingleStructureMissNonConfigurable.testSingleStructureEmpty.doAlloc7): (noInline.testSingleStructureMissNonConfigurable.testSingleStructureEmpty): (noInline.testSingleStructureEmpty.testPolymorphic.doDelete8): (noInline.testSingleStructureEmpty.testPolymorphic): (noInline.testPolymorphic.testPolyvariant.doDelete9): (noInline.testPolymorphic.testPolyvariant.polyvariant): (noInline.testPolymorphic.testPolyvariant): (noInline.testPolyvariant.testConstantFolding.doDelete10): (noInline.testPolyvariant.testConstantFolding): (noInline.testConstantFolding.testObjectSinking.doAlloc11): (noInline.testConstantFolding.testObjectSinking): (noInline.testObjectSinking.testProxy.doAlloc12): (noInline.testObjectSinking.testProxy.noInline.doDelete12): (noInline.testObjectSinking.testProxy): (noInline.testProxy.testTypedArray.doDelete12): (noInline.testProxy.testTypedArray): (noInline.testTypedArray.testMissMixed.doDelete13): (noInline.testTypedArray.testMissMixed): (noInline.testMissMixed.testMissNonMixed.doDelete14): (noInline.testMissMixed.testMissNonMixed): (noInline.testMissNonMixed.testByVal.doDelete15): (noInline.testMissNonMixed.testByVal): Source/JavaScriptCore: When we see that the deleteById inline cache only saw one structure, we inline it into the DFG. This involves creating a new node, FilterDeleteByStatus, and then turning these DeleteById nodes into a FilterDeleteByStatus, CheckStructure, PutByOffset, then PutStructure (or just a CheckStructure in the case of a miss). The logic for pessimising this optimization is the same as for PutById, giving inlined functions the opportunity to use only the DFG profiling information, while everything else uses the DFG+Baseline information. This also adds a MultiDeleteByOffset node, for the case when there are multiple structures seen by the delete. If all of the cases are the same kind of miss, then we only emit a CheckStructure and constant. Finally, if we see a delete by val with a single identifier, we inline that too. This patch removes a dead code path from deleteProperty that checks if we need to nuke the object's butterfly. This also fixes a bug where we were checking the neutering status of typed arrays for named properties when we should only check for indexed properties. The behavior of this now matches for all tiers including when cached. The benchmark shows a 2x improvement on polyvariant-delete-property, and a 50% improvement on delete-property-allocation-sinking. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/AccessCase.cpp: (JSC::AccessCase::createDelete): (JSC::AccessCase::generateImpl): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::getICStatusMap): * bytecode/DeleteByIdVariant.cpp: Added. (JSC::DeleteByIdVariant::DeleteByIdVariant): (JSC::DeleteByIdVariant::~DeleteByIdVariant): (JSC::DeleteByIdVariant::operator=): (JSC::DeleteByIdVariant::attemptToMerge): (JSC::DeleteByIdVariant::writesStructures const): (JSC::DeleteByIdVariant::visitAggregate): (JSC::DeleteByIdVariant::markIfCheap): (JSC::DeleteByIdVariant::dump const): (JSC::DeleteByIdVariant::finalize): (JSC::DeleteByIdVariant::dumpInContext const): * bytecode/DeleteByIdVariant.h: Added. (JSC::DeleteByIdVariant::oldStructure const): (JSC::DeleteByIdVariant::newStructure const): (JSC::DeleteByIdVariant::result const): (JSC::DeleteByIdVariant::offset const): (JSC::DeleteByIdVariant::isPropertyUnset const): (JSC::DeleteByIdVariant::identifier const): (JSC::DeleteByIdVariant::overlaps): * bytecode/DeleteByStatus.cpp: Added. (JSC::DeleteByStatus::appendVariant): (JSC::DeleteByStatus::computeForBaseline): (JSC::DeleteByStatus::DeleteByStatus): (JSC::DeleteByStatus::computeForStubInfoWithoutExitSiteFeedback): (JSC::DeleteByStatus::computeFor): (JSC::DeleteByStatus::slowVersion const): (JSC::DeleteByStatus::merge): (JSC::DeleteByStatus::filter): (JSC::DeleteByStatus::singleIdentifier const): (JSC::DeleteByStatus::visitAggregate): (JSC::DeleteByStatus::markIfCheap): (JSC::DeleteByStatus::finalize): (JSC::DeleteByStatus::dump const): * bytecode/DeleteByStatus.h: Added. * bytecode/ICStatusMap.h: * bytecode/RecordedStatuses.cpp: (JSC::RecordedStatuses::operator=): (JSC::RecordedStatuses::addDeleteByStatus): (JSC::RecordedStatuses::visitAggregate): (JSC::RecordedStatuses::markIfCheap): * bytecode/RecordedStatuses.h: (JSC::RecordedStatuses::forEachVector): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): (JSC::DFG::AbstractInterpreter<AbstractStateType>::filterICStatus): * dfg/DFGArgumentsEliminationPhase.cpp: * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleDeleteById): (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGClobbersExitState.cpp: (JSC::DFG::clobbersExitState): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::emitDeleteByOffset): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): * dfg/DFGGraph.h: * dfg/DFGMayExit.cpp: * dfg/DFGNode.cpp: (JSC::DFG::MultiDeleteByOffsetData::writesStructures const): * dfg/DFGNode.h: (JSC::DFG::Node::hasMultiDeleteByOffsetData): (JSC::DFG::Node::multiDeleteByOffsetData): (JSC::DFG::Node::hasDeleteByStatus): (JSC::DFG::Node::deleteByStatus): * dfg/DFGNodeType.h: * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGTypeCheckHoistingPhase.cpp: (JSC::DFG::TypeCheckHoistingPhase::identifyRedundantStructureChecks): (JSC::DFG::TypeCheckHoistingPhase::identifyRedundantArrayChecks): * dfg/DFGValidate.cpp: * dfg/DFGVarargsForwardingPhase.cpp: * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compileMultiDeleteByOffset): * runtime/JSGenericTypedArrayViewInlines.h: (JSC::JSGenericTypedArrayView<Adaptor>::deleteProperty): * runtime/JSObject.cpp: (JSC::JSObject::deleteProperty): * runtime/Structure.h: * runtime/StructureInlines.h: (JSC::Structure::mayHaveIndexingHeader const): Deleted. (JSC::Structure::canCacheDeleteIC const): Deleted. Canonical link: https://commits.webkit.org/222974@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259583 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-06 18:48:04 +00:00
bytecode/DeleteByStatus.cpp
[JSC] Rename *ByIdVariant to *ByVariant and *ByKind::Normal to *ByKind::ById https://bugs.webkit.org/show_bug.cgi?id=226750 Reviewed by Yusuke Suzuki. Cleanup patch following r278445. 1. {Get, Delete, In}ByStatus (but not `Put`) have had `Id` removed from their names; likewise, remove `Id` from the names of {Get, Delete, In}ByIdVariant. These are used *before* ByVal has been converted to ById. 2. The {Get, Del, In}ByKind enum classes shouldn't really call ById `Normal` -- let's say `ById` explicitly. 3. Bonus: In DFGBytecodeParser, move some *Status::computeFor calls inside the conditional that uses them. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/DeleteByStatus.cpp: (JSC::DeleteByStatus::appendVariant): (JSC::DeleteByStatus::computeForStubInfoWithoutExitSiteFeedback): (JSC::DeleteByStatus::visitAggregateImpl): (JSC::DeleteByStatus::markIfCheap): * bytecode/DeleteByStatus.h: * bytecode/DeleteByVariant.cpp: Renamed from Source/JavaScriptCore/bytecode/DeleteByIdVariant.cpp. (JSC::DeleteByVariant::DeleteByVariant): (JSC::DeleteByVariant::~DeleteByVariant): (JSC::DeleteByVariant::operator=): (JSC::DeleteByVariant::attemptToMerge): (JSC::DeleteByVariant::writesStructures const): (JSC::DeleteByVariant::visitAggregateImpl): (JSC::DeleteByVariant::markIfCheap): (JSC::DeleteByVariant::dump const): (JSC::DeleteByVariant::finalize): (JSC::DeleteByVariant::dumpInContext const): * bytecode/DeleteByVariant.h: Renamed from Source/JavaScriptCore/bytecode/DeleteByIdVariant.h. (JSC::DeleteByVariant::overlaps): * bytecode/GetByStatus.cpp: (JSC::GetByStatus::appendVariant): (JSC::GetByStatus::computeFromLLInt): (JSC::GetByStatus::computeForStubInfoWithoutExitSiteFeedback): (JSC::GetByStatus::computeFor): (JSC::GetByStatus::merge): (JSC::GetByStatus::visitAggregateImpl): (JSC::GetByStatus::markIfCheap): (JSC::GetByStatus::finalize): * bytecode/GetByStatus.h: * bytecode/GetByVariant.cpp: Renamed from Source/JavaScriptCore/bytecode/GetByIdVariant.cpp. (JSC::GetByVariant::GetByVariant): (JSC::GetByVariant::~GetByVariant): (JSC::GetByVariant::operator=): (JSC::GetByVariant::canMergeIntrinsicStructures const): (JSC::GetByVariant::attemptToMerge): (JSC::GetByVariant::visitAggregateImpl): (JSC::GetByVariant::markIfCheap): (JSC::GetByVariant::finalize): (JSC::GetByVariant::dump const): (JSC::GetByVariant::dumpInContext const): * bytecode/GetByVariant.h: Renamed from Source/JavaScriptCore/bytecode/GetByIdVariant.h. (JSC::GetByVariant::overlaps): * bytecode/InByStatus.cpp: (JSC::InByStatus::appendVariant): (JSC::InByStatus::computeForStubInfoWithoutExitSiteFeedback): (JSC::InByStatus::merge): (JSC::InByStatus::markIfCheap): (JSC::InByStatus::finalize): * bytecode/InByStatus.h: * bytecode/InByVariant.cpp: Renamed from Source/JavaScriptCore/bytecode/InByIdVariant.cpp. (JSC::InByVariant::InByVariant): (JSC::InByVariant::attemptToMerge): (JSC::InByVariant::markIfCheap): (JSC::InByVariant::finalize): (JSC::InByVariant::dump const): (JSC::InByVariant::dumpInContext const): * bytecode/InByVariant.h: Renamed from Source/JavaScriptCore/bytecode/InByIdVariant.h. (JSC::InByVariant::overlaps): * bytecode/StructureStubInfo.cpp: (JSC::StructureStubInfo::reset): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleIntrinsicGetter): (JSC::DFG::ByteCodeParser::handleDOMJITGetter): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::handleGetPrivateNameById): (JSC::DFG::ByteCodeParser::handleDeleteById): (JSC::DFG::ByteCodeParser::handleInById): (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::emitGetByOffset): (JSC::DFG::ConstantFoldingPhase::emitDeleteByOffset): * dfg/DFGNode.h: * dfg/DFGValidate.cpp: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileDelBy): (JSC::FTL::DFG::LowerDFGToB3::compileDeleteById): (JSC::FTL::DFG::LowerDFGToB3::compileDeleteByVal): (JSC::FTL::DFG::LowerDFGToB3::compileMultiDeleteByOffset): (JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/Repatch.cpp: (JSC::appropriateOptimizingGetByFunction): (JSC::appropriateGetByFunction): (JSC::tryCacheGetBy): (JSC::repatchDeleteBy): (JSC::tryCacheInBy): (JSC::repatchInBy): (JSC::resetGetBy): (JSC::resetDelBy): (JSC::resetInBy): * jit/Repatch.h: Canonical link: https://commits.webkit.org/238668@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278696 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-10 06:26:12 +00:00
bytecode/DeleteByVariant.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
bytecode/DirectEvalCodeCache.cpp
bytecode/EvalCodeBlock.cpp
CodeBlocks should be in IsoSubspaces https://bugs.webkit.org/show_bug.cgi?id=180884 Reviewed by Saam Barati. Source/JavaScriptCore: This moves CodeBlocks into IsoSubspaces. Doing so means that we no longer need to have the special CodeBlockSet HashSets of new and old CodeBlocks. We also no longer use WeakReferenceHarvester or UnconditionalFinalizer. Instead: - Code block sweeping is now just eager sweeping. This means that it automatically takes advantage of our unswept set, which roughly corresponds to what CodeBlockSet used to use its eden set for. - Those idea of Executable "weakly visiting" the CodeBlock is replaced by Executable marking a ExecutableToCodeBlockEdge object. That object being marked corresponds to what we used to call CodeBlock "having been weakly visited". This means that CodeBlockSet no longer has to clear the set of weakly visited code blocks. This also means that determining CodeBlock liveness, propagating CodeBlock transitions, and jettisoning CodeBlocks during GC are now the edge's job. The edge is also in an IsoSubspace and it has IsoCellSets to tell us which edges have output constraints (what we used to call CodeBlock's weak reference harvester) and which have unconditional finalizers. - CodeBlock now uses an IsoCellSet to tell if it has an unconditional finalizer. - CodeBlockSet still exists! It has one unified HashSet of CodeBlocks that we use to handle requests from the sampler, debugger, and other facilities. They may want to ask if some pointer corresponds to a CodeBlock during stages of execution during which the GC is unable to answer isLive() queries. The trickiest is the sampling profiler thread. There is no way that the GC's isLive could tell us of a CodeBlock that had already been allocated has now been full constructed. Rolling this back in because it was rolled out by mistake. There was a flaky crash that was happening before and after this change, but we misread the revision numbers at first and thought that this was the cause. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::CodeBlock): (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::finishCreationCommon): (JSC::CodeBlock::~CodeBlock): (JSC::CodeBlock::visitChildren): (JSC::CodeBlock::propagateTransitions): (JSC::CodeBlock::determineLiveness): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::stronglyVisitStrongReferences): (JSC::CodeBlock::hasInstalledVMTrapBreakpoints const): (JSC::CodeBlock::installVMTrapBreakpoints): (JSC::CodeBlock::dumpMathICStats): (JSC::CodeBlock::visitWeakly): Deleted. (JSC::CodeBlock::WeakReferenceHarvester::visitWeakReferences): Deleted. (JSC::CodeBlock::UnconditionalFinalizer::finalizeUnconditionally): Deleted. * bytecode/CodeBlock.h: (JSC::CodeBlock::subspaceFor): (JSC::CodeBlock::ownerEdge const): (JSC::CodeBlock::clearVisitWeaklyHasBeenCalled): Deleted. * bytecode/EvalCodeBlock.h: (JSC::EvalCodeBlock::create): Deleted. (JSC::EvalCodeBlock::createStructure): Deleted. (JSC::EvalCodeBlock::variable): Deleted. (JSC::EvalCodeBlock::numVariables): Deleted. (JSC::EvalCodeBlock::functionHoistingCandidate): Deleted. (JSC::EvalCodeBlock::numFunctionHoistingCandidates): Deleted. (JSC::EvalCodeBlock::EvalCodeBlock): Deleted. (JSC::EvalCodeBlock::unlinkedEvalCodeBlock const): Deleted. * bytecode/ExecutableToCodeBlockEdge.cpp: Added. (JSC::ExecutableToCodeBlockEdge::createStructure): (JSC::ExecutableToCodeBlockEdge::create): (JSC::ExecutableToCodeBlockEdge::visitChildren): (JSC::ExecutableToCodeBlockEdge::visitOutputConstraints): (JSC::ExecutableToCodeBlockEdge::finalizeUnconditionally): (JSC::ExecutableToCodeBlockEdge::activate): (JSC::ExecutableToCodeBlockEdge::deactivate): (JSC::ExecutableToCodeBlockEdge::deactivateAndUnwrap): (JSC::ExecutableToCodeBlockEdge::wrap): (JSC::ExecutableToCodeBlockEdge::wrapAndActivate): (JSC::ExecutableToCodeBlockEdge::ExecutableToCodeBlockEdge): (JSC::ExecutableToCodeBlockEdge::runConstraint): * bytecode/ExecutableToCodeBlockEdge.h: Added. (JSC::ExecutableToCodeBlockEdge::subspaceFor): (JSC::ExecutableToCodeBlockEdge::codeBlock const): (JSC::ExecutableToCodeBlockEdge::unwrap): * bytecode/FunctionCodeBlock.h: (JSC::FunctionCodeBlock::subspaceFor): (JSC::FunctionCodeBlock::createStructure): * bytecode/ModuleProgramCodeBlock.h: (JSC::ModuleProgramCodeBlock::create): Deleted. (JSC::ModuleProgramCodeBlock::createStructure): Deleted. (JSC::ModuleProgramCodeBlock::ModuleProgramCodeBlock): Deleted. * bytecode/ProgramCodeBlock.h: (JSC::ProgramCodeBlock::create): Deleted. (JSC::ProgramCodeBlock::createStructure): Deleted. (JSC::ProgramCodeBlock::ProgramCodeBlock): Deleted. * debugger/Debugger.cpp: (JSC::Debugger::SetSteppingModeFunctor::operator() const): (JSC::Debugger::ToggleBreakpointFunctor::operator() const): (JSC::Debugger::ClearCodeBlockDebuggerRequestsFunctor::operator() const): (JSC::Debugger::ClearDebuggerRequestsFunctor::operator() const): * heap/CodeBlockSet.cpp: (JSC::CodeBlockSet::contains): (JSC::CodeBlockSet::dump const): (JSC::CodeBlockSet::add): (JSC::CodeBlockSet::remove): (JSC::CodeBlockSet::promoteYoungCodeBlocks): Deleted. (JSC::CodeBlockSet::clearMarksForFullCollection): Deleted. (JSC::CodeBlockSet::lastChanceToFinalize): Deleted. (JSC::CodeBlockSet::deleteUnmarkedAndUnreferenced): Deleted. * heap/CodeBlockSet.h: * heap/CodeBlockSetInlines.h: (JSC::CodeBlockSet::iterate): (JSC::CodeBlockSet::iterateViaSubspaces): * heap/ConservativeRoots.cpp: (JSC::ConservativeRoots::genericAddPointer): (JSC::DummyMarkHook::markKnownJSCell): (JSC::CompositeMarkHook::mark): (JSC::CompositeMarkHook::markKnownJSCell): * heap/ConservativeRoots.h: * heap/Heap.cpp: (JSC::Heap::lastChanceToFinalize): (JSC::Heap::finalizeMarkedUnconditionalFinalizers): (JSC::Heap::finalizeUnconditionalFinalizers): (JSC::Heap::beginMarking): (JSC::Heap::deleteUnmarkedCompiledCode): (JSC::Heap::sweepInFinalize): (JSC::Heap::forEachCodeBlockImpl): (JSC::Heap::forEachCodeBlockIgnoringJITPlansImpl): (JSC::Heap::addCoreConstraints): (JSC::Heap::finalizeUnconditionalFinalizersInIsoSubspace): Deleted. * heap/Heap.h: * heap/HeapCell.h: * heap/HeapCellInlines.h: (JSC::HeapCell::subspace const): * heap/HeapInlines.h: (JSC::Heap::forEachCodeBlock): (JSC::Heap::forEachCodeBlockIgnoringJITPlans): * heap/HeapUtil.h: (JSC::HeapUtil::findGCObjectPointersForMarking): * heap/IsoCellSet.cpp: (JSC::IsoCellSet::parallelNotEmptyMarkedBlockSource): * heap/IsoCellSet.h: * heap/IsoCellSetInlines.h: (JSC::IsoCellSet::forEachMarkedCellInParallel): (JSC::IsoCellSet::forEachLiveCell): * heap/LargeAllocation.h: (JSC::LargeAllocation::subspace const): * heap/MarkStackMergingConstraint.cpp: (JSC::MarkStackMergingConstraint::executeImpl): * heap/MarkStackMergingConstraint.h: * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::parallelNotEmptyBlockSource): * heap/MarkedBlock.cpp: (JSC::MarkedBlock::Handle::didAddToAllocator): (JSC::MarkedBlock::Handle::didRemoveFromAllocator): * heap/MarkedBlock.h: (JSC::MarkedBlock::subspace const): * heap/MarkedBlockInlines.h: (JSC::MarkedBlock::Handle::forEachLiveCell): * heap/MarkedSpaceInlines.h: (JSC::MarkedSpace::forEachLiveCell): * heap/MarkingConstraint.cpp: (JSC::MarkingConstraint::execute): (JSC::MarkingConstraint::doParallelWork): (JSC::MarkingConstraint::finishParallelWork): Deleted. (JSC::MarkingConstraint::doParallelWorkImpl): Deleted. (JSC::MarkingConstraint::finishParallelWorkImpl): Deleted. * heap/MarkingConstraint.h: * heap/MarkingConstraintSet.cpp: (JSC::MarkingConstraintSet::add): * heap/MarkingConstraintSet.h: (JSC::MarkingConstraintSet::add): * heap/MarkingConstraintSolver.cpp: (JSC::MarkingConstraintSolver::execute): (JSC::MarkingConstraintSolver::addParallelTask): (JSC::MarkingConstraintSolver::runExecutionThread): (JSC::MarkingConstraintSolver::didExecute): Deleted. * heap/MarkingConstraintSolver.h: (JSC::MarkingConstraintSolver::TaskWithConstraint::TaskWithConstraint): (JSC::MarkingConstraintSolver::TaskWithConstraint::operator== const): * heap/SimpleMarkingConstraint.cpp: (JSC::SimpleMarkingConstraint::SimpleMarkingConstraint): (JSC::SimpleMarkingConstraint::executeImpl): * heap/SimpleMarkingConstraint.h: (JSC::SimpleMarkingConstraint::SimpleMarkingConstraint): * heap/SlotVisitor.cpp: (JSC::SlotVisitor::addParallelConstraintTask): * heap/SlotVisitor.h: * heap/Subspace.cpp: (JSC::Subspace::sweep): * heap/Subspace.h: * heap/SubspaceInlines.h: (JSC::Subspace::forEachLiveCell): * llint/LowLevelInterpreter.asm: * runtime/EvalExecutable.cpp: (JSC::EvalExecutable::visitChildren): * runtime/EvalExecutable.h: (JSC::EvalExecutable::codeBlock): * runtime/FunctionExecutable.cpp: (JSC::FunctionExecutable::baselineCodeBlockFor): (JSC::FunctionExecutable::visitChildren): * runtime/FunctionExecutable.h: * runtime/JSType.h: * runtime/ModuleProgramExecutable.cpp: (JSC::ModuleProgramExecutable::visitChildren): * runtime/ModuleProgramExecutable.h: * runtime/ProgramExecutable.cpp: (JSC::ProgramExecutable::visitChildren): * runtime/ProgramExecutable.h: * runtime/ScriptExecutable.cpp: (JSC::ScriptExecutable::installCode): (JSC::ScriptExecutable::newReplacementCodeBlockFor): * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: (JSC::VM::SpaceAndFinalizerSet::SpaceAndFinalizerSet): (JSC::VM::SpaceAndFinalizerSet::finalizerSetFor): (JSC::VM::forEachCodeBlockSpace): * runtime/VMTraps.cpp: (JSC::VMTraps::handleTraps): * tools/VMInspector.cpp: (JSC::VMInspector::codeBlockForMachinePC): (JSC::VMInspector::isValidCodeBlock): Source/WebCore: No new tests because no new behavior. Adopting new parallel constraint API, so that more of the logic of doing parallel constraint solving is shared between the DOM's output constraints and JSC's output constraints. * bindings/js/DOMGCOutputConstraint.cpp: (WebCore::DOMGCOutputConstraint::executeImpl): (WebCore::DOMGCOutputConstraint::doParallelWorkImpl): Deleted. (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl): Deleted. * bindings/js/DOMGCOutputConstraint.h: Source/WTF: Deque<>::contains() is helpful for a debug ASSERT. * wtf/Deque.h: (WTF::inlineCapacity>::contains): Tools: Remove some less important benchmarks from the default run. Doing run-jsc-benchmarks shouldn't take a long time due to benchmarks we don't optimize for. * Scripts/run-jsc-benchmarks: Canonical link: https://commits.webkit.org/197398@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226783 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-11 16:43:07 +00:00
bytecode/ExecutableToCodeBlockEdge.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
bytecode/ExecutionCounter.cpp
We should support CreateThis in the FTL https://bugs.webkit.org/show_bug.cgi?id=164904 Reviewed by Yusuke Suzuki. JSTests: * microbenchmarks/polyvariant-get-by-id-shorter-tower.js: Added. (polyvariant): (Foo.prototype.func): (Foo): (foo): (Bar.prototype.func): (Bar): (bar): * microbenchmarks/polyvariant-get-by-id-tower.js: Added. (polyvariant): (Foo.prototype.func): (Foo): (foo): (Bar.prototype.func): (Bar): (bar): (Baz.prototype.func): (Baz): (baz): Source/JavaScriptCore: This started with Saam's patch to implement CreateThis in the FTL, but turned into a type inference adventure. CreateThis in the FTL was a massive regression in raytrace because it disturbed that benchmark's extremely perverse way of winning at type inference: - The benchmark wanted polyvariant devirtualization of an object construction helper. But, the polyvariant profiler wasn't powerful enough to reliably devirtualize that code. So, the benchmark was falling back to other mechanisms... - The construction helper could not tier up into the FTL. When the DFG compiled it, it would see that the IC had 4 cases. That's too polymorphic for the DFG. So, the DFG would emit a GetById. Shortly after the DFG compile, that get_by_id would see many more cases, but now that the helper was compiled by the DFG, the baseline get_by_id would not see those cases. The DFG's GetById would "hide" those cases. The number of cases the DFG's GetById would see is larger than our polymorphic list limit (limit = 8, case count = 13, I think). Note that if the FTL compiles that construction helper, it sees the 4 cases, turns them into a MultiGetByOffset, then suffers from exits when the new cases hit, and then exits to baseline, which then sees those cases. Luckily, the FTL was not compiling the construction helper because it had a CreateThis. - Compilations that inlined the construction helper would have gotten super lucky with parse-time constant folding, so they knew what structure the input to the get_by_id would have at parse time. This is only profitable if the get_by_id parsing computed a GetByIdStatus that had a finite number of cases. Because the 13 cases were being hidden by the DFG GetById and GetByIdStatus would only look at the baseline get_by_id, which had 4 cases, we would indeed get a finite number of cases. The parser would then prune those cases to just one - based on its knowledge of the structure - and that would result in that get_by_id being folded at parse time to a constant. - The subsequent op_call would inline based on parse-time knowledge of that constant. This patch comprehensively fixes these issues, as well as other issues that come up along the way. The short version is that raytrace was revealing sloppiness in our use of profiling for type inference. This patch fixes the sloppiness by vastly expanding *polyvariant* profiling, i.e. the profiling that considers call context. I was encouraged to do this by the fact that even the old version of polyvariant profiling was a speed-up on JetStream, ARES-6, and Speedometer 2 (it's easy to measure since it's a runtime flag). So, it seemed worthwhile to attack raytrace's problem as a shortcoming of polyvariant profiling. - Polyvariant profiling now consults every DFG or FTL code block that participated in any subset of the inline stack that includes the IC we're profiling. For example, if we have an inline stack like foo->bar->baz, with baz on top, then we will consult DFG or FTL compilations for foo, bar, and baz. In foo, we'll look up foo->bar->baz; in bar we'll look up bar->baz; etc. This fixes two problems encountered in raytrace. First, it ensures that a DFG GetById cannot hide anything from the profiling of that get_by_id, since the polyvariant profiling code will always consult it. Second, it enables raytrace to benefit from polyvariant profling. Previously, the polyvariant profiler would only look at the previous DFG compilation of foo and look up foo->bar->baz. But that only works if DFG-foo had inlined bar and then baz. It may not have done that, because those calls could have required polyvariant profiling that was only available in the FTL. - A particularly interesting case is when some IC in foo-baseline is also available in foo-DFG. This case is encountered by the polyvariant profiler as it walks the inline stack. In the case of gathering profiling for foo-FTL, the polyvariant profiler finds foo-DFG via the trivial case of no inline stack. This also means that if foo ever gets inlined, we will find foo-DFG or foo-FTL in the final case of polyvariant profiling. In those cases, we now merge the IC of foo-baseline and foo-DFG. This avoids lots of unnecessary recompilations, because it warns us of historical polymorphism. Historical polymorphism usually means future polymorphism. IC status code already had some merging functionality, but I needed to beef it up a lot to make this work right. - Inlining an inline cache now preserves as much information as profiling. One challenge of polyvariant profiling is that the FTL compile for bar (that includes bar->baz) could have inlined an inline cache based on polyvariant profiling. So, when the FTL compile for foo (that includes foo->bar->baz) asks bar what it knows about that IC inside bar->baz, it will say "I don't have such an IC". At this point the DFG compilation that included that IC that gave us the information that we used to inline the IC is no longer alive. To keep us from losing the information we learned about the IC, there is now a RecordedStatuses data structure that preserves the statuses we use for inlining ICs. We also filter those statuses according to things we learn from AI. This further reduces the risk of information about an IC being forgotten. - Exit profiling now considers whether or not an exit happened from inline code. This protects us in the case where the not-inlined version of an IC exited a lot because of polymorphism that doesn't exist in the inlined version. So, when using polyvariant profiling data, we consider only inlined exits. - CallLinkInfo now records when it's repatched to the virtual call thunk. Previously, this would clear the CallLinkInfo, so CallLinkStatus would fall back to the lastSeenCallee. It's surprising that we've had this bug. Altogether this patch is performance-neutral in run-jsc-benchmarks, except for speed-ups in microbenchmarks and a compile time regression. Octane/deltablue speeds up by ~5%. Octane/raytrace is regressed by a minuscule amount, which we could make up by implementing prototype access folding in the bytecode parser and constant folder. That would require some significant new logic in GetByIdStatus. That would also require a new benchmark - we want to have a test that captures raytrace's behavior in the case that the parser cannot fold the get_by_id. This change is a 1.2% regression on V8Spider-CompileTime. That's a smaller regression than recent compile time progressions, so I think that's an OK trade-off. Also, I would expect a compile time regression anytime we fill in FTL coverage. This is neutral on JetStream, ARES-6, and Speedometer2. JetStream agrees that deltablue speeds up and that raytrace slows down, but these changes balance out and don't affect the overall score. In ARES-6, it looks like individual tests have some significant 1-2% speed-ups or slow-downs. Air-steady is definitely ~1.5% faster. Basic-worst is probably 2% slower (p ~ 0.1, so it's not very certain). The JetStream, ARES-6, and Speedometer2 overall scores don't see a significant difference. In all three cases the difference is <0.5% with a high p value, with JetStream and Speedometer2 being insignificant infinitesimal speed-ups and ARES-6 being an insignificant infinitesimal slow-down. Oh, and this change means that the FTL now has 100% coverage of JavaScript. You could do an eval in a for-in loop in a for-of loop inside a with block that uses try/catch for control flow in a polymorphic constructor while having a bad time, and we'll still compile it. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/ByValInfo.h: * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::printGetByIdCacheStatus): (JSC::BytecodeDumper<Block>::printPutByIdCacheStatus): (JSC::BytecodeDumper<Block>::printInByIdCacheStatus): (JSC::BytecodeDumper<Block>::dumpCallLinkStatus): (JSC::BytecodeDumper<CodeBlock>::dumpCallLinkStatus): (JSC::BytecodeDumper<Block>::printCallOp): (JSC::BytecodeDumper<Block>::dumpBytecode): (JSC::BytecodeDumper<Block>::dumpBlock): * bytecode/BytecodeDumper.h: * bytecode/CallLinkInfo.h: * bytecode/CallLinkStatus.cpp: (JSC::CallLinkStatus::computeFor): (JSC::CallLinkStatus::computeExitSiteData): (JSC::CallLinkStatus::computeFromCallLinkInfo): (JSC::CallLinkStatus::accountForExits): (JSC::CallLinkStatus::finalize): (JSC::CallLinkStatus::filter): (JSC::CallLinkStatus::computeDFGStatuses): Deleted. * bytecode/CallLinkStatus.h: (JSC::CallLinkStatus::operator bool const): (JSC::CallLinkStatus::operator! const): Deleted. * bytecode/CallVariant.cpp: (JSC::CallVariant::finalize): (JSC::CallVariant::filter): * bytecode/CallVariant.h: (JSC::CallVariant::operator bool const): (JSC::CallVariant::operator! const): Deleted. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): (JSC::CodeBlock::propagateTransitions): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::getICStatusMap): (JSC::CodeBlock::resetJITData): (JSC::CodeBlock::getStubInfoMap): Deleted. (JSC::CodeBlock::getCallLinkInfoMap): Deleted. (JSC::CodeBlock::getByValInfoMap): Deleted. * bytecode/CodeBlock.h: * bytecode/CodeOrigin.cpp: (JSC::CodeOrigin::isApproximatelyEqualTo const): (JSC::CodeOrigin::approximateHash const): * bytecode/CodeOrigin.h: (JSC::CodeOrigin::exitingInlineKind const): * bytecode/DFGExitProfile.cpp: (JSC::DFG::FrequentExitSite::dump const): (JSC::DFG::ExitProfile::add): * bytecode/DFGExitProfile.h: (JSC::DFG::FrequentExitSite::FrequentExitSite): (JSC::DFG::FrequentExitSite::operator== const): (JSC::DFG::FrequentExitSite::subsumes const): (JSC::DFG::FrequentExitSite::hash const): (JSC::DFG::FrequentExitSite::inlineKind const): (JSC::DFG::FrequentExitSite::withInlineKind const): (JSC::DFG::QueryableExitProfile::hasExitSite const): (JSC::DFG::QueryableExitProfile::hasExitSiteWithSpecificJITType const): (JSC::DFG::QueryableExitProfile::hasExitSiteWithSpecificInlineKind const): * bytecode/ExitFlag.cpp: Added. (JSC::ExitFlag::dump const): * bytecode/ExitFlag.h: Added. (JSC::ExitFlag::ExitFlag): (JSC::ExitFlag::operator| const): (JSC::ExitFlag::operator|=): (JSC::ExitFlag::operator& const): (JSC::ExitFlag::operator&=): (JSC::ExitFlag::operator bool const): (JSC::ExitFlag::isSet const): * bytecode/ExitingInlineKind.cpp: Added. (WTF::printInternal): * bytecode/ExitingInlineKind.h: Added. * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::computeFor): (JSC::GetByIdStatus::computeForStubInfo): (JSC::GetByIdStatus::slowVersion const): (JSC::GetByIdStatus::markIfCheap): (JSC::GetByIdStatus::finalize): (JSC::GetByIdStatus::hasExitSite): Deleted. * bytecode/GetByIdStatus.h: * bytecode/GetByIdVariant.cpp: (JSC::GetByIdVariant::markIfCheap): (JSC::GetByIdVariant::finalize): * bytecode/GetByIdVariant.h: * bytecode/ICStatusMap.cpp: Added. (JSC::ICStatusContext::get const): (JSC::ICStatusContext::isInlined const): (JSC::ICStatusContext::inlineKind const): * bytecode/ICStatusMap.h: Added. * bytecode/ICStatusUtils.cpp: Added. (JSC::hasBadCacheExitSite): * bytecode/ICStatusUtils.h: * bytecode/InstanceOfStatus.cpp: (JSC::InstanceOfStatus::computeFor): * bytecode/InstanceOfStatus.h: * bytecode/PolyProtoAccessChain.h: * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::hasExitSite): (JSC::PutByIdStatus::computeFor): (JSC::PutByIdStatus::slowVersion const): (JSC::PutByIdStatus::markIfCheap): (JSC::PutByIdStatus::finalize): (JSC::PutByIdStatus::filter): * bytecode/PutByIdStatus.h: * bytecode/PutByIdVariant.cpp: (JSC::PutByIdVariant::markIfCheap): (JSC::PutByIdVariant::finalize): * bytecode/PutByIdVariant.h: (JSC::PutByIdVariant::structureSet const): * bytecode/RecordedStatuses.cpp: Added. (JSC::RecordedStatuses::operator=): (JSC::RecordedStatuses::RecordedStatuses): (JSC::RecordedStatuses::addCallLinkStatus): (JSC::RecordedStatuses::addGetByIdStatus): (JSC::RecordedStatuses::addPutByIdStatus): (JSC::RecordedStatuses::markIfCheap): (JSC::RecordedStatuses::finalizeWithoutDeleting): (JSC::RecordedStatuses::finalize): (JSC::RecordedStatuses::shrinkToFit): * bytecode/RecordedStatuses.h: Added. (JSC::RecordedStatuses::RecordedStatuses): (JSC::RecordedStatuses::forEachVector): * bytecode/StructureSet.cpp: (JSC::StructureSet::markIfCheap const): (JSC::StructureSet::isStillAlive const): * bytecode/StructureSet.h: * bytecode/TerminatedCodeOrigin.h: Added. (JSC::TerminatedCodeOrigin::TerminatedCodeOrigin): (JSC::TerminatedCodeOriginHashTranslator::hash): (JSC::TerminatedCodeOriginHashTranslator::equal): * bytecode/Watchpoint.cpp: (WTF::printInternal): * bytecode/Watchpoint.h: * dfg/DFGAbstractInterpreter.h: * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): (JSC::DFG::AbstractInterpreter<AbstractStateType>::filterICStatus): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleVarargsCall): (JSC::DFG::ByteCodeParser::handleDOMJITGetter): (JSC::DFG::ByteCodeParser::handleModuleNamespaceLoad): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::handlePutById): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry): (JSC::DFG::ByteCodeParser::InlineStackEntry::~InlineStackEntry): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGClobbersExitState.cpp: (JSC::DFG::clobbersExitState): * dfg/DFGCommonData.h: * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGDesiredWatchpoints.h: (JSC::DFG::SetPointerAdaptor::hasBeenInvalidated): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): * dfg/DFGMayExit.cpp: * dfg/DFGNode.h: (JSC::DFG::Node::hasCallLinkStatus): (JSC::DFG::Node::callLinkStatus): (JSC::DFG::Node::hasGetByIdStatus): (JSC::DFG::Node::getByIdStatus): (JSC::DFG::Node::hasPutByIdStatus): (JSC::DFG::Node::putByIdStatus): * dfg/DFGNodeType.h: * dfg/DFGOSRExitBase.cpp: (JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSiteSlow): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::reallyAdd): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::finalizeInGC): * dfg/DFGPlan.h: * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::removeDeadPlans): * ftl/FTLAbstractHeapRepository.h: * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compileCreateThis): (JSC::FTL::DFG::LowerDFGToB3::compileFilterICStatus): * jit/PolymorphicCallStubRoutine.cpp: (JSC::PolymorphicCallStubRoutine::hasEdges const): (JSC::PolymorphicCallStubRoutine::edges const): * jit/PolymorphicCallStubRoutine.h: * profiler/ProfilerBytecodeSequence.cpp: (JSC::Profiler::BytecodeSequence::BytecodeSequence): * runtime/FunctionRareData.cpp: (JSC::FunctionRareData::initializeObjectAllocationProfile): * runtime/Options.h: Source/WTF: * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::operator!= const): Canonical link: https://commits.webkit.org/203069@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234086 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-22 02:48:16 +00:00
bytecode/ExitFlag.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
bytecode/ExitKind.cpp
We should support CreateThis in the FTL https://bugs.webkit.org/show_bug.cgi?id=164904 Reviewed by Yusuke Suzuki. JSTests: * microbenchmarks/polyvariant-get-by-id-shorter-tower.js: Added. (polyvariant): (Foo.prototype.func): (Foo): (foo): (Bar.prototype.func): (Bar): (bar): * microbenchmarks/polyvariant-get-by-id-tower.js: Added. (polyvariant): (Foo.prototype.func): (Foo): (foo): (Bar.prototype.func): (Bar): (bar): (Baz.prototype.func): (Baz): (baz): Source/JavaScriptCore: This started with Saam's patch to implement CreateThis in the FTL, but turned into a type inference adventure. CreateThis in the FTL was a massive regression in raytrace because it disturbed that benchmark's extremely perverse way of winning at type inference: - The benchmark wanted polyvariant devirtualization of an object construction helper. But, the polyvariant profiler wasn't powerful enough to reliably devirtualize that code. So, the benchmark was falling back to other mechanisms... - The construction helper could not tier up into the FTL. When the DFG compiled it, it would see that the IC had 4 cases. That's too polymorphic for the DFG. So, the DFG would emit a GetById. Shortly after the DFG compile, that get_by_id would see many more cases, but now that the helper was compiled by the DFG, the baseline get_by_id would not see those cases. The DFG's GetById would "hide" those cases. The number of cases the DFG's GetById would see is larger than our polymorphic list limit (limit = 8, case count = 13, I think). Note that if the FTL compiles that construction helper, it sees the 4 cases, turns them into a MultiGetByOffset, then suffers from exits when the new cases hit, and then exits to baseline, which then sees those cases. Luckily, the FTL was not compiling the construction helper because it had a CreateThis. - Compilations that inlined the construction helper would have gotten super lucky with parse-time constant folding, so they knew what structure the input to the get_by_id would have at parse time. This is only profitable if the get_by_id parsing computed a GetByIdStatus that had a finite number of cases. Because the 13 cases were being hidden by the DFG GetById and GetByIdStatus would only look at the baseline get_by_id, which had 4 cases, we would indeed get a finite number of cases. The parser would then prune those cases to just one - based on its knowledge of the structure - and that would result in that get_by_id being folded at parse time to a constant. - The subsequent op_call would inline based on parse-time knowledge of that constant. This patch comprehensively fixes these issues, as well as other issues that come up along the way. The short version is that raytrace was revealing sloppiness in our use of profiling for type inference. This patch fixes the sloppiness by vastly expanding *polyvariant* profiling, i.e. the profiling that considers call context. I was encouraged to do this by the fact that even the old version of polyvariant profiling was a speed-up on JetStream, ARES-6, and Speedometer 2 (it's easy to measure since it's a runtime flag). So, it seemed worthwhile to attack raytrace's problem as a shortcoming of polyvariant profiling. - Polyvariant profiling now consults every DFG or FTL code block that participated in any subset of the inline stack that includes the IC we're profiling. For example, if we have an inline stack like foo->bar->baz, with baz on top, then we will consult DFG or FTL compilations for foo, bar, and baz. In foo, we'll look up foo->bar->baz; in bar we'll look up bar->baz; etc. This fixes two problems encountered in raytrace. First, it ensures that a DFG GetById cannot hide anything from the profiling of that get_by_id, since the polyvariant profiling code will always consult it. Second, it enables raytrace to benefit from polyvariant profling. Previously, the polyvariant profiler would only look at the previous DFG compilation of foo and look up foo->bar->baz. But that only works if DFG-foo had inlined bar and then baz. It may not have done that, because those calls could have required polyvariant profiling that was only available in the FTL. - A particularly interesting case is when some IC in foo-baseline is also available in foo-DFG. This case is encountered by the polyvariant profiler as it walks the inline stack. In the case of gathering profiling for foo-FTL, the polyvariant profiler finds foo-DFG via the trivial case of no inline stack. This also means that if foo ever gets inlined, we will find foo-DFG or foo-FTL in the final case of polyvariant profiling. In those cases, we now merge the IC of foo-baseline and foo-DFG. This avoids lots of unnecessary recompilations, because it warns us of historical polymorphism. Historical polymorphism usually means future polymorphism. IC status code already had some merging functionality, but I needed to beef it up a lot to make this work right. - Inlining an inline cache now preserves as much information as profiling. One challenge of polyvariant profiling is that the FTL compile for bar (that includes bar->baz) could have inlined an inline cache based on polyvariant profiling. So, when the FTL compile for foo (that includes foo->bar->baz) asks bar what it knows about that IC inside bar->baz, it will say "I don't have such an IC". At this point the DFG compilation that included that IC that gave us the information that we used to inline the IC is no longer alive. To keep us from losing the information we learned about the IC, there is now a RecordedStatuses data structure that preserves the statuses we use for inlining ICs. We also filter those statuses according to things we learn from AI. This further reduces the risk of information about an IC being forgotten. - Exit profiling now considers whether or not an exit happened from inline code. This protects us in the case where the not-inlined version of an IC exited a lot because of polymorphism that doesn't exist in the inlined version. So, when using polyvariant profiling data, we consider only inlined exits. - CallLinkInfo now records when it's repatched to the virtual call thunk. Previously, this would clear the CallLinkInfo, so CallLinkStatus would fall back to the lastSeenCallee. It's surprising that we've had this bug. Altogether this patch is performance-neutral in run-jsc-benchmarks, except for speed-ups in microbenchmarks and a compile time regression. Octane/deltablue speeds up by ~5%. Octane/raytrace is regressed by a minuscule amount, which we could make up by implementing prototype access folding in the bytecode parser and constant folder. That would require some significant new logic in GetByIdStatus. That would also require a new benchmark - we want to have a test that captures raytrace's behavior in the case that the parser cannot fold the get_by_id. This change is a 1.2% regression on V8Spider-CompileTime. That's a smaller regression than recent compile time progressions, so I think that's an OK trade-off. Also, I would expect a compile time regression anytime we fill in FTL coverage. This is neutral on JetStream, ARES-6, and Speedometer2. JetStream agrees that deltablue speeds up and that raytrace slows down, but these changes balance out and don't affect the overall score. In ARES-6, it looks like individual tests have some significant 1-2% speed-ups or slow-downs. Air-steady is definitely ~1.5% faster. Basic-worst is probably 2% slower (p ~ 0.1, so it's not very certain). The JetStream, ARES-6, and Speedometer2 overall scores don't see a significant difference. In all three cases the difference is <0.5% with a high p value, with JetStream and Speedometer2 being insignificant infinitesimal speed-ups and ARES-6 being an insignificant infinitesimal slow-down. Oh, and this change means that the FTL now has 100% coverage of JavaScript. You could do an eval in a for-in loop in a for-of loop inside a with block that uses try/catch for control flow in a polymorphic constructor while having a bad time, and we'll still compile it. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/ByValInfo.h: * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::printGetByIdCacheStatus): (JSC::BytecodeDumper<Block>::printPutByIdCacheStatus): (JSC::BytecodeDumper<Block>::printInByIdCacheStatus): (JSC::BytecodeDumper<Block>::dumpCallLinkStatus): (JSC::BytecodeDumper<CodeBlock>::dumpCallLinkStatus): (JSC::BytecodeDumper<Block>::printCallOp): (JSC::BytecodeDumper<Block>::dumpBytecode): (JSC::BytecodeDumper<Block>::dumpBlock): * bytecode/BytecodeDumper.h: * bytecode/CallLinkInfo.h: * bytecode/CallLinkStatus.cpp: (JSC::CallLinkStatus::computeFor): (JSC::CallLinkStatus::computeExitSiteData): (JSC::CallLinkStatus::computeFromCallLinkInfo): (JSC::CallLinkStatus::accountForExits): (JSC::CallLinkStatus::finalize): (JSC::CallLinkStatus::filter): (JSC::CallLinkStatus::computeDFGStatuses): Deleted. * bytecode/CallLinkStatus.h: (JSC::CallLinkStatus::operator bool const): (JSC::CallLinkStatus::operator! const): Deleted. * bytecode/CallVariant.cpp: (JSC::CallVariant::finalize): (JSC::CallVariant::filter): * bytecode/CallVariant.h: (JSC::CallVariant::operator bool const): (JSC::CallVariant::operator! const): Deleted. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): (JSC::CodeBlock::propagateTransitions): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::getICStatusMap): (JSC::CodeBlock::resetJITData): (JSC::CodeBlock::getStubInfoMap): Deleted. (JSC::CodeBlock::getCallLinkInfoMap): Deleted. (JSC::CodeBlock::getByValInfoMap): Deleted. * bytecode/CodeBlock.h: * bytecode/CodeOrigin.cpp: (JSC::CodeOrigin::isApproximatelyEqualTo const): (JSC::CodeOrigin::approximateHash const): * bytecode/CodeOrigin.h: (JSC::CodeOrigin::exitingInlineKind const): * bytecode/DFGExitProfile.cpp: (JSC::DFG::FrequentExitSite::dump const): (JSC::DFG::ExitProfile::add): * bytecode/DFGExitProfile.h: (JSC::DFG::FrequentExitSite::FrequentExitSite): (JSC::DFG::FrequentExitSite::operator== const): (JSC::DFG::FrequentExitSite::subsumes const): (JSC::DFG::FrequentExitSite::hash const): (JSC::DFG::FrequentExitSite::inlineKind const): (JSC::DFG::FrequentExitSite::withInlineKind const): (JSC::DFG::QueryableExitProfile::hasExitSite const): (JSC::DFG::QueryableExitProfile::hasExitSiteWithSpecificJITType const): (JSC::DFG::QueryableExitProfile::hasExitSiteWithSpecificInlineKind const): * bytecode/ExitFlag.cpp: Added. (JSC::ExitFlag::dump const): * bytecode/ExitFlag.h: Added. (JSC::ExitFlag::ExitFlag): (JSC::ExitFlag::operator| const): (JSC::ExitFlag::operator|=): (JSC::ExitFlag::operator& const): (JSC::ExitFlag::operator&=): (JSC::ExitFlag::operator bool const): (JSC::ExitFlag::isSet const): * bytecode/ExitingInlineKind.cpp: Added. (WTF::printInternal): * bytecode/ExitingInlineKind.h: Added. * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::computeFor): (JSC::GetByIdStatus::computeForStubInfo): (JSC::GetByIdStatus::slowVersion const): (JSC::GetByIdStatus::markIfCheap): (JSC::GetByIdStatus::finalize): (JSC::GetByIdStatus::hasExitSite): Deleted. * bytecode/GetByIdStatus.h: * bytecode/GetByIdVariant.cpp: (JSC::GetByIdVariant::markIfCheap): (JSC::GetByIdVariant::finalize): * bytecode/GetByIdVariant.h: * bytecode/ICStatusMap.cpp: Added. (JSC::ICStatusContext::get const): (JSC::ICStatusContext::isInlined const): (JSC::ICStatusContext::inlineKind const): * bytecode/ICStatusMap.h: Added. * bytecode/ICStatusUtils.cpp: Added. (JSC::hasBadCacheExitSite): * bytecode/ICStatusUtils.h: * bytecode/InstanceOfStatus.cpp: (JSC::InstanceOfStatus::computeFor): * bytecode/InstanceOfStatus.h: * bytecode/PolyProtoAccessChain.h: * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::hasExitSite): (JSC::PutByIdStatus::computeFor): (JSC::PutByIdStatus::slowVersion const): (JSC::PutByIdStatus::markIfCheap): (JSC::PutByIdStatus::finalize): (JSC::PutByIdStatus::filter): * bytecode/PutByIdStatus.h: * bytecode/PutByIdVariant.cpp: (JSC::PutByIdVariant::markIfCheap): (JSC::PutByIdVariant::finalize): * bytecode/PutByIdVariant.h: (JSC::PutByIdVariant::structureSet const): * bytecode/RecordedStatuses.cpp: Added. (JSC::RecordedStatuses::operator=): (JSC::RecordedStatuses::RecordedStatuses): (JSC::RecordedStatuses::addCallLinkStatus): (JSC::RecordedStatuses::addGetByIdStatus): (JSC::RecordedStatuses::addPutByIdStatus): (JSC::RecordedStatuses::markIfCheap): (JSC::RecordedStatuses::finalizeWithoutDeleting): (JSC::RecordedStatuses::finalize): (JSC::RecordedStatuses::shrinkToFit): * bytecode/RecordedStatuses.h: Added. (JSC::RecordedStatuses::RecordedStatuses): (JSC::RecordedStatuses::forEachVector): * bytecode/StructureSet.cpp: (JSC::StructureSet::markIfCheap const): (JSC::StructureSet::isStillAlive const): * bytecode/StructureSet.h: * bytecode/TerminatedCodeOrigin.h: Added. (JSC::TerminatedCodeOrigin::TerminatedCodeOrigin): (JSC::TerminatedCodeOriginHashTranslator::hash): (JSC::TerminatedCodeOriginHashTranslator::equal): * bytecode/Watchpoint.cpp: (WTF::printInternal): * bytecode/Watchpoint.h: * dfg/DFGAbstractInterpreter.h: * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): (JSC::DFG::AbstractInterpreter<AbstractStateType>::filterICStatus): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleVarargsCall): (JSC::DFG::ByteCodeParser::handleDOMJITGetter): (JSC::DFG::ByteCodeParser::handleModuleNamespaceLoad): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::handlePutById): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry): (JSC::DFG::ByteCodeParser::InlineStackEntry::~InlineStackEntry): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGClobbersExitState.cpp: (JSC::DFG::clobbersExitState): * dfg/DFGCommonData.h: * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGDesiredWatchpoints.h: (JSC::DFG::SetPointerAdaptor::hasBeenInvalidated): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): * dfg/DFGMayExit.cpp: * dfg/DFGNode.h: (JSC::DFG::Node::hasCallLinkStatus): (JSC::DFG::Node::callLinkStatus): (JSC::DFG::Node::hasGetByIdStatus): (JSC::DFG::Node::getByIdStatus): (JSC::DFG::Node::hasPutByIdStatus): (JSC::DFG::Node::putByIdStatus): * dfg/DFGNodeType.h: * dfg/DFGOSRExitBase.cpp: (JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSiteSlow): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::reallyAdd): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::finalizeInGC): * dfg/DFGPlan.h: * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::removeDeadPlans): * ftl/FTLAbstractHeapRepository.h: * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compileCreateThis): (JSC::FTL::DFG::LowerDFGToB3::compileFilterICStatus): * jit/PolymorphicCallStubRoutine.cpp: (JSC::PolymorphicCallStubRoutine::hasEdges const): (JSC::PolymorphicCallStubRoutine::edges const): * jit/PolymorphicCallStubRoutine.h: * profiler/ProfilerBytecodeSequence.cpp: (JSC::Profiler::BytecodeSequence::BytecodeSequence): * runtime/FunctionRareData.cpp: (JSC::FunctionRareData::initializeObjectAllocationProfile): * runtime/Options.h: Source/WTF: * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::operator!= const): Canonical link: https://commits.webkit.org/203069@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234086 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-22 02:48:16 +00:00
bytecode/ExitingInlineKind.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
bytecode/ExitingJITType.cpp
bytecode/FullCodeOrigin.cpp
bytecode/FunctionCodeBlock.cpp
GetByVal should use polymorphic access and hook into a status object https://bugs.webkit.org/show_bug.cgi?id=202767 Reviewed by Keith Miller. This patch puts get_by_val in our normal IC caching infrastructure. This means building it on top of StructureStubInfo and PolymorphicAccess. For this to work, AccessCase now supports all the array load variants that we used to have fast paths for. For identifier based variants, it we just fall back to the code we've already implemented, but only after doing a runtime check that the identifier matches the expected identifier. This allows us to reuse all the IC infrastructure we have for get_by_id. Our compilation strategy is that the baseline JIT always emits a get_by_val IC. If that IC goes to the slow path, the DFG/FTL won't also emit the same IC, since it's probable that we're seeing a megamorphic switch over strings. This was needed to keep this patch neutral on Speedometer 2. It's likely there is room to improve this heuristic: https://bugs.webkit.org/show_bug.cgi?id=204336 This now allows us to have inline caches which contain array loads, and uses of different identifiers. They just show up as different access cases inside polymorphic access. This patch is a progression on various microbenchmarks, especially those with uses of a fixed set of multiple identifiers. It's neutral on JetStream 2 and Speedometer 2. This patch also hooks in get_by_val ICs to our ICStatus infrastructure. This is going to pave the way to allow us to eagerly throw away baseline code, since when we go for an FTL compile, we will be able to use the IC status from the prior compile without relying on baseline specific data structures. There are a few interesting tidbits in this patch that are worth highlighting. - Unlike get_by_id, when we take an IC snapshot for a get_by_val IC, we're not guaranteed the various identifiers in question will outlive the compile (get_by_id ensures this since they're in the constant pool of CodeBlock). For get_by_val, the Identifiers in question are dynamic fields of AccessCase, and AccessCase may get destroyed as we're compiling concurrently. Also, String's reference counting isn't thread safe, so we can't just ref it. Instead, we use a Box<Identifier> inside AccessCase. This allows us to safely ref the Box without refing the underlying String. We're not worried about the Box being destroyed while we're doing this, since we're holding a lock while taking an IC snapshot inside GetByStatus. - We no longer hold onto the actual JS symbol object in the inline cache. This is what we used to do for inlining by val infos. Instead, this patch extends the CheckStringIdent node to be able to handle symbols as well. This patch also renames CheckStringIdent to CheckIdent. This patch also renames various IC related helpers from GetById* to GetBy*, since they can both be used by get_by_val and get_by_id. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/AccessCase.cpp: (JSC::AccessCase::AccessCase): (JSC::AccessCase::create): (JSC::AccessCase::fromStructureStubInfo): (JSC::AccessCase::commit): (JSC::AccessCase::guardedByStructureCheck const): (JSC::AccessCase::guardedByStructureCheckSkippingConstantIdentifierCheck const): (JSC::AccessCase::requiresIdentifierNameMatch const): (JSC::AccessCase::requiresInt32PropertyCheck const): (JSC::AccessCase::needsScratchFPR const): (JSC::AccessCase::forEachDependentCell const): (JSC::AccessCase::doesCalls const): (JSC::AccessCase::canReplace const): (JSC::AccessCase::dump const): (JSC::AccessCase::generateWithGuard): (JSC::AccessCase::generate): (JSC::AccessCase::generateImpl): (JSC::AccessCase::toTypedArrayType): (JSC::AccessCase::checkConsistency): * bytecode/AccessCase.h: (JSC::AccessCase::uid const): (JSC::AccessCase::identifier const): (JSC::AccessCase::checkConsistency): (JSC::AccessCase::AccessCase): * bytecode/GetByIdStatus.cpp: Removed. * bytecode/GetByIdStatus.h: Removed. * bytecode/GetByIdVariant.cpp: (JSC::GetByIdVariant::GetByIdVariant): (JSC::GetByIdVariant::operator=): (JSC::GetByIdVariant::attemptToMerge): * bytecode/GetByIdVariant.h: (JSC::GetByIdVariant::domAttribute const): (JSC::GetByIdVariant::identifier const): * bytecode/GetByStatus.cpp: Copied from Source/JavaScriptCore/bytecode/GetByIdStatus.cpp. (JSC::GetByStatus::appendVariant): (JSC::GetByStatus::computeFromLLInt): (JSC::GetByStatus::computeFor): (JSC::GetByStatus::GetByStatus): (JSC::GetByStatus::computeForStubInfoWithoutExitSiteFeedback): (JSC::GetByStatus::makesCalls const): (JSC::GetByStatus::slowVersion const): (JSC::GetByStatus::merge): (JSC::GetByStatus::filter): (JSC::GetByStatus::markIfCheap): (JSC::GetByStatus::finalize): (JSC::GetByStatus::singleIdentifier const): (JSC::GetByStatus::dump const): (JSC::GetByIdStatus::appendVariant): Deleted. (JSC::GetByIdStatus::computeFromLLInt): Deleted. (JSC::GetByIdStatus::computeFor): Deleted. (JSC::GetByIdStatus::computeForStubInfo): Deleted. (JSC::GetByIdStatus::GetByIdStatus): Deleted. (JSC::GetByIdStatus::computeForStubInfoWithoutExitSiteFeedback): Deleted. (JSC::GetByIdStatus::makesCalls const): Deleted. (JSC::GetByIdStatus::slowVersion const): Deleted. (JSC::GetByIdStatus::merge): Deleted. (JSC::GetByIdStatus::filter): Deleted. (JSC::GetByIdStatus::markIfCheap): Deleted. (JSC::GetByIdStatus::finalize): Deleted. (JSC::GetByIdStatus::dump const): Deleted. * bytecode/GetByStatus.h: Copied from Source/JavaScriptCore/bytecode/GetByIdStatus.h. (JSC::GetByStatus::GetByStatus): (JSC::GetByStatus::moduleNamespaceObject const): (JSC::GetByStatus::moduleEnvironment const): (JSC::GetByStatus::scopeOffset const): (JSC::GetByIdStatus::GetByIdStatus): Deleted. (JSC::GetByIdStatus::state const): Deleted. (JSC::GetByIdStatus::isSet const): Deleted. (JSC::GetByIdStatus::operator bool const): Deleted. (JSC::GetByIdStatus::isSimple const): Deleted. (JSC::GetByIdStatus::isCustom const): Deleted. (JSC::GetByIdStatus::isModuleNamespace const): Deleted. (JSC::GetByIdStatus::numVariants const): Deleted. (JSC::GetByIdStatus::variants const): Deleted. (JSC::GetByIdStatus::at const): Deleted. (JSC::GetByIdStatus::operator[] const): Deleted. (JSC::GetByIdStatus::takesSlowPath const): Deleted. (JSC::GetByIdStatus::wasSeenInJIT const): Deleted. (JSC::GetByIdStatus::moduleNamespaceObject const): Deleted. (JSC::GetByIdStatus::moduleEnvironment const): Deleted. (JSC::GetByIdStatus::scopeOffset const): Deleted. * bytecode/GetterSetterAccessCase.cpp: (JSC::GetterSetterAccessCase::GetterSetterAccessCase): (JSC::GetterSetterAccessCase::create): * bytecode/GetterSetterAccessCase.h: * bytecode/ICStatusMap.h: * bytecode/InByIdStatus.cpp: (JSC::InByIdStatus::computeForStubInfoWithoutExitSiteFeedback): * bytecode/InlineAccess.cpp: (JSC::InlineAccess::generateSelfPropertyAccess): (JSC::InlineAccess::canGenerateSelfPropertyReplace): (JSC::InlineAccess::generateSelfPropertyReplace): (JSC::InlineAccess::isCacheableArrayLength): (JSC::InlineAccess::generateArrayLength): (JSC::InlineAccess::isCacheableStringLength): (JSC::InlineAccess::generateStringLength): (JSC::InlineAccess::generateSelfInAccess): * bytecode/InstanceOfAccessCase.cpp: (JSC::InstanceOfAccessCase::InstanceOfAccessCase): * bytecode/InstanceOfStatus.cpp: (JSC::InstanceOfStatus::computeForStubInfo): * bytecode/IntrinsicGetterAccessCase.cpp: (JSC::IntrinsicGetterAccessCase::IntrinsicGetterAccessCase): (JSC::IntrinsicGetterAccessCase::create): * bytecode/IntrinsicGetterAccessCase.h: * bytecode/ModuleNamespaceAccessCase.cpp: (JSC::ModuleNamespaceAccessCase::ModuleNamespaceAccessCase): (JSC::ModuleNamespaceAccessCase::create): * bytecode/ModuleNamespaceAccessCase.h: * bytecode/PolymorphicAccess.cpp: (JSC::AccessGenerationState::preserveLiveRegistersToStackForCall): (JSC::PolymorphicAccess::addCases): (JSC::PolymorphicAccess::addCase): (JSC::PolymorphicAccess::commit): (JSC::PolymorphicAccess::regenerate): (WTF::printInternal): * bytecode/PolymorphicAccess.h: * bytecode/ProxyableAccessCase.cpp: (JSC::ProxyableAccessCase::ProxyableAccessCase): (JSC::ProxyableAccessCase::create): * bytecode/ProxyableAccessCase.h: * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::computeForStubInfo): * bytecode/RecordedStatuses.cpp: (JSC::RecordedStatuses::addGetByStatus): (JSC::RecordedStatuses::addGetByIdStatus): Deleted. * bytecode/RecordedStatuses.h: * bytecode/StructureStubInfo.cpp: (JSC::StructureStubInfo::StructureStubInfo): (JSC::StructureStubInfo::initGetByIdSelf): (JSC::StructureStubInfo::initArrayLength): (JSC::StructureStubInfo::initStringLength): (JSC::StructureStubInfo::initPutByIdReplace): (JSC::StructureStubInfo::initInByIdSelf): (JSC::StructureStubInfo::deref): (JSC::StructureStubInfo::aboutToDie): (JSC::StructureStubInfo::addAccessCase): (JSC::StructureStubInfo::reset): (JSC::StructureStubInfo::visitWeakReferences): (JSC::StructureStubInfo::propagateTransitions): (JSC::StructureStubInfo::summary const): (JSC::StructureStubInfo::containsPC const): (JSC::StructureStubInfo::setCacheType): (JSC::StructureStubInfo::checkConsistency): * bytecode/StructureStubInfo.h: (JSC::StructureStubInfo::getByIdSelfIdentifier): (JSC::StructureStubInfo::thisValueIsInThisGPR const): (JSC::StructureStubInfo::checkConsistency): (JSC::StructureStubInfo::cacheType const): (JSC::appropriateOptimizingGetByIdFunction): (JSC::appropriateGenericGetByIdFunction): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): (JSC::DFG::AbstractInterpreter<AbstractStateType>::filterICStatus): * dfg/DFGArgumentsEliminationPhase.cpp: * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleDOMJITGetter): (JSC::DFG::ByteCodeParser::handleModuleNamespaceLoad): (JSC::DFG::ByteCodeParser::load): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::parseGetById): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::handlePutByVal): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGClobbersExitState.cpp: (JSC::DFG::clobbersExitState): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGDesiredIdentifiers.cpp: (JSC::DFG::DesiredIdentifiers::processCodeBlockIdentifiersIfNeeded): (JSC::DFG::DesiredIdentifiers::ensure): (JSC::DFG::DesiredIdentifiers::at const): (JSC::DFG::DesiredIdentifiers::reallyAdd): * dfg/DFGDesiredIdentifiers.h: * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): * dfg/DFGGraph.h: * dfg/DFGInPlaceAbstractState.cpp: * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGJITCompiler.h: (JSC::DFG::JITCompiler::addGetByVal): * dfg/DFGMayExit.cpp: * dfg/DFGNode.h: (JSC::DFG::Node::hasUidOperand): (JSC::DFG::Node::hasGetByStatus): (JSC::DFG::Node::getByStatus): (JSC::DFG::Node::hasGetByIdStatus): Deleted. (JSC::DFG::Node::getByIdStatus): Deleted. * dfg/DFGNodeType.h: * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileGetById): (JSC::DFG::SpeculativeJIT::compileCheckIdent): (JSC::DFG::SpeculativeJIT::compileCheckStringIdent): Deleted. * dfg/DFGSpeculativeJIT.h: * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::cachedGetByIdWithThis): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::cachedGetByIdWithThis): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGVarargsForwardingPhase.cpp: * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compileCheckIdent): (JSC::FTL::DFG::LowerDFGToB3::compileGetById): (JSC::FTL::DFG::LowerDFGToB3::compileGetByVal): (JSC::FTL::DFG::LowerDFGToB3::getByIdWithThis): (JSC::FTL::DFG::LowerDFGToB3::compileCheckStringIdent): Deleted. * jit/ICStats.h: * jit/JIT.cpp: (JSC::JIT::privateCompileSlowCases): (JSC::JIT::link): * jit/JIT.h: * jit/JITInlineCacheGenerator.cpp: (JSC::garbageStubInfo): (JSC::JITGetByIdWithThisGenerator::JITGetByIdWithThisGenerator): (JSC::JITInstanceOfGenerator::JITInstanceOfGenerator): (JSC::JITGetByValGenerator::JITGetByValGenerator): (JSC::JITGetByValGenerator::generateFastPath): (JSC::JITGetByValGenerator::finalize): * jit/JITInlineCacheGenerator.h: (JSC::JITGetByValGenerator::JITGetByValGenerator): (JSC::JITGetByValGenerator::slowPathJump const): * jit/JITInlines.h: (JSC::JIT::emitDoubleGetByVal): Deleted. (JSC::JIT::emitContiguousGetByVal): Deleted. (JSC::JIT::emitArrayStorageGetByVal): Deleted. * jit/JITOperations.cpp: (JSC::getByVal): (JSC::tryGetByValOptimize): Deleted. * jit/JITOperations.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_get_by_val): (JSC::JIT::emitSlow_op_get_by_val): (JSC::JIT::emit_op_try_get_by_id): (JSC::JIT::emit_op_get_by_id_direct): (JSC::JIT::emit_op_get_by_id): (JSC::JIT::emit_op_get_by_id_with_this): (JSC::JIT::emitGetByValWithCachedId): Deleted. (JSC::JIT::privateCompileGetByVal): Deleted. (JSC::JIT::privateCompileGetByValWithCachedId): Deleted. (JSC::JIT::emitDirectArgumentsGetByVal): Deleted. (JSC::JIT::emitScopedArgumentsGetByVal): Deleted. (JSC::JIT::emitIntTypedArrayGetByVal): Deleted. (JSC::JIT::emitFloatTypedArrayGetByVal): Deleted. * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emit_op_get_by_val): (JSC::JIT::emit_op_try_get_by_id): (JSC::JIT::emit_op_get_by_id_direct): (JSC::JIT::emit_op_get_by_id): (JSC::JIT::emit_op_get_by_id_with_this): (JSC::JIT::emitGetByValWithCachedId): Deleted. * jit/Repatch.cpp: (JSC::appropriateOptimizingGetByFunction): (JSC::appropriateGetByFunction): (JSC::tryCacheGetBy): (JSC::repatchGetBy): (JSC::tryCacheArrayGetByVal): (JSC::repatchArrayGetByVal): (JSC::tryCachePutByID): (JSC::tryCacheInByID): (JSC::tryCacheInstanceOf): (JSC::resetGetBy): (JSC::appropriateOptimizingGetByIdFunction): Deleted. (JSC::appropriateGetByIdFunction): Deleted. (JSC::tryCacheGetByID): Deleted. (JSC::repatchGetByID): Deleted. (JSC::resetGetByID): Deleted. * jit/Repatch.h: * llint/LowLevelInterpreter.h: * runtime/DOMAnnotation.h: * runtime/JSCJSValue.cpp: (JSC::JSValue::dumpInContextAssumingStructure const): * runtime/Structure.h: Canonical link: https://commits.webkit.org/217668@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252684 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-20 05:53:38 +00:00
bytecode/GetByStatus.cpp
[JSC] Rename *ByIdVariant to *ByVariant and *ByKind::Normal to *ByKind::ById https://bugs.webkit.org/show_bug.cgi?id=226750 Reviewed by Yusuke Suzuki. Cleanup patch following r278445. 1. {Get, Delete, In}ByStatus (but not `Put`) have had `Id` removed from their names; likewise, remove `Id` from the names of {Get, Delete, In}ByIdVariant. These are used *before* ByVal has been converted to ById. 2. The {Get, Del, In}ByKind enum classes shouldn't really call ById `Normal` -- let's say `ById` explicitly. 3. Bonus: In DFGBytecodeParser, move some *Status::computeFor calls inside the conditional that uses them. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/DeleteByStatus.cpp: (JSC::DeleteByStatus::appendVariant): (JSC::DeleteByStatus::computeForStubInfoWithoutExitSiteFeedback): (JSC::DeleteByStatus::visitAggregateImpl): (JSC::DeleteByStatus::markIfCheap): * bytecode/DeleteByStatus.h: * bytecode/DeleteByVariant.cpp: Renamed from Source/JavaScriptCore/bytecode/DeleteByIdVariant.cpp. (JSC::DeleteByVariant::DeleteByVariant): (JSC::DeleteByVariant::~DeleteByVariant): (JSC::DeleteByVariant::operator=): (JSC::DeleteByVariant::attemptToMerge): (JSC::DeleteByVariant::writesStructures const): (JSC::DeleteByVariant::visitAggregateImpl): (JSC::DeleteByVariant::markIfCheap): (JSC::DeleteByVariant::dump const): (JSC::DeleteByVariant::finalize): (JSC::DeleteByVariant::dumpInContext const): * bytecode/DeleteByVariant.h: Renamed from Source/JavaScriptCore/bytecode/DeleteByIdVariant.h. (JSC::DeleteByVariant::overlaps): * bytecode/GetByStatus.cpp: (JSC::GetByStatus::appendVariant): (JSC::GetByStatus::computeFromLLInt): (JSC::GetByStatus::computeForStubInfoWithoutExitSiteFeedback): (JSC::GetByStatus::computeFor): (JSC::GetByStatus::merge): (JSC::GetByStatus::visitAggregateImpl): (JSC::GetByStatus::markIfCheap): (JSC::GetByStatus::finalize): * bytecode/GetByStatus.h: * bytecode/GetByVariant.cpp: Renamed from Source/JavaScriptCore/bytecode/GetByIdVariant.cpp. (JSC::GetByVariant::GetByVariant): (JSC::GetByVariant::~GetByVariant): (JSC::GetByVariant::operator=): (JSC::GetByVariant::canMergeIntrinsicStructures const): (JSC::GetByVariant::attemptToMerge): (JSC::GetByVariant::visitAggregateImpl): (JSC::GetByVariant::markIfCheap): (JSC::GetByVariant::finalize): (JSC::GetByVariant::dump const): (JSC::GetByVariant::dumpInContext const): * bytecode/GetByVariant.h: Renamed from Source/JavaScriptCore/bytecode/GetByIdVariant.h. (JSC::GetByVariant::overlaps): * bytecode/InByStatus.cpp: (JSC::InByStatus::appendVariant): (JSC::InByStatus::computeForStubInfoWithoutExitSiteFeedback): (JSC::InByStatus::merge): (JSC::InByStatus::markIfCheap): (JSC::InByStatus::finalize): * bytecode/InByStatus.h: * bytecode/InByVariant.cpp: Renamed from Source/JavaScriptCore/bytecode/InByIdVariant.cpp. (JSC::InByVariant::InByVariant): (JSC::InByVariant::attemptToMerge): (JSC::InByVariant::markIfCheap): (JSC::InByVariant::finalize): (JSC::InByVariant::dump const): (JSC::InByVariant::dumpInContext const): * bytecode/InByVariant.h: Renamed from Source/JavaScriptCore/bytecode/InByIdVariant.h. (JSC::InByVariant::overlaps): * bytecode/StructureStubInfo.cpp: (JSC::StructureStubInfo::reset): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleIntrinsicGetter): (JSC::DFG::ByteCodeParser::handleDOMJITGetter): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::handleGetPrivateNameById): (JSC::DFG::ByteCodeParser::handleDeleteById): (JSC::DFG::ByteCodeParser::handleInById): (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::emitGetByOffset): (JSC::DFG::ConstantFoldingPhase::emitDeleteByOffset): * dfg/DFGNode.h: * dfg/DFGValidate.cpp: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileDelBy): (JSC::FTL::DFG::LowerDFGToB3::compileDeleteById): (JSC::FTL::DFG::LowerDFGToB3::compileDeleteByVal): (JSC::FTL::DFG::LowerDFGToB3::compileMultiDeleteByOffset): (JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/Repatch.cpp: (JSC::appropriateOptimizingGetByFunction): (JSC::appropriateGetByFunction): (JSC::tryCacheGetBy): (JSC::repatchDeleteBy): (JSC::tryCacheInBy): (JSC::repatchInBy): (JSC::resetGetBy): (JSC::resetDelBy): (JSC::resetInBy): * jit/Repatch.h: Canonical link: https://commits.webkit.org/238668@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278696 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-10 06:26:12 +00:00
bytecode/GetByVariant.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
bytecode/GetterSetterAccessCase.cpp
We should support CreateThis in the FTL https://bugs.webkit.org/show_bug.cgi?id=164904 Reviewed by Yusuke Suzuki. JSTests: * microbenchmarks/polyvariant-get-by-id-shorter-tower.js: Added. (polyvariant): (Foo.prototype.func): (Foo): (foo): (Bar.prototype.func): (Bar): (bar): * microbenchmarks/polyvariant-get-by-id-tower.js: Added. (polyvariant): (Foo.prototype.func): (Foo): (foo): (Bar.prototype.func): (Bar): (bar): (Baz.prototype.func): (Baz): (baz): Source/JavaScriptCore: This started with Saam's patch to implement CreateThis in the FTL, but turned into a type inference adventure. CreateThis in the FTL was a massive regression in raytrace because it disturbed that benchmark's extremely perverse way of winning at type inference: - The benchmark wanted polyvariant devirtualization of an object construction helper. But, the polyvariant profiler wasn't powerful enough to reliably devirtualize that code. So, the benchmark was falling back to other mechanisms... - The construction helper could not tier up into the FTL. When the DFG compiled it, it would see that the IC had 4 cases. That's too polymorphic for the DFG. So, the DFG would emit a GetById. Shortly after the DFG compile, that get_by_id would see many more cases, but now that the helper was compiled by the DFG, the baseline get_by_id would not see those cases. The DFG's GetById would "hide" those cases. The number of cases the DFG's GetById would see is larger than our polymorphic list limit (limit = 8, case count = 13, I think). Note that if the FTL compiles that construction helper, it sees the 4 cases, turns them into a MultiGetByOffset, then suffers from exits when the new cases hit, and then exits to baseline, which then sees those cases. Luckily, the FTL was not compiling the construction helper because it had a CreateThis. - Compilations that inlined the construction helper would have gotten super lucky with parse-time constant folding, so they knew what structure the input to the get_by_id would have at parse time. This is only profitable if the get_by_id parsing computed a GetByIdStatus that had a finite number of cases. Because the 13 cases were being hidden by the DFG GetById and GetByIdStatus would only look at the baseline get_by_id, which had 4 cases, we would indeed get a finite number of cases. The parser would then prune those cases to just one - based on its knowledge of the structure - and that would result in that get_by_id being folded at parse time to a constant. - The subsequent op_call would inline based on parse-time knowledge of that constant. This patch comprehensively fixes these issues, as well as other issues that come up along the way. The short version is that raytrace was revealing sloppiness in our use of profiling for type inference. This patch fixes the sloppiness by vastly expanding *polyvariant* profiling, i.e. the profiling that considers call context. I was encouraged to do this by the fact that even the old version of polyvariant profiling was a speed-up on JetStream, ARES-6, and Speedometer 2 (it's easy to measure since it's a runtime flag). So, it seemed worthwhile to attack raytrace's problem as a shortcoming of polyvariant profiling. - Polyvariant profiling now consults every DFG or FTL code block that participated in any subset of the inline stack that includes the IC we're profiling. For example, if we have an inline stack like foo->bar->baz, with baz on top, then we will consult DFG or FTL compilations for foo, bar, and baz. In foo, we'll look up foo->bar->baz; in bar we'll look up bar->baz; etc. This fixes two problems encountered in raytrace. First, it ensures that a DFG GetById cannot hide anything from the profiling of that get_by_id, since the polyvariant profiling code will always consult it. Second, it enables raytrace to benefit from polyvariant profling. Previously, the polyvariant profiler would only look at the previous DFG compilation of foo and look up foo->bar->baz. But that only works if DFG-foo had inlined bar and then baz. It may not have done that, because those calls could have required polyvariant profiling that was only available in the FTL. - A particularly interesting case is when some IC in foo-baseline is also available in foo-DFG. This case is encountered by the polyvariant profiler as it walks the inline stack. In the case of gathering profiling for foo-FTL, the polyvariant profiler finds foo-DFG via the trivial case of no inline stack. This also means that if foo ever gets inlined, we will find foo-DFG or foo-FTL in the final case of polyvariant profiling. In those cases, we now merge the IC of foo-baseline and foo-DFG. This avoids lots of unnecessary recompilations, because it warns us of historical polymorphism. Historical polymorphism usually means future polymorphism. IC status code already had some merging functionality, but I needed to beef it up a lot to make this work right. - Inlining an inline cache now preserves as much information as profiling. One challenge of polyvariant profiling is that the FTL compile for bar (that includes bar->baz) could have inlined an inline cache based on polyvariant profiling. So, when the FTL compile for foo (that includes foo->bar->baz) asks bar what it knows about that IC inside bar->baz, it will say "I don't have such an IC". At this point the DFG compilation that included that IC that gave us the information that we used to inline the IC is no longer alive. To keep us from losing the information we learned about the IC, there is now a RecordedStatuses data structure that preserves the statuses we use for inlining ICs. We also filter those statuses according to things we learn from AI. This further reduces the risk of information about an IC being forgotten. - Exit profiling now considers whether or not an exit happened from inline code. This protects us in the case where the not-inlined version of an IC exited a lot because of polymorphism that doesn't exist in the inlined version. So, when using polyvariant profiling data, we consider only inlined exits. - CallLinkInfo now records when it's repatched to the virtual call thunk. Previously, this would clear the CallLinkInfo, so CallLinkStatus would fall back to the lastSeenCallee. It's surprising that we've had this bug. Altogether this patch is performance-neutral in run-jsc-benchmarks, except for speed-ups in microbenchmarks and a compile time regression. Octane/deltablue speeds up by ~5%. Octane/raytrace is regressed by a minuscule amount, which we could make up by implementing prototype access folding in the bytecode parser and constant folder. That would require some significant new logic in GetByIdStatus. That would also require a new benchmark - we want to have a test that captures raytrace's behavior in the case that the parser cannot fold the get_by_id. This change is a 1.2% regression on V8Spider-CompileTime. That's a smaller regression than recent compile time progressions, so I think that's an OK trade-off. Also, I would expect a compile time regression anytime we fill in FTL coverage. This is neutral on JetStream, ARES-6, and Speedometer2. JetStream agrees that deltablue speeds up and that raytrace slows down, but these changes balance out and don't affect the overall score. In ARES-6, it looks like individual tests have some significant 1-2% speed-ups or slow-downs. Air-steady is definitely ~1.5% faster. Basic-worst is probably 2% slower (p ~ 0.1, so it's not very certain). The JetStream, ARES-6, and Speedometer2 overall scores don't see a significant difference. In all three cases the difference is <0.5% with a high p value, with JetStream and Speedometer2 being insignificant infinitesimal speed-ups and ARES-6 being an insignificant infinitesimal slow-down. Oh, and this change means that the FTL now has 100% coverage of JavaScript. You could do an eval in a for-in loop in a for-of loop inside a with block that uses try/catch for control flow in a polymorphic constructor while having a bad time, and we'll still compile it. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/ByValInfo.h: * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::printGetByIdCacheStatus): (JSC::BytecodeDumper<Block>::printPutByIdCacheStatus): (JSC::BytecodeDumper<Block>::printInByIdCacheStatus): (JSC::BytecodeDumper<Block>::dumpCallLinkStatus): (JSC::BytecodeDumper<CodeBlock>::dumpCallLinkStatus): (JSC::BytecodeDumper<Block>::printCallOp): (JSC::BytecodeDumper<Block>::dumpBytecode): (JSC::BytecodeDumper<Block>::dumpBlock): * bytecode/BytecodeDumper.h: * bytecode/CallLinkInfo.h: * bytecode/CallLinkStatus.cpp: (JSC::CallLinkStatus::computeFor): (JSC::CallLinkStatus::computeExitSiteData): (JSC::CallLinkStatus::computeFromCallLinkInfo): (JSC::CallLinkStatus::accountForExits): (JSC::CallLinkStatus::finalize): (JSC::CallLinkStatus::filter): (JSC::CallLinkStatus::computeDFGStatuses): Deleted. * bytecode/CallLinkStatus.h: (JSC::CallLinkStatus::operator bool const): (JSC::CallLinkStatus::operator! const): Deleted. * bytecode/CallVariant.cpp: (JSC::CallVariant::finalize): (JSC::CallVariant::filter): * bytecode/CallVariant.h: (JSC::CallVariant::operator bool const): (JSC::CallVariant::operator! const): Deleted. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): (JSC::CodeBlock::propagateTransitions): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::getICStatusMap): (JSC::CodeBlock::resetJITData): (JSC::CodeBlock::getStubInfoMap): Deleted. (JSC::CodeBlock::getCallLinkInfoMap): Deleted. (JSC::CodeBlock::getByValInfoMap): Deleted. * bytecode/CodeBlock.h: * bytecode/CodeOrigin.cpp: (JSC::CodeOrigin::isApproximatelyEqualTo const): (JSC::CodeOrigin::approximateHash const): * bytecode/CodeOrigin.h: (JSC::CodeOrigin::exitingInlineKind const): * bytecode/DFGExitProfile.cpp: (JSC::DFG::FrequentExitSite::dump const): (JSC::DFG::ExitProfile::add): * bytecode/DFGExitProfile.h: (JSC::DFG::FrequentExitSite::FrequentExitSite): (JSC::DFG::FrequentExitSite::operator== const): (JSC::DFG::FrequentExitSite::subsumes const): (JSC::DFG::FrequentExitSite::hash const): (JSC::DFG::FrequentExitSite::inlineKind const): (JSC::DFG::FrequentExitSite::withInlineKind const): (JSC::DFG::QueryableExitProfile::hasExitSite const): (JSC::DFG::QueryableExitProfile::hasExitSiteWithSpecificJITType const): (JSC::DFG::QueryableExitProfile::hasExitSiteWithSpecificInlineKind const): * bytecode/ExitFlag.cpp: Added. (JSC::ExitFlag::dump const): * bytecode/ExitFlag.h: Added. (JSC::ExitFlag::ExitFlag): (JSC::ExitFlag::operator| const): (JSC::ExitFlag::operator|=): (JSC::ExitFlag::operator& const): (JSC::ExitFlag::operator&=): (JSC::ExitFlag::operator bool const): (JSC::ExitFlag::isSet const): * bytecode/ExitingInlineKind.cpp: Added. (WTF::printInternal): * bytecode/ExitingInlineKind.h: Added. * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::computeFor): (JSC::GetByIdStatus::computeForStubInfo): (JSC::GetByIdStatus::slowVersion const): (JSC::GetByIdStatus::markIfCheap): (JSC::GetByIdStatus::finalize): (JSC::GetByIdStatus::hasExitSite): Deleted. * bytecode/GetByIdStatus.h: * bytecode/GetByIdVariant.cpp: (JSC::GetByIdVariant::markIfCheap): (JSC::GetByIdVariant::finalize): * bytecode/GetByIdVariant.h: * bytecode/ICStatusMap.cpp: Added. (JSC::ICStatusContext::get const): (JSC::ICStatusContext::isInlined const): (JSC::ICStatusContext::inlineKind const): * bytecode/ICStatusMap.h: Added. * bytecode/ICStatusUtils.cpp: Added. (JSC::hasBadCacheExitSite): * bytecode/ICStatusUtils.h: * bytecode/InstanceOfStatus.cpp: (JSC::InstanceOfStatus::computeFor): * bytecode/InstanceOfStatus.h: * bytecode/PolyProtoAccessChain.h: * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::hasExitSite): (JSC::PutByIdStatus::computeFor): (JSC::PutByIdStatus::slowVersion const): (JSC::PutByIdStatus::markIfCheap): (JSC::PutByIdStatus::finalize): (JSC::PutByIdStatus::filter): * bytecode/PutByIdStatus.h: * bytecode/PutByIdVariant.cpp: (JSC::PutByIdVariant::markIfCheap): (JSC::PutByIdVariant::finalize): * bytecode/PutByIdVariant.h: (JSC::PutByIdVariant::structureSet const): * bytecode/RecordedStatuses.cpp: Added. (JSC::RecordedStatuses::operator=): (JSC::RecordedStatuses::RecordedStatuses): (JSC::RecordedStatuses::addCallLinkStatus): (JSC::RecordedStatuses::addGetByIdStatus): (JSC::RecordedStatuses::addPutByIdStatus): (JSC::RecordedStatuses::markIfCheap): (JSC::RecordedStatuses::finalizeWithoutDeleting): (JSC::RecordedStatuses::finalize): (JSC::RecordedStatuses::shrinkToFit): * bytecode/RecordedStatuses.h: Added. (JSC::RecordedStatuses::RecordedStatuses): (JSC::RecordedStatuses::forEachVector): * bytecode/StructureSet.cpp: (JSC::StructureSet::markIfCheap const): (JSC::StructureSet::isStillAlive const): * bytecode/StructureSet.h: * bytecode/TerminatedCodeOrigin.h: Added. (JSC::TerminatedCodeOrigin::TerminatedCodeOrigin): (JSC::TerminatedCodeOriginHashTranslator::hash): (JSC::TerminatedCodeOriginHashTranslator::equal): * bytecode/Watchpoint.cpp: (WTF::printInternal): * bytecode/Watchpoint.h: * dfg/DFGAbstractInterpreter.h: * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): (JSC::DFG::AbstractInterpreter<AbstractStateType>::filterICStatus): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleVarargsCall): (JSC::DFG::ByteCodeParser::handleDOMJITGetter): (JSC::DFG::ByteCodeParser::handleModuleNamespaceLoad): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::handlePutById): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry): (JSC::DFG::ByteCodeParser::InlineStackEntry::~InlineStackEntry): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGClobbersExitState.cpp: (JSC::DFG::clobbersExitState): * dfg/DFGCommonData.h: * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGDesiredWatchpoints.h: (JSC::DFG::SetPointerAdaptor::hasBeenInvalidated): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): * dfg/DFGMayExit.cpp: * dfg/DFGNode.h: (JSC::DFG::Node::hasCallLinkStatus): (JSC::DFG::Node::callLinkStatus): (JSC::DFG::Node::hasGetByIdStatus): (JSC::DFG::Node::getByIdStatus): (JSC::DFG::Node::hasPutByIdStatus): (JSC::DFG::Node::putByIdStatus): * dfg/DFGNodeType.h: * dfg/DFGOSRExitBase.cpp: (JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSiteSlow): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::reallyAdd): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::finalizeInGC): * dfg/DFGPlan.h: * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::removeDeadPlans): * ftl/FTLAbstractHeapRepository.h: * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compileCreateThis): (JSC::FTL::DFG::LowerDFGToB3::compileFilterICStatus): * jit/PolymorphicCallStubRoutine.cpp: (JSC::PolymorphicCallStubRoutine::hasEdges const): (JSC::PolymorphicCallStubRoutine::edges const): * jit/PolymorphicCallStubRoutine.h: * profiler/ProfilerBytecodeSequence.cpp: (JSC::Profiler::BytecodeSequence::BytecodeSequence): * runtime/FunctionRareData.cpp: (JSC::FunctionRareData::initializeObjectAllocationProfile): * runtime/Options.h: Source/WTF: * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::operator!= const): Canonical link: https://commits.webkit.org/203069@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234086 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-22 02:48:16 +00:00
bytecode/ICStatusMap.cpp
bytecode/ICStatusUtils.cpp
[JSC] Implement JIT ICs for InByVal https://bugs.webkit.org/show_bug.cgi?id=226563 Reviewed by Saam Barati. JSTests: * microbenchmarks/in-by-val-int32.js: Added. * microbenchmarks/in-by-val-string-index.js: Added. * microbenchmarks/in-by-val-symbol.js: Added. Source/JavaScriptCore: Until now, InByVal has had few optimizations implemented: DFG would attempt to convert string index lookups to InById and int32 lookups to HasIndexedProperty, but there has been no inline caching nor any special handling for symbol lookups. This has become a more urgent problem now, as `#x in obj` (i.e. HasPrivateName / HasPrivateBrand) will need to mimic InByVal's inline caching strategy in order to be deemed performant enough to ship. This patch thus implements inline caching for InByVal at all JIT tiers. The result is a night-and-day difference for symbols, a nice boost for string indices, and no change for int32s: in-by-val-symbol 203.5572+-2.7647 ^ 19.1035+-0.7498 ^ definitely 10.6555x faster in-by-val-string-index 87.0368+-44.7766 45.9971+-32.0007 might be 1.8922x faster in-by-val-int32 110.9904+-1.7109 ? 111.3431+-1.7558 ? * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CheckPrivateBrandStatus.cpp: (JSC::CheckPrivateBrandStatus::singleIdentifier const): * bytecode/DeleteByStatus.cpp: (JSC::DeleteByStatus::singleIdentifier const): * bytecode/GetByStatus.cpp: (JSC::GetByStatus::singleIdentifier const): * bytecode/ICStatusMap.h: * bytecode/ICStatusUtils.h: (JSC::singleIdentifierForICStatus): * bytecode/InByIdVariant.cpp: (JSC::InByIdVariant::InByIdVariant): (JSC::InByIdVariant::attemptToMerge): (JSC::InByIdVariant::dumpInContext const): * bytecode/InByIdVariant.h: (JSC::InByIdVariant::identifier const): (JSC::InByIdVariant::overlaps): * bytecode/InByStatus.cpp: Renamed from Source/JavaScriptCore/bytecode/InByIdStatus.cpp. (JSC::InByStatus::appendVariant): (JSC::InByStatus::shrinkToFit): (JSC::InByStatus::computeFor): (JSC::InByStatus::computeForStubInfo): (JSC::InByStatus::computeForStubInfoWithoutExitSiteFeedback): (JSC::InByStatus::merge): (JSC::InByStatus::filter): (JSC::InByStatus::markIfCheap): (JSC::InByStatus::finalize): (JSC::InByStatus::singleIdentifier const): (JSC::InByStatus::dump const): * bytecode/InByStatus.h: Renamed from Source/JavaScriptCore/bytecode/InByIdStatus.h. * bytecode/RecordedStatuses.cpp: (JSC::RecordedStatuses::addInByStatus): Renamed from addInByIdStatus. * bytecode/RecordedStatuses.h: * bytecode/SetPrivateBrandStatus.cpp: (JSC::SetPrivateBrandStatus::singleIdentifier const): * bytecode/StructureStubInfo.cpp: (JSC::StructureStubInfo::reset): * bytecode/StructureStubInfo.h: * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): (JSC::DFG::AbstractInterpreter<AbstractStateType>::filterICStatus): * dfg/DFGArgumentsEliminationPhase.cpp: * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleInById): (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGClobbersExitState.cpp: (JSC::DFG::clobbersExitState): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGJITCompiler.h: (JSC::DFG::JITCompiler::addInByVal): * dfg/DFGMayExit.cpp: * dfg/DFGNode.h: (JSC::DFG::Node::hasInByStatus): Renamed from hasInByIdStatus. (JSC::DFG::Node::inByStatus): Renamed from inByIdStatus. * dfg/DFGNodeType.h: * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileInByVal): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGVarargsForwardingPhase.cpp: * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compileInBy): (JSC::FTL::DFG::LowerDFGToB3::compileInById): (JSC::FTL::DFG::LowerDFGToB3::compileInByVal): * jit/ICStats.h: * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::link): * jit/JIT.h: * jit/JITInlineCacheGenerator.cpp: (JSC::JITInByValGenerator::JITInByValGenerator): (JSC::JITInByValGenerator::generateFastPath): (JSC::JITInByValGenerator::finalize): (JSC::JITInByIdGenerator::JITInByIdGenerator): * jit/JITInlineCacheGenerator.h: (JSC::JITDelByIdGenerator::slowPathJump const): (JSC::JITInByValGenerator::JITInByValGenerator): (JSC::JITInByValGenerator::slowPathJump const): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITOperations.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_in_by_val): (JSC::JIT::emitSlow_op_in_by_val): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emit_op_in_by_val): (JSC::JIT::emitSlow_op_in_by_val): * jit/Repatch.cpp: (JSC::tryCacheInBy): Renamed from tryCacheInByID. (JSC::repatchInBy): Renamed from repatchInByID. (JSC::resetInBy): Renamed from resetInByID. * jit/Repatch.h: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter.asm: * runtime/CommonSlowPaths.cpp: * runtime/CommonSlowPaths.h: Canonical link: https://commits.webkit.org/238465@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278445 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-04 03:10:54 +00:00
bytecode/InByStatus.cpp
[JSC] Rename *ByIdVariant to *ByVariant and *ByKind::Normal to *ByKind::ById https://bugs.webkit.org/show_bug.cgi?id=226750 Reviewed by Yusuke Suzuki. Cleanup patch following r278445. 1. {Get, Delete, In}ByStatus (but not `Put`) have had `Id` removed from their names; likewise, remove `Id` from the names of {Get, Delete, In}ByIdVariant. These are used *before* ByVal has been converted to ById. 2. The {Get, Del, In}ByKind enum classes shouldn't really call ById `Normal` -- let's say `ById` explicitly. 3. Bonus: In DFGBytecodeParser, move some *Status::computeFor calls inside the conditional that uses them. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/DeleteByStatus.cpp: (JSC::DeleteByStatus::appendVariant): (JSC::DeleteByStatus::computeForStubInfoWithoutExitSiteFeedback): (JSC::DeleteByStatus::visitAggregateImpl): (JSC::DeleteByStatus::markIfCheap): * bytecode/DeleteByStatus.h: * bytecode/DeleteByVariant.cpp: Renamed from Source/JavaScriptCore/bytecode/DeleteByIdVariant.cpp. (JSC::DeleteByVariant::DeleteByVariant): (JSC::DeleteByVariant::~DeleteByVariant): (JSC::DeleteByVariant::operator=): (JSC::DeleteByVariant::attemptToMerge): (JSC::DeleteByVariant::writesStructures const): (JSC::DeleteByVariant::visitAggregateImpl): (JSC::DeleteByVariant::markIfCheap): (JSC::DeleteByVariant::dump const): (JSC::DeleteByVariant::finalize): (JSC::DeleteByVariant::dumpInContext const): * bytecode/DeleteByVariant.h: Renamed from Source/JavaScriptCore/bytecode/DeleteByIdVariant.h. (JSC::DeleteByVariant::overlaps): * bytecode/GetByStatus.cpp: (JSC::GetByStatus::appendVariant): (JSC::GetByStatus::computeFromLLInt): (JSC::GetByStatus::computeForStubInfoWithoutExitSiteFeedback): (JSC::GetByStatus::computeFor): (JSC::GetByStatus::merge): (JSC::GetByStatus::visitAggregateImpl): (JSC::GetByStatus::markIfCheap): (JSC::GetByStatus::finalize): * bytecode/GetByStatus.h: * bytecode/GetByVariant.cpp: Renamed from Source/JavaScriptCore/bytecode/GetByIdVariant.cpp. (JSC::GetByVariant::GetByVariant): (JSC::GetByVariant::~GetByVariant): (JSC::GetByVariant::operator=): (JSC::GetByVariant::canMergeIntrinsicStructures const): (JSC::GetByVariant::attemptToMerge): (JSC::GetByVariant::visitAggregateImpl): (JSC::GetByVariant::markIfCheap): (JSC::GetByVariant::finalize): (JSC::GetByVariant::dump const): (JSC::GetByVariant::dumpInContext const): * bytecode/GetByVariant.h: Renamed from Source/JavaScriptCore/bytecode/GetByIdVariant.h. (JSC::GetByVariant::overlaps): * bytecode/InByStatus.cpp: (JSC::InByStatus::appendVariant): (JSC::InByStatus::computeForStubInfoWithoutExitSiteFeedback): (JSC::InByStatus::merge): (JSC::InByStatus::markIfCheap): (JSC::InByStatus::finalize): * bytecode/InByStatus.h: * bytecode/InByVariant.cpp: Renamed from Source/JavaScriptCore/bytecode/InByIdVariant.cpp. (JSC::InByVariant::InByVariant): (JSC::InByVariant::attemptToMerge): (JSC::InByVariant::markIfCheap): (JSC::InByVariant::finalize): (JSC::InByVariant::dump const): (JSC::InByVariant::dumpInContext const): * bytecode/InByVariant.h: Renamed from Source/JavaScriptCore/bytecode/InByIdVariant.h. (JSC::InByVariant::overlaps): * bytecode/StructureStubInfo.cpp: (JSC::StructureStubInfo::reset): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleIntrinsicGetter): (JSC::DFG::ByteCodeParser::handleDOMJITGetter): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::handleGetPrivateNameById): (JSC::DFG::ByteCodeParser::handleDeleteById): (JSC::DFG::ByteCodeParser::handleInById): (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::emitGetByOffset): (JSC::DFG::ConstantFoldingPhase::emitDeleteByOffset): * dfg/DFGNode.h: * dfg/DFGValidate.cpp: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileDelBy): (JSC::FTL::DFG::LowerDFGToB3::compileDeleteById): (JSC::FTL::DFG::LowerDFGToB3::compileDeleteByVal): (JSC::FTL::DFG::LowerDFGToB3::compileMultiDeleteByOffset): (JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/Repatch.cpp: (JSC::appropriateOptimizingGetByFunction): (JSC::appropriateGetByFunction): (JSC::tryCacheGetBy): (JSC::repatchDeleteBy): (JSC::tryCacheInBy): (JSC::repatchInBy): (JSC::resetGetBy): (JSC::resetDelBy): (JSC::resetInBy): * jit/Repatch.h: Canonical link: https://commits.webkit.org/238668@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278696 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-10 06:26:12 +00:00
bytecode/InByVariant.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
bytecode/InlineAccess.cpp
bytecode/InlineCallFrame.cpp
bytecode/InlineCallFrameSet.cpp
JSC should have InstanceOf inline caching https://bugs.webkit.org/show_bug.cgi?id=185652 Reviewed by Saam Barati. JSTests: * microbenchmarks/instanceof-always-hit-one.js: Added. * microbenchmarks/instanceof-always-hit-two.js: Added. * microbenchmarks/instanceof-dynamic.js: Added. * microbenchmarks/instanceof-sometimes-hit.js: Added. * stress/instanceof-dynamic-proxy-check-structure.js: Added. * stress/instanceof-dynamic-proxy-loop.js: Added. * stress/instanceof-dynamic-proxy.js: Added. * stress/instanceof-hit-one-object-then-another.js: Added. * stress/instanceof-hit-two-objects-then-another.js: Added. * stress/instanceof-prototype-change.js: Added. * stress/instanceof-prototype-change-to-hit.js: Added. * stress/instanceof-prototype-change-to-null.js: Added. * stress/instanceof-prototype-change-watchpointable.js: Added. Source/JavaScriptCore: This adds a polymorphic inline cache for instanceof. It caches hits and misses. It uses the existing PolymorphicAccess IC machinery along with all of its heuristics. If we ever generate too many cases, we emit the generic instanceof implementation instead. All of the JIT tiers use the same InstanceOf IC. It uses the existing JITInlineCacheGenerator abstraction. This is a ~40% speed-up on instanceof microbenchmarks. It's a *tiny* (~1%) speed-up on Octane/boyer. I think I can make that speed-up bigger by inlining the inline cache. * API/tests/testapi.mm: (testObjectiveCAPIMain): * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * b3/B3Effects.h: (JSC::B3::Effects::forReadOnlyCall): * bytecode/AccessCase.cpp: (JSC::AccessCase::guardedByStructureCheck const): (JSC::AccessCase::canReplace const): (JSC::AccessCase::visitWeak const): (JSC::AccessCase::generateWithGuard): (JSC::AccessCase::generateImpl): * bytecode/AccessCase.h: * bytecode/InstanceOfAccessCase.cpp: Added. (JSC::InstanceOfAccessCase::create): (JSC::InstanceOfAccessCase::dumpImpl const): (JSC::InstanceOfAccessCase::clone const): (JSC::InstanceOfAccessCase::~InstanceOfAccessCase): (JSC::InstanceOfAccessCase::InstanceOfAccessCase): * bytecode/InstanceOfAccessCase.h: Added. (JSC::InstanceOfAccessCase::prototype const): * bytecode/ObjectPropertyCondition.h: (JSC::ObjectPropertyCondition::hasPrototypeWithoutBarrier): (JSC::ObjectPropertyCondition::hasPrototype): * bytecode/ObjectPropertyConditionSet.cpp: (JSC::generateConditionsForInstanceOf): * bytecode/ObjectPropertyConditionSet.h: * bytecode/PolymorphicAccess.cpp: (JSC::PolymorphicAccess::addCases): (JSC::PolymorphicAccess::regenerate): (WTF::printInternal): * bytecode/PropertyCondition.cpp: (JSC::PropertyCondition::dumpInContext const): (JSC::PropertyCondition::isStillValidAssumingImpurePropertyWatchpoint const): (JSC::PropertyCondition::validityRequiresImpurePropertyWatchpoint const): (WTF::printInternal): * bytecode/PropertyCondition.h: (JSC::PropertyCondition::absenceWithoutBarrier): (JSC::PropertyCondition::absenceOfSetEffectWithoutBarrier): (JSC::PropertyCondition::hasPrototypeWithoutBarrier): (JSC::PropertyCondition::hasPrototype): (JSC::PropertyCondition::hasPrototype const): (JSC::PropertyCondition::prototype const): (JSC::PropertyCondition::hash const): (JSC::PropertyCondition::operator== const): * bytecode/StructureStubInfo.cpp: (JSC::StructureStubInfo::StructureStubInfo): (JSC::StructureStubInfo::reset): * bytecode/StructureStubInfo.h: (JSC::StructureStubInfo::considerCaching): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGInlineCacheWrapper.h: * dfg/DFGInlineCacheWrapperInlines.h: (JSC::DFG::InlineCacheWrapper<GeneratorType>::finalize): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGJITCompiler.h: (JSC::DFG::JITCompiler::addInstanceOf): * dfg/DFGOperations.cpp: * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::usedRegisters): (JSC::DFG::SpeculativeJIT::compileInstanceOfForCells): (JSC::DFG::SpeculativeJIT::compileInstanceOf): (JSC::DFG::SpeculativeJIT::compileInstanceOfForObject): Deleted. * dfg/DFGSpeculativeJIT.h: * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::cachedGetById): (JSC::DFG::SpeculativeJIT::cachedGetByIdWithThis): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileAssertNotEmpty): (JSC::FTL::DFG::LowerDFGToB3::compilePutById): (JSC::FTL::DFG::LowerDFGToB3::compileNumberIsInteger): (JSC::FTL::DFG::LowerDFGToB3::compileIn): (JSC::FTL::DFG::LowerDFGToB3::compileInstanceOf): (JSC::FTL::DFG::LowerDFGToB3::getById): (JSC::FTL::DFG::LowerDFGToB3::getByIdWithThis): * jit/ICStats.h: * jit/JIT.cpp: (JSC::JIT::privateCompileSlowCases): (JSC::JIT::link): * jit/JIT.h: * jit/JITInlineCacheGenerator.cpp: (JSC::JITInlineCacheGenerator::JITInlineCacheGenerator): (JSC::JITInlineCacheGenerator::finalize): (JSC::JITByIdGenerator::JITByIdGenerator): (JSC::JITByIdGenerator::finalize): (JSC::JITInstanceOfGenerator::JITInstanceOfGenerator): (JSC::JITInstanceOfGenerator::generateFastPath): (JSC::JITInstanceOfGenerator::finalize): * jit/JITInlineCacheGenerator.h: (JSC::JITInlineCacheGenerator::reportSlowPathCall): (JSC::JITInlineCacheGenerator::slowPathBegin const): (JSC::JITInstanceOfGenerator::JITInstanceOfGenerator): (JSC::finalizeInlineCaches): (JSC::JITByIdGenerator::reportSlowPathCall): Deleted. (JSC::JITByIdGenerator::slowPathBegin const): Deleted. * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_instanceof): (JSC::JIT::emitSlow_op_instanceof): * jit/JITOperations.cpp: * jit/JITOperations.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::privateCompileGetByValWithCachedId): (JSC::JIT::privateCompilePutByValWithCachedId): * jit/RegisterSet.cpp: (JSC::RegisterSet::stubUnavailableRegisters): * jit/Repatch.cpp: (JSC::tryCacheIn): (JSC::tryCacheInstanceOf): (JSC::repatchInstanceOf): (JSC::resetPatchableJump): (JSC::resetIn): (JSC::resetInstanceOf): * jit/Repatch.h: * runtime/Options.h: * runtime/Structure.h: Canonical link: https://commits.webkit.org/201236@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231961 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-18 17:29:56 +00:00
bytecode/InstanceOfAccessCase.cpp
DFG should inline InstanceOf ICs https://bugs.webkit.org/show_bug.cgi?id=185695 Reviewed by Yusuke Suzuki. Source/JavaScriptCore: This teaches the DFG how to inline InstanceOf ICs into a MatchStructure node. This can then be folded to a CheckStructure + JSConstant. In the process of testing this, I found a bug where LICM was not hoisting things that depended on ExtraOSREntryLocal because that might return SpecEmpty. I fixed that by teaching LICM how to materialize CheckNotEmpty on demand whenever !HoistingFailed. This is a ~5% speed-up on boyer. ~2x speed-up on the instanceof-always-hit-one, instanceof-always-hit-two, and instanceof-sometimes-hit microbenchmarks. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::appendVariant): (JSC::GetByIdStatus::filter): * bytecode/GetByIdStatus.h: (JSC::GetByIdStatus::operator bool const): (JSC::GetByIdStatus::operator! const): Deleted. * bytecode/GetByIdVariant.h: (JSC::GetByIdVariant::operator bool const): (JSC::GetByIdVariant::operator! const): Deleted. * bytecode/ICStatusUtils.h: Added. (JSC::appendICStatusVariant): (JSC::filterICStatusVariants): * bytecode/InstanceOfStatus.cpp: Added. (JSC::InstanceOfStatus::appendVariant): (JSC::InstanceOfStatus::computeFor): (JSC::InstanceOfStatus::computeForStubInfo): (JSC::InstanceOfStatus::commonPrototype const): (JSC::InstanceOfStatus::filter): * bytecode/InstanceOfStatus.h: Added. (JSC::InstanceOfStatus::InstanceOfStatus): (JSC::InstanceOfStatus::state const): (JSC::InstanceOfStatus::isSet const): (JSC::InstanceOfStatus::operator bool const): (JSC::InstanceOfStatus::isSimple const): (JSC::InstanceOfStatus::takesSlowPath const): (JSC::InstanceOfStatus::numVariants const): (JSC::InstanceOfStatus::variants const): (JSC::InstanceOfStatus::at const): (JSC::InstanceOfStatus::operator[] const): * bytecode/InstanceOfVariant.cpp: Added. (JSC::InstanceOfVariant::InstanceOfVariant): (JSC::InstanceOfVariant::attemptToMerge): (JSC::InstanceOfVariant::dump const): (JSC::InstanceOfVariant::dumpInContext const): * bytecode/InstanceOfVariant.h: Added. (JSC::InstanceOfVariant::InstanceOfVariant): (JSC::InstanceOfVariant::operator bool const): (JSC::InstanceOfVariant::structureSet const): (JSC::InstanceOfVariant::structureSet): (JSC::InstanceOfVariant::conditionSet const): (JSC::InstanceOfVariant::prototype const): (JSC::InstanceOfVariant::isHit const): * bytecode/StructureStubInfo.cpp: (JSC::StructureStubInfo::StructureStubInfo): * bytecode/StructureStubInfo.h: (JSC::StructureStubInfo::considerCaching): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): * dfg/DFGGraph.h: * dfg/DFGLICMPhase.cpp: (JSC::DFG::LICMPhase::attemptHoist): * dfg/DFGNode.cpp: (JSC::DFG::Node::remove): * dfg/DFGNode.h: (JSC::DFG::Node::hasMatchStructureData): (JSC::DFG::Node::matchStructureData): * dfg/DFGNodeType.h: * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileMatchStructure): * dfg/DFGSpeculativeJIT.h: * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compileMatchStructure): Source/WTF: I found myself needing a way to represent bottom/false/true/top, so I created it. * WTF.xcodeproj/project.pbxproj: * wtf/BooleanLattice.h: Added. (WTF::lubBooleanLattice): (WTF::printInternal): * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/201263@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232000 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-19 22:00:21 +00:00
bytecode/InstanceOfStatus.cpp
bytecode/InstanceOfVariant.cpp
New bytecode format for JSC https://bugs.webkit.org/show_bug.cgi?id=187373 <rdar://problem/44186758> Reviewed by Filip Pizlo. .: Disable JIT by default on 32-bit platforms * Source/cmake/WebKitFeatures.cmake: JSTests: Add tests to ensure that the inferred inline capacity for a narrow op_new_object will be capped at 255. * stress/maximum-inline-capacity.js: Added. (test1): (test3.Foo): (test3): Source/JavaScriptCore: Replace unlinked and linked bytecode with a new immutable bytecode that does not embed any addresses. Instructions can be encoded as narrow (1-byte operands) or wide (4-byte operands) and might contain an extra operand, the metadataID. The metadataID is used to access the instruction's mutable data in a side table in the CodeBlock (the MetadataTable). Bytecodes now must be structs declared in the new BytecodeList.rb. All bytecodes give names and types to all its operands. Additionally, reading a bytecode from the instruction stream requires decoding the whole bytecode, i.e. it's no longer possible to access arbitrary operands directly from the stream. * CMakeLists.txt: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/MacroAssemblerCodeRef.h: (JSC::ReturnAddressPtr::ReturnAddressPtr): (JSC::ReturnAddressPtr::value const): (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): (JSC::MacroAssemblerCodePtr::createFromExecutableAddress): * bytecode/ArithProfile.h: (JSC::ArithProfile::ArithProfile): * bytecode/ArrayAllocationProfile.h: (JSC::ArrayAllocationProfile::ArrayAllocationProfile): * bytecode/ArrayProfile.h: * bytecode/BytecodeBasicBlock.cpp: (JSC::isJumpTarget): (JSC::BytecodeBasicBlock::computeImpl): (JSC::BytecodeBasicBlock::compute): * bytecode/BytecodeBasicBlock.h: (JSC::BytecodeBasicBlock::leaderOffset const): (JSC::BytecodeBasicBlock::totalLength const): (JSC::BytecodeBasicBlock::offsets const): (JSC::BytecodeBasicBlock::BytecodeBasicBlock): (JSC::BytecodeBasicBlock::addLength): * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::printLocationAndOp): (JSC::BytecodeDumper<Block>::dumpBytecode): (JSC::BytecodeDumper<Block>::dumpIdentifiers): (JSC::BytecodeDumper<Block>::dumpConstants): (JSC::BytecodeDumper<Block>::dumpExceptionHandlers): (JSC::BytecodeDumper<Block>::dumpSwitchJumpTables): (JSC::BytecodeDumper<Block>::dumpStringSwitchJumpTables): (JSC::BytecodeDumper<Block>::dumpBlock): * bytecode/BytecodeDumper.h: (JSC::BytecodeDumper::dumpOperand): (JSC::BytecodeDumper::dumpValue): (JSC::BytecodeDumper::BytecodeDumper): (JSC::BytecodeDumper::block const): * bytecode/BytecodeGeneratorification.cpp: (JSC::BytecodeGeneratorification::BytecodeGeneratorification): (JSC::BytecodeGeneratorification::enterPoint const): (JSC::BytecodeGeneratorification::instructions const): (JSC::GeneratorLivenessAnalysis::run): (JSC::BytecodeGeneratorification::run): (JSC::performGeneratorification): * bytecode/BytecodeGeneratorification.h: * bytecode/BytecodeGraph.h: (JSC::BytecodeGraph::blockContainsBytecodeOffset): (JSC::BytecodeGraph::findBasicBlockForBytecodeOffset): (JSC::BytecodeGraph::findBasicBlockWithLeaderOffset): (JSC::BytecodeGraph::BytecodeGraph): * bytecode/BytecodeKills.h: * bytecode/BytecodeList.json: Removed. * bytecode/BytecodeList.rb: Added. * bytecode/BytecodeLivenessAnalysis.cpp: (JSC::BytecodeLivenessAnalysis::dumpResults): * bytecode/BytecodeLivenessAnalysis.h: * bytecode/BytecodeLivenessAnalysisInlines.h: (JSC::isValidRegisterForLiveness): (JSC::BytecodeLivenessPropagation::stepOverInstruction): * bytecode/BytecodeRewriter.cpp: (JSC::BytecodeRewriter::applyModification): (JSC::BytecodeRewriter::execute): (JSC::BytecodeRewriter::adjustJumpTargetsInFragment): (JSC::BytecodeRewriter::insertImpl): (JSC::BytecodeRewriter::adjustJumpTarget): (JSC::BytecodeRewriter::adjustJumpTargets): * bytecode/BytecodeRewriter.h: (JSC::BytecodeRewriter::InsertionPoint::InsertionPoint): (JSC::BytecodeRewriter::Fragment::Fragment): (JSC::BytecodeRewriter::Fragment::appendInstruction): (JSC::BytecodeRewriter::BytecodeRewriter): (JSC::BytecodeRewriter::insertFragmentBefore): (JSC::BytecodeRewriter::insertFragmentAfter): (JSC::BytecodeRewriter::removeBytecode): (JSC::BytecodeRewriter::adjustAbsoluteOffset): (JSC::BytecodeRewriter::adjustJumpTarget): * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): (JSC::computeDefsForBytecodeOffset): * bytecode/CallLinkStatus.cpp: (JSC::CallLinkStatus::computeFromLLInt): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): (JSC::CodeBlock::CodeBlock): (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::estimatedSize): (JSC::CodeBlock::visitChildren): (JSC::CodeBlock::propagateTransitions): (JSC::CodeBlock::finalizeLLIntInlineCaches): (JSC::CodeBlock::addJITAddIC): (JSC::CodeBlock::addJITMulIC): (JSC::CodeBlock::addJITSubIC): (JSC::CodeBlock::addJITNegIC): (JSC::CodeBlock::stronglyVisitStrongReferences): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffset): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffsetSlow): (JSC::CodeBlock::hasOpDebugForLineAndColumn): (JSC::CodeBlock::getArrayProfile): (JSC::CodeBlock::updateAllArrayPredictions): (JSC::CodeBlock::predictedMachineCodeSize): (JSC::CodeBlock::tryGetValueProfileForBytecodeOffset): (JSC::CodeBlock::valueProfilePredictionForBytecodeOffset): (JSC::CodeBlock::valueProfileForBytecodeOffset): (JSC::CodeBlock::validate): (JSC::CodeBlock::outOfLineJumpOffset): (JSC::CodeBlock::outOfLineJumpTarget): (JSC::CodeBlock::arithProfileForBytecodeOffset): (JSC::CodeBlock::arithProfileForPC): (JSC::CodeBlock::couldTakeSpecialFastCase): (JSC::CodeBlock::insertBasicBlockBoundariesForControlFlowProfiler): * bytecode/CodeBlock.h: (JSC::CodeBlock::addMathIC): (JSC::CodeBlock::outOfLineJumpOffset): (JSC::CodeBlock::bytecodeOffset): (JSC::CodeBlock::instructions const): (JSC::CodeBlock::instructionCount const): (JSC::CodeBlock::llintBaselineCalleeSaveSpaceAsVirtualRegisters): (JSC::CodeBlock::metadata): (JSC::CodeBlock::metadataSizeInBytes): (JSC::CodeBlock::numberOfNonArgumentValueProfiles): (JSC::CodeBlock::totalNumberOfValueProfiles): * bytecode/CodeBlockInlines.h: Added. (JSC::CodeBlock::forEachValueProfile): (JSC::CodeBlock::forEachArrayProfile): (JSC::CodeBlock::forEachArrayAllocationProfile): (JSC::CodeBlock::forEachObjectAllocationProfile): (JSC::CodeBlock::forEachLLIntCallLinkInfo): * bytecode/Fits.h: Added. * bytecode/GetByIdMetadata.h: Copied from Source/JavaScriptCore/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h. * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::computeFromLLInt): * bytecode/Instruction.h: (JSC::Instruction::Instruction): (JSC::Instruction::Impl::opcodeID const): (JSC::Instruction::opcodeID const): (JSC::Instruction::name const): (JSC::Instruction::isWide const): (JSC::Instruction::size const): (JSC::Instruction::is const): (JSC::Instruction::as const): (JSC::Instruction::cast): (JSC::Instruction::cast const): (JSC::Instruction::narrow const): (JSC::Instruction::wide const): * bytecode/InstructionStream.cpp: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. (JSC::InstructionStream::InstructionStream): (JSC::InstructionStream::sizeInBytes const): * bytecode/InstructionStream.h: Added. (JSC::InstructionStream::BaseRef::BaseRef): (JSC::InstructionStream::BaseRef::operator=): (JSC::InstructionStream::BaseRef::operator-> const): (JSC::InstructionStream::BaseRef::ptr const): (JSC::InstructionStream::BaseRef::operator!= const): (JSC::InstructionStream::BaseRef::next const): (JSC::InstructionStream::BaseRef::offset const): (JSC::InstructionStream::BaseRef::isValid const): (JSC::InstructionStream::BaseRef::unwrap const): (JSC::InstructionStream::MutableRef::freeze const): (JSC::InstructionStream::MutableRef::operator->): (JSC::InstructionStream::MutableRef::ptr): (JSC::InstructionStream::MutableRef::operator Ref): (JSC::InstructionStream::MutableRef::unwrap): (JSC::InstructionStream::iterator::operator*): (JSC::InstructionStream::iterator::operator++): (JSC::InstructionStream::begin const): (JSC::InstructionStream::end const): (JSC::InstructionStream::at const): (JSC::InstructionStream::size const): (JSC::InstructionStreamWriter::InstructionStreamWriter): (JSC::InstructionStreamWriter::ref): (JSC::InstructionStreamWriter::seek): (JSC::InstructionStreamWriter::position): (JSC::InstructionStreamWriter::write): (JSC::InstructionStreamWriter::rewind): (JSC::InstructionStreamWriter::finalize): (JSC::InstructionStreamWriter::swap): (JSC::InstructionStreamWriter::iterator::operator*): (JSC::InstructionStreamWriter::iterator::operator++): (JSC::InstructionStreamWriter::begin): (JSC::InstructionStreamWriter::end): * bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp: (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::LLIntPrototypeLoadAdaptiveStructureWatchpoint): (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::fireInternal): (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::clearLLIntGetByIdCache): * bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h: * bytecode/MetadataTable.cpp: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. (JSC::MetadataTable::MetadataTable): (JSC::DeallocTable::withOpcodeType): (JSC::MetadataTable::~MetadataTable): (JSC::MetadataTable::sizeInBytes): * bytecode/MetadataTable.h: Copied from Source/JavaScriptCore/runtime/Watchdog.h. (JSC::MetadataTable::get): (JSC::MetadataTable::forEach): (JSC::MetadataTable::getImpl): * bytecode/Opcode.cpp: (JSC::metadataSize): * bytecode/Opcode.h: (JSC::padOpcodeName): * bytecode/OpcodeInlines.h: (JSC::isOpcodeShape): (JSC::getOpcodeType): * bytecode/OpcodeSize.h: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. * bytecode/PreciseJumpTargets.cpp: (JSC::getJumpTargetsForInstruction): (JSC::computePreciseJumpTargetsInternal): (JSC::computePreciseJumpTargets): (JSC::recomputePreciseJumpTargets): (JSC::findJumpTargetsForInstruction): * bytecode/PreciseJumpTargets.h: * bytecode/PreciseJumpTargetsInlines.h: (JSC::jumpTargetForInstruction): (JSC::extractStoredJumpTargetsForInstruction): (JSC::updateStoredJumpTargetsForInstruction): * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::computeFromLLInt): * bytecode/SpecialPointer.cpp: (WTF::printInternal): * bytecode/SpecialPointer.h: * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): (JSC::UnlinkedCodeBlock::visitChildren): (JSC::UnlinkedCodeBlock::estimatedSize): (JSC::UnlinkedCodeBlock::lineNumberForBytecodeOffset): (JSC::dumpLineColumnEntry): (JSC::UnlinkedCodeBlock::expressionRangeForBytecodeOffset const): (JSC::UnlinkedCodeBlock::setInstructions): (JSC::UnlinkedCodeBlock::instructions const): (JSC::UnlinkedCodeBlock::applyModification): (JSC::UnlinkedCodeBlock::addOutOfLineJumpTarget): (JSC::UnlinkedCodeBlock::outOfLineJumpOffset): * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::addPropertyAccessInstruction): (JSC::UnlinkedCodeBlock::propertyAccessInstructions const): (JSC::UnlinkedCodeBlock::addOpProfileControlFlowBytecodeOffset): (JSC::UnlinkedCodeBlock::opProfileControlFlowBytecodeOffsets const): (JSC::UnlinkedCodeBlock::metadata): (JSC::UnlinkedCodeBlock::metadataSizeInBytes): (JSC::UnlinkedCodeBlock::outOfLineJumpOffset): (JSC::UnlinkedCodeBlock::replaceOutOfLineJumpTargets): * bytecode/UnlinkedInstructionStream.cpp: Removed. * bytecode/UnlinkedInstructionStream.h: Removed. * bytecode/UnlinkedMetadataTable.h: Copied from Source/JavaScriptCore/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h. * bytecode/UnlinkedMetadataTableInlines.h: Added. (JSC::UnlinkedMetadataTable::UnlinkedMetadataTable): (JSC::UnlinkedMetadataTable::~UnlinkedMetadataTable): (JSC::UnlinkedMetadataTable::addEntry): (JSC::UnlinkedMetadataTable::sizeInBytes): (JSC::UnlinkedMetadataTable::finalize): (JSC::UnlinkedMetadataTable::link): (JSC::UnlinkedMetadataTable::unlink): * bytecode/VirtualRegister.cpp: (JSC::VirtualRegister::VirtualRegister): * bytecode/VirtualRegister.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::Label::setLocation): (JSC::Label::bind): (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::initializeVarLexicalEnvironment): (JSC::BytecodeGenerator::emitEnter): (JSC::BytecodeGenerator::emitLoopHint): (JSC::BytecodeGenerator::emitJump): (JSC::BytecodeGenerator::emitCheckTraps): (JSC::BytecodeGenerator::rewind): (JSC::BytecodeGenerator::fuseCompareAndJump): (JSC::BytecodeGenerator::fuseTestAndJmp): (JSC::BytecodeGenerator::emitJumpIfTrue): (JSC::BytecodeGenerator::emitJumpIfFalse): (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall): (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply): (JSC::BytecodeGenerator::moveLinkTimeConstant): (JSC::BytecodeGenerator::moveEmptyValue): (JSC::BytecodeGenerator::emitMove): (JSC::BytecodeGenerator::emitUnaryOp): (JSC::BytecodeGenerator::emitBinaryOp): (JSC::BytecodeGenerator::emitToObject): (JSC::BytecodeGenerator::emitToNumber): (JSC::BytecodeGenerator::emitToString): (JSC::BytecodeGenerator::emitTypeOf): (JSC::BytecodeGenerator::emitInc): (JSC::BytecodeGenerator::emitDec): (JSC::BytecodeGenerator::emitEqualityOp): (JSC::BytecodeGenerator::emitProfileType): (JSC::BytecodeGenerator::emitProfileControlFlow): (JSC::BytecodeGenerator::pushLexicalScopeInternal): (JSC::BytecodeGenerator::emitResolveScopeForHoistingFuncDeclInEval): (JSC::BytecodeGenerator::prepareLexicalScopeForNextForLoopIteration): (JSC::BytecodeGenerator::emitOverridesHasInstance): (JSC::BytecodeGenerator::emitResolveScope): (JSC::BytecodeGenerator::emitGetFromScope): (JSC::BytecodeGenerator::emitPutToScope): (JSC::BytecodeGenerator::emitInstanceOf): (JSC::BytecodeGenerator::emitInstanceOfCustom): (JSC::BytecodeGenerator::emitInByVal): (JSC::BytecodeGenerator::emitInById): (JSC::BytecodeGenerator::emitTryGetById): (JSC::BytecodeGenerator::emitGetById): (JSC::BytecodeGenerator::emitDirectGetById): (JSC::BytecodeGenerator::emitPutById): (JSC::BytecodeGenerator::emitDirectPutById): (JSC::BytecodeGenerator::emitPutGetterById): (JSC::BytecodeGenerator::emitPutSetterById): (JSC::BytecodeGenerator::emitPutGetterSetter): (JSC::BytecodeGenerator::emitPutGetterByVal): (JSC::BytecodeGenerator::emitPutSetterByVal): (JSC::BytecodeGenerator::emitDeleteById): (JSC::BytecodeGenerator::emitGetByVal): (JSC::BytecodeGenerator::emitPutByVal): (JSC::BytecodeGenerator::emitDirectPutByVal): (JSC::BytecodeGenerator::emitDeleteByVal): (JSC::BytecodeGenerator::emitSuperSamplerBegin): (JSC::BytecodeGenerator::emitSuperSamplerEnd): (JSC::BytecodeGenerator::emitIdWithProfile): (JSC::BytecodeGenerator::emitUnreachable): (JSC::BytecodeGenerator::emitGetArgument): (JSC::BytecodeGenerator::emitCreateThis): (JSC::BytecodeGenerator::emitTDZCheck): (JSC::BytecodeGenerator::emitNewObject): (JSC::BytecodeGenerator::emitNewArrayBuffer): (JSC::BytecodeGenerator::emitNewArray): (JSC::BytecodeGenerator::emitNewArrayWithSpread): (JSC::BytecodeGenerator::emitNewArrayWithSize): (JSC::BytecodeGenerator::emitNewRegExp): (JSC::BytecodeGenerator::emitNewFunctionExpressionCommon): (JSC::BytecodeGenerator::emitNewDefaultConstructor): (JSC::BytecodeGenerator::emitNewFunction): (JSC::BytecodeGenerator::emitSetFunctionNameIfNeeded): (JSC::BytecodeGenerator::emitCall): (JSC::BytecodeGenerator::emitCallInTailPosition): (JSC::BytecodeGenerator::emitCallEval): (JSC::BytecodeGenerator::emitExpectedFunctionSnippet): (JSC::BytecodeGenerator::emitCallVarargs): (JSC::BytecodeGenerator::emitCallVarargsInTailPosition): (JSC::BytecodeGenerator::emitConstructVarargs): (JSC::BytecodeGenerator::emitCallForwardArgumentsInTailPosition): (JSC::BytecodeGenerator::emitLogShadowChickenPrologueIfNecessary): (JSC::BytecodeGenerator::emitLogShadowChickenTailIfNecessary): (JSC::BytecodeGenerator::emitCallDefineProperty): (JSC::BytecodeGenerator::emitReturn): (JSC::BytecodeGenerator::emitEnd): (JSC::BytecodeGenerator::emitConstruct): (JSC::BytecodeGenerator::emitStrcat): (JSC::BytecodeGenerator::emitToPrimitive): (JSC::BytecodeGenerator::emitGetScope): (JSC::BytecodeGenerator::emitPushWithScope): (JSC::BytecodeGenerator::emitGetParentScope): (JSC::BytecodeGenerator::emitDebugHook): (JSC::BytecodeGenerator::emitCatch): (JSC::BytecodeGenerator::emitThrow): (JSC::BytecodeGenerator::emitArgumentCount): (JSC::BytecodeGenerator::emitThrowStaticError): (JSC::BytecodeGenerator::beginSwitch): (JSC::prepareJumpTableForSwitch): (JSC::prepareJumpTableForStringSwitch): (JSC::BytecodeGenerator::endSwitch): (JSC::BytecodeGenerator::emitGetEnumerableLength): (JSC::BytecodeGenerator::emitHasGenericProperty): (JSC::BytecodeGenerator::emitHasIndexedProperty): (JSC::BytecodeGenerator::emitHasStructureProperty): (JSC::BytecodeGenerator::emitGetPropertyEnumerator): (JSC::BytecodeGenerator::emitEnumeratorStructurePropertyName): (JSC::BytecodeGenerator::emitEnumeratorGenericPropertyName): (JSC::BytecodeGenerator::emitToIndexString): (JSC::BytecodeGenerator::emitIsCellWithType): (JSC::BytecodeGenerator::emitIsObject): (JSC::BytecodeGenerator::emitIsNumber): (JSC::BytecodeGenerator::emitIsUndefined): (JSC::BytecodeGenerator::emitIsEmpty): (JSC::BytecodeGenerator::emitRestParameter): (JSC::BytecodeGenerator::emitRequireObjectCoercible): (JSC::BytecodeGenerator::emitYieldPoint): (JSC::BytecodeGenerator::emitYield): (JSC::BytecodeGenerator::emitGetAsyncIterator): (JSC::BytecodeGenerator::emitDelegateYield): (JSC::BytecodeGenerator::emitFinallyCompletion): (JSC::BytecodeGenerator::emitJumpIf): (JSC::ForInContext::finalize): (JSC::StructureForInContext::finalize): (JSC::IndexedForInContext::finalize): (JSC::StaticPropertyAnalysis::record): (JSC::BytecodeGenerator::emitToThis): * bytecompiler/BytecodeGenerator.h: (JSC::StructureForInContext::addGetInst): (JSC::BytecodeGenerator::recordOpcode): (JSC::BytecodeGenerator::addMetadataFor): (JSC::BytecodeGenerator::emitUnaryOp): (JSC::BytecodeGenerator::kill): (JSC::BytecodeGenerator::instructions const): (JSC::BytecodeGenerator::write): (JSC::BytecodeGenerator::withWriter): * bytecompiler/Label.h: (JSC::Label::Label): (JSC::Label::bind): * bytecompiler/NodesCodegen.cpp: (JSC::ArrayNode::emitBytecode): (JSC::BytecodeIntrinsicNode::emit_intrinsic_argumentCount): (JSC::ApplyFunctionCallDotNode::emitBytecode): (JSC::BitwiseNotNode::emitBytecode): (JSC::BinaryOpNode::emitBytecode): (JSC::EqualNode::emitBytecode): (JSC::StrictEqualNode::emitBytecode): (JSC::emitReadModifyAssignment): (JSC::ForInNode::emitBytecode): (JSC::CaseBlockNode::emitBytecodeForBlock): (JSC::FunctionNode::emitBytecode): (JSC::ClassExprNode::emitBytecode): * bytecompiler/ProfileTypeBytecodeFlag.cpp: Copied from Source/JavaScriptCore/bytecode/VirtualRegister.cpp. (WTF::printInternal): * bytecompiler/ProfileTypeBytecodeFlag.h: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. * bytecompiler/RegisterID.h: * bytecompiler/StaticPropertyAnalysis.h: (JSC::StaticPropertyAnalysis::create): (JSC::StaticPropertyAnalysis::StaticPropertyAnalysis): * bytecompiler/StaticPropertyAnalyzer.h: (JSC::StaticPropertyAnalyzer::createThis): (JSC::StaticPropertyAnalyzer::newObject): (JSC::StaticPropertyAnalyzer::putById): (JSC::StaticPropertyAnalyzer::mov): (JSC::StaticPropertyAnalyzer::kill): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::addCall): (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::getArrayMode): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleVarargsCall): (JSC::DFG::ByteCodeParser::handleRecursiveTailCall): (JSC::DFG::ByteCodeParser::inlineCall): (JSC::DFG::ByteCodeParser::handleCallVariant): (JSC::DFG::ByteCodeParser::handleVarargsInlining): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::handleMinMax): (JSC::DFG::ByteCodeParser::handleIntrinsicCall): (JSC::DFG::ByteCodeParser::handleDOMJITCall): (JSC::DFG::ByteCodeParser::handleIntrinsicGetter): (JSC::DFG::ByteCodeParser::handleDOMJITGetter): (JSC::DFG::ByteCodeParser::handleModuleNamespaceLoad): (JSC::DFG::ByteCodeParser::handleTypedArrayConstructor): (JSC::DFG::ByteCodeParser::handleConstantInternalFunction): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::handlePutById): (JSC::DFG::ByteCodeParser::parseGetById): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::handlePutByVal): (JSC::DFG::ByteCodeParser::handlePutAccessorById): (JSC::DFG::ByteCodeParser::handlePutAccessorByVal): (JSC::DFG::ByteCodeParser::handleNewFunc): (JSC::DFG::ByteCodeParser::handleNewFuncExp): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCapabilities.cpp: (JSC::DFG::capabilityLevel): * dfg/DFGCapabilities.h: (JSC::DFG::capabilityLevel): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareCatchOSREntry): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileValueAdd): (JSC::DFG::SpeculativeJIT::compileValueSub): (JSC::DFG::SpeculativeJIT::compileValueNegate): (JSC::DFG::SpeculativeJIT::compileArithMul): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileValueAdd): (JSC::FTL::DFG::LowerDFGToB3::compileValueSub): (JSC::FTL::DFG::LowerDFGToB3::compileUnaryMathIC): (JSC::FTL::DFG::LowerDFGToB3::compileBinaryMathIC): (JSC::FTL::DFG::LowerDFGToB3::compileArithAddOrSub): (JSC::FTL::DFG::LowerDFGToB3::compileArithMul): (JSC::FTL::DFG::LowerDFGToB3::compileValueNegate): * ftl/FTLOperations.cpp: (JSC::FTL::operationMaterializeObjectInOSR): * generate-bytecode-files: Removed. * generator/Argument.rb: Added. * generator/Assertion.rb: Added. * generator/DSL.rb: Added. * generator/Fits.rb: Added. * generator/GeneratedFile.rb: Added. * generator/Metadata.rb: Added. * generator/Opcode.rb: Added. * generator/OpcodeGroup.rb: Added. * generator/Options.rb: Added. * generator/Section.rb: Added. * generator/Template.rb: Added. * generator/Type.rb: Added. * generator/main.rb: Added. * interpreter/AbstractPC.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::currentVPC const): (JSC::CallFrame::setCurrentVPC): * interpreter/CallFrame.h: (JSC::CallSiteIndex::CallSiteIndex): (JSC::ExecState::setReturnPC): * interpreter/Interpreter.cpp: (WTF::printInternal): * interpreter/Interpreter.h: * interpreter/InterpreterInlines.h: * interpreter/StackVisitor.cpp: (JSC::StackVisitor::Frame::dump const): * interpreter/VMEntryRecord.h: * jit/JIT.cpp: (JSC::JIT::JIT): (JSC::JIT::emitSlowCaseCall): (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::compileWithoutLinking): (JSC::JIT::link): * jit/JIT.h: * jit/JITArithmetic.cpp: (JSC::JIT::emit_op_jless): (JSC::JIT::emit_op_jlesseq): (JSC::JIT::emit_op_jgreater): (JSC::JIT::emit_op_jgreatereq): (JSC::JIT::emit_op_jnless): (JSC::JIT::emit_op_jnlesseq): (JSC::JIT::emit_op_jngreater): (JSC::JIT::emit_op_jngreatereq): (JSC::JIT::emitSlow_op_jless): (JSC::JIT::emitSlow_op_jlesseq): (JSC::JIT::emitSlow_op_jgreater): (JSC::JIT::emitSlow_op_jgreatereq): (JSC::JIT::emitSlow_op_jnless): (JSC::JIT::emitSlow_op_jnlesseq): (JSC::JIT::emitSlow_op_jngreater): (JSC::JIT::emitSlow_op_jngreatereq): (JSC::JIT::emit_op_below): (JSC::JIT::emit_op_beloweq): (JSC::JIT::emit_op_jbelow): (JSC::JIT::emit_op_jbeloweq): (JSC::JIT::emit_op_unsigned): (JSC::JIT::emit_compareAndJump): (JSC::JIT::emit_compareUnsignedAndJump): (JSC::JIT::emit_compareUnsigned): (JSC::JIT::emit_compareAndJumpSlow): (JSC::JIT::emit_op_inc): (JSC::JIT::emit_op_dec): (JSC::JIT::emit_op_mod): (JSC::JIT::emitSlow_op_mod): (JSC::JIT::emit_op_negate): (JSC::JIT::emitSlow_op_negate): (JSC::JIT::emitBitBinaryOpFastPath): (JSC::JIT::emit_op_bitand): (JSC::JIT::emit_op_bitor): (JSC::JIT::emit_op_bitxor): (JSC::JIT::emit_op_lshift): (JSC::JIT::emitRightShiftFastPath): (JSC::JIT::emit_op_rshift): (JSC::JIT::emit_op_urshift): (JSC::getOperandTypes): (JSC::JIT::emit_op_add): (JSC::JIT::emitSlow_op_add): (JSC::JIT::emitMathICFast): (JSC::JIT::emitMathICSlow): (JSC::JIT::emit_op_div): (JSC::JIT::emit_op_mul): (JSC::JIT::emitSlow_op_mul): (JSC::JIT::emit_op_sub): (JSC::JIT::emitSlow_op_sub): * jit/JITCall.cpp: (JSC::JIT::emitPutCallResult): (JSC::JIT::compileSetupFrame): (JSC::JIT::compileCallEval): (JSC::JIT::compileCallEvalSlowCase): (JSC::JIT::compileTailCall): (JSC::JIT::compileOpCall): (JSC::JIT::compileOpCallSlowCase): (JSC::JIT::emit_op_call): (JSC::JIT::emit_op_tail_call): (JSC::JIT::emit_op_call_eval): (JSC::JIT::emit_op_call_varargs): (JSC::JIT::emit_op_tail_call_varargs): (JSC::JIT::emit_op_tail_call_forward_arguments): (JSC::JIT::emit_op_construct_varargs): (JSC::JIT::emit_op_construct): (JSC::JIT::emitSlow_op_call): (JSC::JIT::emitSlow_op_tail_call): (JSC::JIT::emitSlow_op_call_eval): (JSC::JIT::emitSlow_op_call_varargs): (JSC::JIT::emitSlow_op_tail_call_varargs): (JSC::JIT::emitSlow_op_tail_call_forward_arguments): (JSC::JIT::emitSlow_op_construct_varargs): (JSC::JIT::emitSlow_op_construct): * jit/JITDisassembler.cpp: (JSC::JITDisassembler::JITDisassembler): * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITInlines.h: (JSC::JIT::emitDoubleGetByVal): (JSC::JIT::emitLoadForArrayMode): (JSC::JIT::emitContiguousGetByVal): (JSC::JIT::emitArrayStorageGetByVal): (JSC::JIT::appendCallWithExceptionCheckSetJSValueResultWithProfile): (JSC::JIT::sampleInstruction): (JSC::JIT::emitValueProfilingSiteIfProfiledOpcode): (JSC::JIT::emitValueProfilingSite): (JSC::JIT::jumpTarget): (JSC::JIT::copiedGetPutInfo): (JSC::JIT::copiedArithProfile): * jit/JITMathIC.h: (JSC::isProfileEmpty): (JSC::JITBinaryMathIC::JITBinaryMathIC): (JSC::JITUnaryMathIC::JITUnaryMathIC): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_mov): (JSC::JIT::emit_op_end): (JSC::JIT::emit_op_jmp): (JSC::JIT::emit_op_new_object): (JSC::JIT::emitSlow_op_new_object): (JSC::JIT::emit_op_overrides_has_instance): (JSC::JIT::emit_op_instanceof): (JSC::JIT::emitSlow_op_instanceof): (JSC::JIT::emit_op_instanceof_custom): (JSC::JIT::emit_op_is_empty): (JSC::JIT::emit_op_is_undefined): (JSC::JIT::emit_op_is_boolean): (JSC::JIT::emit_op_is_number): (JSC::JIT::emit_op_is_cell_with_type): (JSC::JIT::emit_op_is_object): (JSC::JIT::emit_op_ret): (JSC::JIT::emit_op_to_primitive): (JSC::JIT::emit_op_set_function_name): (JSC::JIT::emit_op_not): (JSC::JIT::emit_op_jfalse): (JSC::JIT::emit_op_jeq_null): (JSC::JIT::emit_op_jneq_null): (JSC::JIT::emit_op_jneq_ptr): (JSC::JIT::emit_op_eq): (JSC::JIT::emit_op_jeq): (JSC::JIT::emit_op_jtrue): (JSC::JIT::emit_op_neq): (JSC::JIT::emit_op_jneq): (JSC::JIT::emit_op_throw): (JSC::JIT::compileOpStrictEq): (JSC::JIT::emit_op_stricteq): (JSC::JIT::emit_op_nstricteq): (JSC::JIT::compileOpStrictEqJump): (JSC::JIT::emit_op_jstricteq): (JSC::JIT::emit_op_jnstricteq): (JSC::JIT::emitSlow_op_jstricteq): (JSC::JIT::emitSlow_op_jnstricteq): (JSC::JIT::emit_op_to_number): (JSC::JIT::emit_op_to_string): (JSC::JIT::emit_op_to_object): (JSC::JIT::emit_op_catch): (JSC::JIT::emit_op_identity_with_profile): (JSC::JIT::emit_op_get_parent_scope): (JSC::JIT::emit_op_switch_imm): (JSC::JIT::emit_op_switch_char): (JSC::JIT::emit_op_switch_string): (JSC::JIT::emit_op_debug): (JSC::JIT::emit_op_eq_null): (JSC::JIT::emit_op_neq_null): (JSC::JIT::emit_op_enter): (JSC::JIT::emit_op_get_scope): (JSC::JIT::emit_op_to_this): (JSC::JIT::emit_op_create_this): (JSC::JIT::emit_op_check_tdz): (JSC::JIT::emitSlow_op_eq): (JSC::JIT::emitSlow_op_neq): (JSC::JIT::emitSlow_op_jeq): (JSC::JIT::emitSlow_op_jneq): (JSC::JIT::emitSlow_op_instanceof_custom): (JSC::JIT::emit_op_loop_hint): (JSC::JIT::emitSlow_op_loop_hint): (JSC::JIT::emit_op_check_traps): (JSC::JIT::emit_op_nop): (JSC::JIT::emit_op_super_sampler_begin): (JSC::JIT::emit_op_super_sampler_end): (JSC::JIT::emitSlow_op_check_traps): (JSC::JIT::emit_op_new_regexp): (JSC::JIT::emitNewFuncCommon): (JSC::JIT::emit_op_new_func): (JSC::JIT::emit_op_new_generator_func): (JSC::JIT::emit_op_new_async_generator_func): (JSC::JIT::emit_op_new_async_func): (JSC::JIT::emitNewFuncExprCommon): (JSC::JIT::emit_op_new_func_exp): (JSC::JIT::emit_op_new_generator_func_exp): (JSC::JIT::emit_op_new_async_func_exp): (JSC::JIT::emit_op_new_async_generator_func_exp): (JSC::JIT::emit_op_new_array): (JSC::JIT::emit_op_new_array_with_size): (JSC::JIT::emit_op_has_structure_property): (JSC::JIT::privateCompileHasIndexedProperty): (JSC::JIT::emit_op_has_indexed_property): (JSC::JIT::emitSlow_op_has_indexed_property): (JSC::JIT::emit_op_get_direct_pname): (JSC::JIT::emit_op_enumerator_structure_pname): (JSC::JIT::emit_op_enumerator_generic_pname): (JSC::JIT::emit_op_profile_type): (JSC::JIT::emit_op_log_shadow_chicken_prologue): (JSC::JIT::emit_op_log_shadow_chicken_tail): (JSC::JIT::emit_op_profile_control_flow): (JSC::JIT::emit_op_argument_count): (JSC::JIT::emit_op_get_rest_length): (JSC::JIT::emit_op_get_argument): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_to_this): * jit/JITOperations.cpp: * jit/JITOperations.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_get_by_val): (JSC::JIT::emitGetByValWithCachedId): (JSC::JIT::emitSlow_op_get_by_val): (JSC::JIT::emit_op_put_by_val_direct): (JSC::JIT::emit_op_put_by_val): (JSC::JIT::emitGenericContiguousPutByVal): (JSC::JIT::emitArrayStoragePutByVal): (JSC::JIT::emitPutByValWithCachedId): (JSC::JIT::emitSlow_op_put_by_val): (JSC::JIT::emit_op_put_getter_by_id): (JSC::JIT::emit_op_put_setter_by_id): (JSC::JIT::emit_op_put_getter_setter_by_id): (JSC::JIT::emit_op_put_getter_by_val): (JSC::JIT::emit_op_put_setter_by_val): (JSC::JIT::emit_op_del_by_id): (JSC::JIT::emit_op_del_by_val): (JSC::JIT::emit_op_try_get_by_id): (JSC::JIT::emitSlow_op_try_get_by_id): (JSC::JIT::emit_op_get_by_id_direct): (JSC::JIT::emitSlow_op_get_by_id_direct): (JSC::JIT::emit_op_get_by_id): (JSC::JIT::emit_op_get_by_id_with_this): (JSC::JIT::emitSlow_op_get_by_id): (JSC::JIT::emitSlow_op_get_by_id_with_this): (JSC::JIT::emit_op_put_by_id): (JSC::JIT::emitSlow_op_put_by_id): (JSC::JIT::emit_op_in_by_id): (JSC::JIT::emitSlow_op_in_by_id): (JSC::JIT::emit_op_resolve_scope): (JSC::JIT::emit_op_get_from_scope): (JSC::JIT::emitSlow_op_get_from_scope): (JSC::JIT::emit_op_put_to_scope): (JSC::JIT::emitSlow_op_put_to_scope): (JSC::JIT::emit_op_get_from_arguments): (JSC::JIT::emit_op_put_to_arguments): (JSC::JIT::privateCompileGetByVal): (JSC::JIT::privateCompileGetByValWithCachedId): (JSC::JIT::privateCompilePutByVal): (JSC::JIT::privateCompilePutByValWithCachedId): (JSC::JIT::emitDoubleLoad): (JSC::JIT::emitContiguousLoad): (JSC::JIT::emitArrayStorageLoad): (JSC::JIT::emitDirectArgumentsGetByVal): (JSC::JIT::emitScopedArgumentsGetByVal): (JSC::JIT::emitIntTypedArrayGetByVal): (JSC::JIT::emitFloatTypedArrayGetByVal): (JSC::JIT::emitIntTypedArrayPutByVal): (JSC::JIT::emitFloatTypedArrayPutByVal): * jit/RegisterSet.cpp: (JSC::RegisterSet::llintBaselineCalleeSaveRegisters): * jit/SlowPathCall.h: (JSC::JITSlowPathCall::JITSlowPathCall): * llint/LLIntData.cpp: (JSC::LLInt::initialize): (JSC::LLInt::Data::performAssertions): * llint/LLIntData.h: (JSC::LLInt::exceptionInstructions): (JSC::LLInt::opcodeMap): (JSC::LLInt::opcodeMapWide): (JSC::LLInt::getOpcode): (JSC::LLInt::getOpcodeWide): (JSC::LLInt::getWideCodePtr): * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::llint_trace_operand): (JSC::LLInt::llint_trace_value): (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::entryOSR): (JSC::LLInt::setupGetByIdPrototypeCache): (JSC::LLInt::getByVal): (JSC::LLInt::handleHostCall): (JSC::LLInt::setUpCall): (JSC::LLInt::genericCall): (JSC::LLInt::varargsSetup): (JSC::LLInt::commonCallEval): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter.cpp: (JSC::CLoopRegister::operator const Instruction*): (JSC::CLoop::execute): * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * offlineasm/arm64.rb: * offlineasm/asm.rb: * offlineasm/ast.rb: * offlineasm/cloop.rb: * offlineasm/generate_offset_extractor.rb: * offlineasm/instructions.rb: * offlineasm/offsets.rb: * offlineasm/parser.rb: * offlineasm/transform.rb: * offlineasm/x86.rb: * parser/ResultType.h: (JSC::ResultType::dump const): (JSC::OperandTypes::first const): (JSC::OperandTypes::second const): (JSC::OperandTypes::dump const): * profiler/ProfilerBytecodeSequence.cpp: (JSC::Profiler::BytecodeSequence::BytecodeSequence): * runtime/CommonSlowPaths.cpp: (JSC::SLOW_PATH_DECL): (JSC::updateArithProfileForUnaryArithOp): (JSC::updateArithProfileForBinaryArithOp): * runtime/CommonSlowPaths.h: (JSC::CommonSlowPaths::tryCachePutToScopeGlobal): (JSC::CommonSlowPaths::tryCacheGetFromScopeGlobal): * runtime/ExceptionFuzz.cpp: (JSC::doExceptionFuzzing): * runtime/ExceptionFuzz.h: (JSC::doExceptionFuzzingIfEnabled): * runtime/GetPutInfo.cpp: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. (JSC::GetPutInfo::dump const): (WTF::printInternal): * runtime/GetPutInfo.h: (JSC::GetPutInfo::operand const): * runtime/JSCPoison.h: * runtime/JSType.cpp: Added. (WTF::printInternal): * runtime/JSType.h: * runtime/SamplingProfiler.cpp: (JSC::SamplingProfiler::StackFrame::displayName): * runtime/SamplingProfiler.h: (JSC::SamplingProfiler::UnprocessedStackFrame::UnprocessedStackFrame): * runtime/SlowPathReturnType.h: (JSC::encodeResult): (JSC::decodeResult): * runtime/VM.h: * runtime/Watchdog.h: * tools/HeapVerifier.cpp: Source/WTF: * wtf/Forward.h: Fix WTF_LAZY_FOR_EACH_TERM on MSVC and add WTF_LAZY_HAS_REST to check whether a macro was passed multiple arguments * wtf/Platform.h: Force ENABLE_JIT=false on all 32-bit platforms * wtf/Vector.h: (WTF::minCapacity>::insertVector): Allow vectors with different overflow handlers to be passed to insertVector Tools: Do not force ENABLE_JIT=true when $forceCLoop is false. * Scripts/build-jsc: LayoutTests: Don't use recursion on `equal` to avoid premature stack overflows when testing deep arrays. * fast/dom/Window/resources/postmessage-test.js: Canonical link: https://commits.webkit.org/205839@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-29 13:16:03 +00:00
bytecode/InstructionStream.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
bytecode/IntrinsicGetterAccessCase.cpp
bytecode/JumpTable.cpp
bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
bytecode/LazyOperandValueProfile.cpp
[JSC] Introduce LinkTimeConstant mechanism https://bugs.webkit.org/show_bug.cgi?id=153792 Reviewed by Saam Barati. Source/JavaScriptCore: We are using private-name-variables of JSGlobalObject as a way to access to constants that are materialized per JSGlobalObject. And we also have special-pointers and old link-time-constants to access to per JSGlobalObject constants. We have bytecode intrinsic constants, but it is only available for per VM values. However, these ones have multiple problems. 1. private-name-variables is too costly. We need to have an entry in JSGlobalObject's variable, this makes SymbolTable of JSGlobalObject large. It also requires WatchpointSet to make it constant-fold in DFG. And accessing these variables from builtin JS takes op_resolve_scope and op_get_from_scope, enlarging bytecode and slow in interpreter and baseline compared to just getting them as a constant register. 2. special-pointers are tailored to op_jne_ptr opcode, and not usable in the other bytecode since this is completely separate from VirtualRegister. 3. Old link-time-constants implementation is putting array of all link-time-constants on each UnlinkedCodeBlock, even if it is not used. If you increase # of link-time-constant, it increases sizeof(UnlinkedCodeBlock). In this patch, we introduce a new link-time-constant mechanism and remove the above old ones mostly. (private-name-variables still exists for WebCore and @assert). We manage link-time-constants in BytecodeIntrinsicRegistry, and emit Int32:LinkTimeConstantID constant when generating an UnlinkedCodeBlock. Later, this constant is alternated to an actual value when we link UnlinkedCodeBlock to CodeBlock with specific JSGlobalObject. private-name-variables accesses are now converted to constant register so that it is very efficiently accessed and it reduces memory used for SymbolTable and WatchpointSet. op_jne_ptr takes link-time-constant VirtualRegisters instead of special-pointers, so that we can remove special-pointers mechanism. We also replace old link-time-constants with new one, which reduces sizeof(UnlinkedCodeBlock). Furthermore, new link-time-constant supports lazy initialization by using LazyProperty in JSGlobalObject. This allows us to lazily generate many internal functions that are previously initialized eagerly. This reduces # of allocated JSFunction significantly when initializing JSGlobalObject. This patch also manually adds 256 to MarkedSpace's size-class. We empirically know that adding 256 here makes sequence of size-class better for memory consumption. But this was achieved by adding `sizeof(UnlinkedFunctionCodeBlock)`. Now sizeof(UnlinkedFunctionCodeBlock) is changed by this patch, and this patch unintentionally breaks that sequence. We should explicitly add 256 instead of adding sizeof(UnlinkedFunctionCodeBlock) adhocly. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Scripts/wkbuiltins/builtins_generate_combined_header.py: (generate_section_for_global_private_code_name_macro): * Sources.txt: * builtins/BuiltinNames.h: * builtins/PromiseConstructor.js: (nakedConstructor.Promise): (nakedConstructor.InternalPromise): (nakedConstructor.Promise.reject): Deleted. (nakedConstructor.InternalPromise.reject): Deleted. * bytecode/BytecodeDumper.cpp: (JSC::CodeBlockBytecodeDumper<Block>::dumpConstants): * bytecode/BytecodeIntrinsicRegistry.cpp: (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): (JSC::BytecodeIntrinsicRegistry::lookup const): * bytecode/BytecodeIntrinsicRegistry.h: (JSC::BytecodeIntrinsicRegistry::Entry::Entry): (JSC::BytecodeIntrinsicRegistry::Entry::type const): (JSC::BytecodeIntrinsicRegistry::Entry::linkTimeConstant const): (JSC::BytecodeIntrinsicRegistry::Entry::emitter const): * bytecode/BytecodeList.rb: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::setConstantRegisters): * bytecode/Fits.h: * bytecode/LinkTimeConstant.cpp: Renamed from Source/JavaScriptCore/bytecode/SpecialPointer.h. (WTF::printInternal): * bytecode/LinkTimeConstant.h: Added. * bytecode/SpecialPointer.cpp: Removed. * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::addConstant): (JSC::UnlinkedCodeBlock::registerIndexForLinkTimeConstant): Deleted. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall): (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply): (JSC::BytecodeGenerator::emitExpectedFunctionSnippet): (JSC::BytecodeGenerator::emitCallDefineProperty): (JSC::BytecodeGenerator::emitGetAsyncIterator): * bytecompiler/BytecodeGenerator.h: * bytecompiler/NodesCodegen.cpp: (JSC::ImportNode::emitBytecode): (JSC::BytecodeIntrinsicNode::emitBytecode): (JSC::promiseInternalFieldIndex): (JSC::generatorInternalFieldIndex): (JSC::asyncGeneratorInternalFieldIndex): (JSC::FunctionNode::emitBytecode): (JSC::ObjectPatternNode::bindValue const): (JSC::ObjectSpreadExpressionNode::emitBytecode): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * heap/MarkedSpace.cpp: * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_jneq_ptr): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_jneq_ptr): * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * parser/ASTBuilder.h: (JSC::ASTBuilder::createResolve): (JSC::ASTBuilder::makeFunctionCallNode): * parser/NodeConstructors.h: (JSC::BytecodeIntrinsicNode::BytecodeIntrinsicNode): * parser/Nodes.h: * runtime/CachedTypes.cpp: (JSC::CachedCodeBlock<CodeBlockType>::decode const): (JSC::CachedCodeBlock<CodeBlockType>::encode): * runtime/JSCJSValue.h: * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::JSGlobalObject): (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::linkTimeConstant const): (JSC::JSGlobalObject::callFunction const): Deleted. (JSC::JSGlobalObject::applyFunction const): Deleted. (JSC::JSGlobalObject::throwTypeErrorFunction const): Deleted. (JSC::JSGlobalObject::newPromiseCapabilityFunction const): Deleted. (JSC::JSGlobalObject::resolvePromiseFunction const): Deleted. (JSC::JSGlobalObject::rejectPromiseFunction const): Deleted. (JSC::JSGlobalObject::promiseProtoThenFunction const): Deleted. (JSC::JSGlobalObject::regExpProtoExecFunction const): Deleted. (JSC::JSGlobalObject::regExpProtoGlobalGetter const): Deleted. (JSC::JSGlobalObject::regExpProtoUnicodeGetter const): Deleted. (JSC::JSGlobalObject::actualPointerFor): Deleted. (JSC::JSGlobalObject::jsCellForLinkTimeConstant): Deleted. * runtime/JSGlobalObjectInlines.h: (JSC::JSGlobalObject::throwTypeErrorFunction const): (JSC::JSGlobalObject::newPromiseCapabilityFunction const): (JSC::JSGlobalObject::resolvePromiseFunction const): (JSC::JSGlobalObject::rejectPromiseFunction const): (JSC::JSGlobalObject::promiseProtoThenFunction const): (JSC::JSGlobalObject::regExpProtoExecFunction const): (JSC::JSGlobalObject::regExpProtoGlobalGetter const): (JSC::JSGlobalObject::regExpProtoUnicodeGetter const): LayoutTests: * inspector/debugger/tail-deleted-frames/tail-deleted-frames-this-value-expected.txt: Canonical link: https://commits.webkit.org/217190@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252032 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-05 02:52:02 +00:00
bytecode/LinkTimeConstant.cpp
New bytecode format for JSC https://bugs.webkit.org/show_bug.cgi?id=187373 <rdar://problem/44186758> Reviewed by Filip Pizlo. .: Disable JIT by default on 32-bit platforms * Source/cmake/WebKitFeatures.cmake: JSTests: Add tests to ensure that the inferred inline capacity for a narrow op_new_object will be capped at 255. * stress/maximum-inline-capacity.js: Added. (test1): (test3.Foo): (test3): Source/JavaScriptCore: Replace unlinked and linked bytecode with a new immutable bytecode that does not embed any addresses. Instructions can be encoded as narrow (1-byte operands) or wide (4-byte operands) and might contain an extra operand, the metadataID. The metadataID is used to access the instruction's mutable data in a side table in the CodeBlock (the MetadataTable). Bytecodes now must be structs declared in the new BytecodeList.rb. All bytecodes give names and types to all its operands. Additionally, reading a bytecode from the instruction stream requires decoding the whole bytecode, i.e. it's no longer possible to access arbitrary operands directly from the stream. * CMakeLists.txt: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/MacroAssemblerCodeRef.h: (JSC::ReturnAddressPtr::ReturnAddressPtr): (JSC::ReturnAddressPtr::value const): (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): (JSC::MacroAssemblerCodePtr::createFromExecutableAddress): * bytecode/ArithProfile.h: (JSC::ArithProfile::ArithProfile): * bytecode/ArrayAllocationProfile.h: (JSC::ArrayAllocationProfile::ArrayAllocationProfile): * bytecode/ArrayProfile.h: * bytecode/BytecodeBasicBlock.cpp: (JSC::isJumpTarget): (JSC::BytecodeBasicBlock::computeImpl): (JSC::BytecodeBasicBlock::compute): * bytecode/BytecodeBasicBlock.h: (JSC::BytecodeBasicBlock::leaderOffset const): (JSC::BytecodeBasicBlock::totalLength const): (JSC::BytecodeBasicBlock::offsets const): (JSC::BytecodeBasicBlock::BytecodeBasicBlock): (JSC::BytecodeBasicBlock::addLength): * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::printLocationAndOp): (JSC::BytecodeDumper<Block>::dumpBytecode): (JSC::BytecodeDumper<Block>::dumpIdentifiers): (JSC::BytecodeDumper<Block>::dumpConstants): (JSC::BytecodeDumper<Block>::dumpExceptionHandlers): (JSC::BytecodeDumper<Block>::dumpSwitchJumpTables): (JSC::BytecodeDumper<Block>::dumpStringSwitchJumpTables): (JSC::BytecodeDumper<Block>::dumpBlock): * bytecode/BytecodeDumper.h: (JSC::BytecodeDumper::dumpOperand): (JSC::BytecodeDumper::dumpValue): (JSC::BytecodeDumper::BytecodeDumper): (JSC::BytecodeDumper::block const): * bytecode/BytecodeGeneratorification.cpp: (JSC::BytecodeGeneratorification::BytecodeGeneratorification): (JSC::BytecodeGeneratorification::enterPoint const): (JSC::BytecodeGeneratorification::instructions const): (JSC::GeneratorLivenessAnalysis::run): (JSC::BytecodeGeneratorification::run): (JSC::performGeneratorification): * bytecode/BytecodeGeneratorification.h: * bytecode/BytecodeGraph.h: (JSC::BytecodeGraph::blockContainsBytecodeOffset): (JSC::BytecodeGraph::findBasicBlockForBytecodeOffset): (JSC::BytecodeGraph::findBasicBlockWithLeaderOffset): (JSC::BytecodeGraph::BytecodeGraph): * bytecode/BytecodeKills.h: * bytecode/BytecodeList.json: Removed. * bytecode/BytecodeList.rb: Added. * bytecode/BytecodeLivenessAnalysis.cpp: (JSC::BytecodeLivenessAnalysis::dumpResults): * bytecode/BytecodeLivenessAnalysis.h: * bytecode/BytecodeLivenessAnalysisInlines.h: (JSC::isValidRegisterForLiveness): (JSC::BytecodeLivenessPropagation::stepOverInstruction): * bytecode/BytecodeRewriter.cpp: (JSC::BytecodeRewriter::applyModification): (JSC::BytecodeRewriter::execute): (JSC::BytecodeRewriter::adjustJumpTargetsInFragment): (JSC::BytecodeRewriter::insertImpl): (JSC::BytecodeRewriter::adjustJumpTarget): (JSC::BytecodeRewriter::adjustJumpTargets): * bytecode/BytecodeRewriter.h: (JSC::BytecodeRewriter::InsertionPoint::InsertionPoint): (JSC::BytecodeRewriter::Fragment::Fragment): (JSC::BytecodeRewriter::Fragment::appendInstruction): (JSC::BytecodeRewriter::BytecodeRewriter): (JSC::BytecodeRewriter::insertFragmentBefore): (JSC::BytecodeRewriter::insertFragmentAfter): (JSC::BytecodeRewriter::removeBytecode): (JSC::BytecodeRewriter::adjustAbsoluteOffset): (JSC::BytecodeRewriter::adjustJumpTarget): * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): (JSC::computeDefsForBytecodeOffset): * bytecode/CallLinkStatus.cpp: (JSC::CallLinkStatus::computeFromLLInt): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): (JSC::CodeBlock::CodeBlock): (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::estimatedSize): (JSC::CodeBlock::visitChildren): (JSC::CodeBlock::propagateTransitions): (JSC::CodeBlock::finalizeLLIntInlineCaches): (JSC::CodeBlock::addJITAddIC): (JSC::CodeBlock::addJITMulIC): (JSC::CodeBlock::addJITSubIC): (JSC::CodeBlock::addJITNegIC): (JSC::CodeBlock::stronglyVisitStrongReferences): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffset): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffsetSlow): (JSC::CodeBlock::hasOpDebugForLineAndColumn): (JSC::CodeBlock::getArrayProfile): (JSC::CodeBlock::updateAllArrayPredictions): (JSC::CodeBlock::predictedMachineCodeSize): (JSC::CodeBlock::tryGetValueProfileForBytecodeOffset): (JSC::CodeBlock::valueProfilePredictionForBytecodeOffset): (JSC::CodeBlock::valueProfileForBytecodeOffset): (JSC::CodeBlock::validate): (JSC::CodeBlock::outOfLineJumpOffset): (JSC::CodeBlock::outOfLineJumpTarget): (JSC::CodeBlock::arithProfileForBytecodeOffset): (JSC::CodeBlock::arithProfileForPC): (JSC::CodeBlock::couldTakeSpecialFastCase): (JSC::CodeBlock::insertBasicBlockBoundariesForControlFlowProfiler): * bytecode/CodeBlock.h: (JSC::CodeBlock::addMathIC): (JSC::CodeBlock::outOfLineJumpOffset): (JSC::CodeBlock::bytecodeOffset): (JSC::CodeBlock::instructions const): (JSC::CodeBlock::instructionCount const): (JSC::CodeBlock::llintBaselineCalleeSaveSpaceAsVirtualRegisters): (JSC::CodeBlock::metadata): (JSC::CodeBlock::metadataSizeInBytes): (JSC::CodeBlock::numberOfNonArgumentValueProfiles): (JSC::CodeBlock::totalNumberOfValueProfiles): * bytecode/CodeBlockInlines.h: Added. (JSC::CodeBlock::forEachValueProfile): (JSC::CodeBlock::forEachArrayProfile): (JSC::CodeBlock::forEachArrayAllocationProfile): (JSC::CodeBlock::forEachObjectAllocationProfile): (JSC::CodeBlock::forEachLLIntCallLinkInfo): * bytecode/Fits.h: Added. * bytecode/GetByIdMetadata.h: Copied from Source/JavaScriptCore/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h. * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::computeFromLLInt): * bytecode/Instruction.h: (JSC::Instruction::Instruction): (JSC::Instruction::Impl::opcodeID const): (JSC::Instruction::opcodeID const): (JSC::Instruction::name const): (JSC::Instruction::isWide const): (JSC::Instruction::size const): (JSC::Instruction::is const): (JSC::Instruction::as const): (JSC::Instruction::cast): (JSC::Instruction::cast const): (JSC::Instruction::narrow const): (JSC::Instruction::wide const): * bytecode/InstructionStream.cpp: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. (JSC::InstructionStream::InstructionStream): (JSC::InstructionStream::sizeInBytes const): * bytecode/InstructionStream.h: Added. (JSC::InstructionStream::BaseRef::BaseRef): (JSC::InstructionStream::BaseRef::operator=): (JSC::InstructionStream::BaseRef::operator-> const): (JSC::InstructionStream::BaseRef::ptr const): (JSC::InstructionStream::BaseRef::operator!= const): (JSC::InstructionStream::BaseRef::next const): (JSC::InstructionStream::BaseRef::offset const): (JSC::InstructionStream::BaseRef::isValid const): (JSC::InstructionStream::BaseRef::unwrap const): (JSC::InstructionStream::MutableRef::freeze const): (JSC::InstructionStream::MutableRef::operator->): (JSC::InstructionStream::MutableRef::ptr): (JSC::InstructionStream::MutableRef::operator Ref): (JSC::InstructionStream::MutableRef::unwrap): (JSC::InstructionStream::iterator::operator*): (JSC::InstructionStream::iterator::operator++): (JSC::InstructionStream::begin const): (JSC::InstructionStream::end const): (JSC::InstructionStream::at const): (JSC::InstructionStream::size const): (JSC::InstructionStreamWriter::InstructionStreamWriter): (JSC::InstructionStreamWriter::ref): (JSC::InstructionStreamWriter::seek): (JSC::InstructionStreamWriter::position): (JSC::InstructionStreamWriter::write): (JSC::InstructionStreamWriter::rewind): (JSC::InstructionStreamWriter::finalize): (JSC::InstructionStreamWriter::swap): (JSC::InstructionStreamWriter::iterator::operator*): (JSC::InstructionStreamWriter::iterator::operator++): (JSC::InstructionStreamWriter::begin): (JSC::InstructionStreamWriter::end): * bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp: (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::LLIntPrototypeLoadAdaptiveStructureWatchpoint): (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::fireInternal): (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::clearLLIntGetByIdCache): * bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h: * bytecode/MetadataTable.cpp: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. (JSC::MetadataTable::MetadataTable): (JSC::DeallocTable::withOpcodeType): (JSC::MetadataTable::~MetadataTable): (JSC::MetadataTable::sizeInBytes): * bytecode/MetadataTable.h: Copied from Source/JavaScriptCore/runtime/Watchdog.h. (JSC::MetadataTable::get): (JSC::MetadataTable::forEach): (JSC::MetadataTable::getImpl): * bytecode/Opcode.cpp: (JSC::metadataSize): * bytecode/Opcode.h: (JSC::padOpcodeName): * bytecode/OpcodeInlines.h: (JSC::isOpcodeShape): (JSC::getOpcodeType): * bytecode/OpcodeSize.h: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. * bytecode/PreciseJumpTargets.cpp: (JSC::getJumpTargetsForInstruction): (JSC::computePreciseJumpTargetsInternal): (JSC::computePreciseJumpTargets): (JSC::recomputePreciseJumpTargets): (JSC::findJumpTargetsForInstruction): * bytecode/PreciseJumpTargets.h: * bytecode/PreciseJumpTargetsInlines.h: (JSC::jumpTargetForInstruction): (JSC::extractStoredJumpTargetsForInstruction): (JSC::updateStoredJumpTargetsForInstruction): * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::computeFromLLInt): * bytecode/SpecialPointer.cpp: (WTF::printInternal): * bytecode/SpecialPointer.h: * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): (JSC::UnlinkedCodeBlock::visitChildren): (JSC::UnlinkedCodeBlock::estimatedSize): (JSC::UnlinkedCodeBlock::lineNumberForBytecodeOffset): (JSC::dumpLineColumnEntry): (JSC::UnlinkedCodeBlock::expressionRangeForBytecodeOffset const): (JSC::UnlinkedCodeBlock::setInstructions): (JSC::UnlinkedCodeBlock::instructions const): (JSC::UnlinkedCodeBlock::applyModification): (JSC::UnlinkedCodeBlock::addOutOfLineJumpTarget): (JSC::UnlinkedCodeBlock::outOfLineJumpOffset): * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::addPropertyAccessInstruction): (JSC::UnlinkedCodeBlock::propertyAccessInstructions const): (JSC::UnlinkedCodeBlock::addOpProfileControlFlowBytecodeOffset): (JSC::UnlinkedCodeBlock::opProfileControlFlowBytecodeOffsets const): (JSC::UnlinkedCodeBlock::metadata): (JSC::UnlinkedCodeBlock::metadataSizeInBytes): (JSC::UnlinkedCodeBlock::outOfLineJumpOffset): (JSC::UnlinkedCodeBlock::replaceOutOfLineJumpTargets): * bytecode/UnlinkedInstructionStream.cpp: Removed. * bytecode/UnlinkedInstructionStream.h: Removed. * bytecode/UnlinkedMetadataTable.h: Copied from Source/JavaScriptCore/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h. * bytecode/UnlinkedMetadataTableInlines.h: Added. (JSC::UnlinkedMetadataTable::UnlinkedMetadataTable): (JSC::UnlinkedMetadataTable::~UnlinkedMetadataTable): (JSC::UnlinkedMetadataTable::addEntry): (JSC::UnlinkedMetadataTable::sizeInBytes): (JSC::UnlinkedMetadataTable::finalize): (JSC::UnlinkedMetadataTable::link): (JSC::UnlinkedMetadataTable::unlink): * bytecode/VirtualRegister.cpp: (JSC::VirtualRegister::VirtualRegister): * bytecode/VirtualRegister.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::Label::setLocation): (JSC::Label::bind): (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::initializeVarLexicalEnvironment): (JSC::BytecodeGenerator::emitEnter): (JSC::BytecodeGenerator::emitLoopHint): (JSC::BytecodeGenerator::emitJump): (JSC::BytecodeGenerator::emitCheckTraps): (JSC::BytecodeGenerator::rewind): (JSC::BytecodeGenerator::fuseCompareAndJump): (JSC::BytecodeGenerator::fuseTestAndJmp): (JSC::BytecodeGenerator::emitJumpIfTrue): (JSC::BytecodeGenerator::emitJumpIfFalse): (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall): (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply): (JSC::BytecodeGenerator::moveLinkTimeConstant): (JSC::BytecodeGenerator::moveEmptyValue): (JSC::BytecodeGenerator::emitMove): (JSC::BytecodeGenerator::emitUnaryOp): (JSC::BytecodeGenerator::emitBinaryOp): (JSC::BytecodeGenerator::emitToObject): (JSC::BytecodeGenerator::emitToNumber): (JSC::BytecodeGenerator::emitToString): (JSC::BytecodeGenerator::emitTypeOf): (JSC::BytecodeGenerator::emitInc): (JSC::BytecodeGenerator::emitDec): (JSC::BytecodeGenerator::emitEqualityOp): (JSC::BytecodeGenerator::emitProfileType): (JSC::BytecodeGenerator::emitProfileControlFlow): (JSC::BytecodeGenerator::pushLexicalScopeInternal): (JSC::BytecodeGenerator::emitResolveScopeForHoistingFuncDeclInEval): (JSC::BytecodeGenerator::prepareLexicalScopeForNextForLoopIteration): (JSC::BytecodeGenerator::emitOverridesHasInstance): (JSC::BytecodeGenerator::emitResolveScope): (JSC::BytecodeGenerator::emitGetFromScope): (JSC::BytecodeGenerator::emitPutToScope): (JSC::BytecodeGenerator::emitInstanceOf): (JSC::BytecodeGenerator::emitInstanceOfCustom): (JSC::BytecodeGenerator::emitInByVal): (JSC::BytecodeGenerator::emitInById): (JSC::BytecodeGenerator::emitTryGetById): (JSC::BytecodeGenerator::emitGetById): (JSC::BytecodeGenerator::emitDirectGetById): (JSC::BytecodeGenerator::emitPutById): (JSC::BytecodeGenerator::emitDirectPutById): (JSC::BytecodeGenerator::emitPutGetterById): (JSC::BytecodeGenerator::emitPutSetterById): (JSC::BytecodeGenerator::emitPutGetterSetter): (JSC::BytecodeGenerator::emitPutGetterByVal): (JSC::BytecodeGenerator::emitPutSetterByVal): (JSC::BytecodeGenerator::emitDeleteById): (JSC::BytecodeGenerator::emitGetByVal): (JSC::BytecodeGenerator::emitPutByVal): (JSC::BytecodeGenerator::emitDirectPutByVal): (JSC::BytecodeGenerator::emitDeleteByVal): (JSC::BytecodeGenerator::emitSuperSamplerBegin): (JSC::BytecodeGenerator::emitSuperSamplerEnd): (JSC::BytecodeGenerator::emitIdWithProfile): (JSC::BytecodeGenerator::emitUnreachable): (JSC::BytecodeGenerator::emitGetArgument): (JSC::BytecodeGenerator::emitCreateThis): (JSC::BytecodeGenerator::emitTDZCheck): (JSC::BytecodeGenerator::emitNewObject): (JSC::BytecodeGenerator::emitNewArrayBuffer): (JSC::BytecodeGenerator::emitNewArray): (JSC::BytecodeGenerator::emitNewArrayWithSpread): (JSC::BytecodeGenerator::emitNewArrayWithSize): (JSC::BytecodeGenerator::emitNewRegExp): (JSC::BytecodeGenerator::emitNewFunctionExpressionCommon): (JSC::BytecodeGenerator::emitNewDefaultConstructor): (JSC::BytecodeGenerator::emitNewFunction): (JSC::BytecodeGenerator::emitSetFunctionNameIfNeeded): (JSC::BytecodeGenerator::emitCall): (JSC::BytecodeGenerator::emitCallInTailPosition): (JSC::BytecodeGenerator::emitCallEval): (JSC::BytecodeGenerator::emitExpectedFunctionSnippet): (JSC::BytecodeGenerator::emitCallVarargs): (JSC::BytecodeGenerator::emitCallVarargsInTailPosition): (JSC::BytecodeGenerator::emitConstructVarargs): (JSC::BytecodeGenerator::emitCallForwardArgumentsInTailPosition): (JSC::BytecodeGenerator::emitLogShadowChickenPrologueIfNecessary): (JSC::BytecodeGenerator::emitLogShadowChickenTailIfNecessary): (JSC::BytecodeGenerator::emitCallDefineProperty): (JSC::BytecodeGenerator::emitReturn): (JSC::BytecodeGenerator::emitEnd): (JSC::BytecodeGenerator::emitConstruct): (JSC::BytecodeGenerator::emitStrcat): (JSC::BytecodeGenerator::emitToPrimitive): (JSC::BytecodeGenerator::emitGetScope): (JSC::BytecodeGenerator::emitPushWithScope): (JSC::BytecodeGenerator::emitGetParentScope): (JSC::BytecodeGenerator::emitDebugHook): (JSC::BytecodeGenerator::emitCatch): (JSC::BytecodeGenerator::emitThrow): (JSC::BytecodeGenerator::emitArgumentCount): (JSC::BytecodeGenerator::emitThrowStaticError): (JSC::BytecodeGenerator::beginSwitch): (JSC::prepareJumpTableForSwitch): (JSC::prepareJumpTableForStringSwitch): (JSC::BytecodeGenerator::endSwitch): (JSC::BytecodeGenerator::emitGetEnumerableLength): (JSC::BytecodeGenerator::emitHasGenericProperty): (JSC::BytecodeGenerator::emitHasIndexedProperty): (JSC::BytecodeGenerator::emitHasStructureProperty): (JSC::BytecodeGenerator::emitGetPropertyEnumerator): (JSC::BytecodeGenerator::emitEnumeratorStructurePropertyName): (JSC::BytecodeGenerator::emitEnumeratorGenericPropertyName): (JSC::BytecodeGenerator::emitToIndexString): (JSC::BytecodeGenerator::emitIsCellWithType): (JSC::BytecodeGenerator::emitIsObject): (JSC::BytecodeGenerator::emitIsNumber): (JSC::BytecodeGenerator::emitIsUndefined): (JSC::BytecodeGenerator::emitIsEmpty): (JSC::BytecodeGenerator::emitRestParameter): (JSC::BytecodeGenerator::emitRequireObjectCoercible): (JSC::BytecodeGenerator::emitYieldPoint): (JSC::BytecodeGenerator::emitYield): (JSC::BytecodeGenerator::emitGetAsyncIterator): (JSC::BytecodeGenerator::emitDelegateYield): (JSC::BytecodeGenerator::emitFinallyCompletion): (JSC::BytecodeGenerator::emitJumpIf): (JSC::ForInContext::finalize): (JSC::StructureForInContext::finalize): (JSC::IndexedForInContext::finalize): (JSC::StaticPropertyAnalysis::record): (JSC::BytecodeGenerator::emitToThis): * bytecompiler/BytecodeGenerator.h: (JSC::StructureForInContext::addGetInst): (JSC::BytecodeGenerator::recordOpcode): (JSC::BytecodeGenerator::addMetadataFor): (JSC::BytecodeGenerator::emitUnaryOp): (JSC::BytecodeGenerator::kill): (JSC::BytecodeGenerator::instructions const): (JSC::BytecodeGenerator::write): (JSC::BytecodeGenerator::withWriter): * bytecompiler/Label.h: (JSC::Label::Label): (JSC::Label::bind): * bytecompiler/NodesCodegen.cpp: (JSC::ArrayNode::emitBytecode): (JSC::BytecodeIntrinsicNode::emit_intrinsic_argumentCount): (JSC::ApplyFunctionCallDotNode::emitBytecode): (JSC::BitwiseNotNode::emitBytecode): (JSC::BinaryOpNode::emitBytecode): (JSC::EqualNode::emitBytecode): (JSC::StrictEqualNode::emitBytecode): (JSC::emitReadModifyAssignment): (JSC::ForInNode::emitBytecode): (JSC::CaseBlockNode::emitBytecodeForBlock): (JSC::FunctionNode::emitBytecode): (JSC::ClassExprNode::emitBytecode): * bytecompiler/ProfileTypeBytecodeFlag.cpp: Copied from Source/JavaScriptCore/bytecode/VirtualRegister.cpp. (WTF::printInternal): * bytecompiler/ProfileTypeBytecodeFlag.h: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. * bytecompiler/RegisterID.h: * bytecompiler/StaticPropertyAnalysis.h: (JSC::StaticPropertyAnalysis::create): (JSC::StaticPropertyAnalysis::StaticPropertyAnalysis): * bytecompiler/StaticPropertyAnalyzer.h: (JSC::StaticPropertyAnalyzer::createThis): (JSC::StaticPropertyAnalyzer::newObject): (JSC::StaticPropertyAnalyzer::putById): (JSC::StaticPropertyAnalyzer::mov): (JSC::StaticPropertyAnalyzer::kill): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::addCall): (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::getArrayMode): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleVarargsCall): (JSC::DFG::ByteCodeParser::handleRecursiveTailCall): (JSC::DFG::ByteCodeParser::inlineCall): (JSC::DFG::ByteCodeParser::handleCallVariant): (JSC::DFG::ByteCodeParser::handleVarargsInlining): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::handleMinMax): (JSC::DFG::ByteCodeParser::handleIntrinsicCall): (JSC::DFG::ByteCodeParser::handleDOMJITCall): (JSC::DFG::ByteCodeParser::handleIntrinsicGetter): (JSC::DFG::ByteCodeParser::handleDOMJITGetter): (JSC::DFG::ByteCodeParser::handleModuleNamespaceLoad): (JSC::DFG::ByteCodeParser::handleTypedArrayConstructor): (JSC::DFG::ByteCodeParser::handleConstantInternalFunction): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::handlePutById): (JSC::DFG::ByteCodeParser::parseGetById): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::handlePutByVal): (JSC::DFG::ByteCodeParser::handlePutAccessorById): (JSC::DFG::ByteCodeParser::handlePutAccessorByVal): (JSC::DFG::ByteCodeParser::handleNewFunc): (JSC::DFG::ByteCodeParser::handleNewFuncExp): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCapabilities.cpp: (JSC::DFG::capabilityLevel): * dfg/DFGCapabilities.h: (JSC::DFG::capabilityLevel): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareCatchOSREntry): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileValueAdd): (JSC::DFG::SpeculativeJIT::compileValueSub): (JSC::DFG::SpeculativeJIT::compileValueNegate): (JSC::DFG::SpeculativeJIT::compileArithMul): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileValueAdd): (JSC::FTL::DFG::LowerDFGToB3::compileValueSub): (JSC::FTL::DFG::LowerDFGToB3::compileUnaryMathIC): (JSC::FTL::DFG::LowerDFGToB3::compileBinaryMathIC): (JSC::FTL::DFG::LowerDFGToB3::compileArithAddOrSub): (JSC::FTL::DFG::LowerDFGToB3::compileArithMul): (JSC::FTL::DFG::LowerDFGToB3::compileValueNegate): * ftl/FTLOperations.cpp: (JSC::FTL::operationMaterializeObjectInOSR): * generate-bytecode-files: Removed. * generator/Argument.rb: Added. * generator/Assertion.rb: Added. * generator/DSL.rb: Added. * generator/Fits.rb: Added. * generator/GeneratedFile.rb: Added. * generator/Metadata.rb: Added. * generator/Opcode.rb: Added. * generator/OpcodeGroup.rb: Added. * generator/Options.rb: Added. * generator/Section.rb: Added. * generator/Template.rb: Added. * generator/Type.rb: Added. * generator/main.rb: Added. * interpreter/AbstractPC.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::currentVPC const): (JSC::CallFrame::setCurrentVPC): * interpreter/CallFrame.h: (JSC::CallSiteIndex::CallSiteIndex): (JSC::ExecState::setReturnPC): * interpreter/Interpreter.cpp: (WTF::printInternal): * interpreter/Interpreter.h: * interpreter/InterpreterInlines.h: * interpreter/StackVisitor.cpp: (JSC::StackVisitor::Frame::dump const): * interpreter/VMEntryRecord.h: * jit/JIT.cpp: (JSC::JIT::JIT): (JSC::JIT::emitSlowCaseCall): (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::compileWithoutLinking): (JSC::JIT::link): * jit/JIT.h: * jit/JITArithmetic.cpp: (JSC::JIT::emit_op_jless): (JSC::JIT::emit_op_jlesseq): (JSC::JIT::emit_op_jgreater): (JSC::JIT::emit_op_jgreatereq): (JSC::JIT::emit_op_jnless): (JSC::JIT::emit_op_jnlesseq): (JSC::JIT::emit_op_jngreater): (JSC::JIT::emit_op_jngreatereq): (JSC::JIT::emitSlow_op_jless): (JSC::JIT::emitSlow_op_jlesseq): (JSC::JIT::emitSlow_op_jgreater): (JSC::JIT::emitSlow_op_jgreatereq): (JSC::JIT::emitSlow_op_jnless): (JSC::JIT::emitSlow_op_jnlesseq): (JSC::JIT::emitSlow_op_jngreater): (JSC::JIT::emitSlow_op_jngreatereq): (JSC::JIT::emit_op_below): (JSC::JIT::emit_op_beloweq): (JSC::JIT::emit_op_jbelow): (JSC::JIT::emit_op_jbeloweq): (JSC::JIT::emit_op_unsigned): (JSC::JIT::emit_compareAndJump): (JSC::JIT::emit_compareUnsignedAndJump): (JSC::JIT::emit_compareUnsigned): (JSC::JIT::emit_compareAndJumpSlow): (JSC::JIT::emit_op_inc): (JSC::JIT::emit_op_dec): (JSC::JIT::emit_op_mod): (JSC::JIT::emitSlow_op_mod): (JSC::JIT::emit_op_negate): (JSC::JIT::emitSlow_op_negate): (JSC::JIT::emitBitBinaryOpFastPath): (JSC::JIT::emit_op_bitand): (JSC::JIT::emit_op_bitor): (JSC::JIT::emit_op_bitxor): (JSC::JIT::emit_op_lshift): (JSC::JIT::emitRightShiftFastPath): (JSC::JIT::emit_op_rshift): (JSC::JIT::emit_op_urshift): (JSC::getOperandTypes): (JSC::JIT::emit_op_add): (JSC::JIT::emitSlow_op_add): (JSC::JIT::emitMathICFast): (JSC::JIT::emitMathICSlow): (JSC::JIT::emit_op_div): (JSC::JIT::emit_op_mul): (JSC::JIT::emitSlow_op_mul): (JSC::JIT::emit_op_sub): (JSC::JIT::emitSlow_op_sub): * jit/JITCall.cpp: (JSC::JIT::emitPutCallResult): (JSC::JIT::compileSetupFrame): (JSC::JIT::compileCallEval): (JSC::JIT::compileCallEvalSlowCase): (JSC::JIT::compileTailCall): (JSC::JIT::compileOpCall): (JSC::JIT::compileOpCallSlowCase): (JSC::JIT::emit_op_call): (JSC::JIT::emit_op_tail_call): (JSC::JIT::emit_op_call_eval): (JSC::JIT::emit_op_call_varargs): (JSC::JIT::emit_op_tail_call_varargs): (JSC::JIT::emit_op_tail_call_forward_arguments): (JSC::JIT::emit_op_construct_varargs): (JSC::JIT::emit_op_construct): (JSC::JIT::emitSlow_op_call): (JSC::JIT::emitSlow_op_tail_call): (JSC::JIT::emitSlow_op_call_eval): (JSC::JIT::emitSlow_op_call_varargs): (JSC::JIT::emitSlow_op_tail_call_varargs): (JSC::JIT::emitSlow_op_tail_call_forward_arguments): (JSC::JIT::emitSlow_op_construct_varargs): (JSC::JIT::emitSlow_op_construct): * jit/JITDisassembler.cpp: (JSC::JITDisassembler::JITDisassembler): * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITInlines.h: (JSC::JIT::emitDoubleGetByVal): (JSC::JIT::emitLoadForArrayMode): (JSC::JIT::emitContiguousGetByVal): (JSC::JIT::emitArrayStorageGetByVal): (JSC::JIT::appendCallWithExceptionCheckSetJSValueResultWithProfile): (JSC::JIT::sampleInstruction): (JSC::JIT::emitValueProfilingSiteIfProfiledOpcode): (JSC::JIT::emitValueProfilingSite): (JSC::JIT::jumpTarget): (JSC::JIT::copiedGetPutInfo): (JSC::JIT::copiedArithProfile): * jit/JITMathIC.h: (JSC::isProfileEmpty): (JSC::JITBinaryMathIC::JITBinaryMathIC): (JSC::JITUnaryMathIC::JITUnaryMathIC): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_mov): (JSC::JIT::emit_op_end): (JSC::JIT::emit_op_jmp): (JSC::JIT::emit_op_new_object): (JSC::JIT::emitSlow_op_new_object): (JSC::JIT::emit_op_overrides_has_instance): (JSC::JIT::emit_op_instanceof): (JSC::JIT::emitSlow_op_instanceof): (JSC::JIT::emit_op_instanceof_custom): (JSC::JIT::emit_op_is_empty): (JSC::JIT::emit_op_is_undefined): (JSC::JIT::emit_op_is_boolean): (JSC::JIT::emit_op_is_number): (JSC::JIT::emit_op_is_cell_with_type): (JSC::JIT::emit_op_is_object): (JSC::JIT::emit_op_ret): (JSC::JIT::emit_op_to_primitive): (JSC::JIT::emit_op_set_function_name): (JSC::JIT::emit_op_not): (JSC::JIT::emit_op_jfalse): (JSC::JIT::emit_op_jeq_null): (JSC::JIT::emit_op_jneq_null): (JSC::JIT::emit_op_jneq_ptr): (JSC::JIT::emit_op_eq): (JSC::JIT::emit_op_jeq): (JSC::JIT::emit_op_jtrue): (JSC::JIT::emit_op_neq): (JSC::JIT::emit_op_jneq): (JSC::JIT::emit_op_throw): (JSC::JIT::compileOpStrictEq): (JSC::JIT::emit_op_stricteq): (JSC::JIT::emit_op_nstricteq): (JSC::JIT::compileOpStrictEqJump): (JSC::JIT::emit_op_jstricteq): (JSC::JIT::emit_op_jnstricteq): (JSC::JIT::emitSlow_op_jstricteq): (JSC::JIT::emitSlow_op_jnstricteq): (JSC::JIT::emit_op_to_number): (JSC::JIT::emit_op_to_string): (JSC::JIT::emit_op_to_object): (JSC::JIT::emit_op_catch): (JSC::JIT::emit_op_identity_with_profile): (JSC::JIT::emit_op_get_parent_scope): (JSC::JIT::emit_op_switch_imm): (JSC::JIT::emit_op_switch_char): (JSC::JIT::emit_op_switch_string): (JSC::JIT::emit_op_debug): (JSC::JIT::emit_op_eq_null): (JSC::JIT::emit_op_neq_null): (JSC::JIT::emit_op_enter): (JSC::JIT::emit_op_get_scope): (JSC::JIT::emit_op_to_this): (JSC::JIT::emit_op_create_this): (JSC::JIT::emit_op_check_tdz): (JSC::JIT::emitSlow_op_eq): (JSC::JIT::emitSlow_op_neq): (JSC::JIT::emitSlow_op_jeq): (JSC::JIT::emitSlow_op_jneq): (JSC::JIT::emitSlow_op_instanceof_custom): (JSC::JIT::emit_op_loop_hint): (JSC::JIT::emitSlow_op_loop_hint): (JSC::JIT::emit_op_check_traps): (JSC::JIT::emit_op_nop): (JSC::JIT::emit_op_super_sampler_begin): (JSC::JIT::emit_op_super_sampler_end): (JSC::JIT::emitSlow_op_check_traps): (JSC::JIT::emit_op_new_regexp): (JSC::JIT::emitNewFuncCommon): (JSC::JIT::emit_op_new_func): (JSC::JIT::emit_op_new_generator_func): (JSC::JIT::emit_op_new_async_generator_func): (JSC::JIT::emit_op_new_async_func): (JSC::JIT::emitNewFuncExprCommon): (JSC::JIT::emit_op_new_func_exp): (JSC::JIT::emit_op_new_generator_func_exp): (JSC::JIT::emit_op_new_async_func_exp): (JSC::JIT::emit_op_new_async_generator_func_exp): (JSC::JIT::emit_op_new_array): (JSC::JIT::emit_op_new_array_with_size): (JSC::JIT::emit_op_has_structure_property): (JSC::JIT::privateCompileHasIndexedProperty): (JSC::JIT::emit_op_has_indexed_property): (JSC::JIT::emitSlow_op_has_indexed_property): (JSC::JIT::emit_op_get_direct_pname): (JSC::JIT::emit_op_enumerator_structure_pname): (JSC::JIT::emit_op_enumerator_generic_pname): (JSC::JIT::emit_op_profile_type): (JSC::JIT::emit_op_log_shadow_chicken_prologue): (JSC::JIT::emit_op_log_shadow_chicken_tail): (JSC::JIT::emit_op_profile_control_flow): (JSC::JIT::emit_op_argument_count): (JSC::JIT::emit_op_get_rest_length): (JSC::JIT::emit_op_get_argument): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_to_this): * jit/JITOperations.cpp: * jit/JITOperations.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_get_by_val): (JSC::JIT::emitGetByValWithCachedId): (JSC::JIT::emitSlow_op_get_by_val): (JSC::JIT::emit_op_put_by_val_direct): (JSC::JIT::emit_op_put_by_val): (JSC::JIT::emitGenericContiguousPutByVal): (JSC::JIT::emitArrayStoragePutByVal): (JSC::JIT::emitPutByValWithCachedId): (JSC::JIT::emitSlow_op_put_by_val): (JSC::JIT::emit_op_put_getter_by_id): (JSC::JIT::emit_op_put_setter_by_id): (JSC::JIT::emit_op_put_getter_setter_by_id): (JSC::JIT::emit_op_put_getter_by_val): (JSC::JIT::emit_op_put_setter_by_val): (JSC::JIT::emit_op_del_by_id): (JSC::JIT::emit_op_del_by_val): (JSC::JIT::emit_op_try_get_by_id): (JSC::JIT::emitSlow_op_try_get_by_id): (JSC::JIT::emit_op_get_by_id_direct): (JSC::JIT::emitSlow_op_get_by_id_direct): (JSC::JIT::emit_op_get_by_id): (JSC::JIT::emit_op_get_by_id_with_this): (JSC::JIT::emitSlow_op_get_by_id): (JSC::JIT::emitSlow_op_get_by_id_with_this): (JSC::JIT::emit_op_put_by_id): (JSC::JIT::emitSlow_op_put_by_id): (JSC::JIT::emit_op_in_by_id): (JSC::JIT::emitSlow_op_in_by_id): (JSC::JIT::emit_op_resolve_scope): (JSC::JIT::emit_op_get_from_scope): (JSC::JIT::emitSlow_op_get_from_scope): (JSC::JIT::emit_op_put_to_scope): (JSC::JIT::emitSlow_op_put_to_scope): (JSC::JIT::emit_op_get_from_arguments): (JSC::JIT::emit_op_put_to_arguments): (JSC::JIT::privateCompileGetByVal): (JSC::JIT::privateCompileGetByValWithCachedId): (JSC::JIT::privateCompilePutByVal): (JSC::JIT::privateCompilePutByValWithCachedId): (JSC::JIT::emitDoubleLoad): (JSC::JIT::emitContiguousLoad): (JSC::JIT::emitArrayStorageLoad): (JSC::JIT::emitDirectArgumentsGetByVal): (JSC::JIT::emitScopedArgumentsGetByVal): (JSC::JIT::emitIntTypedArrayGetByVal): (JSC::JIT::emitFloatTypedArrayGetByVal): (JSC::JIT::emitIntTypedArrayPutByVal): (JSC::JIT::emitFloatTypedArrayPutByVal): * jit/RegisterSet.cpp: (JSC::RegisterSet::llintBaselineCalleeSaveRegisters): * jit/SlowPathCall.h: (JSC::JITSlowPathCall::JITSlowPathCall): * llint/LLIntData.cpp: (JSC::LLInt::initialize): (JSC::LLInt::Data::performAssertions): * llint/LLIntData.h: (JSC::LLInt::exceptionInstructions): (JSC::LLInt::opcodeMap): (JSC::LLInt::opcodeMapWide): (JSC::LLInt::getOpcode): (JSC::LLInt::getOpcodeWide): (JSC::LLInt::getWideCodePtr): * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::llint_trace_operand): (JSC::LLInt::llint_trace_value): (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::entryOSR): (JSC::LLInt::setupGetByIdPrototypeCache): (JSC::LLInt::getByVal): (JSC::LLInt::handleHostCall): (JSC::LLInt::setUpCall): (JSC::LLInt::genericCall): (JSC::LLInt::varargsSetup): (JSC::LLInt::commonCallEval): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter.cpp: (JSC::CLoopRegister::operator const Instruction*): (JSC::CLoop::execute): * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * offlineasm/arm64.rb: * offlineasm/asm.rb: * offlineasm/ast.rb: * offlineasm/cloop.rb: * offlineasm/generate_offset_extractor.rb: * offlineasm/instructions.rb: * offlineasm/offsets.rb: * offlineasm/parser.rb: * offlineasm/transform.rb: * offlineasm/x86.rb: * parser/ResultType.h: (JSC::ResultType::dump const): (JSC::OperandTypes::first const): (JSC::OperandTypes::second const): (JSC::OperandTypes::dump const): * profiler/ProfilerBytecodeSequence.cpp: (JSC::Profiler::BytecodeSequence::BytecodeSequence): * runtime/CommonSlowPaths.cpp: (JSC::SLOW_PATH_DECL): (JSC::updateArithProfileForUnaryArithOp): (JSC::updateArithProfileForBinaryArithOp): * runtime/CommonSlowPaths.h: (JSC::CommonSlowPaths::tryCachePutToScopeGlobal): (JSC::CommonSlowPaths::tryCacheGetFromScopeGlobal): * runtime/ExceptionFuzz.cpp: (JSC::doExceptionFuzzing): * runtime/ExceptionFuzz.h: (JSC::doExceptionFuzzingIfEnabled): * runtime/GetPutInfo.cpp: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. (JSC::GetPutInfo::dump const): (WTF::printInternal): * runtime/GetPutInfo.h: (JSC::GetPutInfo::operand const): * runtime/JSCPoison.h: * runtime/JSType.cpp: Added. (WTF::printInternal): * runtime/JSType.h: * runtime/SamplingProfiler.cpp: (JSC::SamplingProfiler::StackFrame::displayName): * runtime/SamplingProfiler.h: (JSC::SamplingProfiler::UnprocessedStackFrame::UnprocessedStackFrame): * runtime/SlowPathReturnType.h: (JSC::encodeResult): (JSC::decodeResult): * runtime/VM.h: * runtime/Watchdog.h: * tools/HeapVerifier.cpp: Source/WTF: * wtf/Forward.h: Fix WTF_LAZY_FOR_EACH_TERM on MSVC and add WTF_LAZY_HAS_REST to check whether a macro was passed multiple arguments * wtf/Platform.h: Force ENABLE_JIT=false on all 32-bit platforms * wtf/Vector.h: (WTF::minCapacity>::insertVector): Allow vectors with different overflow handlers to be passed to insertVector Tools: Do not force ENABLE_JIT=true when $forceCLoop is false. * Scripts/build-jsc: LayoutTests: Don't use recursion on `equal` to avoid premature stack overflows when testing deep arrays. * fast/dom/Window/resources/postmessage-test.js: Canonical link: https://commits.webkit.org/205839@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-29 13:16:03 +00:00
bytecode/MetadataTable.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
bytecode/MethodOfGettingAValueProfile.cpp
bytecode/ModuleNamespaceAccessCase.cpp
bytecode/ModuleProgramCodeBlock.cpp
bytecode/ObjectPropertyCondition.cpp
bytecode/ObjectPropertyConditionSet.cpp
bytecode/Opcode.cpp
bytecode/ParseHash.cpp
Implement polymorphic prototypes https://bugs.webkit.org/show_bug.cgi?id=176391 Reviewed by Filip Pizlo. JSTests: * microbenchmarks/poly-proto-access.js: Added. (assert): (foo.C): (foo.C.prototype.get bar): (foo): (bar): * microbenchmarks/poly-proto-put-transition-speed.js: Added. (assert): (makePolyProtoObject.foo.C): (makePolyProtoObject.foo): (makePolyProtoObject): (performSet): * microbenchmarks/poly-proto-setter-speed.js: Added. (assert): (makePolyProtoObject.foo.C): (makePolyProtoObject.foo.C.prototype.set p): (makePolyProtoObject.foo): (makePolyProtoObject): (performSet): * stress/constructor-with-return.js: (i.tests.forEach.Constructor): (i.tests.forEach): (tests.forEach.Constructor): Deleted. (tests.forEach): Deleted. * stress/dom-jit-with-poly-proto.js: Added. (assert): (makePolyProtoObject.foo.C): (makePolyProtoObject.foo): (makePolyProtoObject): (validate): * stress/poly-proto-custom-value-and-accessor.js: Added. (assert): (makePolyProtoObject.foo.C): (makePolyProtoObject.foo): (makePolyProtoObject): (items.forEach): (set get for): * stress/poly-proto-intrinsic-getter-correctness.js: Added. (assert): (makePolyProtoObject.foo.C): (makePolyProtoObject.foo): (makePolyProtoObject): (foo): * stress/poly-proto-miss.js: Added. (makePolyProtoInstanceWithNullPrototype.foo.C): (makePolyProtoInstanceWithNullPrototype.foo): (makePolyProtoInstanceWithNullPrototype): (assert): (validate): * stress/poly-proto-op-in-caching.js: Added. (assert): (makePolyProtoObject.foo.C): (makePolyProtoObject.foo): (makePolyProtoObject): (validate): (validate2): * stress/poly-proto-put-transition.js: Added. (assert): (makePolyProtoObject.foo.C): (makePolyProtoObject.foo): (makePolyProtoObject): (performSet): (i.obj.__proto__.set p): * stress/poly-proto-set-prototype.js: Added. (assert): (let.alternateProto.get x): (let.alternateProto2.get y): (let.alternateProto2.get x): (foo.C): (foo): (validate): * stress/poly-proto-setter.js: Added. (assert): (makePolyProtoObject.foo.C): (makePolyProtoObject.foo.C.prototype.set p): (makePolyProtoObject.foo.C.prototype.get p): (makePolyProtoObject.foo): (makePolyProtoObject): (performSet): * stress/poly-proto-using-inheritance.js: Added. (assert): (foo.C): (foo.C.prototype.get baz): (foo): (bar.C): (bar): (validate): * stress/primitive-poly-proto.js: Added. (makePolyProtoInstance.foo.C): (makePolyProtoInstance.foo): (makePolyProtoInstance): (assert): (validate): * stress/prototype-is-not-js-object.js: Added. (foo.bar): (foo): (assert): (validate): * stress/try-get-by-id-poly-proto.js: Added. (assert): (makePolyProtoObject.foo.C): (makePolyProtoObject.foo): (makePolyProtoObject): (tryGetByIdText): (x.__proto__.get bar): (validate): * typeProfiler/overflow.js: Source/JavaScriptCore: This patch changes JSC's object model with respect to where the prototype of an object is stored. Previously, it was always stored as a constant value inside Structure. So an object's structure used to always tell you what its prototype is. Anytime an object changed its prototype, it would do a structure transition. This enables a large class of optimizations: just by doing a structure check, we know what the prototype is. However, this design falls down when you have many objects that have the same shape, but only differ in what their prototype value is. This arises in many JS programs. A simple, and probably common, example is when the program has a constructor inside of a function: ``` function foo() { class C { constructor() { this.field1 = 42; ...; this.fieldN = 42; } method1() { doStuffWith(this.field); } method2() { doStuffWith(this.field); } } let c = new C; do things with c; } repeatedly call foo() here. ``` Before this patch, in the above program, each time `new C` created an object, it would create an object with a different structure. The reason for this is that each time foo is called, there is a new instance of C.prototype. However, each `new C` that was created with have identical shape sans its prototype value. This would cause all ICs that used `c` to quickly give up on any form of caching because they would see too many structures and give up and permanently divert control flow to the slow path. This patch fixes this issue by expanding the notion of where the prototype of an object is stored. There are now two notions of where the prototype is stored. A Structure can now be in two modes: 1. Mono proto mode. This is the same mode as we used to have. It means the structure itself has a constant prototype value. 2. Poly proto mode. This means the structure knows nothing about the prototype value itself. Objects with this structure store their prototype in normal object field storage. The structure will tell you the offset of this prototype inside the object's storage. As of today, we only reserve inline slots for the prototype field because poly proto only occurs for JSFinalObject. However, this will be expanded to support out of line offsets in a future patch when we extend poly proto to work when we inherit from builtin types like Map and Array. In this initial patch, we do poly proto style inline caching whenever we see an object that is poly proto or if an object in its prototype lookup chain is poly proto. Poly proto ICs work by verifying the lookup chain at runtime. This essentially boils down to performing structure checks up the prototype chain. In a future patch, we're going to extend object property condition set to work with objects that don't have poly proto bases. Initially, accesses that have poly proto access chains will always turn into GetById/PutById in the DFG. In a future patch, I'm going to teach the DFG how to inline certain accesses that have poly proto in the access chain. One of most interesting parts about this patch is how we decide when to go poly proto. This patch uses a profiling based approach. An IC will inform a watchpoint that it sees an opportunity when two Structure's are structurally the same, sans the base object's prototype. This means that two structures have equivalent shapes all the way up the prototype chain. To support fast structural comparison, we compute a hash for a structure based on the properties it has. We compute this hash as we add properties to the structure. This computation is nearly free since we always add UniquedStringImpl*'s which already have their hashes computed. To compare structural equivalence, we just compare hash values all the way up the prototype chain. This means we can get hash conflicts between two structures, but it's extremely rare. First, it'll be rare for two structures to have the same hash. Secondly, we only consider structures originating from the same executable. How we set up this poly proto watchpoint is crucial to its design. When we create_this an object originating from some executable, that executable will create a Box<InlineWatchpointSet>. Each structure that originates from this executable will get a copy of that Box<InlineWatchpointSet>. As that structure transitions to new structures, they too will get a copy of that Box<InilneWatchpointSet>. Therefore, when invalidating an arbitrary structure's poly proto watchpoint, we will know the next time we create_this from that executable that it had been invalidated, and that we should create an object with a poly proto structure. We also use the pointer value of this Box<InlineWatchpointSet> to determine if two structures originated from the same executable. This pruning will severely limit the chances of getting a hash conflict in practice. This patch is neutral on my MBP on traditional JS benchmarks like Octane/Kraken/Sunspider. It may be a 1-2% ARES-6 progression. This patch is between neutral and a 9x progression on the various tests I added. Most of the microbenchmarks are progressed by at least 50%. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/BuiltinNames.cpp: * builtins/BuiltinNames.h: (JSC::BuiltinNames::BuiltinNames): (JSC::BuiltinNames::underscoreProtoPrivateName const): * bytecode/AccessCase.cpp: (JSC::AccessCase::AccessCase): (JSC::AccessCase::create): (JSC::AccessCase::commit): (JSC::AccessCase::guardedByStructureCheck const): (JSC::AccessCase::canReplace const): (JSC::AccessCase::dump const): (JSC::AccessCase::visitWeak const): (JSC::AccessCase::propagateTransitions const): (JSC::AccessCase::generateWithGuard): (JSC::AccessCase::generateImpl): * bytecode/AccessCase.h: (JSC::AccessCase::usesPolyProto const): (JSC::AccessCase::AccessCase): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finishCreation): * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::computeForStubInfoWithoutExitSiteFeedback): * bytecode/GetterSetterAccessCase.cpp: (JSC::GetterSetterAccessCase::GetterSetterAccessCase): (JSC::GetterSetterAccessCase::create): * bytecode/GetterSetterAccessCase.h: * bytecode/InternalFunctionAllocationProfile.h: (JSC::InternalFunctionAllocationProfile::createAllocationStructureFromBase): * bytecode/IntrinsicGetterAccessCase.cpp: (JSC::IntrinsicGetterAccessCase::IntrinsicGetterAccessCase): * bytecode/IntrinsicGetterAccessCase.h: * bytecode/ModuleNamespaceAccessCase.cpp: (JSC::ModuleNamespaceAccessCase::ModuleNamespaceAccessCase): * bytecode/ObjectAllocationProfile.cpp: Added. (JSC::ObjectAllocationProfile::initializeProfile): (JSC::ObjectAllocationProfile::possibleDefaultPropertyCount): * bytecode/ObjectAllocationProfile.h: (JSC::ObjectAllocationProfile::clear): (JSC::ObjectAllocationProfile::initialize): Deleted. (JSC::ObjectAllocationProfile::possibleDefaultPropertyCount): Deleted. * bytecode/ObjectPropertyConditionSet.cpp: * bytecode/PolyProtoAccessChain.cpp: Added. (JSC::PolyProtoAccessChain::create): (JSC::PolyProtoAccessChain::needImpurePropertyWatchpoint const): (JSC::PolyProtoAccessChain::operator== const): (JSC::PolyProtoAccessChain::dump const): * bytecode/PolyProtoAccessChain.h: Added. (JSC::PolyProtoAccessChain::clone): (JSC::PolyProtoAccessChain:: const): (JSC::PolyProtoAccessChain::operator!= const): (JSC::PolyProtoAccessChain::forEach const): * bytecode/PolymorphicAccess.cpp: (JSC::PolymorphicAccess::addCases): (JSC::PolymorphicAccess::regenerate): (WTF::printInternal): * bytecode/PolymorphicAccess.h: (JSC::AccessGenerationResult::shouldResetStub const): (JSC::AccessGenerationState::AccessGenerationState): * bytecode/PropertyCondition.cpp: (JSC::PropertyCondition::isStillValidAssumingImpurePropertyWatchpoint const): * bytecode/ProxyableAccessCase.cpp: (JSC::ProxyableAccessCase::ProxyableAccessCase): (JSC::ProxyableAccessCase::create): * bytecode/ProxyableAccessCase.h: * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::computeForStubInfo): * bytecode/StructureStubInfo.cpp: (JSC::StructureStubInfo::addAccessCase): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::load): (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::canDoFastSpread): * dfg/DFGOperations.cpp: * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileInstanceOfForObject): (JSC::DFG::SpeculativeJIT::compileInstanceOf): * dfg/DFGSpeculativeJIT.h: * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileInstanceOf): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_instanceof): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_instanceof): * jit/Repatch.cpp: (JSC::tryCacheGetByID): (JSC::tryCachePutByID): (JSC::tryRepatchIn): * jsc.cpp: (WTF::DOMJITGetterBaseJSObject::DOMJITGetterBaseJSObject): (WTF::DOMJITGetterBaseJSObject::createStructure): (WTF::DOMJITGetterBaseJSObject::create): (WTF::DOMJITGetterBaseJSObject::DOMJITAttribute::DOMJITAttribute): (WTF::DOMJITGetterBaseJSObject::DOMJITAttribute::slowCall): (WTF::DOMJITGetterBaseJSObject::DOMJITAttribute::callDOMGetter): (WTF::DOMJITGetterBaseJSObject::customGetter): (WTF::DOMJITGetterBaseJSObject::finishCreation): (GlobalObject::finishCreation): (functionCreateDOMJITGetterBaseJSObject): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * runtime/ArrayPrototype.cpp: (JSC::holesMustForwardToPrototype): (JSC::fastJoin): (JSC::arrayProtoFuncReverse): (JSC::moveElements): * runtime/ClonedArguments.cpp: (JSC::ClonedArguments::createEmpty): (JSC::ClonedArguments::createWithInlineFrame): (JSC::ClonedArguments::createWithMachineFrame): (JSC::ClonedArguments::createByCopyingFrom): * runtime/CommonSlowPaths.cpp: (JSC::SLOW_PATH_DECL): * runtime/FunctionExecutable.cpp: (JSC::FunctionExecutable::visitChildren): * runtime/FunctionExecutable.h: * runtime/FunctionRareData.cpp: (JSC::FunctionRareData::initializeObjectAllocationProfile): * runtime/FunctionRareData.h: * runtime/InternalFunction.cpp: (JSC::InternalFunction::createSubclassStructureSlow): * runtime/JSArray.cpp: (JSC::JSArray::fastSlice): (JSC::JSArray::shiftCountWithArrayStorage): (JSC::JSArray::shiftCountWithAnyIndexingType): (JSC::JSArray::isIteratorProtocolFastAndNonObservable): * runtime/JSArrayInlines.h: (JSC::JSArray::canFastCopy): * runtime/JSCJSValue.cpp: (JSC::JSValue::dumpInContextAssumingStructure const): * runtime/JSFunction.cpp: (JSC::JSFunction::prototypeForConstruction): (JSC::JSFunction::allocateAndInitializeRareData): (JSC::JSFunction::initializeRareData): (JSC::JSFunction::getOwnPropertySlot): * runtime/JSFunction.h: * runtime/JSMap.cpp: (JSC::JSMap::isIteratorProtocolFastAndNonObservable): (JSC::JSMap::canCloneFastAndNonObservable): * runtime/JSObject.cpp: (JSC::JSObject::putInlineSlow): (JSC::JSObject::createInitialIndexedStorage): (JSC::JSObject::createArrayStorage): (JSC::JSObject::convertUndecidedToArrayStorage): (JSC::JSObject::convertInt32ToArrayStorage): (JSC::JSObject::convertDoubleToArrayStorage): (JSC::JSObject::convertContiguousToArrayStorage): (JSC::JSObject::ensureInt32Slow): (JSC::JSObject::ensureDoubleSlow): (JSC::JSObject::ensureContiguousSlow): (JSC::JSObject::ensureArrayStorageSlow): (JSC::JSObject::setPrototypeDirect): (JSC::JSObject::ordinaryToPrimitive const): (JSC::JSObject::putByIndexBeyondVectorLength): (JSC::JSObject::putDirectIndexSlowOrBeyondVectorLength): (JSC::JSObject::getEnumerableLength): (JSC::JSObject::anyObjectInChainMayInterceptIndexedAccesses const): (JSC::JSObject::prototypeChainMayInterceptStoreTo): (JSC::JSObject::needsSlowPutIndexing const): (JSC::JSObject::suggestedArrayStorageTransition const): * runtime/JSObject.h: (JSC::JSObject::finishCreation): (JSC::JSObject::getPrototypeDirect const): (JSC::JSObject::getPropertySlot): * runtime/JSObjectInlines.h: (JSC::JSObject::getPropertySlot): (JSC::JSObject::getNonIndexPropertySlot): (JSC::JSObject::putInlineForJSObject): * runtime/JSPropertyNameEnumerator.h: (JSC::propertyNameEnumerator): * runtime/JSSet.cpp: (JSC::JSSet::isIteratorProtocolFastAndNonObservable): (JSC::JSSet::canCloneFastAndNonObservable): * runtime/LazyClassStructure.h: (JSC::LazyClassStructure::prototypeConcurrently const): Deleted. * runtime/Operations.cpp: (JSC::normalizePrototypeChain): * runtime/Operations.h: * runtime/Options.h: * runtime/PrototypeMap.cpp: (JSC::PrototypeMap::createEmptyStructure): (JSC::PrototypeMap::emptyStructureForPrototypeFromBaseStructure): (JSC::PrototypeMap::emptyObjectStructureForPrototype): (JSC::PrototypeMap::clearEmptyObjectStructureForPrototype): * runtime/PrototypeMap.h: * runtime/Structure.cpp: (JSC::Structure::Structure): (JSC::Structure::create): (JSC::Structure::holesMustForwardToPrototype const): (JSC::Structure::changePrototypeTransition): (JSC::Structure::isCheapDuringGC): (JSC::Structure::toStructureShape): (JSC::Structure::dump const): (JSC::Structure::canCachePropertyNameEnumerator const): (JSC::Structure::anyObjectInChainMayInterceptIndexedAccesses const): Deleted. (JSC::Structure::needsSlowPutIndexing const): Deleted. (JSC::Structure::suggestedArrayStorageTransition const): Deleted. (JSC::Structure::prototypeForLookup const): Deleted. (JSC::Structure::prototypeChainMayInterceptStoreTo): Deleted. (JSC::Structure::canUseForAllocationsOf): Deleted. * runtime/Structure.h: * runtime/StructureChain.h: * runtime/StructureInlines.h: (JSC::Structure::create): (JSC::Structure::storedPrototypeObject const): (JSC::Structure::storedPrototypeStructure const): (JSC::Structure::storedPrototype const): (JSC::prototypeForLookupPrimitiveImpl): (JSC::Structure::prototypeForLookup const): (JSC::Structure::prototypeChain const): (JSC::Structure::isValid const): (JSC::Structure::add): (JSC::Structure::setPropertyTable): (JSC::Structure::shouldConvertToPolyProto): * runtime/StructureRareData.h: * runtime/TypeProfilerLog.cpp: (JSC::TypeProfilerLog::processLogEntries): * runtime/TypeSet.cpp: (JSC::TypeSet::addTypeInformation): * runtime/TypeSet.h: * runtime/WriteBarrier.h: (JSC::WriteBarrierBase<Unknown>::isInt32 const): Source/WTF: * wtf/Box.h: (WTF::Box::operator bool const): (WTF::Box::operator bool): Deleted. Make Box movable. Also ensure its operator bool doesn't do an atomic increment. * wtf/RefPtr.h: (WTF::RefPtr::operator bool const): Add `explicit operator bool()` for RefPtr. Tools: * Scripts/run-jsc-stress-tests: Canonical link: https://commits.webkit.org/194106@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222827 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-04 01:53:18 +00:00
bytecode/PolyProtoAccessChain.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
bytecode/PolymorphicAccess.cpp
bytecode/PreciseJumpTargets.cpp
bytecode/ProgramCodeBlock.cpp
bytecode/PropertyCondition.cpp
bytecode/ProxyableAccessCase.cpp
bytecode/PutByIdFlags.cpp
bytecode/PutByIdStatus.cpp
bytecode/PutByIdVariant.cpp
We should support CreateThis in the FTL https://bugs.webkit.org/show_bug.cgi?id=164904 Reviewed by Yusuke Suzuki. JSTests: * microbenchmarks/polyvariant-get-by-id-shorter-tower.js: Added. (polyvariant): (Foo.prototype.func): (Foo): (foo): (Bar.prototype.func): (Bar): (bar): * microbenchmarks/polyvariant-get-by-id-tower.js: Added. (polyvariant): (Foo.prototype.func): (Foo): (foo): (Bar.prototype.func): (Bar): (bar): (Baz.prototype.func): (Baz): (baz): Source/JavaScriptCore: This started with Saam's patch to implement CreateThis in the FTL, but turned into a type inference adventure. CreateThis in the FTL was a massive regression in raytrace because it disturbed that benchmark's extremely perverse way of winning at type inference: - The benchmark wanted polyvariant devirtualization of an object construction helper. But, the polyvariant profiler wasn't powerful enough to reliably devirtualize that code. So, the benchmark was falling back to other mechanisms... - The construction helper could not tier up into the FTL. When the DFG compiled it, it would see that the IC had 4 cases. That's too polymorphic for the DFG. So, the DFG would emit a GetById. Shortly after the DFG compile, that get_by_id would see many more cases, but now that the helper was compiled by the DFG, the baseline get_by_id would not see those cases. The DFG's GetById would "hide" those cases. The number of cases the DFG's GetById would see is larger than our polymorphic list limit (limit = 8, case count = 13, I think). Note that if the FTL compiles that construction helper, it sees the 4 cases, turns them into a MultiGetByOffset, then suffers from exits when the new cases hit, and then exits to baseline, which then sees those cases. Luckily, the FTL was not compiling the construction helper because it had a CreateThis. - Compilations that inlined the construction helper would have gotten super lucky with parse-time constant folding, so they knew what structure the input to the get_by_id would have at parse time. This is only profitable if the get_by_id parsing computed a GetByIdStatus that had a finite number of cases. Because the 13 cases were being hidden by the DFG GetById and GetByIdStatus would only look at the baseline get_by_id, which had 4 cases, we would indeed get a finite number of cases. The parser would then prune those cases to just one - based on its knowledge of the structure - and that would result in that get_by_id being folded at parse time to a constant. - The subsequent op_call would inline based on parse-time knowledge of that constant. This patch comprehensively fixes these issues, as well as other issues that come up along the way. The short version is that raytrace was revealing sloppiness in our use of profiling for type inference. This patch fixes the sloppiness by vastly expanding *polyvariant* profiling, i.e. the profiling that considers call context. I was encouraged to do this by the fact that even the old version of polyvariant profiling was a speed-up on JetStream, ARES-6, and Speedometer 2 (it's easy to measure since it's a runtime flag). So, it seemed worthwhile to attack raytrace's problem as a shortcoming of polyvariant profiling. - Polyvariant profiling now consults every DFG or FTL code block that participated in any subset of the inline stack that includes the IC we're profiling. For example, if we have an inline stack like foo->bar->baz, with baz on top, then we will consult DFG or FTL compilations for foo, bar, and baz. In foo, we'll look up foo->bar->baz; in bar we'll look up bar->baz; etc. This fixes two problems encountered in raytrace. First, it ensures that a DFG GetById cannot hide anything from the profiling of that get_by_id, since the polyvariant profiling code will always consult it. Second, it enables raytrace to benefit from polyvariant profling. Previously, the polyvariant profiler would only look at the previous DFG compilation of foo and look up foo->bar->baz. But that only works if DFG-foo had inlined bar and then baz. It may not have done that, because those calls could have required polyvariant profiling that was only available in the FTL. - A particularly interesting case is when some IC in foo-baseline is also available in foo-DFG. This case is encountered by the polyvariant profiler as it walks the inline stack. In the case of gathering profiling for foo-FTL, the polyvariant profiler finds foo-DFG via the trivial case of no inline stack. This also means that if foo ever gets inlined, we will find foo-DFG or foo-FTL in the final case of polyvariant profiling. In those cases, we now merge the IC of foo-baseline and foo-DFG. This avoids lots of unnecessary recompilations, because it warns us of historical polymorphism. Historical polymorphism usually means future polymorphism. IC status code already had some merging functionality, but I needed to beef it up a lot to make this work right. - Inlining an inline cache now preserves as much information as profiling. One challenge of polyvariant profiling is that the FTL compile for bar (that includes bar->baz) could have inlined an inline cache based on polyvariant profiling. So, when the FTL compile for foo (that includes foo->bar->baz) asks bar what it knows about that IC inside bar->baz, it will say "I don't have such an IC". At this point the DFG compilation that included that IC that gave us the information that we used to inline the IC is no longer alive. To keep us from losing the information we learned about the IC, there is now a RecordedStatuses data structure that preserves the statuses we use for inlining ICs. We also filter those statuses according to things we learn from AI. This further reduces the risk of information about an IC being forgotten. - Exit profiling now considers whether or not an exit happened from inline code. This protects us in the case where the not-inlined version of an IC exited a lot because of polymorphism that doesn't exist in the inlined version. So, when using polyvariant profiling data, we consider only inlined exits. - CallLinkInfo now records when it's repatched to the virtual call thunk. Previously, this would clear the CallLinkInfo, so CallLinkStatus would fall back to the lastSeenCallee. It's surprising that we've had this bug. Altogether this patch is performance-neutral in run-jsc-benchmarks, except for speed-ups in microbenchmarks and a compile time regression. Octane/deltablue speeds up by ~5%. Octane/raytrace is regressed by a minuscule amount, which we could make up by implementing prototype access folding in the bytecode parser and constant folder. That would require some significant new logic in GetByIdStatus. That would also require a new benchmark - we want to have a test that captures raytrace's behavior in the case that the parser cannot fold the get_by_id. This change is a 1.2% regression on V8Spider-CompileTime. That's a smaller regression than recent compile time progressions, so I think that's an OK trade-off. Also, I would expect a compile time regression anytime we fill in FTL coverage. This is neutral on JetStream, ARES-6, and Speedometer2. JetStream agrees that deltablue speeds up and that raytrace slows down, but these changes balance out and don't affect the overall score. In ARES-6, it looks like individual tests have some significant 1-2% speed-ups or slow-downs. Air-steady is definitely ~1.5% faster. Basic-worst is probably 2% slower (p ~ 0.1, so it's not very certain). The JetStream, ARES-6, and Speedometer2 overall scores don't see a significant difference. In all three cases the difference is <0.5% with a high p value, with JetStream and Speedometer2 being insignificant infinitesimal speed-ups and ARES-6 being an insignificant infinitesimal slow-down. Oh, and this change means that the FTL now has 100% coverage of JavaScript. You could do an eval in a for-in loop in a for-of loop inside a with block that uses try/catch for control flow in a polymorphic constructor while having a bad time, and we'll still compile it. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/ByValInfo.h: * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::printGetByIdCacheStatus): (JSC::BytecodeDumper<Block>::printPutByIdCacheStatus): (JSC::BytecodeDumper<Block>::printInByIdCacheStatus): (JSC::BytecodeDumper<Block>::dumpCallLinkStatus): (JSC::BytecodeDumper<CodeBlock>::dumpCallLinkStatus): (JSC::BytecodeDumper<Block>::printCallOp): (JSC::BytecodeDumper<Block>::dumpBytecode): (JSC::BytecodeDumper<Block>::dumpBlock): * bytecode/BytecodeDumper.h: * bytecode/CallLinkInfo.h: * bytecode/CallLinkStatus.cpp: (JSC::CallLinkStatus::computeFor): (JSC::CallLinkStatus::computeExitSiteData): (JSC::CallLinkStatus::computeFromCallLinkInfo): (JSC::CallLinkStatus::accountForExits): (JSC::CallLinkStatus::finalize): (JSC::CallLinkStatus::filter): (JSC::CallLinkStatus::computeDFGStatuses): Deleted. * bytecode/CallLinkStatus.h: (JSC::CallLinkStatus::operator bool const): (JSC::CallLinkStatus::operator! const): Deleted. * bytecode/CallVariant.cpp: (JSC::CallVariant::finalize): (JSC::CallVariant::filter): * bytecode/CallVariant.h: (JSC::CallVariant::operator bool const): (JSC::CallVariant::operator! const): Deleted. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): (JSC::CodeBlock::propagateTransitions): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::getICStatusMap): (JSC::CodeBlock::resetJITData): (JSC::CodeBlock::getStubInfoMap): Deleted. (JSC::CodeBlock::getCallLinkInfoMap): Deleted. (JSC::CodeBlock::getByValInfoMap): Deleted. * bytecode/CodeBlock.h: * bytecode/CodeOrigin.cpp: (JSC::CodeOrigin::isApproximatelyEqualTo const): (JSC::CodeOrigin::approximateHash const): * bytecode/CodeOrigin.h: (JSC::CodeOrigin::exitingInlineKind const): * bytecode/DFGExitProfile.cpp: (JSC::DFG::FrequentExitSite::dump const): (JSC::DFG::ExitProfile::add): * bytecode/DFGExitProfile.h: (JSC::DFG::FrequentExitSite::FrequentExitSite): (JSC::DFG::FrequentExitSite::operator== const): (JSC::DFG::FrequentExitSite::subsumes const): (JSC::DFG::FrequentExitSite::hash const): (JSC::DFG::FrequentExitSite::inlineKind const): (JSC::DFG::FrequentExitSite::withInlineKind const): (JSC::DFG::QueryableExitProfile::hasExitSite const): (JSC::DFG::QueryableExitProfile::hasExitSiteWithSpecificJITType const): (JSC::DFG::QueryableExitProfile::hasExitSiteWithSpecificInlineKind const): * bytecode/ExitFlag.cpp: Added. (JSC::ExitFlag::dump const): * bytecode/ExitFlag.h: Added. (JSC::ExitFlag::ExitFlag): (JSC::ExitFlag::operator| const): (JSC::ExitFlag::operator|=): (JSC::ExitFlag::operator& const): (JSC::ExitFlag::operator&=): (JSC::ExitFlag::operator bool const): (JSC::ExitFlag::isSet const): * bytecode/ExitingInlineKind.cpp: Added. (WTF::printInternal): * bytecode/ExitingInlineKind.h: Added. * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::computeFor): (JSC::GetByIdStatus::computeForStubInfo): (JSC::GetByIdStatus::slowVersion const): (JSC::GetByIdStatus::markIfCheap): (JSC::GetByIdStatus::finalize): (JSC::GetByIdStatus::hasExitSite): Deleted. * bytecode/GetByIdStatus.h: * bytecode/GetByIdVariant.cpp: (JSC::GetByIdVariant::markIfCheap): (JSC::GetByIdVariant::finalize): * bytecode/GetByIdVariant.h: * bytecode/ICStatusMap.cpp: Added. (JSC::ICStatusContext::get const): (JSC::ICStatusContext::isInlined const): (JSC::ICStatusContext::inlineKind const): * bytecode/ICStatusMap.h: Added. * bytecode/ICStatusUtils.cpp: Added. (JSC::hasBadCacheExitSite): * bytecode/ICStatusUtils.h: * bytecode/InstanceOfStatus.cpp: (JSC::InstanceOfStatus::computeFor): * bytecode/InstanceOfStatus.h: * bytecode/PolyProtoAccessChain.h: * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::hasExitSite): (JSC::PutByIdStatus::computeFor): (JSC::PutByIdStatus::slowVersion const): (JSC::PutByIdStatus::markIfCheap): (JSC::PutByIdStatus::finalize): (JSC::PutByIdStatus::filter): * bytecode/PutByIdStatus.h: * bytecode/PutByIdVariant.cpp: (JSC::PutByIdVariant::markIfCheap): (JSC::PutByIdVariant::finalize): * bytecode/PutByIdVariant.h: (JSC::PutByIdVariant::structureSet const): * bytecode/RecordedStatuses.cpp: Added. (JSC::RecordedStatuses::operator=): (JSC::RecordedStatuses::RecordedStatuses): (JSC::RecordedStatuses::addCallLinkStatus): (JSC::RecordedStatuses::addGetByIdStatus): (JSC::RecordedStatuses::addPutByIdStatus): (JSC::RecordedStatuses::markIfCheap): (JSC::RecordedStatuses::finalizeWithoutDeleting): (JSC::RecordedStatuses::finalize): (JSC::RecordedStatuses::shrinkToFit): * bytecode/RecordedStatuses.h: Added. (JSC::RecordedStatuses::RecordedStatuses): (JSC::RecordedStatuses::forEachVector): * bytecode/StructureSet.cpp: (JSC::StructureSet::markIfCheap const): (JSC::StructureSet::isStillAlive const): * bytecode/StructureSet.h: * bytecode/TerminatedCodeOrigin.h: Added. (JSC::TerminatedCodeOrigin::TerminatedCodeOrigin): (JSC::TerminatedCodeOriginHashTranslator::hash): (JSC::TerminatedCodeOriginHashTranslator::equal): * bytecode/Watchpoint.cpp: (WTF::printInternal): * bytecode/Watchpoint.h: * dfg/DFGAbstractInterpreter.h: * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): (JSC::DFG::AbstractInterpreter<AbstractStateType>::filterICStatus): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleVarargsCall): (JSC::DFG::ByteCodeParser::handleDOMJITGetter): (JSC::DFG::ByteCodeParser::handleModuleNamespaceLoad): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::handlePutById): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry): (JSC::DFG::ByteCodeParser::InlineStackEntry::~InlineStackEntry): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGClobbersExitState.cpp: (JSC::DFG::clobbersExitState): * dfg/DFGCommonData.h: * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGDesiredWatchpoints.h: (JSC::DFG::SetPointerAdaptor::hasBeenInvalidated): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): * dfg/DFGMayExit.cpp: * dfg/DFGNode.h: (JSC::DFG::Node::hasCallLinkStatus): (JSC::DFG::Node::callLinkStatus): (JSC::DFG::Node::hasGetByIdStatus): (JSC::DFG::Node::getByIdStatus): (JSC::DFG::Node::hasPutByIdStatus): (JSC::DFG::Node::putByIdStatus): * dfg/DFGNodeType.h: * dfg/DFGOSRExitBase.cpp: (JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSiteSlow): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::reallyAdd): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::finalizeInGC): * dfg/DFGPlan.h: * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::removeDeadPlans): * ftl/FTLAbstractHeapRepository.h: * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compileCreateThis): (JSC::FTL::DFG::LowerDFGToB3::compileFilterICStatus): * jit/PolymorphicCallStubRoutine.cpp: (JSC::PolymorphicCallStubRoutine::hasEdges const): (JSC::PolymorphicCallStubRoutine::edges const): * jit/PolymorphicCallStubRoutine.h: * profiler/ProfilerBytecodeSequence.cpp: (JSC::Profiler::BytecodeSequence::BytecodeSequence): * runtime/FunctionRareData.cpp: (JSC::FunctionRareData::initializeObjectAllocationProfile): * runtime/Options.h: Source/WTF: * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::operator!= const): Canonical link: https://commits.webkit.org/203069@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234086 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-22 02:48:16 +00:00
bytecode/RecordedStatuses.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
bytecode/ReduceWhitespace.cpp
[ESNext] Implement private methods https://bugs.webkit.org/show_bug.cgi?id=194434 Reviewed by Filip Pizlo. JSTests: * stress/private-brand-installed-after-super-call-from-arrow-function.js: Added. * stress/private-brand-installed-after-super-call-from-eval.js: Added. * stress/private-method-brand-check.js: Added. * stress/private-method-change-attribute-from-branded-structure.js: Added. * stress/private-method-change-prototype-from-branded-structure.js: Added. * stress/private-method-check-private-brand-ic.js: Added. * stress/private-method-check-structure-miss.js: Added. * stress/private-method-comparison.js: Added. * stress/private-method-delete-property-from-branded-structure.js: Added. * stress/private-method-extends-brand-check.js: Added. * stress/private-method-get-and-call.js: Added. * stress/private-method-invalid-multiple-brand-installation.js: Added. * stress/private-method-invalidate-compiled-with-constant-symbol.js: Added. * stress/private-method-nested-class.js: Added. * stress/private-method-on-sealed-objects.js: Added. * stress/private-method-on-uncacheable-dictionary.js: Added. * stress/private-method-polymorphic-with-constant-symbol.js: Added. * stress/private-method-set-brand-should-have-write-barrier.js: Added. * stress/private-method-untyped-use.js: Added. * stress/private-method-with-uncacheable-dictionary-transition.js: Added. * stress/private-methods-inline-cache.js: Added. * stress/private-methods-megamorphic-ic.js: Added. * stress/private-methods-on-proxy.js: Added. * stress/private-methods-poly-ic-multiple-classes.js: Added. * stress/private-methods-poly-ic-single-class.js: Added. * stress/private-names-available-on-direct-eval.js: Added. * test262/config.yaml: Source/JavaScriptCore: This patch is adding support to private methods following the specification on https://tc39.es/proposal-private-methods/. This is introducing a new way to declare private methods on class syntax. Private methods are only accessible within classes they were declared, and only can be called from objects that are instance of these classes. To guarantee such rules, the proposal presents the concept of Brand Check. During class evaluation, if a private method is present, a `brand` is installed in this class. Every instance of such class then gets this brand installed during `[[Construct]]` operation. It means that an object can have multiple brands (e.g when there is also private methods declared on super class). Before accessing a private method, there is a check to validate if the target of the call has the brand of callee method. The brand check mechanism is implemented using a `@privateBrand` stored on class scope. Here is a representation of how this mechanism works: ``` class C { #m() { return 3; } method() { return this.#m(); } } let c = new C(); console.log(c.method()); // prints 3 ``` Generated bytecode for the following representation: ``` { // class lexical scope const @privateBrand = @createPrivateSymbol(); const #m = function () { return 3; } C.prototype.method = function() { @check_private_brand(this, @privateBrand); return #m.call(this); } C = function() { @set_private_brand(this, @privateBrand); } } let c = new C(); console.log(c.method()); // prints 3 ``` # Resolving correct brand to check In the case of shadowing or nested scope, we need to emit brand checks to the right private brand. See code below: ``` class C { #m() { return 3; } method() { return this.#m();} A = class { #m2() { return 3; } foo(o) { return o.#m(); } } } ``` The call of "#m" in `foo` refers to "C::#m". In such case, we need to check C's private brand, instead of A's private brand. To perform the proper check, we first resolve scope of "#m" and then check the private brand of this scope (the scope where the private method and brand are stored is the same). So the bytecode to lookup the right brand is: ``` mov loc9, arg1 resolve_scope loc10, "#m" get_from_scope loc11, loc10, "@privateBrand" check_private_brand loc9, loc11 get_from_scope loc11, loc10, "#m" // setup call frame call loc11, ... // ... ``` # Brand check mechanism We are introducing in this patch 2 new bytecodes to allow brand check of objects: `op_set_brand` and `op_check_brand`. `op_set_brand` sets a new brand in an object, so we can perform the brand check later when accessing private methods. This operations throws when trying to add the same brand twice in an Object. `op_check_brand` checks if the given object contains the brand we are looking for. It traverses the brand chain to verify if the brand is present, and throws `TypeError` otherwise. We are also introducing a subclass for Structure called BrandedStructure. It is used to store brands and to allow brand check mechanism. BrandedStructure stores a brand and a parent pointer to another BrandedStructure that allow us traverse the brand chain. With `BrandedStructure`, we can then infer that a given object has the brand we are looking for just checking its structureId. This is a very good optimization, since we can reduce most of brand checks to structure checks. We created a new kind of transition called `SetBrand` that happens when `op_set_brand` is executed. This allow us to cache such kind of trasitions on trasition table using the key `<brand->uid, 0, TransitionKind::SetBrand>`. During this transition, we take previous structure and apply one of the following rules: 1. If it's a BrandedStructure, we then set it to `m_parentBrand`, to allow proper brand chain check. 2. If it's not a BrandedStructure, we set `m_parentBrand` to `nullptr`, meaning that this is the first brand being added to the object with this structure. For now, we are using the flag `isBrandedStructure` to identify that a given Structure is a BrandedStructure. This is done to avoid changes on places where we are checking for `vm.structureStructure()`. However, if we ever need space on Structure, this flag is a good candidate to be deleted and we can move to a solution that uses `vm.brandedStructureStructure()`; # JIT Support This patch also includes initial JIT support for `set_private_brand` and `check_private_brand`. On Baseline JIT, we are using `JITPravateBrandAccessGenerator` to support IC for both operands. On `DFGByteCodeParser` we are trying to inline brand access whenever possible, and fallbacking to `SetPrivateBrand` and `CheckPrivateBrand` otherwise. Those nodes are not being optimized at their full potential, but the code generated by them is also relying on `JITPrivateBrandAccessGenerator` to have IC support for both DFG and FTL. During DFG parsing, we try to reduce those access to `CheckIsConstant` and `CheckStructure` (with `PutStructure` for `set_private_brand` cases) based on available profiled data. This is meant to make brand checks almost free on DFG/FTL tiers when we have a single evaluation of a class, since the `CheckIsConstant` can be eliminated by the constant-folded scope load, and the `CheckStructure` is very likely to be redundant to any other `CheckStructure` that can be performed on receiver when we have a finite structure set. For instance, when we have a brand check on a path-of-no-return to a `GetByOffset` sequence on the same receiver, the `CheckStructure` for the brand check will enable CSE of the `CheckStructure` that would happen for that `GetByOffset`. Such design is possible because brand checks supports polymorphic access very similr to what we have for `GetByOffset` sequences. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/BuiltinExecutables.cpp: (JSC::BuiltinExecutables::createDefaultConstructor): (JSC::BuiltinExecutables::createExecutable): * builtins/BuiltinExecutables.h: We are adding a new parameter `PrivateBrandRequirement` to propagate when a default constructor needs to emit code to setup private brand on instances. * builtins/BuiltinNames.h: Adding `@privateBrand` that we use to store private brand on class's scope. * bytecode/AccessCase.cpp: (JSC::AccessCase::createCheckPrivateBrand): (JSC::AccessCase::createSetPrivateBrand): (JSC::AccessCase::requiresIdentifierNameMatch const): (JSC::AccessCase::requiresInt32PropertyCheck const): (JSC::AccessCase::needsScratchFPR const): (JSC::AccessCase::forEachDependentCell const): (JSC::AccessCase::doesCalls const): (JSC::AccessCase::canReplace const): (JSC::AccessCase::dump const): (JSC::AccessCase::generateWithGuard): (JSC::AccessCase::generateImpl): * bytecode/AccessCase.h: (JSC::AccessCase::structure const): (JSC::AccessCase::newStructure const): * bytecode/BytecodeList.rb: * bytecode/BytecodeUseDef.cpp: (JSC::computeUsesForBytecodeIndexImpl): (JSC::computeDefsForBytecodeIndexImpl): * bytecode/CheckPrivateBrandStatus.cpp: Added. (JSC::CheckPrivateBrandStatus::appendVariant): (JSC::CheckPrivateBrandStatus::computeForBaseline): (JSC::CheckPrivateBrandStatus::CheckPrivateBrandStatus): (JSC::CheckPrivateBrandStatus::computeForStubInfoWithoutExitSiteFeedback): (JSC::CheckPrivateBrandStatus::computeFor): (JSC::CheckPrivateBrandStatus::slowVersion const): (JSC::CheckPrivateBrandStatus::merge): (JSC::CheckPrivateBrandStatus::filter): (JSC::CheckPrivateBrandStatus::singleIdentifier const): (JSC::CheckPrivateBrandStatus::visitAggregate): (JSC::CheckPrivateBrandStatus::markIfCheap): (JSC::CheckPrivateBrandStatus::finalize): (JSC::CheckPrivateBrandStatus::dump const): * bytecode/CheckPrivateBrandStatus.h: Added. * bytecode/CheckPrivateBrandVariant.cpp: Added. (JSC::CheckPrivateBrandVariant::CheckPrivateBrandVariant): (JSC::CheckPrivateBrandVariant::~CheckPrivateBrandVariant): (JSC::CheckPrivateBrandVariant::attemptToMerge): (JSC::CheckPrivateBrandVariant::markIfCheap): (JSC::CheckPrivateBrandVariant::finalize): (JSC::CheckPrivateBrandVariant::visitAggregate): (JSC::CheckPrivateBrandVariant::dump const): (JSC::CheckPrivateBrandVariant::dumpInContext const): * bytecode/CheckPrivateBrandVariant.h: Added. (JSC::CheckPrivateBrandVariant::structureSet const): (JSC::CheckPrivateBrandVariant::structureSet): (JSC::CheckPrivateBrandVariant::identifier const): (JSC::CheckPrivateBrandVariant::overlaps): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::finalizeLLIntInlineCaches): * bytecode/ExecutableInfo.h: (JSC::ExecutableInfo::ExecutableInfo): (JSC::ExecutableInfo::privateBrandRequirement const): * bytecode/PolymorphicAccess.cpp: (JSC::PolymorphicAccess::regenerate): (WTF::printInternal): * bytecode/RecordedStatuses.cpp: (JSC::RecordedStatuses::operator=): (JSC::RecordedStatuses::addCheckPrivateBrandStatus): (JSC::RecordedStatuses::addSetPrivateBrandStatus): (JSC::RecordedStatuses::visitAggregate): (JSC::RecordedStatuses::markIfCheap): * bytecode/RecordedStatuses.h: (JSC::RecordedStatuses::forEachVector): * bytecode/SetPrivateBrandStatus.cpp: Added. (JSC::SetPrivateBrandStatus::appendVariant): (JSC::SetPrivateBrandStatus::computeForBaseline): (JSC::SetPrivateBrandStatus::SetPrivateBrandStatus): (JSC::SetPrivateBrandStatus::computeForStubInfoWithoutExitSiteFeedback): (JSC::SetPrivateBrandStatus::computeFor): (JSC::SetPrivateBrandStatus::slowVersion const): (JSC::SetPrivateBrandStatus::merge): (JSC::SetPrivateBrandStatus::filter): (JSC::SetPrivateBrandStatus::singleIdentifier const): (JSC::SetPrivateBrandStatus::visitAggregate): (JSC::SetPrivateBrandStatus::markIfCheap): (JSC::SetPrivateBrandStatus::finalize): (JSC::SetPrivateBrandStatus::dump const): * bytecode/SetPrivateBrandStatus.h: Added. * bytecode/SetPrivateBrandVariant.cpp: Added. (JSC::SetPrivateBrandVariant::SetPrivateBrandVariant): (JSC::SetPrivateBrandVariant::~SetPrivateBrandVariant): (JSC::SetPrivateBrandVariant::attemptToMerge): (JSC::SetPrivateBrandVariant::markIfCheap): (JSC::SetPrivateBrandVariant::finalize): (JSC::SetPrivateBrandVariant::visitAggregate): (JSC::SetPrivateBrandVariant::dump const): (JSC::SetPrivateBrandVariant::dumpInContext const): * bytecode/SetPrivateBrandVariant.h: Added. (JSC::SetPrivateBrandVariant::oldStructure const): (JSC::SetPrivateBrandVariant::newStructure const): (JSC::SetPrivateBrandVariant::identifier const): (JSC::SetPrivateBrandVariant::overlaps): * bytecode/StructureStubInfo.cpp: (JSC::StructureStubInfo::reset): * bytecode/StructureStubInfo.h: * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::privateBrandRequirement const): * bytecode/UnlinkedCodeBlockGenerator.h: (JSC::UnlinkedCodeBlockGenerator::privateBrandRequirement const): * bytecode/UnlinkedFunctionExecutable.cpp: (JSC::generateUnlinkedFunctionCodeBlock): (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable): * bytecode/UnlinkedFunctionExecutable.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): We changed BytecodeGenerator for FunctionNode and EvalNode to propagate parentScope PrivateNameEnvironment. These environments stores private name entries that are visible into the scope of the function/eval. This is required to identify the kind of access a private name is referring to, since it can be a private field or a private method. (JSC::BytecodeGenerator::instantiateLexicalVariables): (JSC::BytecodeGenerator::emitGetPrivateName): (JSC::BytecodeGenerator::emitCreatePrivateBrand): The process to create a private brand is as follows: 1. Create a PrivateSymbol using `@createPrivateSymbol`. 2. Store this symbol into a given scope (i.e class lexical scope) on `@privateBrand` variable. (JSC::BytecodeGenerator::emitInstallPrivateBrand): (JSC::BytecodeGenerator::emitGetPrivateBrand): We added `m_privateNamesStack` to BytecodeGenerator to represent the scope chain of available private names while generating bytecode. (JSC::BytecodeGenerator::emitCheckPrivateBrand): (JSC::BytecodeGenerator::isPrivateMethod): (JSC::BytecodeGenerator::pushPrivateAccessNames): (JSC::BytecodeGenerator::popPrivateAccessNames): (JSC::BytecodeGenerator::getAvailablePrivateAccessNames): (JSC::BytecodeGenerator::emitNewDefaultConstructor): (JSC::BytecodeGenerator::emitNewClassFieldInitializerFunction): (JSC::BytecodeGenerator::emitDirectGetByVal): Deleted. * bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::privateBrandRequirement const): (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::makeFunction): This change is required to properly propagate PrivateBrandRequirement to arrow functions that can potentially call `super()`. * bytecompiler/NodesCodegen.cpp: (JSC::PropertyListNode::emitDeclarePrivateFieldNames): (JSC::PropertyListNode::emitBytecode): (JSC::PropertyListNode::emitPutConstantProperty): (JSC::BaseDotNode::emitGetPropertyValue): Adding support to properly access private method. Since we store private methods on class lexical scope, we need a different set of instructions to access a private method. (JSC::BaseDotNode::emitPutProperty): In the case of we trying to write in a private method, we need to throw a TypeError according to specification (https://tc39.es/proposal-private-methods/#sec-privatefieldset). (JSC::FunctionCallValueNode::emitBytecode): (JSC::PostfixNode::emitDot): (JSC::PrefixNode::emitDot): (JSC::ClassExprNode::emitBytecode): * debugger/DebuggerCallFrame.cpp: (JSC::DebuggerCallFrame::evaluateWithScopeExtension): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): (JSC::DFG::AbstractInterpreter<AbstractStateType>::filterICStatus): * dfg/DFGArgumentsEliminationPhase.cpp: * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCapabilities.cpp: (JSC::DFG::capabilityLevel): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGClobbersExitState.cpp: (JSC::DFG::clobbersExitState): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGGraph.h: * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGJITCompiler.h: (JSC::DFG::JITCompiler::addPrivateBrandAccess): * dfg/DFGMayExit.cpp: * dfg/DFGNode.h: (JSC::DFG::Node::hasCheckPrivateBrandStatus): (JSC::DFG::Node::checkPrivateBrandStatus): (JSC::DFG::Node::hasSetPrivateBrandStatus): (JSC::DFG::Node::setPrivateBrandStatus): * dfg/DFGNodeType.h: * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCheckPrivateBrand): (JSC::DFG::SpeculativeJIT::compileSetPrivateBrand): * dfg/DFGSpeculativeJIT.h: * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStoreBarrierInsertionPhase.cpp: * dfg/DFGVarargsForwardingPhase.cpp: * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compilePrivateBrandAccess): (JSC::FTL::DFG::LowerDFGToB3::compileCheckPrivateBrand): (JSC::FTL::DFG::LowerDFGToB3::compileSetPrivateBrand): * interpreter/Interpreter.cpp: (JSC::eval): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::link): * jit/JIT.h: * jit/JITInlineCacheGenerator.cpp: (JSC::JITPrivateBrandAccessGenerator::JITPrivateBrandAccessGenerator): (JSC::JITPrivateBrandAccessGenerator::generateFastPath): (JSC::JITPrivateBrandAccessGenerator::finalize): * jit/JITInlineCacheGenerator.h: (JSC::JITPrivateBrandAccessGenerator::JITPrivateBrandAccessGenerator): (JSC::JITPrivateBrandAccessGenerator::slowPathJump const): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): (JSC::getPrivateName): * jit/JITOperations.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_set_private_brand): (JSC::JIT::emitSlow_op_set_private_brand): (JSC::JIT::emit_op_check_private_brand): (JSC::JIT::emitSlow_op_check_private_brand): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emit_op_set_private_brand): (JSC::JIT::emitSlow_op_set_private_brand): (JSC::JIT::emit_op_check_private_brand): (JSC::JIT::emitSlow_op_check_private_brand): * jit/Repatch.cpp: (JSC::tryCacheCheckPrivateBrand): (JSC::repatchCheckPrivateBrand): (JSC::tryCacheSetPrivateBrand): (JSC::repatchSetPrivateBrand): (JSC::resetCheckPrivateBrand): (JSC::resetSetPrivateBrand): * jit/Repatch.h: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * parser/Nodes.cpp: (JSC::FunctionMetadataNode::FunctionMetadataNode): * parser/Nodes.h: (JSC::BaseDotNode::isPrivateMember const): (JSC::BaseDotNode::isPrivateField const): Deleted. * parser/Parser.cpp: (JSC::Parser<LexerType>::parseClass): (JSC::Parser<LexerType>::parseMemberExpression): * parser/Parser.h: (JSC::Scope::declarePrivateMethod): (JSC::Scope::declarePrivateField): (JSC::Parser<LexerType>::parse): (JSC::parse): (JSC::Scope::declarePrivateName): Deleted. * parser/ParserModes.h: * parser/SyntaxChecker.h: (JSC::SyntaxChecker::createDotAccess): * parser/VariableEnvironment.cpp: (JSC::VariableEnvironment::declarePrivateMethod): * parser/VariableEnvironment.h: (JSC::VariableEnvironmentEntry::isPrivateField const): (JSC::VariableEnvironmentEntry::isPrivateMethod const): (JSC::VariableEnvironmentEntry::setIsPrivateField): (JSC::VariableEnvironmentEntry::setIsPrivateMethod): (JSC::PrivateNameEntry::isMethod const): (JSC::PrivateNameEntry::isPrivateMethodOrAcessor const): (JSC::VariableEnvironment::addPrivateName): (JSC::VariableEnvironment::declarePrivateField): (JSC::VariableEnvironment::declarePrivateMethod): (JSC::VariableEnvironment::privateNameEnvironment const): (JSC::VariableEnvironment::hasPrivateMethodOrAccessor const): (JSC::VariableEnvironment::addPrivateNamesFrom): (JSC::VariableEnvironmentEntry::isPrivateName const): Deleted. (JSC::VariableEnvironmentEntry::setIsPrivateName): Deleted. (JSC::VariableEnvironment::declarePrivateName): Deleted. * runtime/CachedTypes.cpp: (JSC::CachedCodeBlockRareData::encode): (JSC::CachedCodeBlockRareData::decode const): (JSC::CachedFunctionExecutableRareData::encode): (JSC::CachedFunctionExecutableRareData::decode const): (JSC::CachedFunctionExecutable::privateBrandRequirement const): (JSC::CachedCodeBlock::derivedContextType const): (JSC::CachedFunctionExecutable::encode): (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable): (JSC::CachedCodeBlock::needsClassFieldInitializer const): Deleted. * runtime/CodeCache.cpp: (JSC::generateUnlinkedCodeBlockImpl): (JSC::generateUnlinkedCodeBlock): (JSC::generateUnlinkedCodeBlockForDirectEval): (JSC::CodeCache::getUnlinkedGlobalFunctionExecutable): * runtime/CodeCache.h: * runtime/DirectEvalExecutable.cpp: (JSC::DirectEvalExecutable::create): (JSC::DirectEvalExecutable::DirectEvalExecutable): * runtime/DirectEvalExecutable.h: * runtime/EvalExecutable.cpp: (JSC::EvalExecutable::EvalExecutable): * runtime/EvalExecutable.h: (JSC::EvalExecutable::executableInfo const): (JSC::EvalExecutable::privateBrandRequirement const): * runtime/ExceptionHelpers.cpp: (JSC::createInvalidPrivateNameError): * runtime/IndirectEvalExecutable.cpp: (JSC::IndirectEvalExecutable::IndirectEvalExecutable): * runtime/JSObject.h: * runtime/JSObjectInlines.h: (JSC::JSObject::checkPrivateBrand): (JSC::JSObject::setPrivateBrand): * runtime/JSScope.cpp: (JSC::JSScope::collectClosureVariablesUnderTDZ): * runtime/JSScope.h: * runtime/ModuleProgramExecutable.h: * runtime/Options.cpp: (JSC::Options::recomputeDependentOptions): * runtime/OptionsList.h: * runtime/ProgramExecutable.h: * runtime/Structure.cpp: (JSC::Structure::materializePropertyTable): (JSC::BrandedStructure::BrandedStructure): (JSC::BrandedStructure::create): (JSC::BrandedStructure::checkBrand): (JSC::Structure::setBrandTransitionFromExistingStructureImpl): (JSC::Structure::setBrandTransitionFromExistingStructureConcurrently): (JSC::Structure::setBrandTransition): * runtime/Structure.h: (JSC::Structure::finishCreation): * runtime/StructureInlines.h: (JSC::Structure::create): (JSC::Structure::forEachPropertyConcurrently): * runtime/StructureTransitionTable.h: * runtime/SymbolTable.cpp: (JSC::SymbolTable::cloneScopePart): * runtime/SymbolTable.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Canonical link: https://commits.webkit.org/233852@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272580 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-09 16:30:24 +00:00
bytecode/SetPrivateBrandStatus.cpp
bytecode/SetPrivateBrandVariant.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
bytecode/SpeculatedType.cpp
bytecode/StructureSet.cpp
bytecode/StructureStubClearingWatchpoint.cpp
bytecode/StructureStubInfo.cpp
We should support CreateThis in the FTL https://bugs.webkit.org/show_bug.cgi?id=164904 Reviewed by Yusuke Suzuki. JSTests: * microbenchmarks/polyvariant-get-by-id-shorter-tower.js: Added. (polyvariant): (Foo.prototype.func): (Foo): (foo): (Bar.prototype.func): (Bar): (bar): * microbenchmarks/polyvariant-get-by-id-tower.js: Added. (polyvariant): (Foo.prototype.func): (Foo): (foo): (Bar.prototype.func): (Bar): (bar): (Baz.prototype.func): (Baz): (baz): Source/JavaScriptCore: This started with Saam's patch to implement CreateThis in the FTL, but turned into a type inference adventure. CreateThis in the FTL was a massive regression in raytrace because it disturbed that benchmark's extremely perverse way of winning at type inference: - The benchmark wanted polyvariant devirtualization of an object construction helper. But, the polyvariant profiler wasn't powerful enough to reliably devirtualize that code. So, the benchmark was falling back to other mechanisms... - The construction helper could not tier up into the FTL. When the DFG compiled it, it would see that the IC had 4 cases. That's too polymorphic for the DFG. So, the DFG would emit a GetById. Shortly after the DFG compile, that get_by_id would see many more cases, but now that the helper was compiled by the DFG, the baseline get_by_id would not see those cases. The DFG's GetById would "hide" those cases. The number of cases the DFG's GetById would see is larger than our polymorphic list limit (limit = 8, case count = 13, I think). Note that if the FTL compiles that construction helper, it sees the 4 cases, turns them into a MultiGetByOffset, then suffers from exits when the new cases hit, and then exits to baseline, which then sees those cases. Luckily, the FTL was not compiling the construction helper because it had a CreateThis. - Compilations that inlined the construction helper would have gotten super lucky with parse-time constant folding, so they knew what structure the input to the get_by_id would have at parse time. This is only profitable if the get_by_id parsing computed a GetByIdStatus that had a finite number of cases. Because the 13 cases were being hidden by the DFG GetById and GetByIdStatus would only look at the baseline get_by_id, which had 4 cases, we would indeed get a finite number of cases. The parser would then prune those cases to just one - based on its knowledge of the structure - and that would result in that get_by_id being folded at parse time to a constant. - The subsequent op_call would inline based on parse-time knowledge of that constant. This patch comprehensively fixes these issues, as well as other issues that come up along the way. The short version is that raytrace was revealing sloppiness in our use of profiling for type inference. This patch fixes the sloppiness by vastly expanding *polyvariant* profiling, i.e. the profiling that considers call context. I was encouraged to do this by the fact that even the old version of polyvariant profiling was a speed-up on JetStream, ARES-6, and Speedometer 2 (it's easy to measure since it's a runtime flag). So, it seemed worthwhile to attack raytrace's problem as a shortcoming of polyvariant profiling. - Polyvariant profiling now consults every DFG or FTL code block that participated in any subset of the inline stack that includes the IC we're profiling. For example, if we have an inline stack like foo->bar->baz, with baz on top, then we will consult DFG or FTL compilations for foo, bar, and baz. In foo, we'll look up foo->bar->baz; in bar we'll look up bar->baz; etc. This fixes two problems encountered in raytrace. First, it ensures that a DFG GetById cannot hide anything from the profiling of that get_by_id, since the polyvariant profiling code will always consult it. Second, it enables raytrace to benefit from polyvariant profling. Previously, the polyvariant profiler would only look at the previous DFG compilation of foo and look up foo->bar->baz. But that only works if DFG-foo had inlined bar and then baz. It may not have done that, because those calls could have required polyvariant profiling that was only available in the FTL. - A particularly interesting case is when some IC in foo-baseline is also available in foo-DFG. This case is encountered by the polyvariant profiler as it walks the inline stack. In the case of gathering profiling for foo-FTL, the polyvariant profiler finds foo-DFG via the trivial case of no inline stack. This also means that if foo ever gets inlined, we will find foo-DFG or foo-FTL in the final case of polyvariant profiling. In those cases, we now merge the IC of foo-baseline and foo-DFG. This avoids lots of unnecessary recompilations, because it warns us of historical polymorphism. Historical polymorphism usually means future polymorphism. IC status code already had some merging functionality, but I needed to beef it up a lot to make this work right. - Inlining an inline cache now preserves as much information as profiling. One challenge of polyvariant profiling is that the FTL compile for bar (that includes bar->baz) could have inlined an inline cache based on polyvariant profiling. So, when the FTL compile for foo (that includes foo->bar->baz) asks bar what it knows about that IC inside bar->baz, it will say "I don't have such an IC". At this point the DFG compilation that included that IC that gave us the information that we used to inline the IC is no longer alive. To keep us from losing the information we learned about the IC, there is now a RecordedStatuses data structure that preserves the statuses we use for inlining ICs. We also filter those statuses according to things we learn from AI. This further reduces the risk of information about an IC being forgotten. - Exit profiling now considers whether or not an exit happened from inline code. This protects us in the case where the not-inlined version of an IC exited a lot because of polymorphism that doesn't exist in the inlined version. So, when using polyvariant profiling data, we consider only inlined exits. - CallLinkInfo now records when it's repatched to the virtual call thunk. Previously, this would clear the CallLinkInfo, so CallLinkStatus would fall back to the lastSeenCallee. It's surprising that we've had this bug. Altogether this patch is performance-neutral in run-jsc-benchmarks, except for speed-ups in microbenchmarks and a compile time regression. Octane/deltablue speeds up by ~5%. Octane/raytrace is regressed by a minuscule amount, which we could make up by implementing prototype access folding in the bytecode parser and constant folder. That would require some significant new logic in GetByIdStatus. That would also require a new benchmark - we want to have a test that captures raytrace's behavior in the case that the parser cannot fold the get_by_id. This change is a 1.2% regression on V8Spider-CompileTime. That's a smaller regression than recent compile time progressions, so I think that's an OK trade-off. Also, I would expect a compile time regression anytime we fill in FTL coverage. This is neutral on JetStream, ARES-6, and Speedometer2. JetStream agrees that deltablue speeds up and that raytrace slows down, but these changes balance out and don't affect the overall score. In ARES-6, it looks like individual tests have some significant 1-2% speed-ups or slow-downs. Air-steady is definitely ~1.5% faster. Basic-worst is probably 2% slower (p ~ 0.1, so it's not very certain). The JetStream, ARES-6, and Speedometer2 overall scores don't see a significant difference. In all three cases the difference is <0.5% with a high p value, with JetStream and Speedometer2 being insignificant infinitesimal speed-ups and ARES-6 being an insignificant infinitesimal slow-down. Oh, and this change means that the FTL now has 100% coverage of JavaScript. You could do an eval in a for-in loop in a for-of loop inside a with block that uses try/catch for control flow in a polymorphic constructor while having a bad time, and we'll still compile it. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/ByValInfo.h: * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::printGetByIdCacheStatus): (JSC::BytecodeDumper<Block>::printPutByIdCacheStatus): (JSC::BytecodeDumper<Block>::printInByIdCacheStatus): (JSC::BytecodeDumper<Block>::dumpCallLinkStatus): (JSC::BytecodeDumper<CodeBlock>::dumpCallLinkStatus): (JSC::BytecodeDumper<Block>::printCallOp): (JSC::BytecodeDumper<Block>::dumpBytecode): (JSC::BytecodeDumper<Block>::dumpBlock): * bytecode/BytecodeDumper.h: * bytecode/CallLinkInfo.h: * bytecode/CallLinkStatus.cpp: (JSC::CallLinkStatus::computeFor): (JSC::CallLinkStatus::computeExitSiteData): (JSC::CallLinkStatus::computeFromCallLinkInfo): (JSC::CallLinkStatus::accountForExits): (JSC::CallLinkStatus::finalize): (JSC::CallLinkStatus::filter): (JSC::CallLinkStatus::computeDFGStatuses): Deleted. * bytecode/CallLinkStatus.h: (JSC::CallLinkStatus::operator bool const): (JSC::CallLinkStatus::operator! const): Deleted. * bytecode/CallVariant.cpp: (JSC::CallVariant::finalize): (JSC::CallVariant::filter): * bytecode/CallVariant.h: (JSC::CallVariant::operator bool const): (JSC::CallVariant::operator! const): Deleted. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): (JSC::CodeBlock::propagateTransitions): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::getICStatusMap): (JSC::CodeBlock::resetJITData): (JSC::CodeBlock::getStubInfoMap): Deleted. (JSC::CodeBlock::getCallLinkInfoMap): Deleted. (JSC::CodeBlock::getByValInfoMap): Deleted. * bytecode/CodeBlock.h: * bytecode/CodeOrigin.cpp: (JSC::CodeOrigin::isApproximatelyEqualTo const): (JSC::CodeOrigin::approximateHash const): * bytecode/CodeOrigin.h: (JSC::CodeOrigin::exitingInlineKind const): * bytecode/DFGExitProfile.cpp: (JSC::DFG::FrequentExitSite::dump const): (JSC::DFG::ExitProfile::add): * bytecode/DFGExitProfile.h: (JSC::DFG::FrequentExitSite::FrequentExitSite): (JSC::DFG::FrequentExitSite::operator== const): (JSC::DFG::FrequentExitSite::subsumes const): (JSC::DFG::FrequentExitSite::hash const): (JSC::DFG::FrequentExitSite::inlineKind const): (JSC::DFG::FrequentExitSite::withInlineKind const): (JSC::DFG::QueryableExitProfile::hasExitSite const): (JSC::DFG::QueryableExitProfile::hasExitSiteWithSpecificJITType const): (JSC::DFG::QueryableExitProfile::hasExitSiteWithSpecificInlineKind const): * bytecode/ExitFlag.cpp: Added. (JSC::ExitFlag::dump const): * bytecode/ExitFlag.h: Added. (JSC::ExitFlag::ExitFlag): (JSC::ExitFlag::operator| const): (JSC::ExitFlag::operator|=): (JSC::ExitFlag::operator& const): (JSC::ExitFlag::operator&=): (JSC::ExitFlag::operator bool const): (JSC::ExitFlag::isSet const): * bytecode/ExitingInlineKind.cpp: Added. (WTF::printInternal): * bytecode/ExitingInlineKind.h: Added. * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::computeFor): (JSC::GetByIdStatus::computeForStubInfo): (JSC::GetByIdStatus::slowVersion const): (JSC::GetByIdStatus::markIfCheap): (JSC::GetByIdStatus::finalize): (JSC::GetByIdStatus::hasExitSite): Deleted. * bytecode/GetByIdStatus.h: * bytecode/GetByIdVariant.cpp: (JSC::GetByIdVariant::markIfCheap): (JSC::GetByIdVariant::finalize): * bytecode/GetByIdVariant.h: * bytecode/ICStatusMap.cpp: Added. (JSC::ICStatusContext::get const): (JSC::ICStatusContext::isInlined const): (JSC::ICStatusContext::inlineKind const): * bytecode/ICStatusMap.h: Added. * bytecode/ICStatusUtils.cpp: Added. (JSC::hasBadCacheExitSite): * bytecode/ICStatusUtils.h: * bytecode/InstanceOfStatus.cpp: (JSC::InstanceOfStatus::computeFor): * bytecode/InstanceOfStatus.h: * bytecode/PolyProtoAccessChain.h: * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::hasExitSite): (JSC::PutByIdStatus::computeFor): (JSC::PutByIdStatus::slowVersion const): (JSC::PutByIdStatus::markIfCheap): (JSC::PutByIdStatus::finalize): (JSC::PutByIdStatus::filter): * bytecode/PutByIdStatus.h: * bytecode/PutByIdVariant.cpp: (JSC::PutByIdVariant::markIfCheap): (JSC::PutByIdVariant::finalize): * bytecode/PutByIdVariant.h: (JSC::PutByIdVariant::structureSet const): * bytecode/RecordedStatuses.cpp: Added. (JSC::RecordedStatuses::operator=): (JSC::RecordedStatuses::RecordedStatuses): (JSC::RecordedStatuses::addCallLinkStatus): (JSC::RecordedStatuses::addGetByIdStatus): (JSC::RecordedStatuses::addPutByIdStatus): (JSC::RecordedStatuses::markIfCheap): (JSC::RecordedStatuses::finalizeWithoutDeleting): (JSC::RecordedStatuses::finalize): (JSC::RecordedStatuses::shrinkToFit): * bytecode/RecordedStatuses.h: Added. (JSC::RecordedStatuses::RecordedStatuses): (JSC::RecordedStatuses::forEachVector): * bytecode/StructureSet.cpp: (JSC::StructureSet::markIfCheap const): (JSC::StructureSet::isStillAlive const): * bytecode/StructureSet.h: * bytecode/TerminatedCodeOrigin.h: Added. (JSC::TerminatedCodeOrigin::TerminatedCodeOrigin): (JSC::TerminatedCodeOriginHashTranslator::hash): (JSC::TerminatedCodeOriginHashTranslator::equal): * bytecode/Watchpoint.cpp: (WTF::printInternal): * bytecode/Watchpoint.h: * dfg/DFGAbstractInterpreter.h: * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): (JSC::DFG::AbstractInterpreter<AbstractStateType>::filterICStatus): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleVarargsCall): (JSC::DFG::ByteCodeParser::handleDOMJITGetter): (JSC::DFG::ByteCodeParser::handleModuleNamespaceLoad): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::handlePutById): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry): (JSC::DFG::ByteCodeParser::InlineStackEntry::~InlineStackEntry): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGClobbersExitState.cpp: (JSC::DFG::clobbersExitState): * dfg/DFGCommonData.h: * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGDesiredWatchpoints.h: (JSC::DFG::SetPointerAdaptor::hasBeenInvalidated): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): * dfg/DFGMayExit.cpp: * dfg/DFGNode.h: (JSC::DFG::Node::hasCallLinkStatus): (JSC::DFG::Node::callLinkStatus): (JSC::DFG::Node::hasGetByIdStatus): (JSC::DFG::Node::getByIdStatus): (JSC::DFG::Node::hasPutByIdStatus): (JSC::DFG::Node::putByIdStatus): * dfg/DFGNodeType.h: * dfg/DFGOSRExitBase.cpp: (JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSiteSlow): * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::reallyAdd): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::finalizeInGC): * dfg/DFGPlan.h: * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::removeDeadPlans): * ftl/FTLAbstractHeapRepository.h: * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compileCreateThis): (JSC::FTL::DFG::LowerDFGToB3::compileFilterICStatus): * jit/PolymorphicCallStubRoutine.cpp: (JSC::PolymorphicCallStubRoutine::hasEdges const): (JSC::PolymorphicCallStubRoutine::edges const): * jit/PolymorphicCallStubRoutine.h: * profiler/ProfilerBytecodeSequence.cpp: (JSC::Profiler::BytecodeSequence::BytecodeSequence): * runtime/FunctionRareData.cpp: (JSC::FunctionRareData::initializeObjectAllocationProfile): * runtime/Options.h: Source/WTF: * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::operator!= const): Canonical link: https://commits.webkit.org/203069@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234086 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-22 02:48:16 +00:00
bytecode/StubInfoSummary.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
bytecode/SuperSampler.cpp
bytecode/ToThisStatus.cpp
bytecode/TrackedReferences.cpp
bytecode/UnlinkedCodeBlock.cpp
[JSC] Introduce UnlinkedCodeBlockGenerator and reduce sizeof(UnlinkedCodeBlock) https://bugs.webkit.org/show_bug.cgi?id=207087 Reviewed by Tadeu Zagallo. Source/JavaScriptCore: While UnlinkedCodeBlock is immutable once it is created from BytecodeGenerator, it has many mutable Vectors. This is because we are using UnlinkedCodeBlock as a builder of UnlinkedCodeBlock itself too in BytecodeGenerator. Since Vector takes 16 bytes to allow efficient expansions, it is nice if we can use RefCountedArray instead when we know this Vector is immutable. In this patch, we introduce UnlinkedCodeBlockGenerator wrapper. BytecodeGenerator, BytecodeRewriter, BytecodeDumper, and BytecodeGeneratorification interact with UnlinkedCodeBlockGenerator instead of UnlinkedCodeBlock. And UnlinkedCodeBlockGenerator will generate the finalized UnlinkedCodeBlock. This design allows us to use RefCountedArray for data in UnlinkedCodeBlock, which is (1) smaller and (2) doing shrinkToFit operation when creating it from Vector. This patch reduces sizeof(UnlinkedCodeBlock) from 256 to 168, 88 bytes reduction. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/BytecodeBasicBlock.cpp: (JSC::BytecodeBasicBlock::compute): * bytecode/BytecodeBasicBlock.h: * bytecode/BytecodeDumper.cpp: * bytecode/BytecodeGeneratorification.cpp: (JSC::BytecodeGeneratorification::BytecodeGeneratorification): (JSC::GeneratorLivenessAnalysis::run): (JSC::BytecodeGeneratorification::run): (JSC::performGeneratorification): * bytecode/BytecodeGeneratorification.h: * bytecode/BytecodeRewriter.h: (JSC::BytecodeRewriter::BytecodeRewriter): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::setConstantIdentifierSetRegisters): (JSC::CodeBlock::setConstantRegisters): (JSC::CodeBlock::handlerForIndex): (JSC::CodeBlock::insertBasicBlockBoundariesForControlFlowProfiler): * bytecode/CodeBlock.h: (JSC::CodeBlock::numberOfSwitchJumpTables const): (JSC::CodeBlock::numberOfStringSwitchJumpTables const): (JSC::CodeBlock::addSwitchJumpTable): Deleted. (JSC::CodeBlock::addStringSwitchJumpTable): Deleted. * bytecode/HandlerInfo.h: (JSC::HandlerInfoBase::handlerForIndex): * bytecode/JumpTable.h: (JSC::SimpleJumpTable::add): Deleted. * bytecode/PreciseJumpTargets.cpp: (JSC::computePreciseJumpTargets): (JSC::recomputePreciseJumpTargets): (JSC::findJumpTargetsForInstruction): * bytecode/PreciseJumpTargets.h: * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): (JSC::UnlinkedCodeBlock::visitChildren): (JSC::UnlinkedCodeBlock::dumpExpressionRangeInfo): (JSC::UnlinkedCodeBlock::expressionRangeForBytecodeIndex const): (JSC::UnlinkedCodeBlock::handlerForIndex): (JSC::UnlinkedCodeBlock::addExpressionInfo): Deleted. (JSC::UnlinkedCodeBlock::addTypeProfilerExpressionInfo): Deleted. (JSC::UnlinkedCodeBlock::setInstructions): Deleted. (JSC::UnlinkedCodeBlock::applyModification): Deleted. (JSC::UnlinkedCodeBlock::shrinkToFit): Deleted. (JSC::UnlinkedCodeBlock::addOutOfLineJumpTarget): Deleted. * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::expressionInfo): (JSC::UnlinkedCodeBlock::setNumParameters): (JSC::UnlinkedCodeBlock::numberOfIdentifiers const): (JSC::UnlinkedCodeBlock::identifiers const): (JSC::UnlinkedCodeBlock::bitVector): (JSC::UnlinkedCodeBlock::constantRegisters): (JSC::UnlinkedCodeBlock::constantsSourceCodeRepresentation): (JSC::UnlinkedCodeBlock::constantIdentifierSets): (JSC::UnlinkedCodeBlock::numberOfJumpTargets const): (JSC::UnlinkedCodeBlock::numberOfSwitchJumpTables const): (JSC::UnlinkedCodeBlock::numberOfStringSwitchJumpTables const): (JSC::UnlinkedCodeBlock::numberOfFunctionDecls): (JSC::UnlinkedCodeBlock::numberOfExceptionHandlers const): (JSC::UnlinkedCodeBlock::opProfileControlFlowBytecodeOffsets const): (JSC::UnlinkedCodeBlock::createRareDataIfNecessary): (JSC::UnlinkedCodeBlock::addParameter): Deleted. (JSC::UnlinkedCodeBlock::addIdentifier): Deleted. (JSC::UnlinkedCodeBlock::addBitVector): Deleted. (JSC::UnlinkedCodeBlock::addSetConstant): Deleted. (JSC::UnlinkedCodeBlock::addConstant): Deleted. (JSC::UnlinkedCodeBlock::addJumpTarget): Deleted. (JSC::UnlinkedCodeBlock::addSwitchJumpTable): Deleted. (JSC::UnlinkedCodeBlock::addStringSwitchJumpTable): Deleted. (JSC::UnlinkedCodeBlock::addFunctionDecl): Deleted. (JSC::UnlinkedCodeBlock::addFunctionExpr): Deleted. (JSC::UnlinkedCodeBlock::addExceptionHandler): Deleted. (JSC::UnlinkedCodeBlock::addOpProfileControlFlowBytecodeOffset): Deleted. (JSC::UnlinkedCodeBlock::replaceOutOfLineJumpTargets): Deleted. * bytecode/UnlinkedCodeBlockGenerator.cpp: Added. (JSC::UnlinkedCodeBlockGenerator::getLineAndColumn const): (JSC::UnlinkedCodeBlockGenerator::addExpressionInfo): (JSC::UnlinkedCodeBlockGenerator::addTypeProfilerExpressionInfo): (JSC::UnlinkedCodeBlockGenerator::finalize): (JSC::UnlinkedCodeBlockGenerator::handlerForBytecodeIndex): (JSC::UnlinkedCodeBlockGenerator::handlerForIndex): (JSC::UnlinkedCodeBlockGenerator::applyModification): (JSC::UnlinkedCodeBlockGenerator::addOutOfLineJumpTarget): (JSC::UnlinkedCodeBlockGenerator::outOfLineJumpOffset): (JSC::UnlinkedCodeBlockGenerator::dump const): * bytecode/UnlinkedCodeBlockGenerator.h: Added. (JSC::UnlinkedCodeBlockGenerator::UnlinkedCodeBlockGenerator): (JSC::UnlinkedCodeBlockGenerator::vm): (JSC::UnlinkedCodeBlockGenerator::isConstructor const): (JSC::UnlinkedCodeBlockGenerator::constructorKind const): (JSC::UnlinkedCodeBlockGenerator::superBinding const): (JSC::UnlinkedCodeBlockGenerator::scriptMode const): (JSC::UnlinkedCodeBlockGenerator::needsClassFieldInitializer const): (JSC::UnlinkedCodeBlockGenerator::isStrictMode const): (JSC::UnlinkedCodeBlockGenerator::usesEval const): (JSC::UnlinkedCodeBlockGenerator::parseMode const): (JSC::UnlinkedCodeBlockGenerator::isArrowFunction): (JSC::UnlinkedCodeBlockGenerator::derivedContextType const): (JSC::UnlinkedCodeBlockGenerator::evalContextType const): (JSC::UnlinkedCodeBlockGenerator::isArrowFunctionContext const): (JSC::UnlinkedCodeBlockGenerator::isClassContext const): (JSC::UnlinkedCodeBlockGenerator::numCalleeLocals const): (JSC::UnlinkedCodeBlockGenerator::numVars const): (JSC::UnlinkedCodeBlockGenerator::numParameters const): (JSC::UnlinkedCodeBlockGenerator::thisRegister const): (JSC::UnlinkedCodeBlockGenerator::scopeRegister const): (JSC::UnlinkedCodeBlockGenerator::wasCompiledWithDebuggingOpcodes const): (JSC::UnlinkedCodeBlockGenerator::hasCheckpoints const): (JSC::UnlinkedCodeBlockGenerator::hasTailCalls const): (JSC::UnlinkedCodeBlockGenerator::setHasCheckpoints): (JSC::UnlinkedCodeBlockGenerator::setHasTailCalls): (JSC::UnlinkedCodeBlockGenerator::setNumCalleeLocals): (JSC::UnlinkedCodeBlockGenerator::setNumVars): (JSC::UnlinkedCodeBlockGenerator::setThisRegister): (JSC::UnlinkedCodeBlockGenerator::setScopeRegister): (JSC::UnlinkedCodeBlockGenerator::setNumParameters): (JSC::UnlinkedCodeBlockGenerator::metadata): (JSC::UnlinkedCodeBlockGenerator::addOpProfileControlFlowBytecodeOffset): (JSC::UnlinkedCodeBlockGenerator::numberOfJumpTargets const): (JSC::UnlinkedCodeBlockGenerator::addJumpTarget): (JSC::UnlinkedCodeBlockGenerator::jumpTarget const): (JSC::UnlinkedCodeBlockGenerator::lastJumpTarget const): (JSC::UnlinkedCodeBlockGenerator::numberOfSwitchJumpTables const): (JSC::UnlinkedCodeBlockGenerator::addSwitchJumpTable): (JSC::UnlinkedCodeBlockGenerator::switchJumpTable): (JSC::UnlinkedCodeBlockGenerator::numberOfStringSwitchJumpTables const): (JSC::UnlinkedCodeBlockGenerator::addStringSwitchJumpTable): (JSC::UnlinkedCodeBlockGenerator::stringSwitchJumpTable): (JSC::UnlinkedCodeBlockGenerator::numberOfExceptionHandlers const): (JSC::UnlinkedCodeBlockGenerator::exceptionHandler): (JSC::UnlinkedCodeBlockGenerator::addExceptionHandler): (JSC::UnlinkedCodeBlockGenerator::bitVector): (JSC::UnlinkedCodeBlockGenerator::addBitVector): (JSC::UnlinkedCodeBlockGenerator::numberOfConstantIdentifierSets const): (JSC::UnlinkedCodeBlockGenerator::constantIdentifierSets): (JSC::UnlinkedCodeBlockGenerator::addSetConstant): (JSC::UnlinkedCodeBlockGenerator::constantRegister const): (JSC::UnlinkedCodeBlockGenerator::constantRegisters): (JSC::UnlinkedCodeBlockGenerator::getConstant const): (JSC::UnlinkedCodeBlockGenerator::constantsSourceCodeRepresentation): (JSC::UnlinkedCodeBlockGenerator::addConstant): (JSC::UnlinkedCodeBlockGenerator::addFunctionDecl): (JSC::UnlinkedCodeBlockGenerator::addFunctionExpr): (JSC::UnlinkedCodeBlockGenerator::numberOfIdentifiers const): (JSC::UnlinkedCodeBlockGenerator::identifier const): (JSC::UnlinkedCodeBlockGenerator::addIdentifier): (JSC::UnlinkedCodeBlockGenerator::outOfLineJumpOffset): (JSC::UnlinkedCodeBlockGenerator::replaceOutOfLineJumpTargets): (JSC::UnlinkedCodeBlockGenerator::metadataSizeInBytes): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::initializeNextParameter): (JSC::BytecodeGenerator::emitPushFunctionNameScope): (JSC::prepareJumpTableForSwitch): (JSC::ForInContext::finalize): (JSC::StructureForInContext::finalize): (JSC::IndexedForInContext::finalize): * bytecompiler/BytecodeGenerator.h: * bytecompiler/BytecodeGeneratorBaseInlines.h: (JSC::BytecodeGeneratorBase<Traits>::newRegister): (JSC::BytecodeGeneratorBase<Traits>::addVar): * runtime/CachedTypes.cpp: (JSC::CachedVector::encode): (JSC::CachedVector::decode const): * wasm/WasmFunctionCodeBlock.h: (JSC::Wasm::FunctionCodeBlock::setNumVars): (JSC::Wasm::FunctionCodeBlock::setNumCalleeLocals): Source/WTF: Add more useful methods for RefCountedArray. * wtf/RefCountedArray.h: (WTF::RefCountedArray::operator=): (WTF::RefCountedArray::isEmpty const): (WTF::RefCountedArray::front): (WTF::RefCountedArray::front const): (WTF::RefCountedArray::last): (WTF::RefCountedArray::last const): Canonical link: https://commits.webkit.org/220203@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255687 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-02-04 19:05:17 +00:00
bytecode/UnlinkedCodeBlockGenerator.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
bytecode/UnlinkedEvalCodeBlock.cpp
bytecode/UnlinkedFunctionCodeBlock.cpp
bytecode/UnlinkedFunctionExecutable.cpp
[JSC] UnlinkedMetadataTable's offset table should be small https://bugs.webkit.org/show_bug.cgi?id=197910 Reviewed by Saam Barati. In Gmail, we found that massive # of UnlinkedMetadataTable (21979 - 24727) exists. Each UnlinkedMetadataTable takes at least 204 bytes because of large (unsinged) offset table. This patch reduces the size of offset table by introducing 16bit version offset table. Previously our code for looking up Metadata is like this. offset = offsetTable32[opcode] metadata = (SomeOp::Metadata*)table[offset] + id Instead, we introduce uint16_t offset table. The lookup code becomes like this. offset = offsetTable16[opcode] if (!offset) offset = offsetTable32[opcode] metadata = (SomeOp::Metadata*)table[offset] + id We use 0 offset as a marker to indicate that we have 32bit offset table. This is OK since 0 offset does not appear since all the offsets included in this table is larger than s_offset16TableSize. 32bit offset table is allocated only when the offset exceeds 16bit range. It means that this will be used only when Metadata table is larger than almost 64KB. Even in Gmail, such MetadataTable is rare, and additional 32bit offset table size does not matter much in this case since MetadataTable is already so large. Based on the # of UnlinkedMetadataTables, this optimization should improve Gmail steady state memory by 2MB. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/MetadataTable.cpp: (JSC::MetadataTable::~MetadataTable): (JSC::MetadataTable::destroy): * bytecode/MetadataTable.h: (JSC::MetadataTable::ref): (JSC::MetadataTable::deref): (JSC::MetadataTable::buffer): (JSC::MetadataTable::is32Bit const): (JSC::MetadataTable::offsetTable16 const): (JSC::MetadataTable::offsetTable32 const): (JSC::MetadataTable::totalSize const): (JSC::MetadataTable::getOffset const): (JSC::MetadataTable::getImpl): (JSC::MetadataTable::ref const): Deleted. (JSC::MetadataTable::deref const): Deleted. * bytecode/Opcode.cpp: * bytecode/UnlinkedMetadataTable.cpp: Added. (JSC::UnlinkedMetadataTable::finalize): * bytecode/UnlinkedMetadataTable.h: (JSC::UnlinkedMetadataTable::create): (JSC::UnlinkedMetadataTable::totalSize const): (JSC::UnlinkedMetadataTable::offsetTableSize const): (JSC::UnlinkedMetadataTable::preprocessBuffer const): (JSC::UnlinkedMetadataTable::buffer const): (JSC::UnlinkedMetadataTable::offsetTable16 const): (JSC::UnlinkedMetadataTable::offsetTable32 const): * bytecode/UnlinkedMetadataTableInlines.h: (JSC::UnlinkedMetadataTable::UnlinkedMetadataTable): (JSC::UnlinkedMetadataTable::addEntry): (JSC::UnlinkedMetadataTable::sizeInBytes): (JSC::UnlinkedMetadataTable::link): (JSC::UnlinkedMetadataTable::unlink): (JSC::UnlinkedMetadataTable::finalize): Deleted. * llint/LowLevelInterpreter.asm: * runtime/CachedTypes.cpp: (JSC::CachedMetadataTable::encode): (JSC::CachedMetadataTable::decode const): Canonical link: https://commits.webkit.org/212224@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245669 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-23 01:47:29 +00:00
bytecode/UnlinkedMetadataTable.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
bytecode/UnlinkedModuleProgramCodeBlock.cpp
bytecode/UnlinkedProgramCodeBlock.cpp
bytecode/ValueRecovery.cpp
bytecode/VariableWriteFireDetail.cpp
bytecode/VirtualRegister.cpp
bytecode/Watchpoint.cpp
Reduce JSC's binary size https://bugs.webkit.org/show_bug.cgi?id=204549 Reviewed by Saam Barati. The Wasm interpreter landed in r251886 and significantly increased JSC's binary size. To try and offset that, here and some easy fixes that get us ~200kb back: - We were generating 2 instances of dumpBytecode, at 30kb each. I changed the generator to emit a cpp file instead, avoiding the duplication. - We had 3 instances of computeUsesForBytecodeIndex at 11kb each. I kept the work that depended on the template type in the template function and moved the massive switch into computeUsesForBytecodeIndexImpl. I also did the same for computeDefsForBytecodeIndex. - We had 8 instances of emit_compareAndJump(Slow) at 8kb (7kb for Slow) each. I kept the code that extracts the data from the bytecode in the template, but moved the bulk of the function into emit_compareAndJump(Slow)Impl. * CMakeLists.txt: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumperBase::printLocationAndOp): (JSC::BytecodeDumperBase::dumpValue): * bytecode/BytecodeDumper.h: (JSC::BytecodeDumperBase::~BytecodeDumperBase): (JSC::BytecodeDumperBase::dumpValue): (JSC::BytecodeDumperBase::BytecodeDumperBase): (JSC::BytecodeDumper::BytecodeDumper): * bytecode/BytecodeUseDef.cpp: Copied from Source/JavaScriptCore/bytecode/BytecodeUseDef.h. (JSC::computeUsesForBytecodeIndexImpl): (JSC::computeDefsForBytecodeIndexImpl): * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeIndex): (JSC::computeDefsForBytecodeIndex): * generator/DSL.rb: * generator/Opcode.rb: * generator/Options.rb: * jit/JIT.h: * jit/JITArithmetic.cpp: (JSC::JIT::emit_compareAndJump): (JSC::JIT::emit_compareAndJumpImpl): (JSC::JIT::emit_compareUnsignedAndJump): (JSC::JIT::emit_compareUnsignedAndJumpImpl): (JSC::JIT::emit_compareUnsigned): (JSC::JIT::emit_compareUnsignedImpl): (JSC::JIT::emit_compareAndJumpSlow): (JSC::JIT::emit_compareAndJumpSlowImpl): Canonical link: https://commits.webkit.org/218278@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253335 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-12-10 19:41:40 +00:00
// Derived Sources
BytecodeDumperGenerated.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
bytecompiler/BytecodeGenerator.cpp
bytecompiler/NodesCodegen.cpp
New bytecode format for JSC https://bugs.webkit.org/show_bug.cgi?id=187373 <rdar://problem/44186758> Reviewed by Filip Pizlo. .: Disable JIT by default on 32-bit platforms * Source/cmake/WebKitFeatures.cmake: JSTests: Add tests to ensure that the inferred inline capacity for a narrow op_new_object will be capped at 255. * stress/maximum-inline-capacity.js: Added. (test1): (test3.Foo): (test3): Source/JavaScriptCore: Replace unlinked and linked bytecode with a new immutable bytecode that does not embed any addresses. Instructions can be encoded as narrow (1-byte operands) or wide (4-byte operands) and might contain an extra operand, the metadataID. The metadataID is used to access the instruction's mutable data in a side table in the CodeBlock (the MetadataTable). Bytecodes now must be structs declared in the new BytecodeList.rb. All bytecodes give names and types to all its operands. Additionally, reading a bytecode from the instruction stream requires decoding the whole bytecode, i.e. it's no longer possible to access arbitrary operands directly from the stream. * CMakeLists.txt: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/MacroAssemblerCodeRef.h: (JSC::ReturnAddressPtr::ReturnAddressPtr): (JSC::ReturnAddressPtr::value const): (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): (JSC::MacroAssemblerCodePtr::createFromExecutableAddress): * bytecode/ArithProfile.h: (JSC::ArithProfile::ArithProfile): * bytecode/ArrayAllocationProfile.h: (JSC::ArrayAllocationProfile::ArrayAllocationProfile): * bytecode/ArrayProfile.h: * bytecode/BytecodeBasicBlock.cpp: (JSC::isJumpTarget): (JSC::BytecodeBasicBlock::computeImpl): (JSC::BytecodeBasicBlock::compute): * bytecode/BytecodeBasicBlock.h: (JSC::BytecodeBasicBlock::leaderOffset const): (JSC::BytecodeBasicBlock::totalLength const): (JSC::BytecodeBasicBlock::offsets const): (JSC::BytecodeBasicBlock::BytecodeBasicBlock): (JSC::BytecodeBasicBlock::addLength): * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::printLocationAndOp): (JSC::BytecodeDumper<Block>::dumpBytecode): (JSC::BytecodeDumper<Block>::dumpIdentifiers): (JSC::BytecodeDumper<Block>::dumpConstants): (JSC::BytecodeDumper<Block>::dumpExceptionHandlers): (JSC::BytecodeDumper<Block>::dumpSwitchJumpTables): (JSC::BytecodeDumper<Block>::dumpStringSwitchJumpTables): (JSC::BytecodeDumper<Block>::dumpBlock): * bytecode/BytecodeDumper.h: (JSC::BytecodeDumper::dumpOperand): (JSC::BytecodeDumper::dumpValue): (JSC::BytecodeDumper::BytecodeDumper): (JSC::BytecodeDumper::block const): * bytecode/BytecodeGeneratorification.cpp: (JSC::BytecodeGeneratorification::BytecodeGeneratorification): (JSC::BytecodeGeneratorification::enterPoint const): (JSC::BytecodeGeneratorification::instructions const): (JSC::GeneratorLivenessAnalysis::run): (JSC::BytecodeGeneratorification::run): (JSC::performGeneratorification): * bytecode/BytecodeGeneratorification.h: * bytecode/BytecodeGraph.h: (JSC::BytecodeGraph::blockContainsBytecodeOffset): (JSC::BytecodeGraph::findBasicBlockForBytecodeOffset): (JSC::BytecodeGraph::findBasicBlockWithLeaderOffset): (JSC::BytecodeGraph::BytecodeGraph): * bytecode/BytecodeKills.h: * bytecode/BytecodeList.json: Removed. * bytecode/BytecodeList.rb: Added. * bytecode/BytecodeLivenessAnalysis.cpp: (JSC::BytecodeLivenessAnalysis::dumpResults): * bytecode/BytecodeLivenessAnalysis.h: * bytecode/BytecodeLivenessAnalysisInlines.h: (JSC::isValidRegisterForLiveness): (JSC::BytecodeLivenessPropagation::stepOverInstruction): * bytecode/BytecodeRewriter.cpp: (JSC::BytecodeRewriter::applyModification): (JSC::BytecodeRewriter::execute): (JSC::BytecodeRewriter::adjustJumpTargetsInFragment): (JSC::BytecodeRewriter::insertImpl): (JSC::BytecodeRewriter::adjustJumpTarget): (JSC::BytecodeRewriter::adjustJumpTargets): * bytecode/BytecodeRewriter.h: (JSC::BytecodeRewriter::InsertionPoint::InsertionPoint): (JSC::BytecodeRewriter::Fragment::Fragment): (JSC::BytecodeRewriter::Fragment::appendInstruction): (JSC::BytecodeRewriter::BytecodeRewriter): (JSC::BytecodeRewriter::insertFragmentBefore): (JSC::BytecodeRewriter::insertFragmentAfter): (JSC::BytecodeRewriter::removeBytecode): (JSC::BytecodeRewriter::adjustAbsoluteOffset): (JSC::BytecodeRewriter::adjustJumpTarget): * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): (JSC::computeDefsForBytecodeOffset): * bytecode/CallLinkStatus.cpp: (JSC::CallLinkStatus::computeFromLLInt): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): (JSC::CodeBlock::CodeBlock): (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::estimatedSize): (JSC::CodeBlock::visitChildren): (JSC::CodeBlock::propagateTransitions): (JSC::CodeBlock::finalizeLLIntInlineCaches): (JSC::CodeBlock::addJITAddIC): (JSC::CodeBlock::addJITMulIC): (JSC::CodeBlock::addJITSubIC): (JSC::CodeBlock::addJITNegIC): (JSC::CodeBlock::stronglyVisitStrongReferences): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffset): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffsetSlow): (JSC::CodeBlock::hasOpDebugForLineAndColumn): (JSC::CodeBlock::getArrayProfile): (JSC::CodeBlock::updateAllArrayPredictions): (JSC::CodeBlock::predictedMachineCodeSize): (JSC::CodeBlock::tryGetValueProfileForBytecodeOffset): (JSC::CodeBlock::valueProfilePredictionForBytecodeOffset): (JSC::CodeBlock::valueProfileForBytecodeOffset): (JSC::CodeBlock::validate): (JSC::CodeBlock::outOfLineJumpOffset): (JSC::CodeBlock::outOfLineJumpTarget): (JSC::CodeBlock::arithProfileForBytecodeOffset): (JSC::CodeBlock::arithProfileForPC): (JSC::CodeBlock::couldTakeSpecialFastCase): (JSC::CodeBlock::insertBasicBlockBoundariesForControlFlowProfiler): * bytecode/CodeBlock.h: (JSC::CodeBlock::addMathIC): (JSC::CodeBlock::outOfLineJumpOffset): (JSC::CodeBlock::bytecodeOffset): (JSC::CodeBlock::instructions const): (JSC::CodeBlock::instructionCount const): (JSC::CodeBlock::llintBaselineCalleeSaveSpaceAsVirtualRegisters): (JSC::CodeBlock::metadata): (JSC::CodeBlock::metadataSizeInBytes): (JSC::CodeBlock::numberOfNonArgumentValueProfiles): (JSC::CodeBlock::totalNumberOfValueProfiles): * bytecode/CodeBlockInlines.h: Added. (JSC::CodeBlock::forEachValueProfile): (JSC::CodeBlock::forEachArrayProfile): (JSC::CodeBlock::forEachArrayAllocationProfile): (JSC::CodeBlock::forEachObjectAllocationProfile): (JSC::CodeBlock::forEachLLIntCallLinkInfo): * bytecode/Fits.h: Added. * bytecode/GetByIdMetadata.h: Copied from Source/JavaScriptCore/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h. * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::computeFromLLInt): * bytecode/Instruction.h: (JSC::Instruction::Instruction): (JSC::Instruction::Impl::opcodeID const): (JSC::Instruction::opcodeID const): (JSC::Instruction::name const): (JSC::Instruction::isWide const): (JSC::Instruction::size const): (JSC::Instruction::is const): (JSC::Instruction::as const): (JSC::Instruction::cast): (JSC::Instruction::cast const): (JSC::Instruction::narrow const): (JSC::Instruction::wide const): * bytecode/InstructionStream.cpp: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. (JSC::InstructionStream::InstructionStream): (JSC::InstructionStream::sizeInBytes const): * bytecode/InstructionStream.h: Added. (JSC::InstructionStream::BaseRef::BaseRef): (JSC::InstructionStream::BaseRef::operator=): (JSC::InstructionStream::BaseRef::operator-> const): (JSC::InstructionStream::BaseRef::ptr const): (JSC::InstructionStream::BaseRef::operator!= const): (JSC::InstructionStream::BaseRef::next const): (JSC::InstructionStream::BaseRef::offset const): (JSC::InstructionStream::BaseRef::isValid const): (JSC::InstructionStream::BaseRef::unwrap const): (JSC::InstructionStream::MutableRef::freeze const): (JSC::InstructionStream::MutableRef::operator->): (JSC::InstructionStream::MutableRef::ptr): (JSC::InstructionStream::MutableRef::operator Ref): (JSC::InstructionStream::MutableRef::unwrap): (JSC::InstructionStream::iterator::operator*): (JSC::InstructionStream::iterator::operator++): (JSC::InstructionStream::begin const): (JSC::InstructionStream::end const): (JSC::InstructionStream::at const): (JSC::InstructionStream::size const): (JSC::InstructionStreamWriter::InstructionStreamWriter): (JSC::InstructionStreamWriter::ref): (JSC::InstructionStreamWriter::seek): (JSC::InstructionStreamWriter::position): (JSC::InstructionStreamWriter::write): (JSC::InstructionStreamWriter::rewind): (JSC::InstructionStreamWriter::finalize): (JSC::InstructionStreamWriter::swap): (JSC::InstructionStreamWriter::iterator::operator*): (JSC::InstructionStreamWriter::iterator::operator++): (JSC::InstructionStreamWriter::begin): (JSC::InstructionStreamWriter::end): * bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp: (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::LLIntPrototypeLoadAdaptiveStructureWatchpoint): (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::fireInternal): (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::clearLLIntGetByIdCache): * bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h: * bytecode/MetadataTable.cpp: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. (JSC::MetadataTable::MetadataTable): (JSC::DeallocTable::withOpcodeType): (JSC::MetadataTable::~MetadataTable): (JSC::MetadataTable::sizeInBytes): * bytecode/MetadataTable.h: Copied from Source/JavaScriptCore/runtime/Watchdog.h. (JSC::MetadataTable::get): (JSC::MetadataTable::forEach): (JSC::MetadataTable::getImpl): * bytecode/Opcode.cpp: (JSC::metadataSize): * bytecode/Opcode.h: (JSC::padOpcodeName): * bytecode/OpcodeInlines.h: (JSC::isOpcodeShape): (JSC::getOpcodeType): * bytecode/OpcodeSize.h: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. * bytecode/PreciseJumpTargets.cpp: (JSC::getJumpTargetsForInstruction): (JSC::computePreciseJumpTargetsInternal): (JSC::computePreciseJumpTargets): (JSC::recomputePreciseJumpTargets): (JSC::findJumpTargetsForInstruction): * bytecode/PreciseJumpTargets.h: * bytecode/PreciseJumpTargetsInlines.h: (JSC::jumpTargetForInstruction): (JSC::extractStoredJumpTargetsForInstruction): (JSC::updateStoredJumpTargetsForInstruction): * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::computeFromLLInt): * bytecode/SpecialPointer.cpp: (WTF::printInternal): * bytecode/SpecialPointer.h: * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): (JSC::UnlinkedCodeBlock::visitChildren): (JSC::UnlinkedCodeBlock::estimatedSize): (JSC::UnlinkedCodeBlock::lineNumberForBytecodeOffset): (JSC::dumpLineColumnEntry): (JSC::UnlinkedCodeBlock::expressionRangeForBytecodeOffset const): (JSC::UnlinkedCodeBlock::setInstructions): (JSC::UnlinkedCodeBlock::instructions const): (JSC::UnlinkedCodeBlock::applyModification): (JSC::UnlinkedCodeBlock::addOutOfLineJumpTarget): (JSC::UnlinkedCodeBlock::outOfLineJumpOffset): * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::addPropertyAccessInstruction): (JSC::UnlinkedCodeBlock::propertyAccessInstructions const): (JSC::UnlinkedCodeBlock::addOpProfileControlFlowBytecodeOffset): (JSC::UnlinkedCodeBlock::opProfileControlFlowBytecodeOffsets const): (JSC::UnlinkedCodeBlock::metadata): (JSC::UnlinkedCodeBlock::metadataSizeInBytes): (JSC::UnlinkedCodeBlock::outOfLineJumpOffset): (JSC::UnlinkedCodeBlock::replaceOutOfLineJumpTargets): * bytecode/UnlinkedInstructionStream.cpp: Removed. * bytecode/UnlinkedInstructionStream.h: Removed. * bytecode/UnlinkedMetadataTable.h: Copied from Source/JavaScriptCore/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h. * bytecode/UnlinkedMetadataTableInlines.h: Added. (JSC::UnlinkedMetadataTable::UnlinkedMetadataTable): (JSC::UnlinkedMetadataTable::~UnlinkedMetadataTable): (JSC::UnlinkedMetadataTable::addEntry): (JSC::UnlinkedMetadataTable::sizeInBytes): (JSC::UnlinkedMetadataTable::finalize): (JSC::UnlinkedMetadataTable::link): (JSC::UnlinkedMetadataTable::unlink): * bytecode/VirtualRegister.cpp: (JSC::VirtualRegister::VirtualRegister): * bytecode/VirtualRegister.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::Label::setLocation): (JSC::Label::bind): (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::initializeVarLexicalEnvironment): (JSC::BytecodeGenerator::emitEnter): (JSC::BytecodeGenerator::emitLoopHint): (JSC::BytecodeGenerator::emitJump): (JSC::BytecodeGenerator::emitCheckTraps): (JSC::BytecodeGenerator::rewind): (JSC::BytecodeGenerator::fuseCompareAndJump): (JSC::BytecodeGenerator::fuseTestAndJmp): (JSC::BytecodeGenerator::emitJumpIfTrue): (JSC::BytecodeGenerator::emitJumpIfFalse): (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall): (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply): (JSC::BytecodeGenerator::moveLinkTimeConstant): (JSC::BytecodeGenerator::moveEmptyValue): (JSC::BytecodeGenerator::emitMove): (JSC::BytecodeGenerator::emitUnaryOp): (JSC::BytecodeGenerator::emitBinaryOp): (JSC::BytecodeGenerator::emitToObject): (JSC::BytecodeGenerator::emitToNumber): (JSC::BytecodeGenerator::emitToString): (JSC::BytecodeGenerator::emitTypeOf): (JSC::BytecodeGenerator::emitInc): (JSC::BytecodeGenerator::emitDec): (JSC::BytecodeGenerator::emitEqualityOp): (JSC::BytecodeGenerator::emitProfileType): (JSC::BytecodeGenerator::emitProfileControlFlow): (JSC::BytecodeGenerator::pushLexicalScopeInternal): (JSC::BytecodeGenerator::emitResolveScopeForHoistingFuncDeclInEval): (JSC::BytecodeGenerator::prepareLexicalScopeForNextForLoopIteration): (JSC::BytecodeGenerator::emitOverridesHasInstance): (JSC::BytecodeGenerator::emitResolveScope): (JSC::BytecodeGenerator::emitGetFromScope): (JSC::BytecodeGenerator::emitPutToScope): (JSC::BytecodeGenerator::emitInstanceOf): (JSC::BytecodeGenerator::emitInstanceOfCustom): (JSC::BytecodeGenerator::emitInByVal): (JSC::BytecodeGenerator::emitInById): (JSC::BytecodeGenerator::emitTryGetById): (JSC::BytecodeGenerator::emitGetById): (JSC::BytecodeGenerator::emitDirectGetById): (JSC::BytecodeGenerator::emitPutById): (JSC::BytecodeGenerator::emitDirectPutById): (JSC::BytecodeGenerator::emitPutGetterById): (JSC::BytecodeGenerator::emitPutSetterById): (JSC::BytecodeGenerator::emitPutGetterSetter): (JSC::BytecodeGenerator::emitPutGetterByVal): (JSC::BytecodeGenerator::emitPutSetterByVal): (JSC::BytecodeGenerator::emitDeleteById): (JSC::BytecodeGenerator::emitGetByVal): (JSC::BytecodeGenerator::emitPutByVal): (JSC::BytecodeGenerator::emitDirectPutByVal): (JSC::BytecodeGenerator::emitDeleteByVal): (JSC::BytecodeGenerator::emitSuperSamplerBegin): (JSC::BytecodeGenerator::emitSuperSamplerEnd): (JSC::BytecodeGenerator::emitIdWithProfile): (JSC::BytecodeGenerator::emitUnreachable): (JSC::BytecodeGenerator::emitGetArgument): (JSC::BytecodeGenerator::emitCreateThis): (JSC::BytecodeGenerator::emitTDZCheck): (JSC::BytecodeGenerator::emitNewObject): (JSC::BytecodeGenerator::emitNewArrayBuffer): (JSC::BytecodeGenerator::emitNewArray): (JSC::BytecodeGenerator::emitNewArrayWithSpread): (JSC::BytecodeGenerator::emitNewArrayWithSize): (JSC::BytecodeGenerator::emitNewRegExp): (JSC::BytecodeGenerator::emitNewFunctionExpressionCommon): (JSC::BytecodeGenerator::emitNewDefaultConstructor): (JSC::BytecodeGenerator::emitNewFunction): (JSC::BytecodeGenerator::emitSetFunctionNameIfNeeded): (JSC::BytecodeGenerator::emitCall): (JSC::BytecodeGenerator::emitCallInTailPosition): (JSC::BytecodeGenerator::emitCallEval): (JSC::BytecodeGenerator::emitExpectedFunctionSnippet): (JSC::BytecodeGenerator::emitCallVarargs): (JSC::BytecodeGenerator::emitCallVarargsInTailPosition): (JSC::BytecodeGenerator::emitConstructVarargs): (JSC::BytecodeGenerator::emitCallForwardArgumentsInTailPosition): (JSC::BytecodeGenerator::emitLogShadowChickenPrologueIfNecessary): (JSC::BytecodeGenerator::emitLogShadowChickenTailIfNecessary): (JSC::BytecodeGenerator::emitCallDefineProperty): (JSC::BytecodeGenerator::emitReturn): (JSC::BytecodeGenerator::emitEnd): (JSC::BytecodeGenerator::emitConstruct): (JSC::BytecodeGenerator::emitStrcat): (JSC::BytecodeGenerator::emitToPrimitive): (JSC::BytecodeGenerator::emitGetScope): (JSC::BytecodeGenerator::emitPushWithScope): (JSC::BytecodeGenerator::emitGetParentScope): (JSC::BytecodeGenerator::emitDebugHook): (JSC::BytecodeGenerator::emitCatch): (JSC::BytecodeGenerator::emitThrow): (JSC::BytecodeGenerator::emitArgumentCount): (JSC::BytecodeGenerator::emitThrowStaticError): (JSC::BytecodeGenerator::beginSwitch): (JSC::prepareJumpTableForSwitch): (JSC::prepareJumpTableForStringSwitch): (JSC::BytecodeGenerator::endSwitch): (JSC::BytecodeGenerator::emitGetEnumerableLength): (JSC::BytecodeGenerator::emitHasGenericProperty): (JSC::BytecodeGenerator::emitHasIndexedProperty): (JSC::BytecodeGenerator::emitHasStructureProperty): (JSC::BytecodeGenerator::emitGetPropertyEnumerator): (JSC::BytecodeGenerator::emitEnumeratorStructurePropertyName): (JSC::BytecodeGenerator::emitEnumeratorGenericPropertyName): (JSC::BytecodeGenerator::emitToIndexString): (JSC::BytecodeGenerator::emitIsCellWithType): (JSC::BytecodeGenerator::emitIsObject): (JSC::BytecodeGenerator::emitIsNumber): (JSC::BytecodeGenerator::emitIsUndefined): (JSC::BytecodeGenerator::emitIsEmpty): (JSC::BytecodeGenerator::emitRestParameter): (JSC::BytecodeGenerator::emitRequireObjectCoercible): (JSC::BytecodeGenerator::emitYieldPoint): (JSC::BytecodeGenerator::emitYield): (JSC::BytecodeGenerator::emitGetAsyncIterator): (JSC::BytecodeGenerator::emitDelegateYield): (JSC::BytecodeGenerator::emitFinallyCompletion): (JSC::BytecodeGenerator::emitJumpIf): (JSC::ForInContext::finalize): (JSC::StructureForInContext::finalize): (JSC::IndexedForInContext::finalize): (JSC::StaticPropertyAnalysis::record): (JSC::BytecodeGenerator::emitToThis): * bytecompiler/BytecodeGenerator.h: (JSC::StructureForInContext::addGetInst): (JSC::BytecodeGenerator::recordOpcode): (JSC::BytecodeGenerator::addMetadataFor): (JSC::BytecodeGenerator::emitUnaryOp): (JSC::BytecodeGenerator::kill): (JSC::BytecodeGenerator::instructions const): (JSC::BytecodeGenerator::write): (JSC::BytecodeGenerator::withWriter): * bytecompiler/Label.h: (JSC::Label::Label): (JSC::Label::bind): * bytecompiler/NodesCodegen.cpp: (JSC::ArrayNode::emitBytecode): (JSC::BytecodeIntrinsicNode::emit_intrinsic_argumentCount): (JSC::ApplyFunctionCallDotNode::emitBytecode): (JSC::BitwiseNotNode::emitBytecode): (JSC::BinaryOpNode::emitBytecode): (JSC::EqualNode::emitBytecode): (JSC::StrictEqualNode::emitBytecode): (JSC::emitReadModifyAssignment): (JSC::ForInNode::emitBytecode): (JSC::CaseBlockNode::emitBytecodeForBlock): (JSC::FunctionNode::emitBytecode): (JSC::ClassExprNode::emitBytecode): * bytecompiler/ProfileTypeBytecodeFlag.cpp: Copied from Source/JavaScriptCore/bytecode/VirtualRegister.cpp. (WTF::printInternal): * bytecompiler/ProfileTypeBytecodeFlag.h: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. * bytecompiler/RegisterID.h: * bytecompiler/StaticPropertyAnalysis.h: (JSC::StaticPropertyAnalysis::create): (JSC::StaticPropertyAnalysis::StaticPropertyAnalysis): * bytecompiler/StaticPropertyAnalyzer.h: (JSC::StaticPropertyAnalyzer::createThis): (JSC::StaticPropertyAnalyzer::newObject): (JSC::StaticPropertyAnalyzer::putById): (JSC::StaticPropertyAnalyzer::mov): (JSC::StaticPropertyAnalyzer::kill): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::addCall): (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::getArrayMode): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleVarargsCall): (JSC::DFG::ByteCodeParser::handleRecursiveTailCall): (JSC::DFG::ByteCodeParser::inlineCall): (JSC::DFG::ByteCodeParser::handleCallVariant): (JSC::DFG::ByteCodeParser::handleVarargsInlining): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::handleMinMax): (JSC::DFG::ByteCodeParser::handleIntrinsicCall): (JSC::DFG::ByteCodeParser::handleDOMJITCall): (JSC::DFG::ByteCodeParser::handleIntrinsicGetter): (JSC::DFG::ByteCodeParser::handleDOMJITGetter): (JSC::DFG::ByteCodeParser::handleModuleNamespaceLoad): (JSC::DFG::ByteCodeParser::handleTypedArrayConstructor): (JSC::DFG::ByteCodeParser::handleConstantInternalFunction): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::handlePutById): (JSC::DFG::ByteCodeParser::parseGetById): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::handlePutByVal): (JSC::DFG::ByteCodeParser::handlePutAccessorById): (JSC::DFG::ByteCodeParser::handlePutAccessorByVal): (JSC::DFG::ByteCodeParser::handleNewFunc): (JSC::DFG::ByteCodeParser::handleNewFuncExp): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCapabilities.cpp: (JSC::DFG::capabilityLevel): * dfg/DFGCapabilities.h: (JSC::DFG::capabilityLevel): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareCatchOSREntry): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileValueAdd): (JSC::DFG::SpeculativeJIT::compileValueSub): (JSC::DFG::SpeculativeJIT::compileValueNegate): (JSC::DFG::SpeculativeJIT::compileArithMul): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileValueAdd): (JSC::FTL::DFG::LowerDFGToB3::compileValueSub): (JSC::FTL::DFG::LowerDFGToB3::compileUnaryMathIC): (JSC::FTL::DFG::LowerDFGToB3::compileBinaryMathIC): (JSC::FTL::DFG::LowerDFGToB3::compileArithAddOrSub): (JSC::FTL::DFG::LowerDFGToB3::compileArithMul): (JSC::FTL::DFG::LowerDFGToB3::compileValueNegate): * ftl/FTLOperations.cpp: (JSC::FTL::operationMaterializeObjectInOSR): * generate-bytecode-files: Removed. * generator/Argument.rb: Added. * generator/Assertion.rb: Added. * generator/DSL.rb: Added. * generator/Fits.rb: Added. * generator/GeneratedFile.rb: Added. * generator/Metadata.rb: Added. * generator/Opcode.rb: Added. * generator/OpcodeGroup.rb: Added. * generator/Options.rb: Added. * generator/Section.rb: Added. * generator/Template.rb: Added. * generator/Type.rb: Added. * generator/main.rb: Added. * interpreter/AbstractPC.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::currentVPC const): (JSC::CallFrame::setCurrentVPC): * interpreter/CallFrame.h: (JSC::CallSiteIndex::CallSiteIndex): (JSC::ExecState::setReturnPC): * interpreter/Interpreter.cpp: (WTF::printInternal): * interpreter/Interpreter.h: * interpreter/InterpreterInlines.h: * interpreter/StackVisitor.cpp: (JSC::StackVisitor::Frame::dump const): * interpreter/VMEntryRecord.h: * jit/JIT.cpp: (JSC::JIT::JIT): (JSC::JIT::emitSlowCaseCall): (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::compileWithoutLinking): (JSC::JIT::link): * jit/JIT.h: * jit/JITArithmetic.cpp: (JSC::JIT::emit_op_jless): (JSC::JIT::emit_op_jlesseq): (JSC::JIT::emit_op_jgreater): (JSC::JIT::emit_op_jgreatereq): (JSC::JIT::emit_op_jnless): (JSC::JIT::emit_op_jnlesseq): (JSC::JIT::emit_op_jngreater): (JSC::JIT::emit_op_jngreatereq): (JSC::JIT::emitSlow_op_jless): (JSC::JIT::emitSlow_op_jlesseq): (JSC::JIT::emitSlow_op_jgreater): (JSC::JIT::emitSlow_op_jgreatereq): (JSC::JIT::emitSlow_op_jnless): (JSC::JIT::emitSlow_op_jnlesseq): (JSC::JIT::emitSlow_op_jngreater): (JSC::JIT::emitSlow_op_jngreatereq): (JSC::JIT::emit_op_below): (JSC::JIT::emit_op_beloweq): (JSC::JIT::emit_op_jbelow): (JSC::JIT::emit_op_jbeloweq): (JSC::JIT::emit_op_unsigned): (JSC::JIT::emit_compareAndJump): (JSC::JIT::emit_compareUnsignedAndJump): (JSC::JIT::emit_compareUnsigned): (JSC::JIT::emit_compareAndJumpSlow): (JSC::JIT::emit_op_inc): (JSC::JIT::emit_op_dec): (JSC::JIT::emit_op_mod): (JSC::JIT::emitSlow_op_mod): (JSC::JIT::emit_op_negate): (JSC::JIT::emitSlow_op_negate): (JSC::JIT::emitBitBinaryOpFastPath): (JSC::JIT::emit_op_bitand): (JSC::JIT::emit_op_bitor): (JSC::JIT::emit_op_bitxor): (JSC::JIT::emit_op_lshift): (JSC::JIT::emitRightShiftFastPath): (JSC::JIT::emit_op_rshift): (JSC::JIT::emit_op_urshift): (JSC::getOperandTypes): (JSC::JIT::emit_op_add): (JSC::JIT::emitSlow_op_add): (JSC::JIT::emitMathICFast): (JSC::JIT::emitMathICSlow): (JSC::JIT::emit_op_div): (JSC::JIT::emit_op_mul): (JSC::JIT::emitSlow_op_mul): (JSC::JIT::emit_op_sub): (JSC::JIT::emitSlow_op_sub): * jit/JITCall.cpp: (JSC::JIT::emitPutCallResult): (JSC::JIT::compileSetupFrame): (JSC::JIT::compileCallEval): (JSC::JIT::compileCallEvalSlowCase): (JSC::JIT::compileTailCall): (JSC::JIT::compileOpCall): (JSC::JIT::compileOpCallSlowCase): (JSC::JIT::emit_op_call): (JSC::JIT::emit_op_tail_call): (JSC::JIT::emit_op_call_eval): (JSC::JIT::emit_op_call_varargs): (JSC::JIT::emit_op_tail_call_varargs): (JSC::JIT::emit_op_tail_call_forward_arguments): (JSC::JIT::emit_op_construct_varargs): (JSC::JIT::emit_op_construct): (JSC::JIT::emitSlow_op_call): (JSC::JIT::emitSlow_op_tail_call): (JSC::JIT::emitSlow_op_call_eval): (JSC::JIT::emitSlow_op_call_varargs): (JSC::JIT::emitSlow_op_tail_call_varargs): (JSC::JIT::emitSlow_op_tail_call_forward_arguments): (JSC::JIT::emitSlow_op_construct_varargs): (JSC::JIT::emitSlow_op_construct): * jit/JITDisassembler.cpp: (JSC::JITDisassembler::JITDisassembler): * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITInlines.h: (JSC::JIT::emitDoubleGetByVal): (JSC::JIT::emitLoadForArrayMode): (JSC::JIT::emitContiguousGetByVal): (JSC::JIT::emitArrayStorageGetByVal): (JSC::JIT::appendCallWithExceptionCheckSetJSValueResultWithProfile): (JSC::JIT::sampleInstruction): (JSC::JIT::emitValueProfilingSiteIfProfiledOpcode): (JSC::JIT::emitValueProfilingSite): (JSC::JIT::jumpTarget): (JSC::JIT::copiedGetPutInfo): (JSC::JIT::copiedArithProfile): * jit/JITMathIC.h: (JSC::isProfileEmpty): (JSC::JITBinaryMathIC::JITBinaryMathIC): (JSC::JITUnaryMathIC::JITUnaryMathIC): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_mov): (JSC::JIT::emit_op_end): (JSC::JIT::emit_op_jmp): (JSC::JIT::emit_op_new_object): (JSC::JIT::emitSlow_op_new_object): (JSC::JIT::emit_op_overrides_has_instance): (JSC::JIT::emit_op_instanceof): (JSC::JIT::emitSlow_op_instanceof): (JSC::JIT::emit_op_instanceof_custom): (JSC::JIT::emit_op_is_empty): (JSC::JIT::emit_op_is_undefined): (JSC::JIT::emit_op_is_boolean): (JSC::JIT::emit_op_is_number): (JSC::JIT::emit_op_is_cell_with_type): (JSC::JIT::emit_op_is_object): (JSC::JIT::emit_op_ret): (JSC::JIT::emit_op_to_primitive): (JSC::JIT::emit_op_set_function_name): (JSC::JIT::emit_op_not): (JSC::JIT::emit_op_jfalse): (JSC::JIT::emit_op_jeq_null): (JSC::JIT::emit_op_jneq_null): (JSC::JIT::emit_op_jneq_ptr): (JSC::JIT::emit_op_eq): (JSC::JIT::emit_op_jeq): (JSC::JIT::emit_op_jtrue): (JSC::JIT::emit_op_neq): (JSC::JIT::emit_op_jneq): (JSC::JIT::emit_op_throw): (JSC::JIT::compileOpStrictEq): (JSC::JIT::emit_op_stricteq): (JSC::JIT::emit_op_nstricteq): (JSC::JIT::compileOpStrictEqJump): (JSC::JIT::emit_op_jstricteq): (JSC::JIT::emit_op_jnstricteq): (JSC::JIT::emitSlow_op_jstricteq): (JSC::JIT::emitSlow_op_jnstricteq): (JSC::JIT::emit_op_to_number): (JSC::JIT::emit_op_to_string): (JSC::JIT::emit_op_to_object): (JSC::JIT::emit_op_catch): (JSC::JIT::emit_op_identity_with_profile): (JSC::JIT::emit_op_get_parent_scope): (JSC::JIT::emit_op_switch_imm): (JSC::JIT::emit_op_switch_char): (JSC::JIT::emit_op_switch_string): (JSC::JIT::emit_op_debug): (JSC::JIT::emit_op_eq_null): (JSC::JIT::emit_op_neq_null): (JSC::JIT::emit_op_enter): (JSC::JIT::emit_op_get_scope): (JSC::JIT::emit_op_to_this): (JSC::JIT::emit_op_create_this): (JSC::JIT::emit_op_check_tdz): (JSC::JIT::emitSlow_op_eq): (JSC::JIT::emitSlow_op_neq): (JSC::JIT::emitSlow_op_jeq): (JSC::JIT::emitSlow_op_jneq): (JSC::JIT::emitSlow_op_instanceof_custom): (JSC::JIT::emit_op_loop_hint): (JSC::JIT::emitSlow_op_loop_hint): (JSC::JIT::emit_op_check_traps): (JSC::JIT::emit_op_nop): (JSC::JIT::emit_op_super_sampler_begin): (JSC::JIT::emit_op_super_sampler_end): (JSC::JIT::emitSlow_op_check_traps): (JSC::JIT::emit_op_new_regexp): (JSC::JIT::emitNewFuncCommon): (JSC::JIT::emit_op_new_func): (JSC::JIT::emit_op_new_generator_func): (JSC::JIT::emit_op_new_async_generator_func): (JSC::JIT::emit_op_new_async_func): (JSC::JIT::emitNewFuncExprCommon): (JSC::JIT::emit_op_new_func_exp): (JSC::JIT::emit_op_new_generator_func_exp): (JSC::JIT::emit_op_new_async_func_exp): (JSC::JIT::emit_op_new_async_generator_func_exp): (JSC::JIT::emit_op_new_array): (JSC::JIT::emit_op_new_array_with_size): (JSC::JIT::emit_op_has_structure_property): (JSC::JIT::privateCompileHasIndexedProperty): (JSC::JIT::emit_op_has_indexed_property): (JSC::JIT::emitSlow_op_has_indexed_property): (JSC::JIT::emit_op_get_direct_pname): (JSC::JIT::emit_op_enumerator_structure_pname): (JSC::JIT::emit_op_enumerator_generic_pname): (JSC::JIT::emit_op_profile_type): (JSC::JIT::emit_op_log_shadow_chicken_prologue): (JSC::JIT::emit_op_log_shadow_chicken_tail): (JSC::JIT::emit_op_profile_control_flow): (JSC::JIT::emit_op_argument_count): (JSC::JIT::emit_op_get_rest_length): (JSC::JIT::emit_op_get_argument): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_to_this): * jit/JITOperations.cpp: * jit/JITOperations.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_get_by_val): (JSC::JIT::emitGetByValWithCachedId): (JSC::JIT::emitSlow_op_get_by_val): (JSC::JIT::emit_op_put_by_val_direct): (JSC::JIT::emit_op_put_by_val): (JSC::JIT::emitGenericContiguousPutByVal): (JSC::JIT::emitArrayStoragePutByVal): (JSC::JIT::emitPutByValWithCachedId): (JSC::JIT::emitSlow_op_put_by_val): (JSC::JIT::emit_op_put_getter_by_id): (JSC::JIT::emit_op_put_setter_by_id): (JSC::JIT::emit_op_put_getter_setter_by_id): (JSC::JIT::emit_op_put_getter_by_val): (JSC::JIT::emit_op_put_setter_by_val): (JSC::JIT::emit_op_del_by_id): (JSC::JIT::emit_op_del_by_val): (JSC::JIT::emit_op_try_get_by_id): (JSC::JIT::emitSlow_op_try_get_by_id): (JSC::JIT::emit_op_get_by_id_direct): (JSC::JIT::emitSlow_op_get_by_id_direct): (JSC::JIT::emit_op_get_by_id): (JSC::JIT::emit_op_get_by_id_with_this): (JSC::JIT::emitSlow_op_get_by_id): (JSC::JIT::emitSlow_op_get_by_id_with_this): (JSC::JIT::emit_op_put_by_id): (JSC::JIT::emitSlow_op_put_by_id): (JSC::JIT::emit_op_in_by_id): (JSC::JIT::emitSlow_op_in_by_id): (JSC::JIT::emit_op_resolve_scope): (JSC::JIT::emit_op_get_from_scope): (JSC::JIT::emitSlow_op_get_from_scope): (JSC::JIT::emit_op_put_to_scope): (JSC::JIT::emitSlow_op_put_to_scope): (JSC::JIT::emit_op_get_from_arguments): (JSC::JIT::emit_op_put_to_arguments): (JSC::JIT::privateCompileGetByVal): (JSC::JIT::privateCompileGetByValWithCachedId): (JSC::JIT::privateCompilePutByVal): (JSC::JIT::privateCompilePutByValWithCachedId): (JSC::JIT::emitDoubleLoad): (JSC::JIT::emitContiguousLoad): (JSC::JIT::emitArrayStorageLoad): (JSC::JIT::emitDirectArgumentsGetByVal): (JSC::JIT::emitScopedArgumentsGetByVal): (JSC::JIT::emitIntTypedArrayGetByVal): (JSC::JIT::emitFloatTypedArrayGetByVal): (JSC::JIT::emitIntTypedArrayPutByVal): (JSC::JIT::emitFloatTypedArrayPutByVal): * jit/RegisterSet.cpp: (JSC::RegisterSet::llintBaselineCalleeSaveRegisters): * jit/SlowPathCall.h: (JSC::JITSlowPathCall::JITSlowPathCall): * llint/LLIntData.cpp: (JSC::LLInt::initialize): (JSC::LLInt::Data::performAssertions): * llint/LLIntData.h: (JSC::LLInt::exceptionInstructions): (JSC::LLInt::opcodeMap): (JSC::LLInt::opcodeMapWide): (JSC::LLInt::getOpcode): (JSC::LLInt::getOpcodeWide): (JSC::LLInt::getWideCodePtr): * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::llint_trace_operand): (JSC::LLInt::llint_trace_value): (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::entryOSR): (JSC::LLInt::setupGetByIdPrototypeCache): (JSC::LLInt::getByVal): (JSC::LLInt::handleHostCall): (JSC::LLInt::setUpCall): (JSC::LLInt::genericCall): (JSC::LLInt::varargsSetup): (JSC::LLInt::commonCallEval): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter.cpp: (JSC::CLoopRegister::operator const Instruction*): (JSC::CLoop::execute): * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * offlineasm/arm64.rb: * offlineasm/asm.rb: * offlineasm/ast.rb: * offlineasm/cloop.rb: * offlineasm/generate_offset_extractor.rb: * offlineasm/instructions.rb: * offlineasm/offsets.rb: * offlineasm/parser.rb: * offlineasm/transform.rb: * offlineasm/x86.rb: * parser/ResultType.h: (JSC::ResultType::dump const): (JSC::OperandTypes::first const): (JSC::OperandTypes::second const): (JSC::OperandTypes::dump const): * profiler/ProfilerBytecodeSequence.cpp: (JSC::Profiler::BytecodeSequence::BytecodeSequence): * runtime/CommonSlowPaths.cpp: (JSC::SLOW_PATH_DECL): (JSC::updateArithProfileForUnaryArithOp): (JSC::updateArithProfileForBinaryArithOp): * runtime/CommonSlowPaths.h: (JSC::CommonSlowPaths::tryCachePutToScopeGlobal): (JSC::CommonSlowPaths::tryCacheGetFromScopeGlobal): * runtime/ExceptionFuzz.cpp: (JSC::doExceptionFuzzing): * runtime/ExceptionFuzz.h: (JSC::doExceptionFuzzingIfEnabled): * runtime/GetPutInfo.cpp: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. (JSC::GetPutInfo::dump const): (WTF::printInternal): * runtime/GetPutInfo.h: (JSC::GetPutInfo::operand const): * runtime/JSCPoison.h: * runtime/JSType.cpp: Added. (WTF::printInternal): * runtime/JSType.h: * runtime/SamplingProfiler.cpp: (JSC::SamplingProfiler::StackFrame::displayName): * runtime/SamplingProfiler.h: (JSC::SamplingProfiler::UnprocessedStackFrame::UnprocessedStackFrame): * runtime/SlowPathReturnType.h: (JSC::encodeResult): (JSC::decodeResult): * runtime/VM.h: * runtime/Watchdog.h: * tools/HeapVerifier.cpp: Source/WTF: * wtf/Forward.h: Fix WTF_LAZY_FOR_EACH_TERM on MSVC and add WTF_LAZY_HAS_REST to check whether a macro was passed multiple arguments * wtf/Platform.h: Force ENABLE_JIT=false on all 32-bit platforms * wtf/Vector.h: (WTF::minCapacity>::insertVector): Allow vectors with different overflow handlers to be passed to insertVector Tools: Do not force ENABLE_JIT=true when $forceCLoop is false. * Scripts/build-jsc: LayoutTests: Don't use recursion on `equal` to avoid premature stack overflows when testing deep arrays. * fast/dom/Window/resources/postmessage-test.js: Canonical link: https://commits.webkit.org/205839@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-29 13:16:03 +00:00
bytecompiler/ProfileTypeBytecodeFlag.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
Web Inspector: allow event breakpoints to be configured https://bugs.webkit.org/show_bug.cgi?id=215362 <rdar://problem/66932921> Reviewed by Brian Burg. Source/JavaScriptCore: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing * inspector/protocol/DOM.json: Add an `options` paramater to `DOM.setBreakpointForEventListener` to allow configuration. * inspector/protocol/DOMDebugger.json: Add an `options` paramater to `DOMDebugger.setEventBreakpoint` to allow configuration. * debugger/Breakpoint.h: (JSC::Breakpoint::id const): Added. (JSC::Breakpoint::sourceID const): Added. (JSC::Breakpoint::lineNumber const): Added. (JSC::Breakpoint::columnNumber const): Added. (JSC::Breakpoint::condition const): Added. (JSC::Breakpoint::actions const): Added. (JSC::Breakpoint::isAutoContinue const): Added. (JSC::Breakpoint::resetHitCount): Added. (JSC::Breakpoint::isLinked const): Added. (JSC::Breakpoint::isResolved const): Added. (JSC::BreakpointsList::~BreakpointsList): Deleted. * debugger/Breakpoint.cpp: Added. (JSC::Breakpoint::Action::Action): Added. (JSC::Breakpoint::create): Added. (JSC::Breakpoint::Breakpoint): Added. (JSC::Breakpoint::link): Added. (JSC::Breakpoint::resolve): Added. (JSC::Breakpoint::shouldPause): Added. Unify `JSC::Breakpoint` and `Inspector::ScriptBreakpoint`. * debugger/DebuggerPrimitives.h: * debugger/Debugger.h: * debugger/Debugger.cpp: (JSC::Debugger::Debugger): (JSC::Debugger::addObserver): Added. (JSC::Debugger::removeObserver): Added. (JSC::Debugger::canDispatchFunctionToObservers const): Added. (JSC::Debugger::dispatchFunctionToObservers): Added. (JSC::Debugger::sourceParsed): Added. (JSC::Debugger::toggleBreakpoint): (JSC::Debugger::applyBreakpoints): (JSC::Debugger::resolveBreakpoint): (JSC::Debugger::setBreakpoint): (JSC::Debugger::removeBreakpoint): (JSC::Debugger::didHitBreakpoint): Added. (JSC::Debugger::clearBreakpoints): (JSC::Debugger::evaluateBreakpointCondition): Added. (JSC::Debugger::evaluateBreakpointActions): Added. (JSC::Debugger::schedulePauseAtNextOpportunity): Added. (JSC::Debugger::cancelPauseAtNextOpportunity): Added. (JSC::Debugger::schedulePauseForSpecialBreakpoint): Added. (JSC::Debugger::cancelPauseForSpecialBreakpoint): Added. (JSC::Debugger::continueProgram): (JSC::Debugger::stepNextExpression): (JSC::Debugger::stepIntoStatement): (JSC::Debugger::stepOverStatement): (JSC::Debugger::stepOutOfFunction): (JSC::Debugger::pauseIfNeeded): (JSC::Debugger::handlePause): Added. (JSC::Debugger::exceptionOrCaughtValue): Added. (JSC::Debugger::atExpression): (JSC::Debugger::clearNextPauseState): (JSC::Debugger::willRunMicrotask): Added. (JSC::Debugger::didRunMicrotask): Added. (JSC::Debugger::hasBreakpoint): Deleted. (JSC::Debugger::setPauseOnNextStatement): Deleted. Unify `JSC::Debugger` and `Inspector::ScriptDebugServer` to simplify breakpoint logic. Introduce the concept of a "special breakpoint", which is essentially a `JSC::Breakpoint` that is expected to pause at the next opportunity but isn't tied to a particular location. As an example, whenever an event breakpoint is hit, instead of just pausing at the next opportunity, the newly managed `JSC::Breakpoint` is used as a "special breakpoint", allowing for it's configuration (ie.g. condition, ignore count, actions, auto-continue) to be used. * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::objectGroupForBreakpointAction): (Inspector::breakpointActionTypeForString): Added. (Inspector::parseBreakpointOptions): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::fromPayload): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::ProtocolBreakpoint): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::createDebuggerBreakpoint const): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::matchesScriptURL const): Added. (Inspector::InspectorDebuggerAgent::debuggerBreakpointFromPayload): Added. (Inspector::InspectorDebuggerAgent::enable): (Inspector::InspectorDebuggerAgent::disable): (Inspector::InspectorDebuggerAgent::buildBreakpointPauseReason): (Inspector::InspectorDebuggerAgent::handleConsoleAssert): (Inspector::InspectorDebuggerAgent::didScheduleAsyncCall): (Inspector::buildDebuggerLocation): (Inspector::InspectorDebuggerAgent::setBreakpointByUrl): (Inspector::InspectorDebuggerAgent::setBreakpoint): (Inspector::InspectorDebuggerAgent::didSetBreakpoint): (Inspector::InspectorDebuggerAgent::resolveBreakpoint): (Inspector::InspectorDebuggerAgent::removeBreakpoint): (Inspector::InspectorDebuggerAgent::continueToLocation): (Inspector::InspectorDebuggerAgent::schedulePauseAtNextOpportunity): Added. (Inspector::InspectorDebuggerAgent::cancelPauseAtNextOpportunity): Added. (Inspector::InspectorDebuggerAgent::schedulePauseForSpecialBreakpoint): Added. (Inspector::InspectorDebuggerAgent::cancelPauseForSpecialBreakpoint): Added. (Inspector::InspectorDebuggerAgent::pause): (Inspector::InspectorDebuggerAgent::resume): (Inspector::InspectorDebuggerAgent::didBecomeIdle): (Inspector::InspectorDebuggerAgent::sourceMapURLForScript): (Inspector::InspectorDebuggerAgent::didParseSource): (Inspector::InspectorDebuggerAgent::willRunMicrotask): (Inspector::InspectorDebuggerAgent::didRunMicrotask): (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionSound): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::clearInspectorBreakpointState): (Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState): (Inspector::matches): Deleted. (Inspector::buildObjectForBreakpointCookie): Deleted. (Inspector::InspectorDebuggerAgent::breakpointActionsFromProtocol): Deleted. (Inspector::InspectorDebuggerAgent::schedulePauseOnNextStatement): Deleted. (Inspector::InspectorDebuggerAgent::cancelPauseOnNextStatement): Deleted. Create a private `ProtocolBreakpoint` class that holds the data sent by the frontend. This is necessary because breakpoints in the frontend have a potentially one-to-many relationship with breakpoints in the backend, as the same script can be loaded many times on a page. Each of those scripts is independent, however, and can execute differently, meaning that the same breakpoint for each script also needs a different state (e.g. ignore count). As such, the `ProtocolBreakpoint` is effectively a template that is actualized whenever a new script is parsed that matches the URL of the `ProtocolBreakpoint` to create a `JSC::Breakpoint` that is used by the `JSC::Debugger`. `ProtocolBreakpoint` also parses breakpoint configurations. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectScriptDebugServer.h: * inspector/JSGlobalObjectScriptDebugServer.cpp: (Inspector::JSGlobalObjectScriptDebugServer::JSGlobalObjectScriptDebugServer): (Inspector::JSGlobalObjectScriptDebugServer::attachDebugger): (Inspector::JSGlobalObjectScriptDebugServer::detachDebugger): (Inspector::JSGlobalObjectScriptDebugServer::runEventLoopWhilePaused): * inspector/agents/InspectorAuditAgent.h: * inspector/agents/InspectorAuditAgent.cpp: (Inspector::InspectorAuditAgent::run): * inspector/agents/InspectorRuntimeAgent.h: * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::setPauseOnExceptionsState): (Inspector::InspectorRuntimeAgent::evaluate): (Inspector::InspectorRuntimeAgent::callFunctionOn): (Inspector::InspectorRuntimeAgent::getPreview): (Inspector::InspectorRuntimeAgent::getProperties): (Inspector::InspectorRuntimeAgent::getDisplayableProperties): * inspector/agents/InspectorScriptProfilerAgent.cpp: * inspector/agents/JSGlobalObjectDebuggerAgent.h: Replace `Inspector::ScriptDebugServer` with `JSC::Debugger`. * runtime/JSMicrotask.cpp: (JSC::JSMicrotask::run): Drive-by: r248894 mistakenly omitted the call to notify the debugger that the microtask ran. * inspector/ScriptBreakpoint.h: Removed. * inspector/ScriptDebugListener.h: Removed. * inspector/ScriptDebugServer.h: Removed. * inspector/ScriptDebugServer.cpp: Removed. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: Source/WebCore: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing Tests: inspector/dom/breakpoint-for-event-listener.html inspector/dom-debugger/event-animation-frame-breakpoints.html inspector/dom-debugger/event-interval-breakpoints.html inspector/dom-debugger/event-listener-breakpoints.html inspector/dom-debugger/event-timeout-breakpoints.html * inspector/agents/InspectorDOMAgent.h: * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::getEventListenersForNode): (WebCore::InspectorDOMAgent::setBreakpointForEventListener): (WebCore::InspectorDOMAgent::removeBreakpointForEventListener): (WebCore::InspectorDOMAgent::buildObjectForEventListener): (WebCore::InspectorDOMAgent::breakpointForEventListener): (WebCore::InspectorDOMAgent::hasBreakpointForEventListener): Deleted. * inspector/agents/InspectorDOMDebuggerAgent.h: * inspector/agents/InspectorDOMDebuggerAgent.cpp: (WebCore::InspectorDOMDebuggerAgent::disable): (WebCore::InspectorDOMDebuggerAgent::mainFrameNavigated): (WebCore::InspectorDOMDebuggerAgent::setEventBreakpoint): (WebCore::InspectorDOMDebuggerAgent::removeEventBreakpoint): (WebCore::InspectorDOMDebuggerAgent::willHandleEvent): (WebCore::InspectorDOMDebuggerAgent::didHandleEvent): (WebCore::InspectorDOMDebuggerAgent::willFireTimer): (WebCore::InspectorDOMDebuggerAgent::didFireTimer): * inspector/agents/page/PageDOMDebuggerAgent.h: * inspector/agents/page/PageDOMDebuggerAgent.cpp: (WebCore::PageDOMDebuggerAgent::disable): (WebCore::PageDOMDebuggerAgent::mainFrameNavigated): (WebCore::PageDOMDebuggerAgent::willFireAnimationFrame): (WebCore::PageDOMDebuggerAgent::didFireAnimationFrame): (WebCore::PageDOMDebuggerAgent::setAnimationFrameBreakpoint): * inspector/agents/worker/WorkerDOMDebuggerAgent.h: * inspector/agents/worker/WorkerDOMDebuggerAgent.cpp: (WebCore::WorkerDOMDebuggerAgent::setAnimationFrameBreakpoint): Keep a `JSC::Breakpoint` for each event breakpoint instead of a simple `bool`, allowing for configuration when the breakpoint is first set. When any of these breakpoints are hit, pass it to the `JSC::Debugger` as a "special breakpoint", which behaves the same as "pause ASAP" but also supports a condition, an ignore count, actions, and auto-continue. Reset the hit count for any of these "special breakpoints" that persist across Web Inspector sessions when the main frame navigates. * inspector/PageScriptDebugServer.h: * inspector/PageScriptDebugServer.cpp: (WebCore::PageScriptDebugServer::PageScriptDebugServer): (WebCore::PageScriptDebugServer::attachDebugger): (WebCore::PageScriptDebugServer::detachDebugger): (WebCore::PageScriptDebugServer::didPause): (WebCore::PageScriptDebugServer::didContinue): (WebCore::PageScriptDebugServer::runEventLoopWhilePaused): (WebCore::PageScriptDebugServer::runEventLoopWhilePausedInternal): (WebCore::PageScriptDebugServer::isContentScript const): (WebCore::PageScriptDebugServer::reportException const): * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException const): * inspector/agents/page/PageDebuggerAgent.h: * inspector/agents/page/PageDebuggerAgent.cpp: (WebCore::PageDebuggerAgent::sourceMapURLForScript): Replace `Inspector::ScriptDebugServer` with `JSC::Debugger`. * inspector/TimelineRecordFactory.h: * inspector/TimelineRecordFactory.cpp: (WebCore::TimelineRecordFactory::createProbeSampleData): * inspector/agents/InspectorTimelineAgent.h: * inspector/agents/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::breakpointActionProbe): Replace `Inspector::ScriptBreakpoint` with `JSC::Breakpoint`. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didHandleEvent): (WebCore::InspectorInstrumentation::didFireTimer): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didHandleEventImpl): (WebCore::InspectorInstrumentation::didFireTimerImpl): (WebCore::InspectorInstrumentation::didCommitLoadImpl): (WebCore::InspectorInstrumentation::didFireAnimationFrameImpl): * dom/EventTarget.cpp: (WebCore::EventTarget::innerInvokeEventListeners): * page/DOMTimer.cpp: (WebCore::DOMTimer::fired): When notifying Web Inspector that activity did occur, include all information previously included when notifying Web Inspector that that activity was about to occur so that Web Inspector can know whether a pause for the "special breakpoint" for that activity is still scheduled and if so cancel it. Source/WebInspectorUI: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing * UserInterface/Models/Breakpoint.js: (WI.Breakpoint): (WI.Breakpoint.prototype.toJSON): (WI.Breakpoint.prototype.get special): Added. (WI.Breakpoint.prototype.get removable): Added. (WI.Breakpoint.prototype.get editable): Added. (WI.Breakpoint.prototype.set condition): (WI.Breakpoint.prototype.get ignoreCount): (WI.Breakpoint.prototype.set ignoreCount): (WI.Breakpoint.prototype.get autoContinue): (WI.Breakpoint.prototype.set autoContinue): (WI.Breakpoint.prototype.get actions): (WI.Breakpoint.prototype.get probeActions): (WI.Breakpoint.prototype.cycleToNextMode): (WI.Breakpoint.prototype.createAction): (WI.Breakpoint.prototype.recreateAction): (WI.Breakpoint.prototype.removeAction): (WI.Breakpoint.prototype.clearActions): (WI.Breakpoint.prototype.remove): Added. (WI.Breakpoint.prototype.optionsToProtocol): Added. (WI.Breakpoint.prototype.breakpointActionDidChange): (WI.Breakpoint.fromJSON): Deleted. (WI.Breakpoint.prototype.get sourceCodeLocation): Deleted. (WI.Breakpoint.prototype.get contentIdentifier): Deleted. (WI.Breakpoint.prototype.get scriptIdentifier): Deleted. (WI.Breakpoint.prototype.get target): Deleted. (WI.Breakpoint.prototype.get identifier): Deleted. (WI.Breakpoint.prototype.set identifier): Deleted. (WI.Breakpoint.prototype.get resolved): Deleted. (WI.Breakpoint.prototype.set resolved): Deleted. (WI.Breakpoint.prototype.saveIdentityToCookie): Deleted. (WI.Breakpoint.prototype._isSpecial): Deleted. (WI.Breakpoint.prototype._sourceCodeLocationLocationChanged): Deleted. (WI.Breakpoint.prototype._sourceCodeLocationDisplayLocationChanged): Deleted. * UserInterface/Models/DOMBreakpoint.js: (WI.DOMBreakpoint): (WI.DOMBreakpoint.fromJSON): Added. (WI.DOMBreakpoint.prototype.remove): Added. (WI.DOMBreakpoint.prototype.toJSON): (WI.DOMBreakpoint.deserialize): Deleted. (WI.DOMBreakpoint.prototype.get disabled): Deleted. (WI.DOMBreakpoint.prototype.set disabled): Deleted. * UserInterface/Models/EventBreakpoint.js: (WI.EventBreakpoint): (WI.EventBreakpoint.fromJSON): Added. (WI.EventBreakpoint.prototype.get special): Added. (WI.EventBreakpoint.prototype.get editable): Added. (WI.EventBreakpoint.prototype.remove): Added. (WI.EventBreakpoint.prototype.saveIdentityToCookie): (WI.EventBreakpoint.prototype.toJSON): (WI.EventBreakpoint.deserialize): Deleted. (WI.EventBreakpoint.prototype.get disabled): Deleted. (WI.EventBreakpoint.prototype.set disabled): Deleted. * UserInterface/Models/JavaScriptBreakpoint.js: Copied from UserInterface/Models/Breakpoint.js. (WI.JavaScriptBreakpoint): (WI.JavaScriptBreakpoint.fromJSON): (WI.JavaScriptBreakpoint.prototype.toJSON): (WI.JavaScriptBreakpoint.prototype.get sourceCodeLocation): (WI.JavaScriptBreakpoint.prototype.get contentIdentifier): (WI.JavaScriptBreakpoint.prototype.get scriptIdentifier): (WI.JavaScriptBreakpoint.prototype.get target): (WI.JavaScriptBreakpoint.prototype.get special): Added. (WI.JavaScriptBreakpoint.prototype.get removable): Added. (WI.JavaScriptBreakpoint.prototype.get editable): Added. (WI.JavaScriptBreakpoint.prototype.get identifier): (WI.JavaScriptBreakpoint.prototype.set identifier): (WI.JavaScriptBreakpoint.prototype.get resolved): (WI.JavaScriptBreakpoint.prototype.set resolved): (WI.JavaScriptBreakpoint.prototype.remove): Added. (WI.JavaScriptBreakpoint.prototype.saveIdentityToCookie): (WI.JavaScriptBreakpoint.prototype._isSpecial): (WI.JavaScriptBreakpoint.prototype._sourceCodeLocationLocationChanged): (WI.JavaScriptBreakpoint.prototype._sourceCodeLocationDisplayLocationChanged): * UserInterface/Models/URLBreakpoint.js: (WI.URLBreakpoint): (WI.URLBreakpoint.fromJSON): Added. (WI.URLBreakpoint.prototype.get special): Added. (WI.URLBreakpoint.prototype.remove): Added. (WI.URLBreakpoint.prototype.toJSON): (WI.URLBreakpoint.deserialize): Deleted. (WI.URLBreakpoint.prototype.get disabled): Deleted. (WI.URLBreakpoint.prototype.set disabled): Deleted. Rename `WI.Breakpoint` to `WI.JavaScriptBreakpoint` and use `WI.Breakpoint` as a new common base class for all breakpoint types, allowing more logic to be shared (e.g. disabled state). Additionally, breakpoints are now able to - determine whether or not they're - special - removable - editable (i.e. configurable) - remove themselves without the caller needing to know what manager to consult with. * UserInterface/Controllers/DOMManager.js: (WI.DOMManager): (WI.DOMManager.supportsEventListenerBreakpointConfiguration): Added. (WI.DOMManager.prototype.setBreakpointForEventListener): (WI.DOMManager.prototype.removeBreakpointForEventListener): (WI.DOMManager.prototype._setEventBreakpoint): Added. (WI.DOMManager.prototype._removeEventBreakpoint): Added. (WI.DOMManager.prototype._handleEventBreakpointEditablePropertyChanged): Added. (WI.DOMManager.prototype._handleEventBreakpointActionsChanged): Added. (WI.DOMManager.prototype._updateEventBreakpoint): Deleted. Keep track of configuration changes for specific listener breakpoints. * UserInterface/Controllers/DOMDebuggerManager.js: (WI.DOMDebuggerManager): (WI.DOMDebuggerManager.prototype.initializeTarget): (WI.DOMDebuggerManager.prototype.addDOMBreakpoint): (WI.DOMDebuggerManager.prototype.removeDOMBreakpoint): (WI.DOMDebuggerManager.prototype.addEventBreakpoint): (WI.DOMDebuggerManager.prototype.removeEventBreakpoint): (WI.DOMDebuggerManager.prototype.addURLBreakpoint): (WI.DOMDebuggerManager.prototype.removeURLBreakpoint): (WI.DOMDebuggerManager.prototype._commandArgumentsForEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._setEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._removeEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointDisabledStateChanged): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointEditablePropertyChanged): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointActionsChanged): Added. (WI.DOMDebuggerManager.prototype.isBreakpointSpecial): Deleted. (WI.DOMDebuggerManager.prototype._updateEventBreakpoint): Deleted. Keep track of configuration changes for special event breakpoints. Store special event breakpoints inside `WI.objectStores.eventBreakpoints`. * UserInterface/Controllers/DebuggerManager.js: (WI.DebuggerManager): (WI.DebuggerManager.prototype.addBreakpoint): (WI.DebuggerManager.prototype.removeBreakpoint): (WI.DebuggerManager.prototype.addProbesForBreakpoint): Added. (WI.DebuggerManager.prototype.removeProbesForBreakpoint): Added. (WI.DebuggerManager.prototype.updateProbesForBreakpoint): Added. (WI.DebuggerManager.prototype._setBreakpoint): (WI.DebuggerManager.prototype._breakpointEditablePropertyDidChange): (WI.DebuggerManager.prototype._handleBreakpointActionsDidChange): (WI.DebuggerManager.prototype.isBreakpointRemovable): Deleted. (WI.DebuggerManager.prototype.isBreakpointSpecial): Deleted. (WI.DebuggerManager.prototype.isBreakpointEditable): Deleted. (WI.DebuggerManager.prototype._debuggerBreakpointActionType): Deleted. (WI.DebuggerManager.prototype._debuggerBreakpointOptions): Deleted. (WI.DebuggerManager.prototype._addProbesForBreakpoint): Deleted. (WI.DebuggerManager.prototype._removeProbesForBreakpoint): Deleted. (WI.DebuggerManager.prototype._updateProbesForBreakpoint): Deleted. Replace `WI.Breakpoint` with `WI.JavaScriptBreakpoint`. Probes now support `WI.EventBreakpoint` in addition to `WI.JavaScriptBreakpoint`. * UserInterface/Controllers/BreakpointPopoverController.js: (WI.BreakpointPopoverController.prototype.appendContextMenuItems): (WI.BreakpointPopoverController.prototype._createPopoverContent): Allow any breakpoint instead of only `WI.JavaScriptBreakpoint`. Drive-by: the existing `ignoreCount` value wasn't being used to populate the `<input>`. * UserInterface/Views/BreakpointTreeElement.js: (WI.BreakpointTreeElement.prototype.ondelete): (WI.BreakpointTreeElement.prototype.get listenerSet): Added. (WI.BreakpointTreeElement.prototype.updateStatus): Added. (WI.BreakpointTreeElement.prototype.updateTitles): Added. (WI.BreakpointTreeElement.prototype.get breakpoint): Deleted. (WI.BreakpointTreeElement.prototype.get filterableData): Deleted. (WI.BreakpointTreeElement.prototype._updateTitles): Deleted. (WI.BreakpointTreeElement.prototype._updateStatus): Deleted. (WI.BreakpointTreeElement.prototype._breakpointLocationDidChange): Deleted. * UserInterface/Views/BreakpointTreeElement.css: (.item.breakpoint .status > .status-image): (.item.breakpoint.paused .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.paused .icon): Added. (.item.breakpoint .status > .status-image.resolved): Deleted. (body:not(.window-inactive, .window-docked-inactive) .tree-outline:focus-within .item.breakpoint.selected .status > .status-image.resolved): Deleted. (.item.breakpoint .subtitle.formatted-location): Deleted. (.breakpoint-debugger-statement-icon .icon): Deleted. (.breakpoint-exception-icon .icon): Deleted. (.breakpoint-assertion-icon .icon): Deleted. (.breakpoint-microtask-icon .icon): Deleted. (.breakpoint-paused-icon .icon): Deleted. (.breakpoint-generic-line-icon .icon): Deleted. (.breakpoint-generic-line-icon .icon > span): Deleted. (.data-updated.breakpoint-generic-line-icon .icon > span): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-debugger-statement-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-exception-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-assertion-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-microtask-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-paused-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-generic-line-icon .icon): Deleted. * UserInterface/Views/DOMBreakpointTreeElement.js: (WI.DOMBreakpointTreeElement): (WI.DOMBreakpointTreeElement.prototype.onattach): Deleted. (WI.DOMBreakpointTreeElement.prototype.ondetach): Deleted. (WI.DOMBreakpointTreeElement.prototype.ondelete): Deleted. (WI.DOMBreakpointTreeElement.prototype.onenter): Deleted. (WI.DOMBreakpointTreeElement.prototype.onspace): Deleted. (WI.DOMBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.DOMBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.DOMBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/DOMBreakpointTreeElement.css: (.item.breakpoint.dom.subtree-modified:not(.paused) .icon): Added. (.item.breakpoint.dom.attribute-modified:not(.paused) .icon): Added. (.item.breakpoint.dom.node-removed:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.subtree-modified:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.attribute-modified:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.node-removed:not(.paused) .icon): Added. (.breakpoint.dom.breakpoint-for-subtree-modified:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.dom.breakpoint-for-attribute-modified:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.dom.breakpoint-for-node-removed:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-subtree-modified:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-attribute-modified:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-node-removed:not(.breakpoint-paused-icon) .icon): Deleted. * UserInterface/Views/EventBreakpointTreeElement.js: (WI.EventBreakpointTreeElement): (WI.EventBreakpointTreeElement.prototype.onattach): Deleted. (WI.EventBreakpointTreeElement.prototype.ondetach): Deleted. (WI.EventBreakpointTreeElement.prototype.ondelete): Deleted. (WI.EventBreakpointTreeElement.prototype.onenter): Deleted. (WI.EventBreakpointTreeElement.prototype.onspace): Deleted. (WI.EventBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.EventBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.EventBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/EventBreakpointTreeElement.css: (.item.breakpoint.event.animation-frame:not(.paused) .icon): Added. (.item.breakpoint.event.interval:not(.paused) .icon): Added. (.item.breakpoint.event.listener:not(.paused) .icon): Added. (.item.breakpoint.event.timeout:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.animation-frame:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.interval:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.listener:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.timeout:not(.paused) .icon): Added. (.breakpoint.event.breakpoint-for-animation-frame:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-interval:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-listener:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-timeout:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-animation-frame:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-interval:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-listener:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-timeout:not(.breakpoint-paused-icon) .icon): Deleted. * UserInterface/Views/JavaScriptBreakpointTreeElement.js: Copied from Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js. (WI.JavaScriptBreakpointTreeElement): (WI.JavaScriptBreakpointTreeElement.prototype.get filterableData): (WI.JavaScriptBreakpointTreeElement.prototype.updateStatus): Added. (WI.JavaScriptBreakpointTreeElement.prototype.updateTitles): Added. (WI.JavaScriptBreakpointTreeElement.prototype._breakpointLocationDidChange): * UserInterface/Views/JavaScriptBreakpointTreeElement.css: Copied from Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.css. (.item.breakpoint.javascript .status > .status-image): Added. (.item.breakpoint.javascript .status > .status-image.resolved): Added. (body:not(.window-inactive, .window-docked-inactive) .tree-outline:focus-within .item.breakpoint.javascript.selected .status > .status-image.resolved): Added. (.item.breakpoint.javascript .subtitle.formatted-location): Added. (.item.breakpoint.javascript.line .icon): Added. (.item.breakpoint.javascript.line .icon > span): Added. (.data-updated.item.breakpoint.javascript.line .icon > span): Added. (.item.breakpoint.javascript.debugger-statement .icon): Added. (.item.breakpoint.javascript.exception .icon): Added. (.item.breakpoint.javascript.assertion .icon): Added. (.item.breakpoint.javascript.microtask .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.line .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.debugger-statement .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.exception .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.assertion .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.microtask .icon): Added. * UserInterface/Views/URLBreakpointTreeElement.js: (WI.URLBreakpointTreeElement): (WI.URLBreakpointTreeElement.prototype.onattach): Deleted. (WI.URLBreakpointTreeElement.prototype.ondetach): Deleted. (WI.URLBreakpointTreeElement.prototype.ondelete): Deleted. (WI.URLBreakpointTreeElement.prototype.onenter): Deleted. (WI.URLBreakpointTreeElement.prototype.onspace): Deleted. (WI.URLBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.URLBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.URLBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/URLBreakpointTreeElement.css: (.item.breakpoint.url .subtitle): Added. (.item.breakpoint.url:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.url:not(.paused) .icon): Added. (.breakpoint.url .subtitle): Deleted. (.breakpoint.url:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.url:not(.breakpoint-paused-icon) .icon): Deleted. Rename `WI.BreakpointTreeElement` to `WI.JavaScriptBreakpointTreeElement` and use `WI.BreakpointTreeElement` as a new common base class for all breakpoint tree elements, allowing more logic and styles to be shared (e.g. disabled state). * UserInterface/Views/SourcesNavigationSidebarPanel.js: (WI.SourcesNavigationSidebarPanel): (WI.SourcesNavigationSidebarPanel.prototype.closed): (WI.SourcesNavigationSidebarPanel.prototype._insertDebuggerTreeElement): (WI.SourcesNavigationSidebarPanel.prototype._compareJavaScriptBreakpointTreeElements): Added. (WI.SourcesNavigationSidebarPanel.prototype._addBreakpoint): (WI.SourcesNavigationSidebarPanel.prototype._removeAllBreakpoints): (WI.SourcesNavigationSidebarPanel.prototype._breakpointsBeneathTreeElement): (WI.SourcesNavigationSidebarPanel.prototype._addIssue): (WI.SourcesNavigationSidebarPanel.prototype._updatePauseReasonSection): (WI.SourcesNavigationSidebarPanel.prototype._handleTreeSelectionDidChange): (WI.SourcesNavigationSidebarPanel.prototype._handleBreakpointElementAddedOrRemoved): (WI.SourcesNavigationSidebarPanel.prototype._populateCreateBreakpointContextMenu.addToggleForSpecialEventBreakpoint): (WI.SourcesNavigationSidebarPanel.prototype._populateCreateBreakpointContextMenu): (WI.SourcesNavigationSidebarPanel.prototype._handleDebuggerObjectDisplayLocationDidChange): (WI.SourcesNavigationSidebarPanel.prototype._compareBreakpointTreeElements): Deleted. * UserInterface/Models/ProbeSet.js: (WI.ProbeSet): (WI.ProbeSet.prototype.createProbe): (WI.ProbeSet.prototype.willRemove): * UserInterface/Controllers/TimelineManager.js: (WI.TimelineManager.prototype._processRecord): * UserInterface/Views/ProbeSetDetailsSection.js: (WI.ProbeSetDetailsSection): * UserInterface/Views/ProbeDetailsSidebarPanel.js: (WI.ProbeDetailsSidebarPanel.prototype.inspect): * UserInterface/Views/SourceCodeTextEditor.js: (WI.SourceCodeTextEditor): (WI.SourceCodeTextEditor.prototype.close): (WI.SourceCodeTextEditor.prototype.textEditorBreakpointAdded): * UserInterface/Views/TextResourceContentView.js: (WI.TextResourceContentView.prototype.get supplementalRepresentedObjects): (WI.TextResourceContentView.prototype._probeSetsChanged): Probes now support `WI.EventBreakpoint` in addition to `WI.JavaScriptBreakpoint`. * UserInterface/Views/ContentView.js: (WI.ContentView.createFromRepresentedObject): (WI.ContentView.resolvedRepresentedObjectForRepresentedObject): (WI.ContentView.isViewable): * UserInterface/Views/ContextMenuUtilities.js: (WI.appendContextMenuItemsForSourceCode): Replace `WI.Breakpoint` with `WI.JavaScriptBreakpoint`. * UserInterface/Views/DOMTreeContentView.js: (WI.DOMTreeContentView): Replace `WI.DOMBreakpoint` with `WI.Breakpoint`. * UserInterface/Views/EventListenerSectionGroup.js: (WI.EventListenerSectionGroup): * UserInterface/Views/EventListenerSectionGroup.css: (.event-listener-section > .content input[type="checkbox"] + .go-to-arrow): Added. (.event-listener-section > .content input[type="checkbox"]:not(:checked) + .go-to-arrow): Added. Add a go-to arrow next to the Breakpoint checkbox that reveals the `WI.EventBreakpoint` in the Sources Tab. * UserInterface/Views/BreakpointActionView.js: (WI.BreakpointActionView.prototype._appendActionButtonClicked): Drive-by: minor code cleanup. * UserInterface/Views/CallFrameTreeElement.js: (WI.CallFrameTreeElement.prototype.populateContextMenu): Drive-by: include source code location context menu items. * UserInterface/Base/Setting.js: * UserInterface/Main.html: * UserInterface/Test.html: LayoutTests: * inspector/dom-debugger/resources/event-breakpoint-utilities.js: (TestPage.registerInitializer.InspectorTest.EventBreakpoint.addBreakpointOptionsTestCases): Added. (TestPage.registerInitializer.InspectorTest.EventBreakpoint.async teardown): (TestPage.registerInitializer.InspectorTest.EventBreakpoint.createBreakpoint): (TestPage.registerInitializer.InspectorTest.EventBreakpoint.removeBreakpoint): * inspector/dom/breakpoint-for-event-listener.html: * inspector/dom/breakpoint-for-event-listener-expected.txt: * inspector/dom-debugger/event-animation-frame-breakpoints.html: * inspector/dom-debugger/event-animation-frame-breakpoints-expected.txt: * inspector/dom-debugger/event-interval-breakpoints.html: * inspector/dom-debugger/event-interval-breakpoints-expected.txt: * inspector/dom-debugger/event-listener-breakpoints.html: * inspector/dom-debugger/event-listener-breakpoints-expected.txt: * inspector/dom-debugger/event-timeout-breakpoints.html: * inspector/dom-debugger/event-timeout-breakpoints-expected.txt: Add tests for new event breakpoint configuration options. * http/tests/inspector/debugger/debugger-test.js: (TestPage.registerInitializer.InspectorTest.startTracingBreakpoints): * http/tests/inspector/resources/probe-test.js: (TestPage.registerInitializer.ProtocolTest.Probe.installTracingListeners): * inspector/debugger/breakpoint-action-eval.html: * inspector/debugger/breakpoint-action-log.html: * inspector/debugger/breakpoint-columns.html: * inspector/debugger/breakpoint-scope.html: * inspector/debugger/debugger-stack-overflow.html: * inspector/debugger/pause-reason.html: * inspector/debugger/probe-manager-add-remove-actions.html: * inspector/debugger/stepping/stepping-through-autoContinue-breakpoint.html: * inspector/debugger/tail-deleted-frames-this-value.html: * inspector/debugger/tail-recursion.html: * inspector/worker/debugger-pause.html: * inspector/worker/debugger-shared-breakpoint.html: Update existing breakpoint tests to use new model objects. Canonical link: https://commits.webkit.org/228551@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-24 17:34:12 +00:00
debugger/Breakpoint.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
debugger/Debugger.cpp
debugger/DebuggerCallFrame.cpp
debugger/DebuggerLocation.cpp
debugger/DebuggerParseData.cpp
debugger/DebuggerScope.cpp
dfg/DFGAbstractHeap.cpp
DFG AI and clobberize should agree with each other https://bugs.webkit.org/show_bug.cgi?id=184440 Reviewed by Saam Barati. JSTests: Add tests for all of the bugs I fixed. * stress/direct-arguments-out-of-bounds-change-structure.js: Added. (foo): * stress/new-typed-array-cse-effects.js: Added. (foo): * stress/scoped-arguments-out-of-bounds-change-structure.js: Added. (foo.theO): (foo): * stress/string-from-char-code-change-structure-not-dead.js: Added. (foo): (i.valueOf): (weirdValue.valueOf): * stress/string-from-char-code-change-structure.js: Added. (foo): (i.valueOf): (weirdValue.valueOf): Source/JavaScriptCore: One way to fix bugs involving underapproximation in AI or clobberize is to assert that they agree with each other. That's what this patch does: it adds an assertion that AI's structure state tracking must be equivalent to JSCell_structureID being clobbered. One subtlety is that AI sometimes folds away structure clobbering using information that clobberize doesn't have. So, we track this wuth special kinds of AI states (FoldedClobber and ObservedTransitions). This fixes a bunch of cases of AI missing clobberStructures/clobberWorld and one case of clobberize missing a write(Heap). This also makes some cases more precise in order to appease the assertion. Making things more precise might make things faster, but I didn't measure it because that wasn't the goal. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * dfg/DFGAbstractInterpreter.h: * dfg/DFGAbstractInterpreterClobberState.cpp: Added. (WTF::printInternal): * dfg/DFGAbstractInterpreterClobberState.h: Added. (JSC::DFG::mergeClobberStates): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::startExecuting): (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): (JSC::DFG::AbstractInterpreter<AbstractStateType>::didFoldClobberWorld): (JSC::DFG::AbstractInterpreter<AbstractStateType>::clobberStructures): (JSC::DFG::AbstractInterpreter<AbstractStateType>::didFoldClobberStructures): (JSC::DFG::AbstractInterpreter<AbstractStateType>::observeTransition): (JSC::DFG::AbstractInterpreter<AbstractStateType>::observeTransitions): (JSC::DFG::AbstractInterpreter<AbstractStateType>::setDidClobber): Deleted. * dfg/DFGAtTailAbstractState.h: (JSC::DFG::AtTailAbstractState::setClobberState): (JSC::DFG::AtTailAbstractState::mergeClobberState): (JSC::DFG::AtTailAbstractState::setDidClobber): Deleted. * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::performBlockCFA): * dfg/DFGClobberSet.cpp: (JSC::DFG::writeSet): * dfg/DFGClobberSet.h: * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGInPlaceAbstractState.h: (JSC::DFG::InPlaceAbstractState::clobberState const): (JSC::DFG::InPlaceAbstractState::didClobberOrFolded const): (JSC::DFG::InPlaceAbstractState::didClobber const): (JSC::DFG::InPlaceAbstractState::setClobberState): (JSC::DFG::InPlaceAbstractState::mergeClobberState): (JSC::DFG::InPlaceAbstractState::setDidClobber): Deleted. Canonical link: https://commits.webkit.org/200013@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230488 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-10 19:45:54 +00:00
dfg/DFGAbstractInterpreterClobberState.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
dfg/DFGAbstractValue.cpp
DFG AI should have O(1) clobbering https://bugs.webkit.org/show_bug.cgi?id=185287 Reviewed by Saam Barati. JSTests: * stress/simple-ai-effect.js: Added. (bar): (foo): Source/JavaScriptCore: This fixes an old scalability probem in AI. Previously, if we did clobberWorld(), then we would traverse all of the state available to the AI at that time and clobber it. This changes clobberWorld() to be O(1). It just does some math to a clobber epoch. This is a ~1% speed-up for compile times. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * dfg/DFGAbstractInterpreter.h: (JSC::DFG::AbstractInterpreter::forNode): (JSC::DFG::AbstractInterpreter::setForNode): (JSC::DFG::AbstractInterpreter::clearForNode): (JSC::DFG::AbstractInterpreter::variables): Deleted. * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): (JSC::DFG::AbstractInterpreter<AbstractStateType>::clobberWorld): (JSC::DFG::AbstractInterpreter<AbstractStateType>::forAllValues): (JSC::DFG::AbstractInterpreter<AbstractStateType>::clobberStructures): (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeDoubleUnaryOpEffects): * dfg/DFGAbstractValue.cpp: (JSC::DFG::AbstractValue::fastForwardToSlow): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::fastForwardTo): (JSC::DFG::AbstractValue::clobberStructuresFor): Deleted. (JSC::DFG::AbstractValue::observeInvalidationPoint): Deleted. (JSC::DFG::AbstractValue::observeInvalidationPointFor): Deleted. * dfg/DFGAbstractValueClobberEpoch.cpp: Added. (JSC::DFG::AbstractValueClobberEpoch::dump const): * dfg/DFGAbstractValueClobberEpoch.h: Added. (JSC::DFG::AbstractValueClobberEpoch::AbstractValueClobberEpoch): (JSC::DFG::AbstractValueClobberEpoch::first): (JSC::DFG::AbstractValueClobberEpoch::clobber): (JSC::DFG::AbstractValueClobberEpoch::observeInvalidationPoint): (JSC::DFG::AbstractValueClobberEpoch::operator== const): (JSC::DFG::AbstractValueClobberEpoch::operator!= const): (JSC::DFG::AbstractValueClobberEpoch::structureClobberState const): (JSC::DFG::AbstractValueClobberEpoch::clobberEpoch const): * dfg/DFGAtTailAbstractState.h: (JSC::DFG::AtTailAbstractState::setForNode): (JSC::DFG::AtTailAbstractState::clearForNode): (JSC::DFG::AtTailAbstractState::numberOfArguments const): (JSC::DFG::AtTailAbstractState::numberOfLocals const): (JSC::DFG::AtTailAbstractState::operand): (JSC::DFG::AtTailAbstractState::local): (JSC::DFG::AtTailAbstractState::argument): (JSC::DFG::AtTailAbstractState::clobberStructures): (JSC::DFG::AtTailAbstractState::observeInvalidationPoint): (JSC::DFG::AtTailAbstractState::variables): Deleted. * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::performBlockCFA): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGFlowMap.h: (JSC::DFG::FlowMap::at): (JSC::DFG::FlowMap::atShadow): (JSC::DFG::FlowMap::at const): (JSC::DFG::FlowMap::atShadow const): * dfg/DFGInPlaceAbstractState.cpp: (JSC::DFG::InPlaceAbstractState::beginBasicBlock): (JSC::DFG::InPlaceAbstractState::endBasicBlock): * dfg/DFGInPlaceAbstractState.h: (JSC::DFG::InPlaceAbstractState::forNode): (JSC::DFG::InPlaceAbstractState::setForNode): (JSC::DFG::InPlaceAbstractState::clearForNode): (JSC::DFG::InPlaceAbstractState::variablesForDebugging): (JSC::DFG::InPlaceAbstractState::numberOfArguments const): (JSC::DFG::InPlaceAbstractState::numberOfLocals const): (JSC::DFG::InPlaceAbstractState::operand): (JSC::DFG::InPlaceAbstractState::local): (JSC::DFG::InPlaceAbstractState::argument): (JSC::DFG::InPlaceAbstractState::variableAt): (JSC::DFG::InPlaceAbstractState::clobberStructures): (JSC::DFG::InPlaceAbstractState::observeInvalidationPoint): (JSC::DFG::InPlaceAbstractState::fastForward): (JSC::DFG::InPlaceAbstractState::variables): Deleted. * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileGetStack): Canonical link: https://commits.webkit.org/200872@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231471 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-08 01:05:21 +00:00
dfg/DFGAbstractValueClobberEpoch.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
dfg/DFGAdaptiveInferredPropertyValueWatchpoint.cpp
dfg/DFGAdaptiveStructureWatchpoint.cpp
dfg/DFGArgumentsEliminationPhase.cpp
dfg/DFGArgumentsUtilities.cpp
dfg/DFGArithMode.cpp
dfg/DFGArrayMode.cpp
dfg/DFGAtTailAbstractState.cpp
dfg/DFGAvailability.cpp
dfg/DFGAvailabilityMap.cpp
dfg/DFGBackwardsPropagationPhase.cpp
dfg/DFGBasicBlock.cpp
dfg/DFGBlockInsertionSet.cpp
dfg/DFGBlockSet.cpp
dfg/DFGByteCodeParser.cpp
dfg/DFGCFAPhase.cpp
dfg/DFGCFGSimplificationPhase.cpp
dfg/DFGCPSRethreadingPhase.cpp
dfg/DFGCSEPhase.cpp
dfg/DFGCapabilities.cpp
dfg/DFGCleanUpPhase.cpp
dfg/DFGClobberSet.cpp
dfg/DFGClobberize.cpp
dfg/DFGClobbersExitState.cpp
[JSC] Return DisposableCallSiteIndex when destroying GCAwareJITStubRoutineWithExceptionHandler https://bugs.webkit.org/show_bug.cgi?id=213069 <rdar://problem/64205186> Reviewed by Saam Barati. JSTests: * stress/dont-dispose-callsiteindex-while-executing.js: Added. (emptyFunction): (foo.bar.set catch): (foo.bar): (foo): Source/JavaScriptCore: Inside GCAwareJITStubRoutineWithExceptionHandler::observeZeroRefCount, we are returning DisposableCallSiteIndex to freelist. However, GCAwareJITStubRoutineWithExceptionHandler::observeZeroRefCount can be called even if the code of GCAwareJITStubRoutineWithExceptionHandler is on the stack. Let's consider the following scenario. 1. Execute GCAwareJITStubRoutineWithExceptionHandler's code. Set CallSiteIndex to the stack. 2. Execute more code. (1)'s GCAwareJITStubRoutineWithExceptionHandler's code is on the stack. 3. (1)'s GCAwareJITStubRoutineWithExceptionHandler's refcount becomes zero. 4. CallSiteIndex of GCAwareJITStubRoutineWithExceptionHandler is returned. 5. Execute StackVisitor to construct frames. But we cannot find CodeOrigin corresponding to CallSiteIndex stored in (1) since it is already returned. DisposableCallSiteIndex should be returned after ensuring that GCAwareJITStubRoutineWithExceptionHandler's code is not on the stack. Detecting this is the functionality what GCAwareJITStubRoutineWithExceptionHandler can offer. It is destroyed after ensuring that GCAwareJITStubRoutineWithExceptionHandler's code is not on the stack. This patch delays DisposableCallSiteIndex returning until we destroy owner GCAwareJITStubRoutineWithExceptionHandler. But it is possible that CodeBlock* corresponding to GCAwareJITStubRoutineWithExceptionHandler is already destroyed. To avoid this condition, we extract CodeOrigins vector as Ref<DFG::CodeOriginPool> and keep it alive from GCAwareJITStubRoutineWithExceptionHandler too. And since CodeOrigin addition / removal happens only from the main thread after finishing the compilation, and GCAwareJITStubRoutineWithExceptionHandler's destructor is called from the Heap's finalizer, which must be executed from the main thread, we can just modify it without a lock. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::newExceptionHandlingCallSiteIndex): (JSC::CodeBlock::codeOrigins): * bytecode/CodeBlock.h: (JSC::CodeBlock::codeOrigin): * dfg/DFGCodeOriginPool.cpp: Added. (JSC::DFG::CodeOriginPool::addCodeOrigin): (JSC::DFG::CodeOriginPool::addUniqueCallSiteIndex): (JSC::DFG::CodeOriginPool::lastCallSite const): (JSC::DFG::CodeOriginPool::addDisposableCallSiteIndex): (JSC::DFG::CodeOriginPool::removeDisposableCallSiteIndex): (JSC::DFG::CodeOriginPool::shrinkToFit): * dfg/DFGCodeOriginPool.h: Added. (JSC::DFG::CodeOriginPool::create): (JSC::DFG::CodeOriginPool::get): (JSC::DFG::CodeOriginPool::size const): * dfg/DFGCommonData.cpp: (JSC::DFG::CommonData::shrinkToFit): (JSC::DFG::CommonData::addCodeOrigin): Deleted. (JSC::DFG::CommonData::addUniqueCallSiteIndex): Deleted. (JSC::DFG::CommonData::lastCallSite const): Deleted. (JSC::DFG::CommonData::addDisposableCallSiteIndex): Deleted. (JSC::DFG::CommonData::removeDisposableCallSiteIndex): Deleted. * dfg/DFGCommonData.h: (JSC::DFG::CommonData::CommonData): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::exceptionCheck): * dfg/DFGJITCompiler.h: (JSC::DFG::JITCompiler::addCallSite): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compilePutById): (JSC::FTL::DFG::LowerDFGToB3::compileGetByVal): (JSC::FTL::DFG::LowerDFGToB3::compileDelBy): (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstruct): (JSC::FTL::DFG::LowerDFGToB3::compileDirectCallOrConstruct): (JSC::FTL::DFG::LowerDFGToB3::compileTailCall): (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread): (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs): (JSC::FTL::DFG::LowerDFGToB3::compileCallEval): (JSC::FTL::DFG::LowerDFGToB3::compileInById): (JSC::FTL::DFG::LowerDFGToB3::compileInstanceOf): (JSC::FTL::DFG::LowerDFGToB3::compileLogShadowChickenTail): (JSC::FTL::DFG::LowerDFGToB3::getById): (JSC::FTL::DFG::LowerDFGToB3::getByIdWithThis): (JSC::FTL::DFG::LowerDFGToB3::lazySlowPath): (JSC::FTL::DFG::LowerDFGToB3::callPreflight): * ftl/FTLSlowPathCall.cpp: (JSC::FTL::callSiteIndexForCodeOrigin): * jit/GCAwareJITStubRoutine.cpp: (JSC::GCAwareJITStubRoutineWithExceptionHandler::GCAwareJITStubRoutineWithExceptionHandler): (JSC::GCAwareJITStubRoutineWithExceptionHandler::~GCAwareJITStubRoutineWithExceptionHandler): (JSC::GCAwareJITStubRoutineWithExceptionHandler::aboutToDie): (JSC::GCAwareJITStubRoutineWithExceptionHandler::observeZeroRefCount): * jit/GCAwareJITStubRoutine.h: Canonical link: https://commits.webkit.org/225876@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262920 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-11 20:11:34 +00:00
dfg/DFGCodeOriginPool.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
dfg/DFGCombinedLiveness.cpp
dfg/DFGCommon.cpp
dfg/DFGCommonData.cpp
dfg/DFGConstantFoldingPhase.cpp
dfg/DFGConstantHoistingPhase.cpp
dfg/DFGCriticalEdgeBreakingPhase.cpp
dfg/DFGDCEPhase.cpp
[JSC] Global lexical bindings can shadow global variables if it is `configurable = true` https://bugs.webkit.org/show_bug.cgi?id=193308 <rdar://problem/45546542> Reviewed by Saam Barati. JSTests: * stress/const-lexical-binding-shadow-existing-global-property-ftl.js: Added. (shouldThrow): (shouldBe): (foo): (get shouldThrow): * stress/const-lexical-binding-shadow-existing-global-property-tdz-ftl.js: Added. (shouldThrow): (shouldBe): (foo): (get shouldBe): (get shouldThrow): (get return): * stress/const-lexical-binding-shadow-existing-global-property-tdz.js: Added. (shouldThrow): (shouldBe): (foo): (get shouldBe): (get shouldThrow): * stress/const-lexical-binding-shadow-existing-global-property.js: Added. (shouldThrow): (shouldBe): (foo): * stress/const-lexical-binding-shadowing-global-properties-and-eval-injection.js: Added. (shouldThrow): (shouldBe): (foo): * stress/global-add-function-should-not-be-shadowed-by-lexical-bindings.js: Added. (shouldThrow): * stress/global-static-variables-should-not-be-shadowed-by-lexical-bindings.js: Added. (shouldThrow): * stress/let-lexical-binding-shadow-existing-global-property-ftl.js: Added. (shouldThrow): (shouldBe): (foo): * stress/let-lexical-binding-shadow-existing-global-property-tdz-ftl.js: Added. (shouldThrow): (shouldBe): (foo): (get shouldBe): (get shouldThrow): (get return): * stress/let-lexical-binding-shadow-existing-global-property-tdz.js: Added. (shouldThrow): (shouldBe): (foo): (get shouldBe): (get shouldThrow): * stress/let-lexical-binding-shadow-existing-global-property.js: Added. (shouldThrow): (shouldBe): (foo): * stress/let-lexical-binding-shadowing-global-properties-and-eval-injection.js: Added. (shouldThrow): (shouldBe): (foo): Source/JavaScriptCore: Previously, we assumed that lexical bindings in JSGlobalLexicalEnvironment cannot shadow existing global properties. However, it is wrong. According to the spec, we can shadow global properties if a property's attribute is configurable = true. For example, we execute two scripts. script1.js bar = 42; function load() { return bar; } print(bar); // 42 print(load()); // 42 script2.js let bar = 0; // This lexical binding can shadow the global.bar defined in script1.js print(bar); // 0 print(load()); // 0 In JSC, we cache GlobalProperty resolve type and its associated information in op_resolve_type, op_get_from_scope, and op_put_to_scope. They attempt to load a property from JSGlobalObject directly. However, once the newly added lexical binding starts shadowing this, our existing instructions become invalid since they do not respect JSGlobalLexicalEnvironment. In this patch, we fix this issue by introducing the following mechanisms. 1. We have a HashMap<property name, watchpoint set> in JSGlobalObject. DFG and FTL create a watchpoint set with the property name if the generated code depends on GlobalProperty condition of op_resolve_scope etc. These watchpoint will be fired when the shadowing happens, so that our generated DFG and FTL code will be invalidated if it depends on the condition which is no longer valid. 2. When we detect shadowing, we iterate all the live CodeBlocks which globalObject is the target one. And we rewrite instructions in them from GlobalProperty to GlobalLexicalVar (or Dynamic precisely). So, the subsequent LLInt code just works well. "Dynamic" conversion happens when your op_put_to_scope attempts to put a value onto a const lexical binding. This fails and it should throw a type error. 3. GlobalProperty scope operations in Baseline JIT start checking ResolveType in metadata, and emit code for GlobalProperty and GlobalLexicalVar. Once the rewrite happens, baseline JIT continues working because it checks the rewritten metadata's ResolveType. We use this mechanism (which is similar to haveABadTime() thing) because, 1. Shadowing should be super rare. Before r214145, we made these cases as SytaxError. Thus, before r214145, this type of code cannot be executed in WebKit. And the number of the live CodeBlocks for the given JSGlobalObject should be small. This supports introducing rather simple (but not so efficient) mechanism instead of the complicated one. 2. Rewriting instructions immediately forces GlobalProperty => GlobalLexicalVar / Dynamic conversion in all the possible CodeBlock. This allows us to avoid compilation failure loop in DFG and FTL: DFG and FTL codes are invalidated by the watchpoint, but we may attempt to compile the code with the invalidated watchpoint and GlobalProperty status if we do not rewrite it. One possible other implementation is having and checking a counter in instruction, and every time we introduce a new shadow binding, bump the counter. And eventually executed instruction will go to the slow path and rewrite itself. However, this way leaves the not-executed-again-yet instructions as is, and DFG and FTL repeatedly fail to compile if we just watch the invalidated watchpoint for that. Rewriting all the existing GlobalProperty immediately avoids this situation easily. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::notifyLexicalBindingShadowing): * bytecode/CodeBlock.h: (JSC::CodeBlock::scriptMode const): * bytecode/Watchpoint.h: (JSC::WatchpointSet::create): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGDesiredGlobalProperties.cpp: Added. (JSC::DFG::DesiredGlobalProperties::isStillValidOnMainThread): (JSC::DFG::DesiredGlobalProperties::reallyAdd): * dfg/DFGDesiredGlobalProperties.h: Added. (JSC::DFG::DesiredGlobalProperties::addLazily): We need this DesiredGlobalProperties mechanism since we do not want to ref() the UniquedStringImpl in DFG and FTL thread. We keep JSGlobalObject* and identifierNumber, and materialize WatchpointSets for each JSGlobalObject's property referenced from DFG and FTL and inject CodeBlock jettison watchpoints in the main thread. * dfg/DFGDesiredGlobalProperty.h: Added. (JSC::DFG::DesiredGlobalProperty::DesiredGlobalProperty): (JSC::DFG::DesiredGlobalProperty::globalObject const): (JSC::DFG::DesiredGlobalProperty::identifierNumber const): (JSC::DFG::DesiredGlobalProperty::operator== const): (JSC::DFG::DesiredGlobalProperty::operator!= const): (JSC::DFG::DesiredGlobalProperty::isHashTableDeletedValue const): (JSC::DFG::DesiredGlobalProperty::hash const): (JSC::DFG::DesiredGlobalProperty::dumpInContext const): (JSC::DFG::DesiredGlobalProperty::dump const): (JSC::DFG::DesiredGlobalPropertyHash::hash): (JSC::DFG::DesiredGlobalPropertyHash::equal): * dfg/DFGGraph.h: (JSC::DFG::Graph::globalProperties): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::reallyAdd): (JSC::DFG::Plan::isStillValidOnMainThread): (JSC::DFG::Plan::finalizeWithoutNotifyingCallback): (JSC::DFG::Plan::cancel): * dfg/DFGPlan.h: (JSC::DFG::Plan::globalProperties): * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_resolve_scope): (JSC::JIT::emit_op_get_from_scope): (JSC::JIT::emit_op_put_to_scope): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emit_op_resolve_scope): (JSC::JIT::emit_op_get_from_scope): (JSC::JIT::emit_op_put_to_scope): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::addStaticGlobals): (JSC::JSGlobalObject::notifyLexicalBindingShadowing): (JSC::JSGlobalObject::getReferencedPropertyWatchpointSet): (JSC::JSGlobalObject::ensureReferencedPropertyWatchpointSet): * runtime/JSGlobalObject.h: * runtime/ProgramExecutable.cpp: (JSC::hasRestrictedGlobalProperty): (JSC::ProgramExecutable::initializeGlobalProperties): Canonical link: https://commits.webkit.org/207863@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239879 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-11 23:10:31 +00:00
dfg/DFGDesiredGlobalProperties.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
dfg/DFGDesiredIdentifiers.cpp
dfg/DFGDesiredTransitions.cpp
dfg/DFGDesiredWatchpoints.cpp
dfg/DFGDesiredWeakReferences.cpp
dfg/DFGDisassembler.cpp
dfg/DFGDoesGC.cpp
[Re-landing] Enhance DoesGC verification to print more useful info when verification fails. https://bugs.webkit.org/show_bug.cgi?id=212680 Reviewed by Yusuke Susuki. When DoesGC verification fails, the first step of debugging it would be to find out what and which DFG node resulted in the failed verification. In pre-existing code, all we get is an assertion failure. This patch makes it so that the verifier will dump useful info. Here's an example: Error: DoesGC failed @ D@34 DateGetInt32OrNaN in #DtCHMz:[0x1135bd1d0->0x1135bcab0->0x1135e5c80, DFGFunctionCall, 150 (DidTryToEnterInLoop)] [0] frame 0x7ffee8285660 { name: sourceURL: isInlinedFrame: false callee: 0x1135f6820 returnPC: 0x50ce61248ae6 callerFrame: 0x7ffee82856f0 rawLocationBits: 5 0x5 codeBlock: 0x1135bd1d0 #DtCHMz:[0x1135bd1d0->0x1135bcab0->0x1135e5c80, DFGFunctionCall, 150 (DidTryToEnterInLoop)] hasCodeOrigins: true callSiteIndex: 5 of 13 jitCode: 0x113020200 start 0x50ce61214c60 end 0x50ce61219b00 line: 1 column: 60 EntryFrame: 0x7ffee8285860 } [1] frame 0x7ffee82856f0 { name: sourceURL: date-format-xparb.js isInlinedFrame: false callee: 0x1135f65a0 returnPC: 0x50ce61227e99 callerFrame: 0x7ffee8285770 rawLocationBits: 4 0x4 codeBlock: 0x1135bd0a0 #BU6Zcd:[0x1135bd0a0->0x1135bc260->0x1135e5180, DFGFunctionCall, 112 (DidTryToEnterInLoop)] hasCodeOrigins: true callSiteIndex: 4 of 12 jitCode: 0x113004000 start 0x50ce61212c60 end 0x50ce61214960 line: 26 column: 22 EntryFrame: 0x7ffee8285860 } [2] frame 0x7ffee8285770 { name: sourceURL: date-format-xparb.js isInlinedFrame: false callee: 0x1135f64e0 returnPC: 0x108058eb1 callerFrame: 0x7ffee82857e0 rawLocationBits: 1001 0x3e9 codeBlock: 0x1135bc130 #DAS9xe:[0x1135bc130->0x1135e5100, BaselineFunctionCall, 1149] bc#1001 of 1149 line: 417 column: 38 EntryFrame: 0x7ffee8285860 } [3] frame 0x7ffee82857e0 { name: global code sourceURL: date-format-xparb.js isInlinedFrame: false callee: 0x1130f97b8 returnPC: 0x108039043 callerFrame: 0x0 rawLocationBits: 23 0x17 codeBlock: 0x1135bc000 <global>#CukXvt:[0x1135bc000->0x1130cd768, LLIntGlobal, 81] bc#23 of 81 line: 425 column: 3 EntryFrame: 0x7ffee8285860 } ASSERTION FAILED: expectDoesGC() The error message now comes with the node index, NodeType, codeBlock which this failure was found in, and the JS call stack that led to the failure. Changes made: 1. Introduced a DoesGCCheck value that is used to encode some of the above data. Previously, we only recorded whether doesGC() returns true or false for the Node. Now, we record the nodeIndex and nodeOp as well. Note that we also set DoesGC expectations for OSR exits. So, DoesGCCheck includes Special cases for those. 2. Added store64(TrustedImm64 imm, const void* address) emitters for X86_64 and ARM64. Also added a test for this new emitter in testmasm. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/MacroAssemblerARM64.h: (JSC::MacroAssemblerARM64::store64): * assembler/MacroAssemblerX86_64.h: (JSC::MacroAssemblerX86_64::store64): * assembler/testmasm.cpp: (JSC::testStore64Imm64AddressPointer): (JSC::run): * dfg/DFGDoesGCCheck.cpp: Copied from Source/JavaScriptCore/dfg/DFGDoesGCCheck.cpp. * dfg/DFGDoesGCCheck.h: Copied from Source/JavaScriptCore/dfg/DFGDoesGCCheck.h. * dfg/DFGGraph.cpp: * dfg/DFGOSRExit.cpp: (JSC::DFG::operationCompileOSRExit): (JSC::DFG::OSRExit::compileExit): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileStub): (JSC::FTL::operationCompileFTLOSRExit): * heap/CompleteSubspace.cpp: (JSC::CompleteSubspace::tryAllocateSlow): (JSC::CompleteSubspace::reallocatePreciseAllocationNonVirtual): * heap/CompleteSubspaceInlines.h: (JSC::CompleteSubspace::allocateNonVirtual): * heap/DeferGC.h: (JSC::DeferGC::~DeferGC): * heap/GCDeferralContextInlines.h: (JSC::GCDeferralContext::~GCDeferralContext): * heap/Heap.cpp: (JSC::Heap::collectNow): (JSC::Heap::collectAsync): (JSC::Heap::collectSync): (JSC::Heap::stopIfNecessarySlow): (JSC::Heap::collectIfNecessaryOrDefer): * heap/Heap.h: (JSC::Heap::addressOfDoesGC): (JSC::Heap::setDoesGCExpectation): (JSC::Heap::verifyCanGC): (JSC::Heap::expectDoesGC const): Deleted. (JSC::Heap::setExpectDoesGC): Deleted. (JSC::Heap::addressOfExpectDoesGC): Deleted. * heap/HeapInlines.h: (JSC::Heap::acquireAccess): (JSC::Heap::stopIfNecessary): * heap/LocalAllocatorInlines.h: (JSC::LocalAllocator::allocate): * heap/PreciseAllocation.cpp: (JSC::PreciseAllocation::tryCreate): (JSC::PreciseAllocation::createForLowerTier): * runtime/JSString.h: (JSC::jsSingleCharacterString): (JSC::JSString::toAtomString const): (JSC::JSString::toExistingAtomString const): (JSC::JSString::value const): (JSC::JSString::tryGetValue const): (JSC::JSRopeString::unsafeView const): (JSC::JSRopeString::viewWithUnderlyingString const): (JSC::JSString::unsafeView const): * runtime/RegExpMatchesArray.h: (JSC::createRegExpMatchesArray): Canonical link: https://commits.webkit.org/225537@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262513 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-03 20:23:30 +00:00
dfg/DFGDoesGCCheck.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
dfg/DFGDriver.cpp
dfg/DFGEdge.cpp
dfg/DFGEpoch.cpp
dfg/DFGFailedFinalizer.cpp
dfg/DFGFinalizer.cpp
dfg/DFGFixupPhase.cpp
dfg/DFGFlowIndexing.cpp
dfg/DFGFlushFormat.cpp
dfg/DFGFlushedAt.cpp
dfg/DFGLiveCatchVariablePreservationPhase.cpp
dfg/DFGFrozenValue.cpp
dfg/DFGGraph.cpp
dfg/DFGGraphSafepoint.cpp
dfg/DFGHeapLocation.cpp
dfg/DFGInPlaceAbstractState.cpp
dfg/DFGInsertionSet.cpp
dfg/DFGIntegerCheckCombiningPhase.cpp
dfg/DFGIntegerRangeOptimizationPhase.cpp
dfg/DFGInvalidationPointInjectionPhase.cpp
dfg/DFGJITCode.cpp
dfg/DFGJITCompiler.cpp
dfg/DFGJITFinalizer.cpp
dfg/DFGJumpReplacement.cpp
dfg/DFGLICMPhase.cpp
dfg/DFGLazyJSValue.cpp
dfg/DFGLazyNode.cpp
dfg/DFGLivenessAnalysisPhase.cpp
dfg/DFGLoopPreHeaderCreationPhase.cpp
dfg/DFGMayExit.cpp
dfg/DFGMinifiedGraph.cpp
dfg/DFGMinifiedNode.cpp
dfg/DFGMultiGetByOffsetData.cpp
dfg/DFGNode.cpp
dfg/DFGNodeAbstractValuePair.cpp
dfg/DFGNodeFlags.cpp
dfg/DFGNodeFlowProjection.cpp
dfg/DFGNodeOrigin.cpp
dfg/DFGOSRAvailabilityAnalysisPhase.cpp
dfg/DFGOSREntry.cpp
dfg/DFGOSREntrypointCreationPhase.cpp
dfg/DFGOSRExit.cpp
dfg/DFGOSRExitBase.cpp
dfg/DFGOSRExitCompilerCommon.cpp
dfg/DFGOSRExitFuzz.cpp
dfg/DFGOSRExitJumpPlaceholder.cpp
dfg/DFGObjectAllocationSinkingPhase.cpp
dfg/DFGObjectMaterializationData.cpp
dfg/DFGOperations.cpp
dfg/DFGPhantomInsertionPhase.cpp
dfg/DFGPhase.cpp
dfg/DFGPhiChildren.cpp
dfg/DFGPlan.cpp
dfg/DFGPredictionInjectionPhase.cpp
dfg/DFGPredictionPropagationPhase.cpp
dfg/DFGPromotedHeapLocation.cpp
dfg/DFGPureValue.cpp
dfg/DFGPutStackSinkingPhase.cpp
dfg/DFGRegisteredStructureSet.cpp
dfg/DFGSSACalculator.cpp
dfg/DFGSSAConversionPhase.cpp
dfg/DFGSSALoweringPhase.cpp
dfg/DFGSnippetParams.cpp
// These files take a long time to compile so we do them individually.
dfg/DFGSpeculativeJIT.cpp @no-unify
dfg/DFGSpeculativeJIT32_64.cpp @no-unify
dfg/DFGSpeculativeJIT64.cpp @no-unify
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
dfg/DFGStackLayoutPhase.cpp
dfg/DFGStaticExecutionCountEstimationPhase.cpp
dfg/DFGStoreBarrierClusteringPhase.cpp
dfg/DFGStoreBarrierInsertionPhase.cpp
dfg/DFGStrengthReductionPhase.cpp
dfg/DFGStructureAbstractValue.cpp
dfg/DFGThunks.cpp
dfg/DFGTierUpCheckInjectionPhase.cpp
dfg/DFGToFTLDeferredCompilationCallback.cpp
dfg/DFGToFTLForOSREntryDeferredCompilationCallback.cpp
dfg/DFGTransition.cpp
dfg/DFGTypeCheckHoistingPhase.cpp
dfg/DFGUnificationPhase.cpp
dfg/DFGUseKind.cpp
dfg/DFGValidate.cpp
Add a ValueRepReduction phase https://bugs.webkit.org/show_bug.cgi?id=196234 Reviewed by Filip Pizlo. This patch adds a ValueRepReduction phase. The main idea here is to try to reduce DoubleRep(RealNumberUse:ValueRep(DoubleRepUse:@x)) to just be @x. This patch handles such above strengh reduction rules as long as we prove that all users of the ValueRep can be converted to using the incoming double value. That way we prevent introducing a parallel live range for the double value. This patch tracks the uses of the ValueRep through Phi variables, so we can convert entire Phi variables to being Double instead of JSValue if the Phi also has only double uses. This is implemented through a simple escape analysis. DoubleRep(RealNumberUse:) and OSR exit hints are not counted as escapes. All other uses are counted as escapes. Connected Phi graphs are converted to being Double only if the entire graph is ok with the result being Double. Some ways we could extend this phase in the future: - There are a lot of DoubleRep(NumberUse:@ValueRep(@x)) uses. This ensures that the result of the DoubleRep of @x is not impure NaN. We could handle this case if we introduced a PurifyNaN node and replace the DoubleRep with PurifyNaN(@x). Alternatively, we could see if certain users of this DoubleRep are okay with impure NaN flowing into them and we'd need to ensure their output type is always treated as if the input is impure NaN. - We could do sinking of ValueRep where we think it's profitable. So instead of an escape making it so we never represent the variable as a Double, we could make the escape reconstruct the JSValueRep where profitable. - We can extend this phase to handle Int52Rep if it's profitable. - We can opt other nodes into accepting incoming Doubles so we no longer treat them as escapes. This patch is somewhere between neutral and a 1% progression on JetStream 2. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGValueRepReductionPhase.cpp: Added. (JSC::DFG::ValueRepReductionPhase::ValueRepReductionPhase): (JSC::DFG::ValueRepReductionPhase::run): (JSC::DFG::ValueRepReductionPhase::convertValueRepsToDouble): (JSC::DFG::performValueRepReduction): * dfg/DFGValueRepReductionPhase.h: Added. * runtime/Options.h: Canonical link: https://commits.webkit.org/210756@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243744 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 15:58:34 +00:00
dfg/DFGValueRepReductionPhase.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
dfg/DFGValueSource.cpp
dfg/DFGValueStrength.cpp
dfg/DFGVarargsForwardingPhase.cpp
dfg/DFGVariableAccessData.cpp
dfg/DFGVariableAccessDataDump.cpp
dfg/DFGVariableEvent.cpp
dfg/DFGVariableEventStream.cpp
dfg/DFGVirtualRegisterAllocationPhase.cpp
dfg/DFGWatchpointCollectionPhase.cpp
disassembler/ARM64Disassembler.cpp
[JSC][GTK][JSCONLY] Use capstone disassembler https://bugs.webkit.org/show_bug.cgi?id=185283 Reviewed by Michael Catanzaro. .: * Source/CMakeLists.txt: * Source/cmake/FindLLVM.cmake: Removed. * Source/cmake/OptionsCommon.cmake: * Source/cmake/OptionsGTK.cmake: * Source/cmake/OptionsJSCOnly.cmake: * Source/cmake/OptionsWPE.cmake: Source/JavaScriptCore: Instead of adding MIPS disassembler baked by ourselves, we import capstone disassembler. And use capstone disassembler for MIPS, ARM, and ARMv7 in GTK, WPE, WinCairo and JSCOnly ports. And we remove ARM LLVM disassembler. Capstone is licensed under 3-clause BSD, which is acceptable in WebKit tree. * CMakeLists.txt: * Sources.txt: * disassembler/ARMLLVMDisassembler.cpp: Removed. * disassembler/CapstoneDisassembler.cpp: Added. (JSC::tryToDisassemble): Source/ThirdParty: Add capstone to ThirdParty. We build capstone as a static library, and link it against JSC. We only build disassembler for target architecture. So for MIPS target, we only enable MIPS part of capstone. We also remove unnecessary architectures in capstone, XCore, PowerPC, SystemZ, etc. This is simply done by deleting these architecture directories. We pick "next" branch instead of "master" branch since "next" branch is actively developed. * capstone/CMakeLists.txt: Added. * capstone/Source/.appveyor.yml: Added. * capstone/Source/.gitattributes: Added. * capstone/Source/.gitignore: Added. * capstone/Source/.travis.yml: Added. * capstone/Source/CMakeLists.txt: Added. * capstone/Source/COMPILE.TXT: Added. * capstone/Source/COMPILE_CMAKE.TXT: Added. * capstone/Source/COMPILE_MSVC.TXT: Added. * capstone/Source/CREDITS.TXT: Added. * capstone/Source/ChangeLog-capstone: Added. * capstone/Source/HACK.TXT: Added. * capstone/Source/LEB128.h: Added. (decodeULEB128): * capstone/Source/LICENSE.TXT: Added. * capstone/Source/LICENSE_LLVM.TXT: Added. * capstone/Source/MCDisassembler.h: Added. * capstone/Source/MCFixedLenDisassembler.h: Added. * capstone/Source/MCInst.c: Added. (MCInst_Init): (MCInst_clear): (MCInst_insert0): (MCInst_setOpcode): (MCInst_setOpcodePub): (MCInst_getOpcode): (MCInst_getOpcodePub): (MCInst_getOperand): (MCInst_getNumOperands): (MCInst_addOperand2): (MCOperand_Init): (MCOperand_isValid): (MCOperand_isReg): (MCOperand_isImm): (MCOperand_isFPImm): (MCOperand_getReg): (MCOperand_setReg): (MCOperand_getImm): (MCOperand_setImm): (MCOperand_getFPImm): (MCOperand_setFPImm): (MCOperand_CreateReg1): (MCOperand_CreateReg0): (MCOperand_CreateImm1): (MCOperand_CreateImm0): * capstone/Source/MCInst.h: Added. * capstone/Source/MCInstrDesc.c: Added. (MCOperandInfo_isPredicate): (MCOperandInfo_isOptionalDef): * capstone/Source/MCInstrDesc.h: Added. * capstone/Source/MCRegisterInfo.c: Added. (MCRegisterInfo_InitMCRegisterInfo): (DiffListIterator_init): (DiffListIterator_getVal): (DiffListIterator_next): (DiffListIterator_isValid): (MCRegisterInfo_getMatchingSuperReg): (MCRegisterInfo_getSubReg): (MCRegisterInfo_getRegClass): (MCRegisterClass_contains): * capstone/Source/MCRegisterInfo.h: Added. * capstone/Source/Makefile: Added. * capstone/Source/MathExtras.h: Added. (Hi_32): (Lo_32): (isUIntN): (isMask_32): (isMask_64): (isShiftedMask_32): (isShiftedMask_64): (isPowerOf2_32): (CountLeadingZeros_32): (CountLeadingOnes_32): (CountLeadingZeros_64): (CountLeadingOnes_64): (CountTrailingZeros_32): (CountTrailingOnes_32): (CountTrailingZeros_64): (CountTrailingOnes_64): (CountPopulation_32): (CountPopulation_64): (Log2_32): (Log2_64): (Log2_32_Ceil): (Log2_64_Ceil): (GreatestCommonDivisor64): (BitsToDouble): (BitsToFloat): (DoubleToBits): (FloatToBits): (MinAlign): (NextPowerOf2): (RoundUpToAlignment): (OffsetToAlignment): (abs64): (SignExtend32): (SignExtend64): (countLeadingZeros): * capstone/Source/README.md: Added. * capstone/Source/RELEASE_NOTES: Added. * capstone/Source/SStream.c: Added. (SStream_Init): (SStream_concat0): (SStream_concat): (printInt64Bang): (printUInt64Bang): (printInt64): (printInt32BangDec): (printInt32Bang): (printInt32): (printUInt32Bang): (printUInt32): * capstone/Source/SStream.h: Added. * capstone/Source/TODO: Added. * capstone/Source/arch/ARM/ARMAddressingModes.h: Added. (ARM_AM_getAddrOpcStr): (ARM_AM_getShiftOpcStr): (ARM_AM_getShiftOpcEncoding): (ARM_AM_getAMSubModeStr): (rotr32): (rotl32): (getSORegOpc): (getSORegOffset): (ARM_AM_getSORegShOp): (getSOImmValImm): (getSOImmValRot): (getSOImmValRotate): (getSOImmVal): (isSOImmTwoPartVal): (getSOImmTwoPartFirst): (getSOImmTwoPartSecond): (getThumbImmValShift): (isThumbImmShiftedVal): (getThumbImm16ValShift): (isThumbImm16ShiftedVal): (getThumbImmNonShiftedVal): (getT2SOImmValSplatVal): (getT2SOImmValRotateVal): (getT2SOImmVal): (getT2SOImmValRotate): (isT2SOImmTwoPartVal): (getT2SOImmTwoPartFirst): (getT2SOImmTwoPartSecond): (ARM_AM_getAM2Opc): (getAM2Offset): (getAM2Op): (getAM2ShiftOpc): (getAM2IdxMode): (getAM3Opc): (getAM3Offset): (getAM3Op): (getAM3IdxMode): (getAM4SubMode): (getAM4ModeImm): (ARM_AM_getAM5Opc): (ARM_AM_getAM5Offset): (ARM_AM_getAM5Op): (createNEONModImm): (getNEONModImmOpCmode): (getNEONModImmVal): (ARM_AM_decodeNEONModImm): (getFPImmFloat): * capstone/Source/arch/ARM/ARMBaseInfo.h: Added. (ARMCC_getOppositeCondition): (ARMCC_ARMCondCodeToString): (ARM_PROC_IFlagsToString): (ARM_PROC_IModToString): (ARM_MB_MemBOptToString): (ARM_ISB_InstSyncBOptToString): (isARMLowRegister): (ARMII_AddrModeToString): * capstone/Source/arch/ARM/ARMDisassembler.c: Added. (ITStatus_push_back): (ITStatus_instrInITBlock): (ITStatus_instrLastInITBlock): (ITStatus_getITCC): (ITStatus_advanceITState): (ITStatus_setITState): (Check): (ARM_getFeatureBits): (DecodePredicateOperand): (ARM_init): (checkDecodedInstruction): (_ARM_getInstruction): (AddThumb1SBit): (AddThumbPredicate): (UpdateThumbVFPPredicate): (_Thumb_getInstruction): (Thumb_getInstruction): (ARM_getInstruction): (DecodeGPRnopcRegisterClass): (DecodeGPRwithAPSRRegisterClass): (DecodetGPRRegisterClass): (DecodetcGPRRegisterClass): (DecoderGPRRegisterClass): (DecodeDPRRegisterClass): (DecodeDPR_8RegisterClass): (DecodeDPR_VFP2RegisterClass): (DecodeDPairRegisterClass): (DecodeCCOutOperand): (DecodeSORegImmOperand): (DecodeSORegRegOperand): (DecodeRegListOperand): (DecodeSPRRegListOperand): (DecodeDPRRegListOperand): (DecodeBitfieldMaskOperand): (DecodeCopMemInstruction): (DecodeAddrMode2IdxInstruction): (DecodeSORegMemOperand): (DecodeAddrMode3Instruction): (DecodeRFEInstruction): (DecodeQADDInstruction): (DecodeMemMultipleWritebackInstruction): (DecodeCPSInstruction): (DecodeT2CPSInstruction): (DecodeT2MOVTWInstruction): (DecodeArmMOVTWInstruction): (DecodeSMLAInstruction): (DecodeAddrModeImm12Operand): (DecodeAddrMode5Operand): (DecodeAddrMode7Operand): (DecodeT2BInstruction): (DecodeBranchImmInstruction): (DecodeAddrMode6Operand): (DecodeVLDInstruction): (DecodeVLDST1Instruction): (DecodeVLDST2Instruction): (DecodeVLDST3Instruction): (DecodeVLDST4Instruction): (DecodeVSTInstruction): (DecodeVLD1DupInstruction): (DecodeVLD2DupInstruction): (DecodeVLD3DupInstruction): (DecodeVLD4DupInstruction): (DecodeNEONModImmInstruction): (DecodeVSHLMaxInstruction): (DecodeShiftRight8Imm): (DecodeShiftRight16Imm): (DecodeShiftRight32Imm): (DecodeShiftRight64Imm): (DecodeTBLInstruction): (DecodeThumbAddSpecialReg): (DecodeThumbBROperand): (DecodeT2BROperand): (DecodeThumbCmpBROperand): (DecodeThumbAddrModeRR): (DecodeThumbAddrModeIS): (DecodeThumbAddrModePC): (DecodeThumbAddrModeSP): (DecodeT2AddrModeSOReg): (DecodeT2LoadShift): (DecodeT2LoadImm8): (DecodeT2LoadImm12): (DecodeT2LoadT): (DecodeT2LoadLabel): (DecodeT2Imm8S4): (DecodeT2AddrModeImm8s4): (DecodeT2AddrModeImm0_1020s4): (DecodeT2Imm8): (DecodeT2AddrModeImm8): (DecodeT2LdStPre): (DecodeT2AddrModeImm12): (DecodeThumbAddSPImm): (DecodeThumbAddSPReg): (DecodeThumbCPS): (DecodePostIdxReg): (DecodeThumbBLXOffset): (DecodeCoprocessor): (DecodeThumbTableBranch): (DecodeThumb2BCCInstruction): (DecodeT2SOImm): (DecodeThumbBCCTargetOperand): (DecodeThumbBLTargetOperand): (DecodeMemBarrierOption): (DecodeInstSyncBarrierOption): (DecodeMSRMask): (DecodeBankedReg): (DecodeDoubleRegLoad): (DecodeDoubleRegStore): (DecodeLDRPreImm): (DecodeLDRPreReg): (DecodeSTRPreImm): (DecodeSTRPreReg): (DecodeVLD1LN): (DecodeVST1LN): (DecodeVLD2LN): (DecodeVST2LN): (DecodeVLD3LN): (DecodeVST3LN): (DecodeVLD4LN): (DecodeVST4LN): (DecodeVMOVSRR): (DecodeVMOVRRS): (DecodeIT): (DecodeT2LDRDPreInstruction): (DecodeT2STRDPreInstruction): (DecodeT2Adr): (DecodeT2ShifterImmOperand): (DecodeSwap): (DecodeVCVTD): (DecodeVCVTQ): (DecodeLDR): (DecodeMRRC2): * capstone/Source/arch/ARM/ARMDisassembler.h: Added. * capstone/Source/arch/ARM/ARMGenAsmWriter.inc: Added. * capstone/Source/arch/ARM/ARMGenDisassemblerTables.inc: Added. * capstone/Source/arch/ARM/ARMGenInstrInfo.inc: Added. * capstone/Source/arch/ARM/ARMGenRegisterInfo.inc: Added. * capstone/Source/arch/ARM/ARMGenSubtargetInfo.inc: Added. * capstone/Source/arch/ARM/ARMInstPrinter.c: Added. (get_op_access): (set_mem_access): (op_addImm): (ARM_getRegName): (translateShiftImm): (printRegImmShift): (printRegName): (ARM_printInst): (printOperand): (printThumbLdrLabelOperand): (printSORegRegOperand): (printSORegImmOperand): (printAM2PreOrOffsetIndexOp): (printAddrModeTBB): (printAddrModeTBH): (printAddrMode2Operand): (printAddrMode2OffsetOperand): (printAM3PreOrOffsetIndexOp): (printAddrMode3Operand): (printAddrMode3OffsetOperand): (printPostIdxImm8Operand): (printPostIdxRegOperand): (printPostIdxImm8s4Operand): (printAddrMode5Operand): (printAddrMode6Operand): (printAddrMode7Operand): (printAddrMode6OffsetOperand): (printBitfieldInvMaskImmOperand): (printMemBOption): (printInstSyncBOption): (printShiftImmOperand): (printPKHLSLShiftImm): (printPKHASRShiftImm): (printRegisterList): (printGPRPairOperand): (printSetendOperand): (printCPSIMod): (printCPSIFlag): (printMSRMaskOperand): (printBankedRegOperand): (printPredicateOperand): (printMandatoryPredicateOperand): (printSBitModifierOperand): (printNoHashImmediate): (printPImmediate): (printCImmediate): (printCoprocOptionImm): (printAdrLabelOperand): (printThumbS4ImmOperand): (printThumbSRImm): (printThumbITMask): (printThumbAddrModeRROperand): (printThumbAddrModeImm5SOperand): (printThumbAddrModeImm5S1Operand): (printThumbAddrModeImm5S2Operand): (printThumbAddrModeImm5S4Operand): (printThumbAddrModeSPOperand): (printT2SOOperand): (printAddrModeImm12Operand): (printT2AddrModeImm8Operand): (printT2AddrModeImm8s4Operand): (printT2AddrModeImm0_1020s4Operand): (printT2AddrModeImm8OffsetOperand): (printT2AddrModeImm8s4OffsetOperand): (printT2AddrModeSoRegOperand): (printFPImmOperand): (printNEONModImmOperand): (printImmPlusOneOperand): (printRotImmOperand): (printModImmOperand): (printFBits16): (printFBits32): (printVectorIndex): (printVectorListOne): (printVectorListTwo): (printVectorListTwoSpaced): (printVectorListThree): (printVectorListFour): (printVectorListOneAllLanes): (printVectorListTwoAllLanes): (printVectorListThreeAllLanes): (printVectorListFourAllLanes): (printVectorListTwoSpacedAllLanes): (printVectorListThreeSpacedAllLanes): (printVectorListFourSpacedAllLanes): (printVectorListThreeSpaced): (printVectorListFourSpaced): (ARM_addVectorDataType): (ARM_addVectorDataSize): (ARM_addReg): (ARM_addUserMode): (ARM_addSysReg): * capstone/Source/arch/ARM/ARMInstPrinter.h: Added. * capstone/Source/arch/ARM/ARMMapping.c: Added. (ARM_reg_name2): (ARM_insn_name): (ARM_rel_branch): (ARM_blx_to_arm_mode): (ARM_reg_access): * capstone/Source/arch/ARM/ARMMapping.h: Added. * capstone/Source/arch/ARM/ARMMappingInsn.inc: Added. * capstone/Source/arch/ARM/ARMMappingInsnOp.inc: Added. * capstone/Source/arch/ARM/ARMModule.c: Added. (init): (option): (ARM_enable): * capstone/Source/arch/Mips/MipsDisassembler.c: Added. (getFeatureBits): (Mips_init): (readInstruction16): (readInstruction32): (MipsDisassembler_getInstruction): (Mips_getInstruction): (getReg): (DecodeINSVE_DF_4): (DecodeAddiGroupBranch_4): (DecodeDaddiGroupBranch_4): (DecodeBlezlGroupBranch_4): (DecodeBgtzlGroupBranch_4): (DecodeBgtzGroupBranch_4): (DecodeBlezGroupBranch_4): (DecodeCPU16RegsRegisterClass): (DecodeGPR64RegisterClass): (DecodeGPRMM16RegisterClass): (DecodeGPRMM16ZeroRegisterClass): (DecodeGPRMM16MovePRegisterClass): (DecodeGPR32RegisterClass): (DecodePtrRegisterClass): (DecodeDSPRRegisterClass): (DecodeFGR64RegisterClass): (DecodeFGR32RegisterClass): (DecodeCCRRegisterClass): (DecodeFCCRegisterClass): (DecodeCCRegisterClass): (DecodeFGRCCRegisterClass): (DecodeMem): (DecodeCacheOp): (DecodeCacheOpMM): (DecodeCacheOpR6): (DecodeSyncI): (DecodeMSA128Mem): (DecodeMemMMImm4): (DecodeMemMMSPImm5Lsl2): (DecodeMemMMGPImm7Lsl2): (DecodeMemMMReglistImm4Lsl2): (DecodeMemMMImm12): (DecodeMemMMImm16): (DecodeFMem): (DecodeFMem2): (DecodeFMem3): (DecodeFMemCop2R6): (DecodeSpecial3LlSc): (DecodeHWRegsRegisterClass): (DecodeAFGR64RegisterClass): (DecodeACC64DSPRegisterClass): (DecodeHI32DSPRegisterClass): (DecodeLO32DSPRegisterClass): (DecodeMSA128BRegisterClass): (DecodeMSA128HRegisterClass): (DecodeMSA128WRegisterClass): (DecodeMSA128DRegisterClass): (DecodeMSACtrlRegisterClass): (DecodeCOP2RegisterClass): (DecodeBranchTarget): (DecodeJumpTarget): (DecodeBranchTarget21): (DecodeBranchTarget26): (DecodeBranchTarget7MM): (DecodeBranchTarget10MM): (DecodeBranchTargetMM): (DecodeJumpTargetMM): (DecodeAddiur2Simm7): (DecodeUImm6Lsl2): (DecodeLiSimm7): (DecodeSimm4): (DecodeSimm16): (DecodeLSAImm): (DecodeInsSize): (DecodeExtSize): (DecodeSimm19Lsl2): (DecodeSimm18Lsl3): (DecodeSimm9SP): (DecodeANDI16Imm): (DecodeUImm5lsl2): (DecodeRegListOperand): (DecodeRegListOperand16): (DecodeMovePRegPair): (DecodeSimm23Lsl2): * capstone/Source/arch/Mips/MipsDisassembler.h: Added. * capstone/Source/arch/Mips/MipsGenAsmWriter.inc: Added. * capstone/Source/arch/Mips/MipsGenDisassemblerTables.inc: Added. * capstone/Source/arch/Mips/MipsGenInstrInfo.inc: Added. * capstone/Source/arch/Mips/MipsGenRegisterInfo.inc: Added. * capstone/Source/arch/Mips/MipsGenSubtargetInfo.inc: Added. * capstone/Source/arch/Mips/MipsInstPrinter.c: Added. (set_mem_access): (isReg): (MipsFCCToString): (printRegName): (Mips_printInst): (printOperand): (printUnsignedImm): (printUnsignedImm8): (printMemOperand): (printMemOperandEA): (printFCCOperand): (printRegisterPair): (printAlias1): (printAlias2): (printAlias): (printRegisterList): * capstone/Source/arch/Mips/MipsInstPrinter.h: Added. * capstone/Source/arch/Mips/MipsMapping.c: Added. (Mips_get_insn_id): (Mips_group_name): (Mips_map_insn): (Mips_map_register): * capstone/Source/arch/Mips/MipsMapping.h: Added. * capstone/Source/arch/Mips/MipsMappingInsn.inc: Added. * capstone/Source/arch/Mips/MipsModule.c: Added. (init): (option): (Mips_enable): * capstone/Source/capstone.pc.in: Added. * capstone/Source/config.mk: Added. * capstone/Source/cs.c: Added. (cs_kern_os_calloc): (cs_version): (cs_support): (cs_errno): (cs_strerror): (cs_open): (cs_close): (fill_insn): (skipdata_size): (cs_option): (skipdata_opstr): (cs_disasm): (cs_disasm_ex): (cs_free): (cs_malloc): (cs_disasm_iter): (cs_reg_name): (cs_insn_name): (cs_group_name): (cs_insn_group): (cs_reg_read): (cs_reg_write): (cs_op_count): (cs_op_index): (cs_regs_access): * capstone/Source/cs_priv.h: Added. * capstone/Source/functions.mk: Added. * capstone/Source/include/capstone/arm.h: Added. * capstone/Source/include/capstone/arm64.h: Added. * capstone/Source/include/capstone/capstone.h: Added. * capstone/Source/include/capstone/evm.h: Added. * capstone/Source/include/capstone/m680x.h: Added. * capstone/Source/include/capstone/m68k.h: Added. * capstone/Source/include/capstone/mips.h: Added. * capstone/Source/include/capstone/platform.h: Added. * capstone/Source/include/capstone/ppc.h: Added. * capstone/Source/include/capstone/sparc.h: Added. * capstone/Source/include/capstone/systemz.h: Added. * capstone/Source/include/capstone/tms320c64x.h: Added. * capstone/Source/include/capstone/x86.h: Added. * capstone/Source/include/capstone/xcore.h: Added. * capstone/Source/include/windowsce/intrin.h: Added. * capstone/Source/include/windowsce/stdint.h: Added. * capstone/Source/make.sh: Added. * capstone/Source/nmake-x86.bat: Added. * capstone/Source/nmake.bat: Added. * capstone/Source/pkgconfig.mk: Added. * capstone/Source/utils.c: Added. (make_id2insn): (insn_find): (name2id): (id2name): (count_positive): (count_positive8): (cs_strdup): (cs_snprintf): (arr_exist8): (arr_exist): * capstone/Source/utils.h: Added. * capstone/capstone-Revision.txt: Added. Source/WTF: Add USE_CAPSTONE used for MIPS and ARM. * wtf/Platform.h: Tools: * gtk/manifest.txt.in: * wpe/manifest.txt.in: Canonical link: https://commits.webkit.org/200942@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231553 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-09 11:42:09 +00:00
disassembler/CapstoneDisassembler.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
disassembler/Disassembler.cpp
disassembler/UDis86Disassembler.cpp
disassembler/X86Disassembler.cpp
disassembler/ARM64/A64DOpcode.cpp
disassembler/udis86/udis86.c
disassembler/udis86/udis86_decode.c
disassembler/udis86/udis86_itab_holder.c
disassembler/udis86/udis86_syn-att.c
disassembler/udis86/udis86_syn-intel.c
disassembler/udis86/udis86_syn.c
domjit/DOMJITAbstractHeap.cpp
domjit/DOMJITHeapRange.cpp
ftl/FTLAbstractHeap.cpp
ftl/FTLAbstractHeapRepository.cpp
ftl/FTLAvailableRecovery.cpp
ftl/FTLCapabilities.cpp
ftl/FTLCommonValues.cpp
ftl/FTLCompile.cpp
ftl/FTLExceptionTarget.cpp
ftl/FTLExitArgument.cpp
ftl/FTLExitArgumentForOperand.cpp
ftl/FTLExitPropertyValue.cpp
ftl/FTLExitTimeObjectMaterialization.cpp
ftl/FTLExitValue.cpp
ftl/FTLFail.cpp
ftl/FTLForOSREntryJITCode.cpp
ftl/FTLJITCode.cpp
ftl/FTLJITFinalizer.cpp
ftl/FTLLazySlowPath.cpp
ftl/FTLLink.cpp
ftl/FTLLocation.cpp
// This file takes a long time to compile so we do it individually.
ftl/FTLLowerDFGToB3.cpp @no-unify
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
ftl/FTLOSREntry.cpp
ftl/FTLOSRExit.cpp
ftl/FTLOSRExitCompiler.cpp
ftl/FTLOSRExitHandle.cpp
ftl/FTLOperations.cpp
ftl/FTLOutput.cpp
ftl/FTLPatchpointExceptionHandle.cpp
ftl/FTLRecoveryOpcode.cpp
ftl/FTLSaveRestore.cpp
ftl/FTLSlowPathCall.cpp
ftl/FTLSlowPathCallKey.cpp
ftl/FTLSnippetParams.cpp
ftl/FTLState.cpp
ftl/FTLThunks.cpp
ftl/FTLValueRange.cpp
heap/AlignedMemoryAllocator.cpp
JSC GC should support TLCs (thread local caches) https://bugs.webkit.org/show_bug.cgi?id=181559 Reviewed by Mark Lam and Saam Barati. Source/JavaScriptCore: This is a big step towards object distancing by site origin. This patch implements TLCs, or thread-local caches, which allow each thread to allocate from its own free lists. It also means that any given thread can context-switch TLCs. This will allow us to do separate allocation for separate site origins. Eventually, once we reshape how MarkedBlock looks, this will allow us to have a hard distancing constraint between objects from different origins. In this new design, every "size class" is represented as a BlockDirectory (formerly known as MarkedAllocator, prior to r226822). This contains a bag of blocks allocated using some aligned memory allocator (which roughly represents which cage you came out of), and anyone using the same allocator can share those blocks - but so long as they are in that BlockDirectory, they will have the size and type of that directory. Previously, each BlockDirectory had exactly one FreeList. Now, each BlockDirectory has a double-linked-list of LocalAllocators, each of which has a FreeList. To decide which LocalAllocator to allocate out of, we need a ThreadLocalCache and a BlockDirectory. The directory gives us an offset-within-the-ThreadLocalCache, which we simply call the Allocator (which is just a POD type that contains a 32-bit offset). Each allocation starts by figuring out what Allocator it wants (often we have this information at JIT time). Then the allocation loads its ThreadLocalCache::Data from a fast TLS slot. Then we add the Allocator offset to the ThreadLocalCache::Data to get the LocalAllocator. Note that we use offsets as opposed to indices to make it easy to do the math on each allocation (if LocalAllocator had a weird size then every allocation would have to do an imul). This is a definite slow-down on GC-heavy benchmarks, but by a small margin, and only on unusually heavy tests. For example, boyer and splay are both 3% regressed, but the Octane geomean is just fine. The JetStream score regressed by 0.5% with p = 0.08 (so maybe there is something there, but it's not significant according to our threshold). Relanding after fixing ARM64 bug in AssemblyHelpers::emitAllocateWithNonNullAllocator(). That function needs to be careful to avoid using the scratch register because the FTL will call it in disallow-scratch-register mode. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * b3/B3LowerToAir.cpp: * b3/B3PatchpointSpecial.cpp: (JSC::B3::PatchpointSpecial::admitsStack): * b3/B3StackmapSpecial.cpp: (JSC::B3::StackmapSpecial::forEachArgImpl): (JSC::B3::StackmapSpecial::isArgValidForRep): * b3/B3StackmapValue.cpp: (JSC::B3::StackmapValue::appendSomeRegisterWithClobber): * b3/B3StackmapValue.h: * b3/B3Validate.cpp: * b3/B3ValueRep.cpp: (JSC::B3::ValueRep::addUsedRegistersTo const): (JSC::B3::ValueRep::dump const): (WTF::printInternal): * b3/B3ValueRep.h: (JSC::B3::ValueRep::ValueRep): * bytecode/AccessCase.cpp: (JSC::AccessCase::generateImpl): * bytecode/ObjectAllocationProfile.h: (JSC::ObjectAllocationProfile::ObjectAllocationProfile): (JSC::ObjectAllocationProfile::clear): * bytecode/ObjectAllocationProfileInlines.h: (JSC::ObjectAllocationProfile::initializeProfile): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::emitAllocateRawObject): (JSC::DFG::SpeculativeJIT::compileMakeRope): (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage): (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage): (JSC::DFG::SpeculativeJIT::compileCreateThis): (JSC::DFG::SpeculativeJIT::compileNewObject): * dfg/DFGSpeculativeJIT.h: (JSC::DFG::SpeculativeJIT::emitAllocateJSCell): (JSC::DFG::SpeculativeJIT::emitAllocateJSObject): * ftl/FTLAbstractHeapRepository.h: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileMakeRope): (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewObject): (JSC::FTL::DFG::LowerDFGToB3::allocatePropertyStorageWithSizeImpl): (JSC::FTL::DFG::LowerDFGToB3::allocateHeapCell): (JSC::FTL::DFG::LowerDFGToB3::allocateObject): (JSC::FTL::DFG::LowerDFGToB3::allocatorForSize): (JSC::FTL::DFG::LowerDFGToB3::allocateVariableSizedObject): (JSC::FTL::DFG::LowerDFGToB3::allocateVariableSizedCell): * heap/Allocator.cpp: Added. (JSC::Allocator::cellSize const): * heap/Allocator.h: Added. (JSC::Allocator::Allocator): (JSC::Allocator::offset const): (JSC::Allocator::operator== const): (JSC::Allocator::operator!= const): (JSC::Allocator::operator bool const): * heap/AllocatorInlines.h: Added. (JSC::Allocator::allocate const): (JSC::Allocator::tryAllocate const): * heap/BlockDirectory.cpp: (JSC::BlockDirectory::BlockDirectory): (JSC::BlockDirectory::findBlockForAllocation): (JSC::BlockDirectory::stopAllocating): (JSC::BlockDirectory::prepareForAllocation): (JSC::BlockDirectory::stopAllocatingForGood): (JSC::BlockDirectory::resumeAllocating): (JSC::BlockDirectory::endMarking): (JSC::BlockDirectory::isFreeListedCell): (JSC::BlockDirectory::didConsumeFreeList): Deleted. (JSC::BlockDirectory::tryAllocateWithoutCollecting): Deleted. (JSC::BlockDirectory::allocateIn): Deleted. (JSC::BlockDirectory::tryAllocateIn): Deleted. (JSC::BlockDirectory::doTestCollectionsIfNeeded): Deleted. (JSC::BlockDirectory::allocateSlowCase): Deleted. * heap/BlockDirectory.h: (JSC::BlockDirectory::cellKind const): (JSC::BlockDirectory::allocator const): (JSC::BlockDirectory::freeList const): Deleted. (JSC::BlockDirectory::offsetOfFreeList): Deleted. (JSC::BlockDirectory::offsetOfCellSize): Deleted. * heap/BlockDirectoryInlines.h: (JSC::BlockDirectory::isFreeListedCell const): Deleted. (JSC::BlockDirectory::allocate): Deleted. * heap/CompleteSubspace.cpp: (JSC::CompleteSubspace::CompleteSubspace): (JSC::CompleteSubspace::allocatorFor): (JSC::CompleteSubspace::allocate): (JSC::CompleteSubspace::allocateNonVirtual): (JSC::CompleteSubspace::allocatorForSlow): (JSC::CompleteSubspace::allocateSlow): (JSC::CompleteSubspace::tryAllocateSlow): * heap/CompleteSubspace.h: (JSC::CompleteSubspace::allocatorForSizeStep): (JSC::CompleteSubspace::allocatorForNonVirtual): * heap/FreeList.h: * heap/GCDeferralContext.h: * heap/Heap.cpp: (JSC::Heap::Heap): (JSC::Heap::lastChanceToFinalize): * heap/Heap.h: (JSC::Heap::threadLocalCacheLayout): * heap/IsoCellSet.h: * heap/IsoSubspace.cpp: (JSC::IsoSubspace::IsoSubspace): (JSC::IsoSubspace::allocatorFor): (JSC::IsoSubspace::allocate): (JSC::IsoSubspace::allocateNonVirtual): * heap/IsoSubspace.h: (JSC::IsoSubspace::allocatorForNonVirtual): * heap/LocalAllocator.cpp: Added. (JSC::LocalAllocator::LocalAllocator): (JSC::LocalAllocator::reset): (JSC::LocalAllocator::~LocalAllocator): (JSC::LocalAllocator::stopAllocating): (JSC::LocalAllocator::resumeAllocating): (JSC::LocalAllocator::prepareForAllocation): (JSC::LocalAllocator::stopAllocatingForGood): (JSC::LocalAllocator::allocateSlowCase): (JSC::LocalAllocator::didConsumeFreeList): (JSC::LocalAllocator::tryAllocateWithoutCollecting): (JSC::LocalAllocator::allocateIn): (JSC::LocalAllocator::tryAllocateIn): (JSC::LocalAllocator::doTestCollectionsIfNeeded): (JSC::LocalAllocator::isFreeListedCell const): * heap/LocalAllocator.h: Added. (JSC::LocalAllocator::offsetOfFreeList): (JSC::LocalAllocator::offsetOfCellSize): * heap/LocalAllocatorInlines.h: Added. (JSC::LocalAllocator::allocate): * heap/MarkedSpace.cpp: (JSC::MarkedSpace::stopAllocatingForGood): * heap/MarkedSpace.h: * heap/SlotVisitor.cpp: * heap/SlotVisitor.h: * heap/Subspace.h: * heap/ThreadLocalCache.cpp: Added. (JSC::ThreadLocalCache::create): (JSC::ThreadLocalCache::ThreadLocalCache): (JSC::ThreadLocalCache::~ThreadLocalCache): (JSC::ThreadLocalCache::allocateData): (JSC::ThreadLocalCache::destroyData): (JSC::ThreadLocalCache::installSlow): (JSC::ThreadLocalCache::installData): (JSC::ThreadLocalCache::allocatorSlow): (JSC::ThreadLocalCache::destructor): * heap/ThreadLocalCache.h: Added. (JSC::ThreadLocalCache::offsetOfSize): (JSC::ThreadLocalCache::offsetOfFirstAllocator): * heap/ThreadLocalCacheInlines.h: Added. (JSC::ThreadLocalCache::getImpl): (JSC::ThreadLocalCache::get): (JSC::ThreadLocalCache::install): (JSC::ThreadLocalCache::allocator): (JSC::ThreadLocalCache::tryGetAllocator): * heap/ThreadLocalCacheLayout.cpp: Added. (JSC::ThreadLocalCacheLayout::ThreadLocalCacheLayout): (JSC::ThreadLocalCacheLayout::~ThreadLocalCacheLayout): (JSC::ThreadLocalCacheLayout::allocateOffset): (JSC::ThreadLocalCacheLayout::snapshot): (JSC::ThreadLocalCacheLayout::directory): * heap/ThreadLocalCacheLayout.h: Added. * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::emitAllocateWithNonNullAllocator): (JSC::AssemblyHelpers::emitAllocate): (JSC::AssemblyHelpers::emitAllocateVariableSized): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::vm): (JSC::AssemblyHelpers::emitAllocateJSCell): (JSC::AssemblyHelpers::emitAllocateJSObject): (JSC::AssemblyHelpers::emitAllocateJSObjectWithKnownSize): (JSC::AssemblyHelpers::emitAllocateWithNonNullAllocator): Deleted. (JSC::AssemblyHelpers::emitAllocate): Deleted. (JSC::AssemblyHelpers::emitAllocateVariableSized): Deleted. * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_new_object): (JSC::JIT::emit_op_create_this): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_new_object): (JSC::JIT::emit_op_create_this): * runtime/ButterflyInlines.h: (JSC::Butterfly::createUninitialized): (JSC::Butterfly::tryCreate): (JSC::Butterfly::growArrayRight): * runtime/DirectArguments.cpp: (JSC::DirectArguments::overrideThings): * runtime/GenericArgumentsInlines.h: (JSC::GenericArguments<Type>::initModifiedArgumentsDescriptor): * runtime/HashMapImpl.h: (JSC::HashMapBuffer::create): * runtime/JSArray.cpp: (JSC::JSArray::tryCreateUninitializedRestricted): (JSC::JSArray::unshiftCountSlowCase): * runtime/JSArray.h: (JSC::JSArray::tryCreate): * runtime/JSArrayBufferView.cpp: (JSC::JSArrayBufferView::ConstructionContext::ConstructionContext): * runtime/JSCellInlines.h: (JSC::tryAllocateCellHelper): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::JSGlobalObject): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::threadLocalCache const): * runtime/JSLock.cpp: (JSC::JSLock::didAcquireLock): * runtime/Options.h: * runtime/RegExpMatchesArray.h: (JSC::tryCreateUninitializedRegExpMatchesArray): * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: * runtime/VMEntryScope.cpp: (JSC::VMEntryScope::VMEntryScope): Source/WTF: * wtf/Bitmap.h: Just fixing a compile error. Canonical link: https://commits.webkit.org/197951@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227617 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-25 19:32:00 +00:00
heap/Allocator.cpp
Rename MarkedAllocator to BlockDirectory and AllocatorAttributes to CellAttributes https://bugs.webkit.org/show_bug.cgi?id=181543 Rubber stamped by Michael Saboff. Source/JavaScriptCore: In a world that has thread-local caches, the thing we now call the "MarkedAllocator" doesn't really have anything to do with allocation anymore. The allocation will be done by something in the TLC. When you move the allocation logic out of MarkedAllocator, it becomes just a place to find blocks (a "block directory"). Once we do that renaming, the term "allocator attributes" becomes weird. Those are really the attributes of the HeapCellType. So let's call them CellAttributes. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/AccessCase.cpp: (JSC::AccessCase::generateImpl): * bytecode/ObjectAllocationProfile.h: * bytecode/ObjectAllocationProfileInlines.h: (JSC::ObjectAllocationProfile::initializeProfile): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::emitAllocateRawObject): (JSC::DFG::SpeculativeJIT::compileMakeRope): (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage): (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage): (JSC::DFG::SpeculativeJIT::compileNewObject): * dfg/DFGSpeculativeJIT.h: (JSC::DFG::SpeculativeJIT::emitAllocateJSCell): (JSC::DFG::SpeculativeJIT::emitAllocateJSObject): * ftl/FTLAbstractHeapRepository.h: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileMakeRope): (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewObject): (JSC::FTL::DFG::LowerDFGToB3::allocatePropertyStorageWithSizeImpl): (JSC::FTL::DFG::LowerDFGToB3::allocateHeapCell): (JSC::FTL::DFG::LowerDFGToB3::allocateObject): (JSC::FTL::DFG::LowerDFGToB3::allocatorForSize): * heap/AlignedMemoryAllocator.cpp: (JSC::AlignedMemoryAllocator::registerDirectory): (JSC::AlignedMemoryAllocator::registerAllocator): Deleted. * heap/AlignedMemoryAllocator.h: (JSC::AlignedMemoryAllocator::firstDirectory const): (JSC::AlignedMemoryAllocator::firstAllocator const): Deleted. * heap/AllocatorAttributes.cpp: Removed. * heap/AllocatorAttributes.h: Removed. * heap/BlockDirectory.cpp: Copied from Source/JavaScriptCore/heap/MarkedAllocator.cpp. (JSC::BlockDirectory::BlockDirectory): (JSC::BlockDirectory::setSubspace): (JSC::BlockDirectory::isPagedOut): (JSC::BlockDirectory::findEmptyBlockToSteal): (JSC::BlockDirectory::didConsumeFreeList): (JSC::BlockDirectory::tryAllocateWithoutCollecting): (JSC::BlockDirectory::allocateIn): (JSC::BlockDirectory::tryAllocateIn): (JSC::BlockDirectory::doTestCollectionsIfNeeded): (JSC::BlockDirectory::allocateSlowCase): (JSC::BlockDirectory::blockSizeForBytes): (JSC::BlockDirectory::tryAllocateBlock): (JSC::BlockDirectory::addBlock): (JSC::BlockDirectory::removeBlock): (JSC::BlockDirectory::stopAllocating): (JSC::BlockDirectory::prepareForAllocation): (JSC::BlockDirectory::lastChanceToFinalize): (JSC::BlockDirectory::resumeAllocating): (JSC::BlockDirectory::beginMarkingForFullCollection): (JSC::BlockDirectory::endMarking): (JSC::BlockDirectory::snapshotUnsweptForEdenCollection): (JSC::BlockDirectory::snapshotUnsweptForFullCollection): (JSC::BlockDirectory::findBlockToSweep): (JSC::BlockDirectory::sweep): (JSC::BlockDirectory::shrink): (JSC::BlockDirectory::assertNoUnswept): (JSC::BlockDirectory::parallelNotEmptyBlockSource): (JSC::BlockDirectory::dump const): (JSC::BlockDirectory::dumpBits): (JSC::BlockDirectory::markedSpace const): (JSC::MarkedAllocator::MarkedAllocator): Deleted. (JSC::MarkedAllocator::setSubspace): Deleted. (JSC::MarkedAllocator::isPagedOut): Deleted. (JSC::MarkedAllocator::findEmptyBlockToSteal): Deleted. (JSC::MarkedAllocator::didConsumeFreeList): Deleted. (JSC::MarkedAllocator::tryAllocateWithoutCollecting): Deleted. (JSC::MarkedAllocator::allocateIn): Deleted. (JSC::MarkedAllocator::tryAllocateIn): Deleted. (JSC::MarkedAllocator::doTestCollectionsIfNeeded): Deleted. (JSC::MarkedAllocator::allocateSlowCase): Deleted. (JSC::MarkedAllocator::blockSizeForBytes): Deleted. (JSC::MarkedAllocator::tryAllocateBlock): Deleted. (JSC::MarkedAllocator::addBlock): Deleted. (JSC::MarkedAllocator::removeBlock): Deleted. (JSC::MarkedAllocator::stopAllocating): Deleted. (JSC::MarkedAllocator::prepareForAllocation): Deleted. (JSC::MarkedAllocator::lastChanceToFinalize): Deleted. (JSC::MarkedAllocator::resumeAllocating): Deleted. (JSC::MarkedAllocator::beginMarkingForFullCollection): Deleted. (JSC::MarkedAllocator::endMarking): Deleted. (JSC::MarkedAllocator::snapshotUnsweptForEdenCollection): Deleted. (JSC::MarkedAllocator::snapshotUnsweptForFullCollection): Deleted. (JSC::MarkedAllocator::findBlockToSweep): Deleted. (JSC::MarkedAllocator::sweep): Deleted. (JSC::MarkedAllocator::shrink): Deleted. (JSC::MarkedAllocator::assertNoUnswept): Deleted. (JSC::MarkedAllocator::parallelNotEmptyBlockSource): Deleted. (JSC::MarkedAllocator::dump const): Deleted. (JSC::MarkedAllocator::dumpBits): Deleted. (JSC::MarkedAllocator::markedSpace const): Deleted. * heap/BlockDirectory.h: Copied from Source/JavaScriptCore/heap/MarkedAllocator.h. (JSC::BlockDirectory::attributes const): (JSC::BlockDirectory::forEachBitVector): (JSC::BlockDirectory::forEachBitVectorWithName): (JSC::BlockDirectory::nextDirectory const): (JSC::BlockDirectory::nextDirectoryInSubspace const): (JSC::BlockDirectory::nextDirectoryInAlignedMemoryAllocator const): (JSC::BlockDirectory::setNextDirectory): (JSC::BlockDirectory::setNextDirectoryInSubspace): (JSC::BlockDirectory::setNextDirectoryInAlignedMemoryAllocator): (JSC::BlockDirectory::offsetOfFreeList): (JSC::BlockDirectory::offsetOfCellSize): (JSC::MarkedAllocator::cellSize const): Deleted. (JSC::MarkedAllocator::attributes const): Deleted. (JSC::MarkedAllocator::needsDestruction const): Deleted. (JSC::MarkedAllocator::destruction const): Deleted. (JSC::MarkedAllocator::cellKind const): Deleted. (JSC::MarkedAllocator::heap): Deleted. (JSC::MarkedAllocator::bitvectorLock): Deleted. (JSC::MarkedAllocator::forEachBitVector): Deleted. (JSC::MarkedAllocator::forEachBitVectorWithName): Deleted. (JSC::MarkedAllocator::nextAllocator const): Deleted. (JSC::MarkedAllocator::nextAllocatorInSubspace const): Deleted. (JSC::MarkedAllocator::nextAllocatorInAlignedMemoryAllocator const): Deleted. (JSC::MarkedAllocator::setNextAllocator): Deleted. (JSC::MarkedAllocator::setNextAllocatorInSubspace): Deleted. (JSC::MarkedAllocator::setNextAllocatorInAlignedMemoryAllocator): Deleted. (JSC::MarkedAllocator::subspace const): Deleted. (JSC::MarkedAllocator::freeList const): Deleted. (JSC::MarkedAllocator::offsetOfFreeList): Deleted. (JSC::MarkedAllocator::offsetOfCellSize): Deleted. * heap/BlockDirectoryInlines.h: Copied from Source/JavaScriptCore/heap/MarkedAllocatorInlines.h. (JSC::BlockDirectory::isFreeListedCell const): (JSC::BlockDirectory::allocate): (JSC::BlockDirectory::forEachBlock): (JSC::BlockDirectory::forEachNotEmptyBlock): (JSC::MarkedAllocator::isFreeListedCell const): Deleted. (JSC::MarkedAllocator::allocate): Deleted. (JSC::MarkedAllocator::forEachBlock): Deleted. (JSC::MarkedAllocator::forEachNotEmptyBlock): Deleted. * heap/CellAttributes.cpp: Copied from Source/JavaScriptCore/heap/AllocatorAttributes.cpp. (JSC::CellAttributes::dump const): (JSC::AllocatorAttributes::dump const): Deleted. * heap/CellAttributes.h: Copied from Source/JavaScriptCore/heap/AllocatorAttributes.h. (JSC::CellAttributes::CellAttributes): (JSC::AllocatorAttributes::AllocatorAttributes): Deleted. * heap/CompleteSubspace.cpp: (JSC::CompleteSubspace::allocatorFor): (JSC::CompleteSubspace::allocateNonVirtual): (JSC::CompleteSubspace::allocatorForSlow): (JSC::CompleteSubspace::tryAllocateSlow): * heap/CompleteSubspace.h: (JSC::CompleteSubspace::allocatorForSizeStep): (JSC::CompleteSubspace::allocatorForNonVirtual): * heap/GCDeferralContext.h: * heap/Heap.cpp: (JSC::Heap::updateAllocationLimits): * heap/Heap.h: * heap/HeapCell.h: * heap/HeapCellInlines.h: (JSC::HeapCell::cellAttributes const): (JSC::HeapCell::destructionMode const): (JSC::HeapCell::cellKind const): (JSC::HeapCell::allocatorAttributes const): Deleted. * heap/HeapCellType.cpp: (JSC::HeapCellType::HeapCellType): * heap/HeapCellType.h: (JSC::HeapCellType::attributes const): * heap/IncrementalSweeper.cpp: (JSC::IncrementalSweeper::IncrementalSweeper): (JSC::IncrementalSweeper::sweepNextBlock): (JSC::IncrementalSweeper::startSweeping): (JSC::IncrementalSweeper::stopSweeping): * heap/IncrementalSweeper.h: * heap/IsoCellSet.cpp: (JSC::IsoCellSet::IsoCellSet): (JSC::IsoCellSet::parallelNotEmptyMarkedBlockSource): (JSC::IsoCellSet::addSlow): (JSC::IsoCellSet::didRemoveBlock): (JSC::IsoCellSet::sweepToFreeList): * heap/IsoCellSetInlines.h: (JSC::IsoCellSet::forEachMarkedCell): (JSC::IsoCellSet::forEachLiveCell): * heap/IsoSubspace.cpp: (JSC::IsoSubspace::IsoSubspace): (JSC::IsoSubspace::allocatorFor): (JSC::IsoSubspace::allocateNonVirtual): * heap/IsoSubspace.h: (JSC::IsoSubspace::allocatorForNonVirtual): * heap/LargeAllocation.h: (JSC::LargeAllocation::attributes const): * heap/MarkedAllocator.cpp: Removed. * heap/MarkedAllocator.h: Removed. * heap/MarkedAllocatorInlines.h: Removed. * heap/MarkedBlock.cpp: (JSC::MarkedBlock::Handle::~Handle): (JSC::MarkedBlock::Handle::setIsFreeListed): (JSC::MarkedBlock::Handle::stopAllocating): (JSC::MarkedBlock::Handle::lastChanceToFinalize): (JSC::MarkedBlock::Handle::resumeAllocating): (JSC::MarkedBlock::aboutToMarkSlow): (JSC::MarkedBlock::Handle::didConsumeFreeList): (JSC::MarkedBlock::noteMarkedSlow): (JSC::MarkedBlock::Handle::removeFromDirectory): (JSC::MarkedBlock::Handle::didAddToDirectory): (JSC::MarkedBlock::Handle::didRemoveFromDirectory): (JSC::MarkedBlock::Handle::dumpState): (JSC::MarkedBlock::Handle::subspace const): (JSC::MarkedBlock::Handle::sweep): (JSC::MarkedBlock::Handle::isFreeListedCell const): (JSC::MarkedBlock::Handle::removeFromAllocator): Deleted. (JSC::MarkedBlock::Handle::didAddToAllocator): Deleted. (JSC::MarkedBlock::Handle::didRemoveFromAllocator): Deleted. * heap/MarkedBlock.h: (JSC::MarkedBlock::Handle::directory const): (JSC::MarkedBlock::Handle::attributes const): (JSC::MarkedBlock::attributes const): (JSC::MarkedBlock::Handle::allocator const): Deleted. * heap/MarkedBlockInlines.h: (JSC::MarkedBlock::Handle::isAllocated): (JSC::MarkedBlock::Handle::isLive): (JSC::MarkedBlock::Handle::specializedSweep): (JSC::MarkedBlock::Handle::isEmpty): * heap/MarkedSpace.cpp: (JSC::MarkedSpace::lastChanceToFinalize): (JSC::MarkedSpace::sweep): (JSC::MarkedSpace::stopAllocating): (JSC::MarkedSpace::resumeAllocating): (JSC::MarkedSpace::isPagedOut): (JSC::MarkedSpace::freeBlock): (JSC::MarkedSpace::shrink): (JSC::MarkedSpace::beginMarking): (JSC::MarkedSpace::endMarking): (JSC::MarkedSpace::snapshotUnswept): (JSC::MarkedSpace::assertNoUnswept): (JSC::MarkedSpace::dumpBits): (JSC::MarkedSpace::addBlockDirectory): (JSC::MarkedSpace::addMarkedAllocator): Deleted. * heap/MarkedSpace.h: (JSC::MarkedSpace::firstDirectory const): (JSC::MarkedSpace::directoryLock): (JSC::MarkedSpace::forEachBlock): (JSC::MarkedSpace::forEachDirectory): (JSC::MarkedSpace::firstAllocator const): Deleted. (JSC::MarkedSpace::allocatorLock): Deleted. (JSC::MarkedSpace::forEachAllocator): Deleted. * heap/MarkedSpaceInlines.h: * heap/Subspace.cpp: (JSC::Subspace::initialize): (JSC::Subspace::prepareForAllocation): (JSC::Subspace::findEmptyBlockToSteal): (JSC::Subspace::parallelDirectorySource): (JSC::Subspace::parallelNotEmptyMarkedBlockSource): (JSC::Subspace::sweep): (JSC::Subspace::parallelAllocatorSource): Deleted. * heap/Subspace.h: (JSC::Subspace::attributes const): (JSC::Subspace::didCreateFirstDirectory): (JSC::Subspace::didCreateFirstAllocator): Deleted. * heap/SubspaceInlines.h: (JSC::Subspace::forEachDirectory): (JSC::Subspace::forEachMarkedBlock): (JSC::Subspace::forEachNotEmptyMarkedBlock): (JSC::Subspace::forEachAllocator): Deleted. * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::emitAllocateWithNonNullAllocator): (JSC::AssemblyHelpers::emitAllocate): (JSC::AssemblyHelpers::emitAllocateJSCell): (JSC::AssemblyHelpers::emitAllocateJSObject): (JSC::AssemblyHelpers::emitAllocateJSObjectWithKnownSize): * jit/JIT.h: * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_new_object): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_new_object): * runtime/JSDestructibleObjectHeapCellType.cpp: (JSC::JSDestructibleObjectHeapCellType::JSDestructibleObjectHeapCellType): * runtime/JSSegmentedVariableObjectHeapCellType.cpp: (JSC::JSSegmentedVariableObjectHeapCellType::JSSegmentedVariableObjectHeapCellType): * runtime/JSStringHeapCellType.cpp: (JSC::JSStringHeapCellType::JSStringHeapCellType): * runtime/VM.cpp: (JSC::VM::VM): * wasm/js/JSWebAssemblyCodeBlockHeapCellType.cpp: (JSC::JSWebAssemblyCodeBlockHeapCellType::JSWebAssemblyCodeBlockHeapCellType): Source/WebCore: No new tests because I'm just renaming things. * ForwardingHeaders/heap/BlockDirectoryInlines.h: Copied from Source/WebCore/ForwardingHeaders/heap/MarkedAllocatorInlines.h. * ForwardingHeaders/heap/MarkedAllocatorInlines.h: Removed. * bindings/js/DOMGCOutputConstraint.cpp: Canonical link: https://commits.webkit.org/197434@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226822 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-12 00:32:33 +00:00
heap/BlockDirectory.cpp
heap/CellAttributes.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
heap/CellContainer.cpp
heap/CodeBlockSet.cpp
heap/CollectionScope.cpp
heap/CollectorPhase.cpp
GC should support isoheaps https://bugs.webkit.org/show_bug.cgi?id=179288 Reviewed by Saam Barati. Source/JavaScriptCore: This expands the power of the Subspace API in JSC: - Everything associated with describing the types of objects is now part of the HeapCellType class. We have different HeapCellTypes for different destruction strategies. Any Subspace can use any HeapCellType; these are orthogonal things. - There are now two variants of Subspace: CompleteSubspace, which can allocate any size objects using any AlignedMemoryAllocator; and IsoSubspace, which can allocate just one size of object and uses a special virtual memory pool for that purpose. Like bmalloc's IsoHeap, IsoSubspace hoards virtual pages but releases the physical pages as part of the respective allocator's scavenging policy (the Scavenger in bmalloc for IsoHeap and the incremental sweep and full sweep in Riptide for IsoSubspace). So far, this patch just puts subtypes of ExecutableBase in IsoSubspaces. If it works, we can use it for more things. This does not have any effect on JetStream (0.18% faster with p = 0.69). * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/AccessCase.cpp: (JSC::AccessCase::generateImpl): * bytecode/ObjectAllocationProfileInlines.h: (JSC::ObjectAllocationProfile::initializeProfile): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::emitAllocateRawObject): (JSC::DFG::SpeculativeJIT::compileMakeRope): (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage): (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * ftl/FTLAbstractHeapRepository.h: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileMakeRope): (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewObject): (JSC::FTL::DFG::LowerDFGToB3::allocatePropertyStorageWithSizeImpl): (JSC::FTL::DFG::LowerDFGToB3::allocateObject): (JSC::FTL::DFG::LowerDFGToB3::allocatorForSize): * heap/AlignedMemoryAllocator.cpp: (JSC::AlignedMemoryAllocator::registerAllocator): (JSC::AlignedMemoryAllocator::registerSubspace): * heap/AlignedMemoryAllocator.h: (JSC::AlignedMemoryAllocator::firstAllocator const): * heap/AllocationFailureMode.h: Added. * heap/CompleteSubspace.cpp: Added. (JSC::CompleteSubspace::CompleteSubspace): (JSC::CompleteSubspace::~CompleteSubspace): (JSC::CompleteSubspace::allocatorFor): (JSC::CompleteSubspace::allocate): (JSC::CompleteSubspace::allocateNonVirtual): (JSC::CompleteSubspace::allocatorForSlow): (JSC::CompleteSubspace::allocateSlow): (JSC::CompleteSubspace::tryAllocateSlow): * heap/CompleteSubspace.h: Added. (JSC::CompleteSubspace::offsetOfAllocatorForSizeStep): (JSC::CompleteSubspace::allocatorForSizeStep): (JSC::CompleteSubspace::allocatorForNonVirtual): * heap/HeapCellType.cpp: Added. (JSC::HeapCellType::HeapCellType): (JSC::HeapCellType::~HeapCellType): (JSC::HeapCellType::finishSweep): (JSC::HeapCellType::destroy): * heap/HeapCellType.h: Added. (JSC::HeapCellType::attributes const): * heap/IsoAlignedMemoryAllocator.cpp: Added. (JSC::IsoAlignedMemoryAllocator::IsoAlignedMemoryAllocator): (JSC::IsoAlignedMemoryAllocator::~IsoAlignedMemoryAllocator): (JSC::IsoAlignedMemoryAllocator::tryAllocateAlignedMemory): (JSC::IsoAlignedMemoryAllocator::freeAlignedMemory): (JSC::IsoAlignedMemoryAllocator::dump const): * heap/IsoAlignedMemoryAllocator.h: Added. * heap/IsoSubspace.cpp: Added. (JSC::IsoSubspace::IsoSubspace): (JSC::IsoSubspace::~IsoSubspace): (JSC::IsoSubspace::allocatorFor): (JSC::IsoSubspace::allocatorForNonVirtual): (JSC::IsoSubspace::allocate): (JSC::IsoSubspace::allocateNonVirtual): * heap/IsoSubspace.h: Added. (JSC::IsoSubspace::size const): * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::MarkedAllocator): (JSC::MarkedAllocator::setSubspace): (JSC::MarkedAllocator::allocateSlowCase): (JSC::MarkedAllocator::tryAllocateSlowCase): Deleted. (JSC::MarkedAllocator::allocateSlowCaseImpl): Deleted. * heap/MarkedAllocator.h: (JSC::MarkedAllocator::nextAllocatorInAlignedMemoryAllocator const): (JSC::MarkedAllocator::setNextAllocatorInAlignedMemoryAllocator): * heap/MarkedAllocatorInlines.h: (JSC::MarkedAllocator::allocate): (JSC::MarkedAllocator::tryAllocate): Deleted. * heap/MarkedBlock.h: * heap/MarkedBlockInlines.h: (JSC::MarkedBlock::Handle::finishSweepKnowingHeapCellType): (JSC::MarkedBlock::Handle::finishSweepKnowingSubspace): Deleted. * heap/MarkedSpace.cpp: (JSC::MarkedSpace::addMarkedAllocator): * heap/MarkedSpace.h: * heap/Subspace.cpp: (JSC::Subspace::Subspace): (JSC::Subspace::initialize): (JSC::Subspace::finishSweep): (JSC::Subspace::destroy): (JSC::Subspace::prepareForAllocation): (JSC::Subspace::findEmptyBlockToSteal): (): Deleted. (JSC::Subspace::allocate): Deleted. (JSC::Subspace::tryAllocate): Deleted. (JSC::Subspace::allocatorForSlow): Deleted. (JSC::Subspace::allocateSlow): Deleted. (JSC::Subspace::tryAllocateSlow): Deleted. (JSC::Subspace::didAllocate): Deleted. * heap/Subspace.h: (JSC::Subspace::heapCellType const): (JSC::Subspace::nextSubspaceInAlignedMemoryAllocator const): (JSC::Subspace::setNextSubspaceInAlignedMemoryAllocator): (JSC::Subspace::offsetOfAllocatorForSizeStep): Deleted. (JSC::Subspace::allocatorForSizeStep): Deleted. (JSC::Subspace::tryAllocatorFor): Deleted. (JSC::Subspace::allocatorFor): Deleted. * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::emitAllocateJSObjectWithKnownSize): (JSC::AssemblyHelpers::emitAllocateVariableSized): (JSC::AssemblyHelpers::emitAllocateVariableSizedCell): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_new_object): * runtime/ButterflyInlines.h: (JSC::Butterfly::createUninitialized): (JSC::Butterfly::tryCreate): (JSC::Butterfly::growArrayRight): * runtime/DirectArguments.cpp: (JSC::DirectArguments::overrideThings): * runtime/DirectArguments.h: (JSC::DirectArguments::subspaceFor): * runtime/DirectEvalExecutable.h: * runtime/EvalExecutable.h: * runtime/ExecutableBase.h: (JSC::ExecutableBase::subspaceFor): * runtime/FunctionExecutable.h: * runtime/GenericArgumentsInlines.h: (JSC::GenericArguments<Type>::initModifiedArgumentsDescriptor): * runtime/HashMapImpl.h: (JSC::HashMapBuffer::create): * runtime/IndirectEvalExecutable.h: * runtime/JSArray.cpp: (JSC::JSArray::tryCreateUninitializedRestricted): (JSC::JSArray::unshiftCountSlowCase): * runtime/JSArray.h: (JSC::JSArray::tryCreate): * runtime/JSArrayBufferView.cpp: (JSC::JSArrayBufferView::ConstructionContext::ConstructionContext): * runtime/JSCell.h: (JSC::subspaceFor): * runtime/JSCellInlines.h: (JSC::JSCell::subspaceFor): (JSC::tryAllocateCellHelper): (JSC::allocateCell): (JSC::tryAllocateCell): * runtime/JSDestructibleObject.h: (JSC::JSDestructibleObject::subspaceFor): * runtime/JSDestructibleObjectHeapCellType.cpp: Copied from Source/JavaScriptCore/runtime/JSDestructibleObjectSubspace.cpp. (JSC::JSDestructibleObjectHeapCellType::JSDestructibleObjectHeapCellType): (JSC::JSDestructibleObjectHeapCellType::~JSDestructibleObjectHeapCellType): (JSC::JSDestructibleObjectHeapCellType::finishSweep): (JSC::JSDestructibleObjectHeapCellType::destroy): (JSC::JSDestructibleObjectSubspace::JSDestructibleObjectSubspace): Deleted. (JSC::JSDestructibleObjectSubspace::~JSDestructibleObjectSubspace): Deleted. (JSC::JSDestructibleObjectSubspace::finishSweep): Deleted. (JSC::JSDestructibleObjectSubspace::destroy): Deleted. * runtime/JSDestructibleObjectHeapCellType.h: Copied from Source/JavaScriptCore/runtime/JSDestructibleObjectSubspace.h. * runtime/JSDestructibleObjectSubspace.cpp: Removed. * runtime/JSDestructibleObjectSubspace.h: Removed. * runtime/JSLexicalEnvironment.h: (JSC::JSLexicalEnvironment::subspaceFor): * runtime/JSSegmentedVariableObject.h: (JSC::JSSegmentedVariableObject::subspaceFor): * runtime/JSSegmentedVariableObjectHeapCellType.cpp: Copied from Source/JavaScriptCore/runtime/JSSegmentedVariableObjectSubspace.cpp. (JSC::JSSegmentedVariableObjectHeapCellType::JSSegmentedVariableObjectHeapCellType): (JSC::JSSegmentedVariableObjectHeapCellType::~JSSegmentedVariableObjectHeapCellType): (JSC::JSSegmentedVariableObjectHeapCellType::finishSweep): (JSC::JSSegmentedVariableObjectHeapCellType::destroy): (JSC::JSSegmentedVariableObjectSubspace::JSSegmentedVariableObjectSubspace): Deleted. (JSC::JSSegmentedVariableObjectSubspace::~JSSegmentedVariableObjectSubspace): Deleted. (JSC::JSSegmentedVariableObjectSubspace::finishSweep): Deleted. (JSC::JSSegmentedVariableObjectSubspace::destroy): Deleted. * runtime/JSSegmentedVariableObjectHeapCellType.h: Copied from Source/JavaScriptCore/runtime/JSSegmentedVariableObjectSubspace.h. * runtime/JSSegmentedVariableObjectSubspace.cpp: Removed. * runtime/JSSegmentedVariableObjectSubspace.h: Removed. * runtime/JSString.h: (JSC::JSString::subspaceFor): * runtime/JSStringHeapCellType.cpp: Copied from Source/JavaScriptCore/runtime/JSStringSubspace.cpp. (JSC::JSStringHeapCellType::JSStringHeapCellType): (JSC::JSStringHeapCellType::~JSStringHeapCellType): (JSC::JSStringHeapCellType::finishSweep): (JSC::JSStringHeapCellType::destroy): (JSC::JSStringSubspace::JSStringSubspace): Deleted. (JSC::JSStringSubspace::~JSStringSubspace): Deleted. (JSC::JSStringSubspace::finishSweep): Deleted. (JSC::JSStringSubspace::destroy): Deleted. * runtime/JSStringHeapCellType.h: Copied from Source/JavaScriptCore/runtime/JSStringSubspace.h. * runtime/JSStringSubspace.cpp: Removed. * runtime/JSStringSubspace.h: Removed. * runtime/ModuleProgramExecutable.h: * runtime/NativeExecutable.h: * runtime/ProgramExecutable.h: * runtime/RegExpMatchesArray.h: (JSC::tryCreateUninitializedRegExpMatchesArray): * runtime/ScopedArguments.h: (JSC::ScopedArguments::subspaceFor): * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: (JSC::VM::gigacageAuxiliarySpace): * wasm/js/JSWebAssemblyCodeBlock.h: * wasm/js/JSWebAssemblyCodeBlockHeapCellType.cpp: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyCodeBlockSubspace.cpp. (JSC::JSWebAssemblyCodeBlockHeapCellType::JSWebAssemblyCodeBlockHeapCellType): (JSC::JSWebAssemblyCodeBlockHeapCellType::~JSWebAssemblyCodeBlockHeapCellType): (JSC::JSWebAssemblyCodeBlockHeapCellType::finishSweep): (JSC::JSWebAssemblyCodeBlockHeapCellType::destroy): (JSC::JSWebAssemblyCodeBlockSubspace::JSWebAssemblyCodeBlockSubspace): Deleted. (JSC::JSWebAssemblyCodeBlockSubspace::~JSWebAssemblyCodeBlockSubspace): Deleted. (JSC::JSWebAssemblyCodeBlockSubspace::finishSweep): Deleted. (JSC::JSWebAssemblyCodeBlockSubspace::destroy): Deleted. * wasm/js/JSWebAssemblyCodeBlockHeapCellType.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyCodeBlockSubspace.h. * wasm/js/JSWebAssemblyCodeBlockSubspace.cpp: Removed. * wasm/js/JSWebAssemblyCodeBlockSubspace.h: Removed. * wasm/js/JSWebAssemblyMemory.h: (JSC::JSWebAssemblyMemory::subspaceFor): Source/WebCore: No new tests because no new behavior. Adopting changes in JSC Subspace API. * ForwardingHeaders/runtime/JSDestructibleObjectHeapCellType.h: Added. * ForwardingHeaders/runtime/JSSegmentedVariableObjectHeapCellType.h: Added. * bindings/js/JSDOMWrapper.cpp: (WebCore::outputConstraintSubspaceFor): (WebCore::globalObjectOutputConstraintSubspaceFor): * bindings/js/JSDOMWrapper.h: * bindings/js/WebCoreJSClientData.cpp: (WebCore::JSVMClientData::JSVMClientData): * bindings/js/WebCoreJSClientData.h: (WebCore::JSVMClientData::outputConstraintSpace): (WebCore::JSVMClientData::globalObjectOutputConstraintSpace): * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): Source/WTF: One of my favorite data structures in the GC is a singly-linked list that knows its tail, so that things get added to it at the end rather that at the beginning. In this patch, I use this to put the same node on multiple lists, which our existing linked list templates also don't support. This adds a new linked list that does those things: - It supports append(). It could also support prepend(), but currently there is no need for it. - It supports nodes that are on multiple lists. The GC uses std::mem_fn() to create a lambda that the list uses to set next. * WTF.xcodeproj/project.pbxproj: * wtf/SinglyLinkedListWithTail.h: Added. (WTF::SinglyLinkedListWithTail::isEmpty const): (WTF::SinglyLinkedListWithTail::append): (WTF::SinglyLinkedListWithTail::first const): (WTF::SinglyLinkedListWithTail::last const): Canonical link: https://commits.webkit.org/196172@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225314 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-11-30 04:39:50 +00:00
heap/CompleteSubspace.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
heap/ConservativeRoots.cpp
heap/DeferGC.cpp
heap/DestructionMode.cpp
heap/EdenGCActivityCallback.cpp
heap/FastMallocAlignedMemoryAllocator.cpp
heap/FullGCActivityCallback.cpp
heap/FreeList.cpp
heap/GCActivityCallback.cpp
heap/GCConductor.cpp
heap/GCLogging.cpp
heap/GCRequest.cpp
Experiment: create lots of different malloc zones for easier accounting of memory use https://bugs.webkit.org/show_bug.cgi?id=186422 Patch by Yusuke Suzuki <ysuzuki@apple.com> and Simon Fraser <simon.fraser@apple.com> on 2020-01-02 Reviewed by Saam Barati. Source/bmalloc: * bmalloc/BPlatform.h: * bmalloc/Environment.cpp: (bmalloc::Environment::computeIsDebugHeapEnabled): * bmalloc/IsoHeap.h: (bmalloc::api::IsoHeap::IsoHeap): * bmalloc/IsoHeapInlines.h: (bmalloc::api::IsoHeap<Type>::IsoHeap): * bmalloc/IsoTLSInlines.h: (bmalloc::IsoTLS::allocateSlow): (bmalloc::IsoTLS::deallocateSlow): Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/AssemblerBuffer.cpp: Copied from Source/JavaScriptCore/bytecode/InstructionStream.cpp. * assembler/AssemblerBuffer.h: (JSC::AssemblerData::AssemblerData): (JSC::AssemblerData::operator=): (JSC::AssemblerData::~AssemblerData): (JSC::AssemblerData::grow): * bytecode/AccessCase.cpp: * bytecode/AccessCase.h: * bytecode/BytecodeBasicBlock.cpp: * bytecode/BytecodeBasicBlock.h: * bytecode/CodeBlock.cpp: * bytecode/CodeBlock.h: * bytecode/InstructionStream.cpp: * bytecode/InstructionStream.h: * bytecode/PolymorphicAccess.cpp: * bytecode/PolymorphicAccess.h: * bytecode/UnlinkedMetadataTable.cpp: (JSC::UnlinkedMetadataTable::finalize): * bytecode/UnlinkedMetadataTable.h: * bytecode/UnlinkedMetadataTableInlines.h: (JSC::UnlinkedMetadataTable::UnlinkedMetadataTable): (JSC::UnlinkedMetadataTable::~UnlinkedMetadataTable): (JSC::UnlinkedMetadataTable::link): (JSC::UnlinkedMetadataTable::unlink): * bytecode/ValueProfile.h: (JSC::ValueProfileAndVirtualRegisterBuffer::ValueProfileAndVirtualRegisterBuffer): * bytecode/Watchpoint.cpp: * bytecode/Watchpoint.h: * dfg/DFGBasicBlock.cpp: * dfg/DFGBasicBlock.h: * dfg/DFGNode.cpp: * dfg/DFGNode.h: * dfg/DFGSpeculativeJIT.cpp: * dfg/DFGSpeculativeJIT.h: * heap/BlockDirectory.cpp: * heap/BlockDirectory.h: * heap/FastMallocAlignedMemoryAllocator.cpp: (JSC::FastMallocAlignedMemoryAllocator::FastMallocAlignedMemoryAllocator): (JSC::FastMallocAlignedMemoryAllocator::tryAllocateAlignedMemory): (JSC::FastMallocAlignedMemoryAllocator::freeAlignedMemory): (JSC::FastMallocAlignedMemoryAllocator::tryAllocateMemory): (JSC::FastMallocAlignedMemoryAllocator::freeMemory): (JSC::FastMallocAlignedMemoryAllocator::tryReallocateMemory): * heap/FastMallocAlignedMemoryAllocator.h: * heap/GCSegmentedArray.cpp: Copied from Source/JavaScriptCore/parser/SourceProviderCache.cpp. * heap/GCSegmentedArray.h: * heap/GCSegmentedArrayInlines.h: (JSC::GCArraySegment<T>::create): (JSC::GCArraySegment<T>::destroy): * heap/GigacageAlignedMemoryAllocator.cpp: (JSC::GigacageAlignedMemoryAllocator::GigacageAlignedMemoryAllocator): (JSC::GigacageAlignedMemoryAllocator::tryAllocateAlignedMemory): (JSC::GigacageAlignedMemoryAllocator::freeAlignedMemory): (JSC::GigacageAlignedMemoryAllocator::tryAllocateMemory): (JSC::GigacageAlignedMemoryAllocator::freeMemory): (JSC::GigacageAlignedMemoryAllocator::tryReallocateMemory): * heap/GigacageAlignedMemoryAllocator.h: * heap/IsoAlignedMemoryAllocator.cpp: (JSC::IsoAlignedMemoryAllocator::IsoAlignedMemoryAllocator): (JSC::IsoAlignedMemoryAllocator::~IsoAlignedMemoryAllocator): (JSC::IsoAlignedMemoryAllocator::tryAllocateAlignedMemory): (JSC::IsoAlignedMemoryAllocator::freeAlignedMemory): (JSC::IsoAlignedMemoryAllocator::tryAllocateMemory): (JSC::IsoAlignedMemoryAllocator::freeMemory): * heap/IsoAlignedMemoryAllocator.h: * heap/IsoSubspace.cpp: (JSC::IsoSubspace::IsoSubspace): * heap/MarkedBlock.cpp: * heap/MarkedBlock.h: * heap/WeakBlock.cpp: (JSC::WeakBlock::create): (JSC::WeakBlock::destroy): * heap/WeakBlock.h: * jit/JITCode.cpp: * jit/JITCode.h: * jit/RegisterAtOffsetList.cpp: * jit/RegisterAtOffsetList.h: * parser/Nodes.cpp: * parser/Nodes.h: * parser/ParserArena.cpp: (JSC::ParserArena::deallocateObjects): (JSC::ParserArena::allocateFreeablePool): * parser/ParserArena.h: * parser/SourceProvider.cpp: * parser/SourceProvider.h: * parser/SourceProviderCache.cpp: * parser/SourceProviderCache.h: * parser/SourceProviderCacheItem.h: (JSC::SourceProviderCacheItem::create): * runtime/CachePayload.cpp: (JSC::CachePayload::makeMallocPayload): * runtime/CachePayload.h: * runtime/CachedBytecode.h: (JSC::CachedBytecode::create): * runtime/CachedTypes.cpp: (JSC::Encoder::release): (JSC::Encoder::Page::Page): (JSC::CachedVector::encode): (JSC::CachedVector::decode const): (JSC::CachedInstructionStream::decode const): * runtime/PropertyMapHashTable.h: (JSC::PropertyTable::rehash): * runtime/PropertyTable.cpp: (JSC::PropertyTable::PropertyTable): (JSC::PropertyTable::~PropertyTable): * runtime/SymbolTable.cpp: * runtime/SymbolTable.h: * runtime/VM.cpp: (JSC::VM::~VM): * runtime/VM.h: (JSC::ScratchBuffer::create): (JSC::VM::exceptionFuzzingBuffer): * wasm/WasmInstance.cpp: (JSC::Wasm::Instance::Instance): * wasm/WasmInstance.h: * wasm/WasmTable.cpp: (JSC::Wasm::Table::Table): (JSC::Wasm::FuncRefTable::FuncRefTable): * wasm/WasmTable.h: Source/WebCore: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/SerializedScriptValue.cpp: * bindings/js/SerializedScriptValue.h: * css/CSSFontFace.cpp: * css/CSSFontFace.h: * css/CSSSelector.cpp: * css/CSSSelector.h: * css/CSSValue.cpp: * css/CSSValue.h: * css/StyleProperties.cpp: (WebCore::ImmutableStyleProperties::create): * css/StyleProperties.h: * css/StyleRule.cpp: * css/StyleRule.h: * dom/ElementData.cpp: (WebCore::ShareableElementData::createWithAttributes): (WebCore::UniqueElementData::makeShareableCopy const): * dom/ElementData.h: * dom/NodeRareData.cpp: * dom/NodeRareData.h: * dom/QualifiedName.cpp: * dom/QualifiedName.h: * html/parser/HTMLDocumentParser.cpp: * html/parser/HTMLDocumentParser.h: * loader/DocumentLoader.cpp: * loader/DocumentLoader.h: * loader/ResourceLoader.cpp: * loader/ResourceLoader.h: * loader/cache/CachedResource.cpp: * loader/cache/CachedResource.h: * page/PerformanceEntry.cpp: * page/PerformanceEntry.h: * platform/graphics/Font.cpp: * platform/graphics/Font.h: * platform/graphics/FontCascadeFonts.cpp: * platform/graphics/FontCascadeFonts.h: * platform/graphics/Region.cpp: * platform/graphics/Region.h: * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: (WebCore::releaseUint8Vector): * platform/graphics/cg/ImageBufferCG.cpp: (WebCore::ImageBuffer::ImageBuffer): * platform/graphics/nicosia/NicosiaBuffer.cpp: (Nicosia::Buffer::Buffer): * platform/network/ResourceHandle.cpp: * platform/network/ResourceHandleInternal.h: * platform/network/cf/FormDataStreamCFNet.cpp: (WebCore::closeCurrentStream): (WebCore::advanceCurrentStream): * rendering/RenderLayer.cpp: * rendering/RenderLayer.h: * rendering/TableLayout.cpp: Copied from Source/JavaScriptCore/parser/SourceProviderCache.cpp. * rendering/TableLayout.h: * rendering/style/RenderStyle.cpp: * rendering/style/RenderStyle.h: * rendering/style/SVGRenderStyle.cpp: * rendering/style/SVGRenderStyle.h: * rendering/style/SVGRenderStyleDefs.cpp: * rendering/style/SVGRenderStyleDefs.h: * rendering/style/StyleBoxData.cpp: * rendering/style/StyleBoxData.h: * rendering/style/StyleInheritedData.cpp: * rendering/style/StyleInheritedData.h: * rendering/style/StyleRareInheritedData.cpp: * rendering/style/StyleRareInheritedData.h: * rendering/style/StyleRareNonInheritedData.cpp: * rendering/style/StyleRareNonInheritedData.h: * rendering/style/StyleSurroundData.cpp: * rendering/style/StyleSurroundData.h: * rendering/style/StyleTransformData.cpp: * rendering/style/StyleTransformData.h: * style/StyleTreeResolver.cpp: * style/StyleTreeResolver.h: * svg/animation/SMILTimeContainer.cpp: * svg/animation/SMILTimeContainer.h: Source/WebKit: * Shared/ShareableBitmap.cpp: (WebKit::ShareableBitmap::create): (WebKit::ShareableBitmap::~ShareableBitmap): * UIProcess/mac/LegacySessionStateCoding.cpp: (WebKit::HistoryEntryDataEncoder::HistoryEntryDataEncoder): (WebKit::HistoryEntryDataEncoder::finishEncoding): (WebKit::encodeSessionHistoryEntryData): (WebKit::encodeLegacySessionState): Source/WTF: This patch introduces ENABLE(MALLOC_HEAP_BREAKDOWN). If this is enabled, we allocate malloc_zone per malloc kind. This offers the way to investigate the usage of memory per kind by using vmmap, like the following. VIRTUAL RESIDENT DIRTY SWAPPED ALLOCATION BYTES DIRTY+SWAP REGION MALLOC ZONE SIZE SIZE SIZE SIZE COUNT ALLOCATED FRAG SIZE % FRAG COUNT =========== ======= ========= ========= ========= ========= ========= ========= ====== ====== StringImpl_0x116efd000 188.0M 69.3M 30.9M 0K 139456 18.0M 12.9M 42% 34 DefaultMallocZone_0x10f487000 176.0M 53.9M 14.1M 0K 115956 9955K 4497K 32% 22 Vector_0x116eff000 162.0M 56.3M 55.3M 0K 140715 17.3M 37.9M 69% 36 MetadataTable_0x11843b000 152.0M 17.5M 17.5M 0K 14200 2353K 15.2M 87% 26 WebKit Using System Malloc_0x114cbe000 150.0M 31.6M 21.8M 0K 87422 16.7M 5278K 24% 23 InstructionStream_0x118469000 150.0M 5764K 5764K 0K 14470 4688K 1076K 19% 24 AssemblerData_0x117ee6000 150.0M 1928K 1928K 0K 1 16 1928K 100% 24 To achieve this goal without making very large change, we put a template type in various containers. For example, Vector will take Malloc parameter (the default one is FastMalloc allocator). If ENABLE(MALLOC_HEAP_BREAKDOWN) is enabled, we change this to specific VectorMalloc allocator, and vmmap can show memory usage of this allocator. This patch also supports malloc_zone per IsoHeap. So we can see memory allocation per IsoHeap in vmmap. To use this feature, we need to flip two compile time flags, ENABLE(MALLOC_HEAP_BREAKDOWN) in WTF and BENABLE_MALLOC_HEAP_BREAKDOWN in bmalloc. And use `vmmap $PID` to dump malloc zones. To allocate objects of a class with a specific malloc-zone, use WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(HeapIdentifier) for the class, and define allocator by DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(HeapIdentifier) in a header and DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(HeapIdentifier) in a cpp file. This patch also introduce callstack collector for malloc. Vector, HashMap etc. are used to allocate various things, but the above malloc_zone feature only tells thing like "Vector takes XXX MB memory". But what we want to know in this case is what Vector is consuming memory. We collect StackShot for each malloc call, and combine these information to tell which callsite is consuming much memory, which tell us that what Vector is consuming memory. * WTF.xcodeproj/project.pbxproj: * wtf/Bag.cpp: Copied from Source/JavaScriptCore/parser/SourceProviderCache.cpp. * wtf/Bag.h: (WTF::Private::BagNode::BagNode): Deleted. * wtf/BitVector.cpp: (WTF::BitVector::OutOfLineBits::create): (WTF::BitVector::OutOfLineBits::destroy): * wtf/CMakeLists.txt: * wtf/ConcurrentBuffer.cpp: Copied from Source/JavaScriptCore/parser/SourceProviderCache.cpp. * wtf/ConcurrentBuffer.h: * wtf/DebugHeap.cpp: Copied from Source/JavaScriptCore/runtime/CachePayload.cpp. (WTF::DebugHeap::DebugHeap): (WTF::DebugHeap::malloc): (WTF::DebugHeap::calloc): (WTF::DebugHeap::memalign): (WTF::DebugHeap::realloc): (WTF::DebugHeap::free): * wtf/DebugHeap.h: Added. * wtf/FastBitVector.cpp: (WTF::FastBitVectorWordOwner::setEqualsSlow): (WTF::FastBitVectorWordOwner::resizeSlow): * wtf/FastBitVector.h: (WTF::FastBitVectorWordOwner::~FastBitVectorWordOwner): * wtf/FastMalloc.cpp: (WTF::fastMallocDumpMallocStats): (WTF::AvoidRecordingScope::AvoidRecordingScope): (WTF::AvoidRecordingScope::~AvoidRecordingScope): (WTF::MallocCallTracker::MallocSiteData::MallocSiteData): (WTF::MallocCallTracker::singleton): (WTF::MallocCallTracker::MallocCallTracker): (WTF::MallocCallTracker::recordMalloc): (WTF::MallocCallTracker::recordRealloc): (WTF::MallocCallTracker::recordFree): (WTF::MallocCallTracker::dumpStats): (WTF::fastMalloc): (WTF::fastRealloc): (WTF::fastFree): (WTF::fastAlignedMalloc): (WTF::tryFastAlignedMalloc): (WTF::fastAlignedFree): * wtf/FastMalloc.h: (WTF::FastMalloc::zeroedMalloc): (WTF::FastMalloc::tryZeroedMalloc): * wtf/Forward.h: * wtf/HashTable.cpp: * wtf/HashTable.h: (WTF::KeyTraits>::allocateTable): (WTF::KeyTraits>::deallocateTable): (WTF::KeyTraits>::rehash): * wtf/MallocPtr.h: (WTF::MallocPtr::MallocPtr): (WTF::MallocPtr::malloc): (WTF::MallocPtr::zeroedMalloc): (WTF::MallocPtr::tryMalloc): (WTF::MallocPtr::tryZeroedMalloc): (WTF::adoptMallocPtr): * wtf/MetaAllocator.cpp: (WTF::MetaAllocator::allocFreeSpaceNode): (WTF::MetaAllocator::freeFreeSpaceNode): * wtf/MetaAllocatorHandle.h: * wtf/Platform.h: * wtf/RefCountedArray.cpp: Copied from Source/JavaScriptCore/bytecode/InstructionStream.cpp. * wtf/RefCountedArray.h: (WTF::RefCountedArray::RefCountedArray): (WTF::RefCountedArray::~RefCountedArray): (WTF::RefCountedArray::assign): * wtf/SegmentedVector.cpp: Copied from Source/JavaScriptCore/bytecode/InstructionStream.cpp. * wtf/SegmentedVector.h: * wtf/SmallPtrSet.cpp: Copied from Source/JavaScriptCore/bytecode/InstructionStream.cpp. * wtf/SmallPtrSet.h: (WTF::SmallPtrSet::~SmallPtrSet): (WTF::SmallPtrSet::grow): * wtf/UniqueArray.cpp: Copied from Source/JavaScriptCore/bytecode/InstructionStream.cpp. * wtf/UniqueArray.h: (WTF::UniqueArrayFree::operator() const): (WTF::UniqueArrayFree<T::operator() const): * wtf/Vector.cpp: Copied from Source/JavaScriptCore/bytecode/InstructionStream.cpp. * wtf/Vector.h: (WTF::VectorBufferBase::allocateBuffer): (WTF::VectorBufferBase::tryAllocateBuffer): (WTF::VectorBufferBase::reallocateBuffer): (WTF::VectorBufferBase::deallocateBuffer): (WTF::VectorBufferBase::releaseBuffer): (WTF::VectorBuffer::releaseBuffer): (WTF::Vector::swap): (WTF::Malloc>::Vector): (WTF::=): (WTF::Malloc>::contains const): (WTF::Malloc>::findMatching const): (WTF::Malloc>::find const): (WTF::Malloc>::reverseFind const): (WTF::Malloc>::appendIfNotContains): (WTF::Malloc>::fill): (WTF::Malloc>::appendRange): (WTF::Malloc>::expandCapacity): (WTF::Malloc>::tryExpandCapacity): (WTF::Malloc>::resize): (WTF::Malloc>::resizeToFit): (WTF::Malloc>::shrink): (WTF::Malloc>::grow): (WTF::Malloc>::asanSetInitialBufferSizeTo): (WTF::Malloc>::asanSetBufferSizeToFullCapacity): (WTF::Malloc>::asanBufferSizeWillChangeTo): (WTF::Malloc>::reserveCapacity): (WTF::Malloc>::tryReserveCapacity): (WTF::Malloc>::reserveInitialCapacity): (WTF::Malloc>::shrinkCapacity): (WTF::Malloc>::append): (WTF::Malloc>::tryAppend): (WTF::Malloc>::constructAndAppend): (WTF::Malloc>::tryConstructAndAppend): (WTF::Malloc>::appendSlowCase): (WTF::Malloc>::constructAndAppendSlowCase): (WTF::Malloc>::tryConstructAndAppendSlowCase): (WTF::Malloc>::uncheckedAppend): (WTF::Malloc>::uncheckedConstructAndAppend): (WTF::Malloc>::appendVector): (WTF::Malloc>::insert): (WTF::Malloc>::insertVector): (WTF::Malloc>::remove): (WTF::Malloc>::removeFirst): (WTF::Malloc>::removeFirstMatching): (WTF::Malloc>::removeAll): (WTF::Malloc>::removeAllMatching): (WTF::Malloc>::reverse): (WTF::Malloc>::map const): (WTF::Malloc>::releaseBuffer): (WTF::Malloc>::checkConsistency): (WTF::swap): (WTF::operator==): (WTF::operator!=): (WTF::Malloc>::isolatedCopy const): (WTF::removeRepeatedElements): (WTF::minCapacity>::Vector): Deleted. (WTF::minCapacity>::contains const): Deleted. (WTF::minCapacity>::findMatching const): Deleted. (WTF::minCapacity>::find const): Deleted. (WTF::minCapacity>::reverseFind const): Deleted. (WTF::minCapacity>::appendIfNotContains): Deleted. (WTF::minCapacity>::fill): Deleted. (WTF::minCapacity>::appendRange): Deleted. (WTF::minCapacity>::expandCapacity): Deleted. (WTF::minCapacity>::tryExpandCapacity): Deleted. (WTF::minCapacity>::resize): Deleted. (WTF::minCapacity>::resizeToFit): Deleted. (WTF::minCapacity>::shrink): Deleted. (WTF::minCapacity>::grow): Deleted. (WTF::minCapacity>::asanSetInitialBufferSizeTo): Deleted. (WTF::minCapacity>::asanSetBufferSizeToFullCapacity): Deleted. (WTF::minCapacity>::asanBufferSizeWillChangeTo): Deleted. (WTF::minCapacity>::reserveCapacity): Deleted. (WTF::minCapacity>::tryReserveCapacity): Deleted. (WTF::minCapacity>::reserveInitialCapacity): Deleted. (WTF::minCapacity>::shrinkCapacity): Deleted. (WTF::minCapacity>::append): Deleted. (WTF::minCapacity>::tryAppend): Deleted. (WTF::minCapacity>::constructAndAppend): Deleted. (WTF::minCapacity>::tryConstructAndAppend): Deleted. (WTF::minCapacity>::appendSlowCase): Deleted. (WTF::minCapacity>::constructAndAppendSlowCase): Deleted. (WTF::minCapacity>::tryConstructAndAppendSlowCase): Deleted. (WTF::minCapacity>::uncheckedAppend): Deleted. (WTF::minCapacity>::uncheckedConstructAndAppend): Deleted. (WTF::minCapacity>::appendVector): Deleted. (WTF::minCapacity>::insert): Deleted. (WTF::minCapacity>::insertVector): Deleted. (WTF::minCapacity>::remove): Deleted. (WTF::minCapacity>::removeFirst): Deleted. (WTF::minCapacity>::removeFirstMatching): Deleted. (WTF::minCapacity>::removeAll): Deleted. (WTF::minCapacity>::removeAllMatching): Deleted. (WTF::minCapacity>::reverse): Deleted. (WTF::minCapacity>::map const): Deleted. (WTF::minCapacity>::releaseBuffer): Deleted. (WTF::minCapacity>::checkConsistency): Deleted. (WTF::minCapacity>::isolatedCopy const): Deleted. * wtf/text/CString.cpp: (WTF::CStringBuffer::createUninitialized): * wtf/text/CString.h: * wtf/text/StringBuffer.cpp: Copied from Source/JavaScriptCore/bytecode/InstructionStream.cpp. * wtf/text/StringBuffer.h: (WTF::StringBuffer::StringBuffer): (WTF::StringBuffer::~StringBuffer): (WTF::StringBuffer::resize): (WTF::StringBuffer::release): * wtf/text/StringImpl.cpp: (WTF::StringImpl::~StringImpl): (WTF::StringImpl::destroy): (WTF::StringImpl::createUninitializedInternalNonEmpty): (WTF::StringImpl::reallocateInternal): * wtf/text/StringImpl.h: (WTF::StringImpl::StringImpl): (WTF::StringImpl::createSubstringSharingImpl): (WTF::StringImpl::tryCreateUninitialized): (WTF::StringImpl::adopt): * wtf/text/cf/StringImplCF.cpp: (WTF::StringWrapperCFAllocator::allocate): (WTF::StringWrapperCFAllocator::reallocate): (WTF::StringWrapperCFAllocator::deallocate): Canonical link: https://commits.webkit.org/218863@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253987 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-03 02:36:43 +00:00
heap/GCSegmentedArray.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
heap/GigacageAlignedMemoryAllocator.cpp
heap/HandleSet.cpp
heap/Heap.cpp
heap/HeapCell.cpp
GC should support isoheaps https://bugs.webkit.org/show_bug.cgi?id=179288 Reviewed by Saam Barati. Source/JavaScriptCore: This expands the power of the Subspace API in JSC: - Everything associated with describing the types of objects is now part of the HeapCellType class. We have different HeapCellTypes for different destruction strategies. Any Subspace can use any HeapCellType; these are orthogonal things. - There are now two variants of Subspace: CompleteSubspace, which can allocate any size objects using any AlignedMemoryAllocator; and IsoSubspace, which can allocate just one size of object and uses a special virtual memory pool for that purpose. Like bmalloc's IsoHeap, IsoSubspace hoards virtual pages but releases the physical pages as part of the respective allocator's scavenging policy (the Scavenger in bmalloc for IsoHeap and the incremental sweep and full sweep in Riptide for IsoSubspace). So far, this patch just puts subtypes of ExecutableBase in IsoSubspaces. If it works, we can use it for more things. This does not have any effect on JetStream (0.18% faster with p = 0.69). * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/AccessCase.cpp: (JSC::AccessCase::generateImpl): * bytecode/ObjectAllocationProfileInlines.h: (JSC::ObjectAllocationProfile::initializeProfile): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::emitAllocateRawObject): (JSC::DFG::SpeculativeJIT::compileMakeRope): (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage): (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * ftl/FTLAbstractHeapRepository.h: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileMakeRope): (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewObject): (JSC::FTL::DFG::LowerDFGToB3::allocatePropertyStorageWithSizeImpl): (JSC::FTL::DFG::LowerDFGToB3::allocateObject): (JSC::FTL::DFG::LowerDFGToB3::allocatorForSize): * heap/AlignedMemoryAllocator.cpp: (JSC::AlignedMemoryAllocator::registerAllocator): (JSC::AlignedMemoryAllocator::registerSubspace): * heap/AlignedMemoryAllocator.h: (JSC::AlignedMemoryAllocator::firstAllocator const): * heap/AllocationFailureMode.h: Added. * heap/CompleteSubspace.cpp: Added. (JSC::CompleteSubspace::CompleteSubspace): (JSC::CompleteSubspace::~CompleteSubspace): (JSC::CompleteSubspace::allocatorFor): (JSC::CompleteSubspace::allocate): (JSC::CompleteSubspace::allocateNonVirtual): (JSC::CompleteSubspace::allocatorForSlow): (JSC::CompleteSubspace::allocateSlow): (JSC::CompleteSubspace::tryAllocateSlow): * heap/CompleteSubspace.h: Added. (JSC::CompleteSubspace::offsetOfAllocatorForSizeStep): (JSC::CompleteSubspace::allocatorForSizeStep): (JSC::CompleteSubspace::allocatorForNonVirtual): * heap/HeapCellType.cpp: Added. (JSC::HeapCellType::HeapCellType): (JSC::HeapCellType::~HeapCellType): (JSC::HeapCellType::finishSweep): (JSC::HeapCellType::destroy): * heap/HeapCellType.h: Added. (JSC::HeapCellType::attributes const): * heap/IsoAlignedMemoryAllocator.cpp: Added. (JSC::IsoAlignedMemoryAllocator::IsoAlignedMemoryAllocator): (JSC::IsoAlignedMemoryAllocator::~IsoAlignedMemoryAllocator): (JSC::IsoAlignedMemoryAllocator::tryAllocateAlignedMemory): (JSC::IsoAlignedMemoryAllocator::freeAlignedMemory): (JSC::IsoAlignedMemoryAllocator::dump const): * heap/IsoAlignedMemoryAllocator.h: Added. * heap/IsoSubspace.cpp: Added. (JSC::IsoSubspace::IsoSubspace): (JSC::IsoSubspace::~IsoSubspace): (JSC::IsoSubspace::allocatorFor): (JSC::IsoSubspace::allocatorForNonVirtual): (JSC::IsoSubspace::allocate): (JSC::IsoSubspace::allocateNonVirtual): * heap/IsoSubspace.h: Added. (JSC::IsoSubspace::size const): * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::MarkedAllocator): (JSC::MarkedAllocator::setSubspace): (JSC::MarkedAllocator::allocateSlowCase): (JSC::MarkedAllocator::tryAllocateSlowCase): Deleted. (JSC::MarkedAllocator::allocateSlowCaseImpl): Deleted. * heap/MarkedAllocator.h: (JSC::MarkedAllocator::nextAllocatorInAlignedMemoryAllocator const): (JSC::MarkedAllocator::setNextAllocatorInAlignedMemoryAllocator): * heap/MarkedAllocatorInlines.h: (JSC::MarkedAllocator::allocate): (JSC::MarkedAllocator::tryAllocate): Deleted. * heap/MarkedBlock.h: * heap/MarkedBlockInlines.h: (JSC::MarkedBlock::Handle::finishSweepKnowingHeapCellType): (JSC::MarkedBlock::Handle::finishSweepKnowingSubspace): Deleted. * heap/MarkedSpace.cpp: (JSC::MarkedSpace::addMarkedAllocator): * heap/MarkedSpace.h: * heap/Subspace.cpp: (JSC::Subspace::Subspace): (JSC::Subspace::initialize): (JSC::Subspace::finishSweep): (JSC::Subspace::destroy): (JSC::Subspace::prepareForAllocation): (JSC::Subspace::findEmptyBlockToSteal): (): Deleted. (JSC::Subspace::allocate): Deleted. (JSC::Subspace::tryAllocate): Deleted. (JSC::Subspace::allocatorForSlow): Deleted. (JSC::Subspace::allocateSlow): Deleted. (JSC::Subspace::tryAllocateSlow): Deleted. (JSC::Subspace::didAllocate): Deleted. * heap/Subspace.h: (JSC::Subspace::heapCellType const): (JSC::Subspace::nextSubspaceInAlignedMemoryAllocator const): (JSC::Subspace::setNextSubspaceInAlignedMemoryAllocator): (JSC::Subspace::offsetOfAllocatorForSizeStep): Deleted. (JSC::Subspace::allocatorForSizeStep): Deleted. (JSC::Subspace::tryAllocatorFor): Deleted. (JSC::Subspace::allocatorFor): Deleted. * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::emitAllocateJSObjectWithKnownSize): (JSC::AssemblyHelpers::emitAllocateVariableSized): (JSC::AssemblyHelpers::emitAllocateVariableSizedCell): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_new_object): * runtime/ButterflyInlines.h: (JSC::Butterfly::createUninitialized): (JSC::Butterfly::tryCreate): (JSC::Butterfly::growArrayRight): * runtime/DirectArguments.cpp: (JSC::DirectArguments::overrideThings): * runtime/DirectArguments.h: (JSC::DirectArguments::subspaceFor): * runtime/DirectEvalExecutable.h: * runtime/EvalExecutable.h: * runtime/ExecutableBase.h: (JSC::ExecutableBase::subspaceFor): * runtime/FunctionExecutable.h: * runtime/GenericArgumentsInlines.h: (JSC::GenericArguments<Type>::initModifiedArgumentsDescriptor): * runtime/HashMapImpl.h: (JSC::HashMapBuffer::create): * runtime/IndirectEvalExecutable.h: * runtime/JSArray.cpp: (JSC::JSArray::tryCreateUninitializedRestricted): (JSC::JSArray::unshiftCountSlowCase): * runtime/JSArray.h: (JSC::JSArray::tryCreate): * runtime/JSArrayBufferView.cpp: (JSC::JSArrayBufferView::ConstructionContext::ConstructionContext): * runtime/JSCell.h: (JSC::subspaceFor): * runtime/JSCellInlines.h: (JSC::JSCell::subspaceFor): (JSC::tryAllocateCellHelper): (JSC::allocateCell): (JSC::tryAllocateCell): * runtime/JSDestructibleObject.h: (JSC::JSDestructibleObject::subspaceFor): * runtime/JSDestructibleObjectHeapCellType.cpp: Copied from Source/JavaScriptCore/runtime/JSDestructibleObjectSubspace.cpp. (JSC::JSDestructibleObjectHeapCellType::JSDestructibleObjectHeapCellType): (JSC::JSDestructibleObjectHeapCellType::~JSDestructibleObjectHeapCellType): (JSC::JSDestructibleObjectHeapCellType::finishSweep): (JSC::JSDestructibleObjectHeapCellType::destroy): (JSC::JSDestructibleObjectSubspace::JSDestructibleObjectSubspace): Deleted. (JSC::JSDestructibleObjectSubspace::~JSDestructibleObjectSubspace): Deleted. (JSC::JSDestructibleObjectSubspace::finishSweep): Deleted. (JSC::JSDestructibleObjectSubspace::destroy): Deleted. * runtime/JSDestructibleObjectHeapCellType.h: Copied from Source/JavaScriptCore/runtime/JSDestructibleObjectSubspace.h. * runtime/JSDestructibleObjectSubspace.cpp: Removed. * runtime/JSDestructibleObjectSubspace.h: Removed. * runtime/JSLexicalEnvironment.h: (JSC::JSLexicalEnvironment::subspaceFor): * runtime/JSSegmentedVariableObject.h: (JSC::JSSegmentedVariableObject::subspaceFor): * runtime/JSSegmentedVariableObjectHeapCellType.cpp: Copied from Source/JavaScriptCore/runtime/JSSegmentedVariableObjectSubspace.cpp. (JSC::JSSegmentedVariableObjectHeapCellType::JSSegmentedVariableObjectHeapCellType): (JSC::JSSegmentedVariableObjectHeapCellType::~JSSegmentedVariableObjectHeapCellType): (JSC::JSSegmentedVariableObjectHeapCellType::finishSweep): (JSC::JSSegmentedVariableObjectHeapCellType::destroy): (JSC::JSSegmentedVariableObjectSubspace::JSSegmentedVariableObjectSubspace): Deleted. (JSC::JSSegmentedVariableObjectSubspace::~JSSegmentedVariableObjectSubspace): Deleted. (JSC::JSSegmentedVariableObjectSubspace::finishSweep): Deleted. (JSC::JSSegmentedVariableObjectSubspace::destroy): Deleted. * runtime/JSSegmentedVariableObjectHeapCellType.h: Copied from Source/JavaScriptCore/runtime/JSSegmentedVariableObjectSubspace.h. * runtime/JSSegmentedVariableObjectSubspace.cpp: Removed. * runtime/JSSegmentedVariableObjectSubspace.h: Removed. * runtime/JSString.h: (JSC::JSString::subspaceFor): * runtime/JSStringHeapCellType.cpp: Copied from Source/JavaScriptCore/runtime/JSStringSubspace.cpp. (JSC::JSStringHeapCellType::JSStringHeapCellType): (JSC::JSStringHeapCellType::~JSStringHeapCellType): (JSC::JSStringHeapCellType::finishSweep): (JSC::JSStringHeapCellType::destroy): (JSC::JSStringSubspace::JSStringSubspace): Deleted. (JSC::JSStringSubspace::~JSStringSubspace): Deleted. (JSC::JSStringSubspace::finishSweep): Deleted. (JSC::JSStringSubspace::destroy): Deleted. * runtime/JSStringHeapCellType.h: Copied from Source/JavaScriptCore/runtime/JSStringSubspace.h. * runtime/JSStringSubspace.cpp: Removed. * runtime/JSStringSubspace.h: Removed. * runtime/ModuleProgramExecutable.h: * runtime/NativeExecutable.h: * runtime/ProgramExecutable.h: * runtime/RegExpMatchesArray.h: (JSC::tryCreateUninitializedRegExpMatchesArray): * runtime/ScopedArguments.h: (JSC::ScopedArguments::subspaceFor): * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: (JSC::VM::gigacageAuxiliarySpace): * wasm/js/JSWebAssemblyCodeBlock.h: * wasm/js/JSWebAssemblyCodeBlockHeapCellType.cpp: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyCodeBlockSubspace.cpp. (JSC::JSWebAssemblyCodeBlockHeapCellType::JSWebAssemblyCodeBlockHeapCellType): (JSC::JSWebAssemblyCodeBlockHeapCellType::~JSWebAssemblyCodeBlockHeapCellType): (JSC::JSWebAssemblyCodeBlockHeapCellType::finishSweep): (JSC::JSWebAssemblyCodeBlockHeapCellType::destroy): (JSC::JSWebAssemblyCodeBlockSubspace::JSWebAssemblyCodeBlockSubspace): Deleted. (JSC::JSWebAssemblyCodeBlockSubspace::~JSWebAssemblyCodeBlockSubspace): Deleted. (JSC::JSWebAssemblyCodeBlockSubspace::finishSweep): Deleted. (JSC::JSWebAssemblyCodeBlockSubspace::destroy): Deleted. * wasm/js/JSWebAssemblyCodeBlockHeapCellType.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyCodeBlockSubspace.h. * wasm/js/JSWebAssemblyCodeBlockSubspace.cpp: Removed. * wasm/js/JSWebAssemblyCodeBlockSubspace.h: Removed. * wasm/js/JSWebAssemblyMemory.h: (JSC::JSWebAssemblyMemory::subspaceFor): Source/WebCore: No new tests because no new behavior. Adopting changes in JSC Subspace API. * ForwardingHeaders/runtime/JSDestructibleObjectHeapCellType.h: Added. * ForwardingHeaders/runtime/JSSegmentedVariableObjectHeapCellType.h: Added. * bindings/js/JSDOMWrapper.cpp: (WebCore::outputConstraintSubspaceFor): (WebCore::globalObjectOutputConstraintSubspaceFor): * bindings/js/JSDOMWrapper.h: * bindings/js/WebCoreJSClientData.cpp: (WebCore::JSVMClientData::JSVMClientData): * bindings/js/WebCoreJSClientData.h: (WebCore::JSVMClientData::outputConstraintSpace): (WebCore::JSVMClientData::globalObjectOutputConstraintSpace): * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): Source/WTF: One of my favorite data structures in the GC is a singly-linked list that knows its tail, so that things get added to it at the end rather that at the beginning. In this patch, I use this to put the same node on multiple lists, which our existing linked list templates also don't support. This adds a new linked list that does those things: - It supports append(). It could also support prepend(), but currently there is no need for it. - It supports nodes that are on multiple lists. The GC uses std::mem_fn() to create a lambda that the list uses to set next. * WTF.xcodeproj/project.pbxproj: * wtf/SinglyLinkedListWithTail.h: Added. (WTF::SinglyLinkedListWithTail::isEmpty const): (WTF::SinglyLinkedListWithTail::append): (WTF::SinglyLinkedListWithTail::first const): (WTF::SinglyLinkedListWithTail::last const): Canonical link: https://commits.webkit.org/196172@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225314 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-11-30 04:39:50 +00:00
heap/HeapCellType.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
heap/HeapFinalizerCallback.cpp
heap/HeapHelperPool.cpp
heap/HeapProfiler.cpp
heap/HeapSnapshot.cpp
heap/HeapSnapshotBuilder.cpp
heap/IncrementalSweeper.cpp
GC should support isoheaps https://bugs.webkit.org/show_bug.cgi?id=179288 Reviewed by Saam Barati. Source/JavaScriptCore: This expands the power of the Subspace API in JSC: - Everything associated with describing the types of objects is now part of the HeapCellType class. We have different HeapCellTypes for different destruction strategies. Any Subspace can use any HeapCellType; these are orthogonal things. - There are now two variants of Subspace: CompleteSubspace, which can allocate any size objects using any AlignedMemoryAllocator; and IsoSubspace, which can allocate just one size of object and uses a special virtual memory pool for that purpose. Like bmalloc's IsoHeap, IsoSubspace hoards virtual pages but releases the physical pages as part of the respective allocator's scavenging policy (the Scavenger in bmalloc for IsoHeap and the incremental sweep and full sweep in Riptide for IsoSubspace). So far, this patch just puts subtypes of ExecutableBase in IsoSubspaces. If it works, we can use it for more things. This does not have any effect on JetStream (0.18% faster with p = 0.69). * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/AccessCase.cpp: (JSC::AccessCase::generateImpl): * bytecode/ObjectAllocationProfileInlines.h: (JSC::ObjectAllocationProfile::initializeProfile): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::emitAllocateRawObject): (JSC::DFG::SpeculativeJIT::compileMakeRope): (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage): (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * ftl/FTLAbstractHeapRepository.h: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileMakeRope): (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewObject): (JSC::FTL::DFG::LowerDFGToB3::allocatePropertyStorageWithSizeImpl): (JSC::FTL::DFG::LowerDFGToB3::allocateObject): (JSC::FTL::DFG::LowerDFGToB3::allocatorForSize): * heap/AlignedMemoryAllocator.cpp: (JSC::AlignedMemoryAllocator::registerAllocator): (JSC::AlignedMemoryAllocator::registerSubspace): * heap/AlignedMemoryAllocator.h: (JSC::AlignedMemoryAllocator::firstAllocator const): * heap/AllocationFailureMode.h: Added. * heap/CompleteSubspace.cpp: Added. (JSC::CompleteSubspace::CompleteSubspace): (JSC::CompleteSubspace::~CompleteSubspace): (JSC::CompleteSubspace::allocatorFor): (JSC::CompleteSubspace::allocate): (JSC::CompleteSubspace::allocateNonVirtual): (JSC::CompleteSubspace::allocatorForSlow): (JSC::CompleteSubspace::allocateSlow): (JSC::CompleteSubspace::tryAllocateSlow): * heap/CompleteSubspace.h: Added. (JSC::CompleteSubspace::offsetOfAllocatorForSizeStep): (JSC::CompleteSubspace::allocatorForSizeStep): (JSC::CompleteSubspace::allocatorForNonVirtual): * heap/HeapCellType.cpp: Added. (JSC::HeapCellType::HeapCellType): (JSC::HeapCellType::~HeapCellType): (JSC::HeapCellType::finishSweep): (JSC::HeapCellType::destroy): * heap/HeapCellType.h: Added. (JSC::HeapCellType::attributes const): * heap/IsoAlignedMemoryAllocator.cpp: Added. (JSC::IsoAlignedMemoryAllocator::IsoAlignedMemoryAllocator): (JSC::IsoAlignedMemoryAllocator::~IsoAlignedMemoryAllocator): (JSC::IsoAlignedMemoryAllocator::tryAllocateAlignedMemory): (JSC::IsoAlignedMemoryAllocator::freeAlignedMemory): (JSC::IsoAlignedMemoryAllocator::dump const): * heap/IsoAlignedMemoryAllocator.h: Added. * heap/IsoSubspace.cpp: Added. (JSC::IsoSubspace::IsoSubspace): (JSC::IsoSubspace::~IsoSubspace): (JSC::IsoSubspace::allocatorFor): (JSC::IsoSubspace::allocatorForNonVirtual): (JSC::IsoSubspace::allocate): (JSC::IsoSubspace::allocateNonVirtual): * heap/IsoSubspace.h: Added. (JSC::IsoSubspace::size const): * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::MarkedAllocator): (JSC::MarkedAllocator::setSubspace): (JSC::MarkedAllocator::allocateSlowCase): (JSC::MarkedAllocator::tryAllocateSlowCase): Deleted. (JSC::MarkedAllocator::allocateSlowCaseImpl): Deleted. * heap/MarkedAllocator.h: (JSC::MarkedAllocator::nextAllocatorInAlignedMemoryAllocator const): (JSC::MarkedAllocator::setNextAllocatorInAlignedMemoryAllocator): * heap/MarkedAllocatorInlines.h: (JSC::MarkedAllocator::allocate): (JSC::MarkedAllocator::tryAllocate): Deleted. * heap/MarkedBlock.h: * heap/MarkedBlockInlines.h: (JSC::MarkedBlock::Handle::finishSweepKnowingHeapCellType): (JSC::MarkedBlock::Handle::finishSweepKnowingSubspace): Deleted. * heap/MarkedSpace.cpp: (JSC::MarkedSpace::addMarkedAllocator): * heap/MarkedSpace.h: * heap/Subspace.cpp: (JSC::Subspace::Subspace): (JSC::Subspace::initialize): (JSC::Subspace::finishSweep): (JSC::Subspace::destroy): (JSC::Subspace::prepareForAllocation): (JSC::Subspace::findEmptyBlockToSteal): (): Deleted. (JSC::Subspace::allocate): Deleted. (JSC::Subspace::tryAllocate): Deleted. (JSC::Subspace::allocatorForSlow): Deleted. (JSC::Subspace::allocateSlow): Deleted. (JSC::Subspace::tryAllocateSlow): Deleted. (JSC::Subspace::didAllocate): Deleted. * heap/Subspace.h: (JSC::Subspace::heapCellType const): (JSC::Subspace::nextSubspaceInAlignedMemoryAllocator const): (JSC::Subspace::setNextSubspaceInAlignedMemoryAllocator): (JSC::Subspace::offsetOfAllocatorForSizeStep): Deleted. (JSC::Subspace::allocatorForSizeStep): Deleted. (JSC::Subspace::tryAllocatorFor): Deleted. (JSC::Subspace::allocatorFor): Deleted. * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::emitAllocateJSObjectWithKnownSize): (JSC::AssemblyHelpers::emitAllocateVariableSized): (JSC::AssemblyHelpers::emitAllocateVariableSizedCell): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_new_object): * runtime/ButterflyInlines.h: (JSC::Butterfly::createUninitialized): (JSC::Butterfly::tryCreate): (JSC::Butterfly::growArrayRight): * runtime/DirectArguments.cpp: (JSC::DirectArguments::overrideThings): * runtime/DirectArguments.h: (JSC::DirectArguments::subspaceFor): * runtime/DirectEvalExecutable.h: * runtime/EvalExecutable.h: * runtime/ExecutableBase.h: (JSC::ExecutableBase::subspaceFor): * runtime/FunctionExecutable.h: * runtime/GenericArgumentsInlines.h: (JSC::GenericArguments<Type>::initModifiedArgumentsDescriptor): * runtime/HashMapImpl.h: (JSC::HashMapBuffer::create): * runtime/IndirectEvalExecutable.h: * runtime/JSArray.cpp: (JSC::JSArray::tryCreateUninitializedRestricted): (JSC::JSArray::unshiftCountSlowCase): * runtime/JSArray.h: (JSC::JSArray::tryCreate): * runtime/JSArrayBufferView.cpp: (JSC::JSArrayBufferView::ConstructionContext::ConstructionContext): * runtime/JSCell.h: (JSC::subspaceFor): * runtime/JSCellInlines.h: (JSC::JSCell::subspaceFor): (JSC::tryAllocateCellHelper): (JSC::allocateCell): (JSC::tryAllocateCell): * runtime/JSDestructibleObject.h: (JSC::JSDestructibleObject::subspaceFor): * runtime/JSDestructibleObjectHeapCellType.cpp: Copied from Source/JavaScriptCore/runtime/JSDestructibleObjectSubspace.cpp. (JSC::JSDestructibleObjectHeapCellType::JSDestructibleObjectHeapCellType): (JSC::JSDestructibleObjectHeapCellType::~JSDestructibleObjectHeapCellType): (JSC::JSDestructibleObjectHeapCellType::finishSweep): (JSC::JSDestructibleObjectHeapCellType::destroy): (JSC::JSDestructibleObjectSubspace::JSDestructibleObjectSubspace): Deleted. (JSC::JSDestructibleObjectSubspace::~JSDestructibleObjectSubspace): Deleted. (JSC::JSDestructibleObjectSubspace::finishSweep): Deleted. (JSC::JSDestructibleObjectSubspace::destroy): Deleted. * runtime/JSDestructibleObjectHeapCellType.h: Copied from Source/JavaScriptCore/runtime/JSDestructibleObjectSubspace.h. * runtime/JSDestructibleObjectSubspace.cpp: Removed. * runtime/JSDestructibleObjectSubspace.h: Removed. * runtime/JSLexicalEnvironment.h: (JSC::JSLexicalEnvironment::subspaceFor): * runtime/JSSegmentedVariableObject.h: (JSC::JSSegmentedVariableObject::subspaceFor): * runtime/JSSegmentedVariableObjectHeapCellType.cpp: Copied from Source/JavaScriptCore/runtime/JSSegmentedVariableObjectSubspace.cpp. (JSC::JSSegmentedVariableObjectHeapCellType::JSSegmentedVariableObjectHeapCellType): (JSC::JSSegmentedVariableObjectHeapCellType::~JSSegmentedVariableObjectHeapCellType): (JSC::JSSegmentedVariableObjectHeapCellType::finishSweep): (JSC::JSSegmentedVariableObjectHeapCellType::destroy): (JSC::JSSegmentedVariableObjectSubspace::JSSegmentedVariableObjectSubspace): Deleted. (JSC::JSSegmentedVariableObjectSubspace::~JSSegmentedVariableObjectSubspace): Deleted. (JSC::JSSegmentedVariableObjectSubspace::finishSweep): Deleted. (JSC::JSSegmentedVariableObjectSubspace::destroy): Deleted. * runtime/JSSegmentedVariableObjectHeapCellType.h: Copied from Source/JavaScriptCore/runtime/JSSegmentedVariableObjectSubspace.h. * runtime/JSSegmentedVariableObjectSubspace.cpp: Removed. * runtime/JSSegmentedVariableObjectSubspace.h: Removed. * runtime/JSString.h: (JSC::JSString::subspaceFor): * runtime/JSStringHeapCellType.cpp: Copied from Source/JavaScriptCore/runtime/JSStringSubspace.cpp. (JSC::JSStringHeapCellType::JSStringHeapCellType): (JSC::JSStringHeapCellType::~JSStringHeapCellType): (JSC::JSStringHeapCellType::finishSweep): (JSC::JSStringHeapCellType::destroy): (JSC::JSStringSubspace::JSStringSubspace): Deleted. (JSC::JSStringSubspace::~JSStringSubspace): Deleted. (JSC::JSStringSubspace::finishSweep): Deleted. (JSC::JSStringSubspace::destroy): Deleted. * runtime/JSStringHeapCellType.h: Copied from Source/JavaScriptCore/runtime/JSStringSubspace.h. * runtime/JSStringSubspace.cpp: Removed. * runtime/JSStringSubspace.h: Removed. * runtime/ModuleProgramExecutable.h: * runtime/NativeExecutable.h: * runtime/ProgramExecutable.h: * runtime/RegExpMatchesArray.h: (JSC::tryCreateUninitializedRegExpMatchesArray): * runtime/ScopedArguments.h: (JSC::ScopedArguments::subspaceFor): * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: (JSC::VM::gigacageAuxiliarySpace): * wasm/js/JSWebAssemblyCodeBlock.h: * wasm/js/JSWebAssemblyCodeBlockHeapCellType.cpp: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyCodeBlockSubspace.cpp. (JSC::JSWebAssemblyCodeBlockHeapCellType::JSWebAssemblyCodeBlockHeapCellType): (JSC::JSWebAssemblyCodeBlockHeapCellType::~JSWebAssemblyCodeBlockHeapCellType): (JSC::JSWebAssemblyCodeBlockHeapCellType::finishSweep): (JSC::JSWebAssemblyCodeBlockHeapCellType::destroy): (JSC::JSWebAssemblyCodeBlockSubspace::JSWebAssemblyCodeBlockSubspace): Deleted. (JSC::JSWebAssemblyCodeBlockSubspace::~JSWebAssemblyCodeBlockSubspace): Deleted. (JSC::JSWebAssemblyCodeBlockSubspace::finishSweep): Deleted. (JSC::JSWebAssemblyCodeBlockSubspace::destroy): Deleted. * wasm/js/JSWebAssemblyCodeBlockHeapCellType.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyCodeBlockSubspace.h. * wasm/js/JSWebAssemblyCodeBlockSubspace.cpp: Removed. * wasm/js/JSWebAssemblyCodeBlockSubspace.h: Removed. * wasm/js/JSWebAssemblyMemory.h: (JSC::JSWebAssemblyMemory::subspaceFor): Source/WebCore: No new tests because no new behavior. Adopting changes in JSC Subspace API. * ForwardingHeaders/runtime/JSDestructibleObjectHeapCellType.h: Added. * ForwardingHeaders/runtime/JSSegmentedVariableObjectHeapCellType.h: Added. * bindings/js/JSDOMWrapper.cpp: (WebCore::outputConstraintSubspaceFor): (WebCore::globalObjectOutputConstraintSubspaceFor): * bindings/js/JSDOMWrapper.h: * bindings/js/WebCoreJSClientData.cpp: (WebCore::JSVMClientData::JSVMClientData): * bindings/js/WebCoreJSClientData.h: (WebCore::JSVMClientData::outputConstraintSpace): (WebCore::JSVMClientData::globalObjectOutputConstraintSpace): * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): Source/WTF: One of my favorite data structures in the GC is a singly-linked list that knows its tail, so that things get added to it at the end rather that at the beginning. In this patch, I use this to put the same node on multiple lists, which our existing linked list templates also don't support. This adds a new linked list that does those things: - It supports append(). It could also support prepend(), but currently there is no need for it. - It supports nodes that are on multiple lists. The GC uses std::mem_fn() to create a lambda that the list uses to set next. * WTF.xcodeproj/project.pbxproj: * wtf/SinglyLinkedListWithTail.h: Added. (WTF::SinglyLinkedListWithTail::isEmpty const): (WTF::SinglyLinkedListWithTail::append): (WTF::SinglyLinkedListWithTail::first const): (WTF::SinglyLinkedListWithTail::last const): Canonical link: https://commits.webkit.org/196172@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225314 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-11-30 04:39:50 +00:00
heap/IsoAlignedMemoryAllocator.cpp
It should be possible to flag a cell for unconditional finalization https://bugs.webkit.org/show_bug.cgi?id=180636 Reviewed by Saam Barati. Source/JavaScriptCore: UnconditionalFinalizers were annoying - you had to allocate them and you had to manage a global linked list - but they had some nice properties: - You only did the hardest work (creating the UnconditionalFinalizer) on first GC where you survived and needed it. -> Just needing it wasn't enough. -> Just surviving wasn't enough. The new API based on IsoSubspaces meant that just surviving was enough to cause unconditional finalizer logic to be invoked. I think that's not great. InferredType got around this by making InferredStructure a cell, but this was a gross hack. For one, it meant that InferredStructure would survive during the GC in which its finalizer obviated the need for its existence. It's not really an idiom I want us to repeat because it sounds like the sort of thing that turns out to be subtly broken. We really need to have a way of indicating when you have entered into the state that requires your unconditional finalizer to be invoked. Basically, we want to be able to track the set of objects that need unconditional finalizers. Only the subset of that set that overlaps with the set of marked objects needs to be accurate. The easiest way to do this is a hierarchy of bitvectors: one to say which MarkedBlocks have objects that have unconditional finalizers, and another level to say which atoms within a MarkedBlock have unconditional finalizers. This change introduces IsoCellSet, which couples itself to the MarkedAllocator of some IsoSubspace to allow maintaining a set of objects (well, cells - you could do this with auxiliaries) that belong to that IsoSubspace. It'll have undefined behavior if you try to add/remove/contains an object that isn't in that IsoSubspace. For objects in that subspace, you can add/remove/contains and forEachMarkedCell. The cost of each IsoCellSet is at worst about 0.8% increase in size to every object in the subspace that the set is attached to. So, it makes sense to have a handful per subspace max. This change only needs one per subspace, but you could imagine more if we do this for WeakReferenceHarvester. To absolutely minimize the possibility that this incurs costs, the add/remove/contains functions can be used from any thread so long as forEachMarkedCell isn't running. This means that InferredType only needs to add itself to the set during visitChildren. Thus, it needs to both survive and need it for the hardest work to take place. The work of adding does involve a gnarly load chain that ends in a CAS: load block handle from block, load index, load segment, load bitvector, load bit -> if not set, then CAS. That's five dependent loads! However, it's perfect for running in parallel since the only write operations are to widely dispersed cache lines that contain the bits underlying the set. The best part is how forEachMarkedCell works. That skips blocks that don't have any objects that need unconditional finalizers, and only touches the memory of marked objects that have the unconditional finalizer bit set. It will walk those objects in roughly address order. I previously found that this speeds up walking over a lot of objects when I made similar changes for DOM GC (calling visitAdditionalChildren via forEachMarkedCell rather than by walking a HashSet). This change makes InferredStructure be a malloc object again, but now it's in an IsoHeap. My expectation for this change is that it's perf-neutral. Long-term, it gives us a path forward for eliminating UnconditionalFinalizer and WeakReferenceHarvester while using IsoSubspace in more places. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * heap/AtomIndices.h: Added. (JSC::AtomIndices::AtomIndices): * heap/Heap.cpp: (JSC::Heap::finalizeUnconditionalFinalizers): * heap/Heap.h: * heap/IsoCellSet.cpp: Added. (JSC::IsoCellSet::IsoCellSet): (JSC::IsoCellSet::~IsoCellSet): (JSC::IsoCellSet::addSlow): (JSC::IsoCellSet::didResizeBits): (JSC::IsoCellSet::didRemoveBlock): (JSC::IsoCellSet::sweepToFreeList): * heap/IsoCellSet.h: Added. * heap/IsoCellSetInlines.h: Added. (JSC::IsoCellSet::add): (JSC::IsoCellSet::remove): (JSC::IsoCellSet::contains const): (JSC::IsoCellSet::forEachMarkedCell): * heap/IsoSubspace.cpp: (JSC::IsoSubspace::didResizeBits): (JSC::IsoSubspace::didRemoveBlock): (JSC::IsoSubspace::didBeginSweepingToFreeList): * heap/IsoSubspace.h: * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::addBlock): (JSC::MarkedAllocator::removeBlock): * heap/MarkedAllocator.h: * heap/MarkedAllocatorInlines.h: * heap/MarkedBlock.cpp: (JSC::MarkedBlock::Handle::sweep): (JSC::MarkedBlock::Handle::isEmpty): Deleted. * heap/MarkedBlock.h: (JSC::MarkedBlock::marks const): (JSC::MarkedBlock::Handle::newlyAllocated const): * heap/MarkedBlockInlines.h: (JSC::MarkedBlock::Handle::isAllocated): (JSC::MarkedBlock::Handle::isEmpty): (JSC::MarkedBlock::Handle::emptyMode): (JSC::MarkedBlock::Handle::forEachMarkedCell): * heap/Subspace.cpp: (JSC::Subspace::didResizeBits): (JSC::Subspace::didRemoveBlock): (JSC::Subspace::didBeginSweepingToFreeList): * heap/Subspace.h: * heap/SubspaceInlines.h: (JSC::Subspace::forEachMarkedCell): * runtime/InferredStructure.cpp: (JSC::InferredStructure::InferredStructure): (JSC::InferredStructure::create): Deleted. (JSC::InferredStructure::destroy): Deleted. (JSC::InferredStructure::createStructure): Deleted. (JSC::InferredStructure::visitChildren): Deleted. (JSC::InferredStructure::finalizeUnconditionally): Deleted. (JSC::InferredStructure::finishCreation): Deleted. * runtime/InferredStructure.h: * runtime/InferredStructureWatchpoint.cpp: (JSC::InferredStructureWatchpoint::fireInternal): * runtime/InferredType.cpp: (JSC::InferredType::visitChildren): (JSC::InferredType::willStoreValueSlow): (JSC::InferredType::makeTopSlow): (JSC::InferredType::set): (JSC::InferredType::removeStructure): (JSC::InferredType::finalizeUnconditionally): * runtime/InferredType.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Source/WTF: This adds ConcurrentVector, which is like SegmentedVector, but wastes some space to allow resizing to proceed concurrently to access. It's not possible to resize concurrently to resizing, concurrent read/writes aren't protected from racing if they access the same element, and who knows what you'll get if you iterate up to size() while someone else append()s. The key insight is to stash all prior copies of the spine, so that nobody crashes trying to access a stale spine. I'm going to want to do the same thing for FastBitVector, by creating a segmented WordOwner class. That would require repeating the dance of having a spine that can resize while stashing old versions. So, the spine resizing logic is abstracted behind ConcurrentBuffer. You could use that as a kind of "concurrent vector" for immutable data. That's how ConcurrentVector uses it: it's an immutable array of segment pointers. * WTF.xcodeproj/project.pbxproj: * wtf/ConcurrentBuffer.h: Added. (WTF::ConcurrentBuffer::ConcurrentBuffer): (WTF::ConcurrentBuffer::~ConcurrentBuffer): (WTF::ConcurrentBuffer::growExact): (WTF::ConcurrentBuffer::grow): (WTF::ConcurrentBuffer::array const): (WTF::ConcurrentBuffer::operator[]): (WTF::ConcurrentBuffer::operator[] const): (WTF::ConcurrentBuffer::createArray): * wtf/ConcurrentVector.h: Added. (WTF::ConcurrentVectorIterator::~ConcurrentVectorIterator): (WTF::ConcurrentVectorIterator::operator* const): (WTF::ConcurrentVectorIterator::operator-> const): (WTF::ConcurrentVectorIterator::operator++): (WTF::ConcurrentVectorIterator::operator== const): (WTF::ConcurrentVectorIterator::operator!= const): (WTF::ConcurrentVectorIterator::operator=): (WTF::ConcurrentVectorIterator::ConcurrentVectorIterator): (WTF::ConcurrentVector::~ConcurrentVector): (WTF::ConcurrentVector::size const): (WTF::ConcurrentVector::isEmpty const): (WTF::ConcurrentVector::at): (WTF::ConcurrentVector::at const): (WTF::ConcurrentVector::operator[]): (WTF::ConcurrentVector::operator[] const): (WTF::ConcurrentVector::first): (WTF::ConcurrentVector::first const): (WTF::ConcurrentVector::last): (WTF::ConcurrentVector::last const): (WTF::ConcurrentVector::takeLast): (WTF::ConcurrentVector::append): (WTF::ConcurrentVector::alloc): (WTF::ConcurrentVector::removeLast): (WTF::ConcurrentVector::grow): (WTF::ConcurrentVector::begin): (WTF::ConcurrentVector::end): (WTF::ConcurrentVector::segmentExistsFor): (WTF::ConcurrentVector::segmentFor): (WTF::ConcurrentVector::subscriptFor): (WTF::ConcurrentVector::ensureSegmentsFor): (WTF::ConcurrentVector::ensureSegment): (WTF::ConcurrentVector::allocateSegment): Canonical link: https://commits.webkit.org/196644@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225831 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-13 02:35:54 +00:00
heap/IsoCellSet.cpp
[JSC] IsoHeapCellType should have destroy function member instead of specializing template function https://bugs.webkit.org/show_bug.cgi?id=205152 Reviewed by Saam Barati. We were specializing MarkedBlock::Handle::specializedSweep in 5 different ways for each IsoSubspace-ed cell. This bloats binary. Instead of specializing it with CellType, we specialize it with one functor, which invokes function pointer held by IsoHeapCellType. This requires one indirect function call per cell. But this is OK since, 1. We were using JSDestructibleObject's cell->classInfo->methodTable.destroy function call to dispatch destruction, before IsoSubspace replaces them with IsoHeapCellType-based destruction. Compared to that, the new one is still saving one pointer chasing basically (classInfo dereference, we assume cell deference is no cost since it will be done anyway). 2. We still keep JSString's destroy function inlining by using IsoInlinedHeapCellType. This is important since it is critical to performance and we had JSStringHeapCellType before we replaced it with IsoHeapCellType. But IsoInlinedHeapCellType specialization is for only one class so generated binary size is the same to the old code using JSStringHeapCellType. This saves 480KB binary-size in JavaScriptCore. And more importantly, after this patch, adding IsoSubspace will not bloat code, so we can simply put things into IsoSubspace. This patch also removes `using namespace JSC;` in global code in JavaScriptCore except for API codes, since it starts causing build failure due to unified builds: API defines JSType enum in a global scope, which is different from our JSC::JSType. If we do `using namespace JSC;` in a global scope, it can lead to ambiguity of looking up. * API/JSHeapFinalizerPrivate.cpp: (JSContextGroupAddHeapFinalizer): (JSContextGroupRemoveHeapFinalizer): * API/JSHeapFinalizerPrivate.h: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/AbstractMacroAssembler.cpp: * bindings/ScriptFunctionCall.cpp: * bindings/ScriptObject.cpp: * bindings/ScriptValue.cpp: * heap/IsoHeapCellType.cpp: Copied from Source/JavaScriptCore/assembler/AbstractMacroAssembler.cpp. (JSC::IsoHeapCellType::finishSweep): (JSC::IsoHeapCellType::destroy): * heap/IsoHeapCellType.h: * heap/IsoInlinedHeapCellType.h: Copied from Source/JavaScriptCore/heap/IsoHeapCellType.h. * heap/MutatorState.cpp: * heap/Synchronousness.cpp: * inspector/InjectedScriptHost.cpp: * inspector/InjectedScriptManager.cpp: * inspector/JSGlobalObjectConsoleClient.cpp: * inspector/JSGlobalObjectInspectorController.cpp: * inspector/JSGlobalObjectScriptDebugServer.cpp: * inspector/JSInjectedScriptHost.cpp: * inspector/JSInjectedScriptHostPrototype.cpp: * inspector/JSJavaScriptCallFrame.cpp: * inspector/JSJavaScriptCallFramePrototype.cpp: * inspector/JavaScriptCallFrame.cpp: * inspector/PerGlobalObjectWrapperWorld.cpp: * inspector/ScriptCallStackFactory.cpp: * inspector/ScriptDebugServer.cpp: * inspector/agents/InspectorHeapAgent.cpp: * inspector/agents/InspectorScriptProfilerAgent.cpp: * inspector/agents/JSGlobalObjectAuditAgent.cpp: * inspector/agents/JSGlobalObjectDebuggerAgent.cpp: * inspector/agents/JSGlobalObjectRuntimeAgent.cpp: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Canonical link: https://commits.webkit.org/218351@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253423 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-12-12 09:36:13 +00:00
heap/IsoHeapCellType.cpp
GC should support isoheaps https://bugs.webkit.org/show_bug.cgi?id=179288 Reviewed by Saam Barati. Source/JavaScriptCore: This expands the power of the Subspace API in JSC: - Everything associated with describing the types of objects is now part of the HeapCellType class. We have different HeapCellTypes for different destruction strategies. Any Subspace can use any HeapCellType; these are orthogonal things. - There are now two variants of Subspace: CompleteSubspace, which can allocate any size objects using any AlignedMemoryAllocator; and IsoSubspace, which can allocate just one size of object and uses a special virtual memory pool for that purpose. Like bmalloc's IsoHeap, IsoSubspace hoards virtual pages but releases the physical pages as part of the respective allocator's scavenging policy (the Scavenger in bmalloc for IsoHeap and the incremental sweep and full sweep in Riptide for IsoSubspace). So far, this patch just puts subtypes of ExecutableBase in IsoSubspaces. If it works, we can use it for more things. This does not have any effect on JetStream (0.18% faster with p = 0.69). * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/AccessCase.cpp: (JSC::AccessCase::generateImpl): * bytecode/ObjectAllocationProfileInlines.h: (JSC::ObjectAllocationProfile::initializeProfile): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::emitAllocateRawObject): (JSC::DFG::SpeculativeJIT::compileMakeRope): (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage): (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * ftl/FTLAbstractHeapRepository.h: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileMakeRope): (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewObject): (JSC::FTL::DFG::LowerDFGToB3::allocatePropertyStorageWithSizeImpl): (JSC::FTL::DFG::LowerDFGToB3::allocateObject): (JSC::FTL::DFG::LowerDFGToB3::allocatorForSize): * heap/AlignedMemoryAllocator.cpp: (JSC::AlignedMemoryAllocator::registerAllocator): (JSC::AlignedMemoryAllocator::registerSubspace): * heap/AlignedMemoryAllocator.h: (JSC::AlignedMemoryAllocator::firstAllocator const): * heap/AllocationFailureMode.h: Added. * heap/CompleteSubspace.cpp: Added. (JSC::CompleteSubspace::CompleteSubspace): (JSC::CompleteSubspace::~CompleteSubspace): (JSC::CompleteSubspace::allocatorFor): (JSC::CompleteSubspace::allocate): (JSC::CompleteSubspace::allocateNonVirtual): (JSC::CompleteSubspace::allocatorForSlow): (JSC::CompleteSubspace::allocateSlow): (JSC::CompleteSubspace::tryAllocateSlow): * heap/CompleteSubspace.h: Added. (JSC::CompleteSubspace::offsetOfAllocatorForSizeStep): (JSC::CompleteSubspace::allocatorForSizeStep): (JSC::CompleteSubspace::allocatorForNonVirtual): * heap/HeapCellType.cpp: Added. (JSC::HeapCellType::HeapCellType): (JSC::HeapCellType::~HeapCellType): (JSC::HeapCellType::finishSweep): (JSC::HeapCellType::destroy): * heap/HeapCellType.h: Added. (JSC::HeapCellType::attributes const): * heap/IsoAlignedMemoryAllocator.cpp: Added. (JSC::IsoAlignedMemoryAllocator::IsoAlignedMemoryAllocator): (JSC::IsoAlignedMemoryAllocator::~IsoAlignedMemoryAllocator): (JSC::IsoAlignedMemoryAllocator::tryAllocateAlignedMemory): (JSC::IsoAlignedMemoryAllocator::freeAlignedMemory): (JSC::IsoAlignedMemoryAllocator::dump const): * heap/IsoAlignedMemoryAllocator.h: Added. * heap/IsoSubspace.cpp: Added. (JSC::IsoSubspace::IsoSubspace): (JSC::IsoSubspace::~IsoSubspace): (JSC::IsoSubspace::allocatorFor): (JSC::IsoSubspace::allocatorForNonVirtual): (JSC::IsoSubspace::allocate): (JSC::IsoSubspace::allocateNonVirtual): * heap/IsoSubspace.h: Added. (JSC::IsoSubspace::size const): * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::MarkedAllocator): (JSC::MarkedAllocator::setSubspace): (JSC::MarkedAllocator::allocateSlowCase): (JSC::MarkedAllocator::tryAllocateSlowCase): Deleted. (JSC::MarkedAllocator::allocateSlowCaseImpl): Deleted. * heap/MarkedAllocator.h: (JSC::MarkedAllocator::nextAllocatorInAlignedMemoryAllocator const): (JSC::MarkedAllocator::setNextAllocatorInAlignedMemoryAllocator): * heap/MarkedAllocatorInlines.h: (JSC::MarkedAllocator::allocate): (JSC::MarkedAllocator::tryAllocate): Deleted. * heap/MarkedBlock.h: * heap/MarkedBlockInlines.h: (JSC::MarkedBlock::Handle::finishSweepKnowingHeapCellType): (JSC::MarkedBlock::Handle::finishSweepKnowingSubspace): Deleted. * heap/MarkedSpace.cpp: (JSC::MarkedSpace::addMarkedAllocator): * heap/MarkedSpace.h: * heap/Subspace.cpp: (JSC::Subspace::Subspace): (JSC::Subspace::initialize): (JSC::Subspace::finishSweep): (JSC::Subspace::destroy): (JSC::Subspace::prepareForAllocation): (JSC::Subspace::findEmptyBlockToSteal): (): Deleted. (JSC::Subspace::allocate): Deleted. (JSC::Subspace::tryAllocate): Deleted. (JSC::Subspace::allocatorForSlow): Deleted. (JSC::Subspace::allocateSlow): Deleted. (JSC::Subspace::tryAllocateSlow): Deleted. (JSC::Subspace::didAllocate): Deleted. * heap/Subspace.h: (JSC::Subspace::heapCellType const): (JSC::Subspace::nextSubspaceInAlignedMemoryAllocator const): (JSC::Subspace::setNextSubspaceInAlignedMemoryAllocator): (JSC::Subspace::offsetOfAllocatorForSizeStep): Deleted. (JSC::Subspace::allocatorForSizeStep): Deleted. (JSC::Subspace::tryAllocatorFor): Deleted. (JSC::Subspace::allocatorFor): Deleted. * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::emitAllocateJSObjectWithKnownSize): (JSC::AssemblyHelpers::emitAllocateVariableSized): (JSC::AssemblyHelpers::emitAllocateVariableSizedCell): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_new_object): * runtime/ButterflyInlines.h: (JSC::Butterfly::createUninitialized): (JSC::Butterfly::tryCreate): (JSC::Butterfly::growArrayRight): * runtime/DirectArguments.cpp: (JSC::DirectArguments::overrideThings): * runtime/DirectArguments.h: (JSC::DirectArguments::subspaceFor): * runtime/DirectEvalExecutable.h: * runtime/EvalExecutable.h: * runtime/ExecutableBase.h: (JSC::ExecutableBase::subspaceFor): * runtime/FunctionExecutable.h: * runtime/GenericArgumentsInlines.h: (JSC::GenericArguments<Type>::initModifiedArgumentsDescriptor): * runtime/HashMapImpl.h: (JSC::HashMapBuffer::create): * runtime/IndirectEvalExecutable.h: * runtime/JSArray.cpp: (JSC::JSArray::tryCreateUninitializedRestricted): (JSC::JSArray::unshiftCountSlowCase): * runtime/JSArray.h: (JSC::JSArray::tryCreate): * runtime/JSArrayBufferView.cpp: (JSC::JSArrayBufferView::ConstructionContext::ConstructionContext): * runtime/JSCell.h: (JSC::subspaceFor): * runtime/JSCellInlines.h: (JSC::JSCell::subspaceFor): (JSC::tryAllocateCellHelper): (JSC::allocateCell): (JSC::tryAllocateCell): * runtime/JSDestructibleObject.h: (JSC::JSDestructibleObject::subspaceFor): * runtime/JSDestructibleObjectHeapCellType.cpp: Copied from Source/JavaScriptCore/runtime/JSDestructibleObjectSubspace.cpp. (JSC::JSDestructibleObjectHeapCellType::JSDestructibleObjectHeapCellType): (JSC::JSDestructibleObjectHeapCellType::~JSDestructibleObjectHeapCellType): (JSC::JSDestructibleObjectHeapCellType::finishSweep): (JSC::JSDestructibleObjectHeapCellType::destroy): (JSC::JSDestructibleObjectSubspace::JSDestructibleObjectSubspace): Deleted. (JSC::JSDestructibleObjectSubspace::~JSDestructibleObjectSubspace): Deleted. (JSC::JSDestructibleObjectSubspace::finishSweep): Deleted. (JSC::JSDestructibleObjectSubspace::destroy): Deleted. * runtime/JSDestructibleObjectHeapCellType.h: Copied from Source/JavaScriptCore/runtime/JSDestructibleObjectSubspace.h. * runtime/JSDestructibleObjectSubspace.cpp: Removed. * runtime/JSDestructibleObjectSubspace.h: Removed. * runtime/JSLexicalEnvironment.h: (JSC::JSLexicalEnvironment::subspaceFor): * runtime/JSSegmentedVariableObject.h: (JSC::JSSegmentedVariableObject::subspaceFor): * runtime/JSSegmentedVariableObjectHeapCellType.cpp: Copied from Source/JavaScriptCore/runtime/JSSegmentedVariableObjectSubspace.cpp. (JSC::JSSegmentedVariableObjectHeapCellType::JSSegmentedVariableObjectHeapCellType): (JSC::JSSegmentedVariableObjectHeapCellType::~JSSegmentedVariableObjectHeapCellType): (JSC::JSSegmentedVariableObjectHeapCellType::finishSweep): (JSC::JSSegmentedVariableObjectHeapCellType::destroy): (JSC::JSSegmentedVariableObjectSubspace::JSSegmentedVariableObjectSubspace): Deleted. (JSC::JSSegmentedVariableObjectSubspace::~JSSegmentedVariableObjectSubspace): Deleted. (JSC::JSSegmentedVariableObjectSubspace::finishSweep): Deleted. (JSC::JSSegmentedVariableObjectSubspace::destroy): Deleted. * runtime/JSSegmentedVariableObjectHeapCellType.h: Copied from Source/JavaScriptCore/runtime/JSSegmentedVariableObjectSubspace.h. * runtime/JSSegmentedVariableObjectSubspace.cpp: Removed. * runtime/JSSegmentedVariableObjectSubspace.h: Removed. * runtime/JSString.h: (JSC::JSString::subspaceFor): * runtime/JSStringHeapCellType.cpp: Copied from Source/JavaScriptCore/runtime/JSStringSubspace.cpp. (JSC::JSStringHeapCellType::JSStringHeapCellType): (JSC::JSStringHeapCellType::~JSStringHeapCellType): (JSC::JSStringHeapCellType::finishSweep): (JSC::JSStringHeapCellType::destroy): (JSC::JSStringSubspace::JSStringSubspace): Deleted. (JSC::JSStringSubspace::~JSStringSubspace): Deleted. (JSC::JSStringSubspace::finishSweep): Deleted. (JSC::JSStringSubspace::destroy): Deleted. * runtime/JSStringHeapCellType.h: Copied from Source/JavaScriptCore/runtime/JSStringSubspace.h. * runtime/JSStringSubspace.cpp: Removed. * runtime/JSStringSubspace.h: Removed. * runtime/ModuleProgramExecutable.h: * runtime/NativeExecutable.h: * runtime/ProgramExecutable.h: * runtime/RegExpMatchesArray.h: (JSC::tryCreateUninitializedRegExpMatchesArray): * runtime/ScopedArguments.h: (JSC::ScopedArguments::subspaceFor): * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: (JSC::VM::gigacageAuxiliarySpace): * wasm/js/JSWebAssemblyCodeBlock.h: * wasm/js/JSWebAssemblyCodeBlockHeapCellType.cpp: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyCodeBlockSubspace.cpp. (JSC::JSWebAssemblyCodeBlockHeapCellType::JSWebAssemblyCodeBlockHeapCellType): (JSC::JSWebAssemblyCodeBlockHeapCellType::~JSWebAssemblyCodeBlockHeapCellType): (JSC::JSWebAssemblyCodeBlockHeapCellType::finishSweep): (JSC::JSWebAssemblyCodeBlockHeapCellType::destroy): (JSC::JSWebAssemblyCodeBlockSubspace::JSWebAssemblyCodeBlockSubspace): Deleted. (JSC::JSWebAssemblyCodeBlockSubspace::~JSWebAssemblyCodeBlockSubspace): Deleted. (JSC::JSWebAssemblyCodeBlockSubspace::finishSweep): Deleted. (JSC::JSWebAssemblyCodeBlockSubspace::destroy): Deleted. * wasm/js/JSWebAssemblyCodeBlockHeapCellType.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyCodeBlockSubspace.h. * wasm/js/JSWebAssemblyCodeBlockSubspace.cpp: Removed. * wasm/js/JSWebAssemblyCodeBlockSubspace.h: Removed. * wasm/js/JSWebAssemblyMemory.h: (JSC::JSWebAssemblyMemory::subspaceFor): Source/WebCore: No new tests because no new behavior. Adopting changes in JSC Subspace API. * ForwardingHeaders/runtime/JSDestructibleObjectHeapCellType.h: Added. * ForwardingHeaders/runtime/JSSegmentedVariableObjectHeapCellType.h: Added. * bindings/js/JSDOMWrapper.cpp: (WebCore::outputConstraintSubspaceFor): (WebCore::globalObjectOutputConstraintSubspaceFor): * bindings/js/JSDOMWrapper.h: * bindings/js/WebCoreJSClientData.cpp: (WebCore::JSVMClientData::JSVMClientData): * bindings/js/WebCoreJSClientData.h: (WebCore::JSVMClientData::outputConstraintSpace): (WebCore::JSVMClientData::globalObjectOutputConstraintSpace): * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): Source/WTF: One of my favorite data structures in the GC is a singly-linked list that knows its tail, so that things get added to it at the end rather that at the beginning. In this patch, I use this to put the same node on multiple lists, which our existing linked list templates also don't support. This adds a new linked list that does those things: - It supports append(). It could also support prepend(), but currently there is no need for it. - It supports nodes that are on multiple lists. The GC uses std::mem_fn() to create a lambda that the list uses to set next. * WTF.xcodeproj/project.pbxproj: * wtf/SinglyLinkedListWithTail.h: Added. (WTF::SinglyLinkedListWithTail::isEmpty const): (WTF::SinglyLinkedListWithTail::append): (WTF::SinglyLinkedListWithTail::first const): (WTF::SinglyLinkedListWithTail::last const): Canonical link: https://commits.webkit.org/196172@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225314 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-11-30 04:39:50 +00:00
heap/IsoSubspace.cpp
The InternalFunction hierarchy should be in IsoSubspaces https://bugs.webkit.org/show_bug.cgi?id=184721 Reviewed by Saam Barati. Source/JavaScriptCore: This moves InternalFunction into a IsoSubspace. It also moves all subclasses into IsoSubspaces, but subclasses that are the same size as InternalFunction share its subspace. I did this because the subclasses appear to just override methods, which are called dynamically via the structure or class of the object. So, I don't see a type confusion risk if UAF is used to allocate one kind of InternalFunction over another. * API/JSBase.h: * API/JSCallbackFunction.h: * API/ObjCCallbackFunction.h: (JSC::ObjCCallbackFunction::subspaceFor): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * heap/IsoSubspacePerVM.cpp: Added. (JSC::IsoSubspacePerVM::AutoremovingIsoSubspace::AutoremovingIsoSubspace): (JSC::IsoSubspacePerVM::AutoremovingIsoSubspace::~AutoremovingIsoSubspace): (JSC::IsoSubspacePerVM::IsoSubspacePerVM): (JSC::IsoSubspacePerVM::~IsoSubspacePerVM): (JSC::IsoSubspacePerVM::forVM): * heap/IsoSubspacePerVM.h: Added. (JSC::IsoSubspacePerVM::SubspaceParameters::SubspaceParameters): * runtime/Error.h: * runtime/ErrorConstructor.h: * runtime/InternalFunction.h: (JSC::InternalFunction::subspaceFor): * runtime/IntlCollatorConstructor.h: * runtime/IntlDateTimeFormatConstructor.h: * runtime/IntlNumberFormatConstructor.h: * runtime/JSArrayBufferConstructor.h: * runtime/NativeErrorConstructor.h: * runtime/ProxyRevoke.h: * runtime/RegExpConstructor.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Source/WebCore: No new tests because no new behavior. * bindings/js/WebCoreJSClientData.cpp: (WebCore::JSVMClientData::JSVMClientData): * bindings/js/WebCoreJSClientData.h: (WebCore::JSVMClientData::runtimeMethodSpace): * bridge/runtime_method.cpp: (JSC::RuntimeMethod::subspaceForImpl): * bridge/runtime_method.h: Source/WebKit: * WebProcess/Plugins/Netscape/JSNPMethod.cpp: (WebKit::JSNPMethod::subspaceForImpl): * WebProcess/Plugins/Netscape/JSNPMethod.h: (WebKit::JSNPMethod::create): Deleted. (WebKit::JSNPMethod::npIdentifier const): Deleted. (WebKit::JSNPMethod::createStructure): Deleted. * WebProcess/Plugins/Netscape/JSNPObject.cpp: (WebKit::JSNPObject::subspaceForImpl): * WebProcess/Plugins/Netscape/JSNPObject.h: (WebKit::JSNPObject::create): Deleted. (WebKit::JSNPObject::npObject const): Deleted. (WebKit::JSNPObject::createStructure): Deleted. Canonical link: https://commits.webkit.org/200292@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230813 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-19 19:33:03 +00:00
heap/IsoSubspacePerVM.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
heap/JITStubRoutineSet.cpp
[JSC] Rename LargeAllocation to PreciseAllocation https://bugs.webkit.org/show_bug.cgi?id=204040 Reviewed by Keith Miller. After r252298, LargeAllocation is also used for small allocations. This patch renames from LargeAllocation to PreciseAllocation since it reflects the behavior. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * heap/CellContainer.cpp: (JSC::CellContainer::isNewlyAllocated const): * heap/CellContainer.h: (JSC::CellContainer::CellContainer): (JSC::CellContainer::isMarkedBlock const): (JSC::CellContainer::isPreciseAllocation const): (JSC::CellContainer::preciseAllocation const): (JSC::CellContainer::isLargeAllocation const): Deleted. (JSC::CellContainer::largeAllocation const): Deleted. * heap/CellContainerInlines.h: (JSC::CellContainer::vm const): (JSC::CellContainer::isMarked const): (JSC::CellContainer::noteMarked): (JSC::CellContainer::assertValidCell const): (JSC::CellContainer::cellSize const): (JSC::CellContainer::weakSet const): (JSC::CellContainer::aboutToMark): (JSC::CellContainer::areMarksStale const): * heap/CompleteSubspace.cpp: (JSC::CompleteSubspace::tryAllocateSlow): (JSC::CompleteSubspace::reallocatePreciseAllocationNonVirtual): (JSC::CompleteSubspace::reallocateLargeAllocationNonVirtual): Deleted. * heap/CompleteSubspace.h: * heap/Heap.cpp: (JSC::Heap::sweepInFinalize): * heap/HeapCell.cpp: (JSC::HeapCell::isLive): * heap/HeapCell.h: * heap/HeapCellInlines.h: (JSC::HeapCell::isPreciseAllocation const): (JSC::HeapCell::cellContainer const): (JSC::HeapCell::preciseAllocation const): (JSC::HeapCell::vm const): (JSC::HeapCell::cellSize const): (JSC::HeapCell::cellAttributes const): (JSC::HeapCell::subspace const): (JSC::HeapCell::isLargeAllocation const): Deleted. (JSC::HeapCell::largeAllocation const): Deleted. * heap/HeapInlines.h: (JSC::Heap::isMarked): (JSC::Heap::testAndSetMarked): * heap/HeapUtil.h: (JSC::HeapUtil::findGCObjectPointersForMarking): (JSC::HeapUtil::isPointerGCObjectJSCell): (JSC::HeapUtil::isValueGCObject): * heap/IsoAlignedMemoryAllocator.cpp: (JSC::IsoAlignedMemoryAllocator::tryReallocateMemory): * heap/IsoCellSetInlines.h: (JSC::IsoCellSet::add): (JSC::IsoCellSet::remove): (JSC::IsoCellSet::contains const): (JSC::IsoCellSet::forEachMarkedCell): (JSC::IsoCellSet::forEachMarkedCellInParallel): (JSC::IsoCellSet::forEachLiveCell): * heap/IsoSubspace.cpp: (JSC::IsoSubspace::tryAllocateFromLowerTier): (JSC::IsoSubspace::sweepLowerTierCell): (JSC::IsoSubspace::destroyLowerTierFreeList): * heap/IsoSubspace.h: * heap/MarkedSpace.cpp: (JSC::MarkedSpace::freeMemory): (JSC::MarkedSpace::lastChanceToFinalize): (JSC::MarkedSpace::sweepPreciseAllocations): (JSC::MarkedSpace::prepareForAllocation): (JSC::MarkedSpace::enablePreciseAllocationTracking): (JSC::MarkedSpace::prepareForConservativeScan): (JSC::MarkedSpace::prepareForMarking): (JSC::MarkedSpace::resumeAllocating): (JSC::MarkedSpace::isPagedOut): (JSC::MarkedSpace::beginMarking): (JSC::MarkedSpace::endMarking): (JSC::MarkedSpace::objectCount): (JSC::MarkedSpace::size): (JSC::MarkedSpace::sweepLargeAllocations): Deleted. (JSC::MarkedSpace::enableLargeAllocationTracking): Deleted. * heap/MarkedSpace.h: (JSC::MarkedSpace:: const): (JSC::MarkedSpace::preciseAllocationsNurseryOffset const): (JSC::MarkedSpace::preciseAllocationsOffsetForThisCollection const): (JSC::MarkedSpace::preciseAllocationsForThisCollectionBegin const): (JSC::MarkedSpace::preciseAllocationsForThisCollectionEnd const): (JSC::MarkedSpace::preciseAllocationsForThisCollectionSize const): (JSC::MarkedSpace::largeAllocationsNurseryOffset const): Deleted. (JSC::MarkedSpace::largeAllocationsOffsetForThisCollection const): Deleted. (JSC::MarkedSpace::largeAllocationsForThisCollectionBegin const): Deleted. (JSC::MarkedSpace::largeAllocationsForThisCollectionEnd const): Deleted. (JSC::MarkedSpace::largeAllocationsForThisCollectionSize const): Deleted. * heap/MarkedSpaceInlines.h: (JSC::MarkedSpace::forEachLiveCell): (JSC::MarkedSpace::forEachDeadCell): * heap/PreciseAllocation.cpp: Renamed from Source/JavaScriptCore/heap/LargeAllocation.cpp. (JSC::isAlignedForPreciseAllocation): (JSC::PreciseAllocation::tryCreate): (JSC::PreciseAllocation::tryReallocate): (JSC::PreciseAllocation::createForLowerTier): (JSC::PreciseAllocation::reuseForLowerTier): (JSC::PreciseAllocation::PreciseAllocation): (JSC::PreciseAllocation::~PreciseAllocation): (JSC::PreciseAllocation::lastChanceToFinalize): (JSC::PreciseAllocation::shrink): (JSC::PreciseAllocation::visitWeakSet): (JSC::PreciseAllocation::reapWeakSet): (JSC::PreciseAllocation::flip): (JSC::PreciseAllocation::isEmpty): (JSC::PreciseAllocation::sweep): (JSC::PreciseAllocation::destroy): (JSC::PreciseAllocation::dump const): (JSC::PreciseAllocation::assertValidCell const): * heap/PreciseAllocation.h: Renamed from Source/JavaScriptCore/heap/LargeAllocation.h. (JSC::PreciseAllocation::fromCell): (JSC::PreciseAllocation::isPreciseAllocation): (JSC::PreciseAllocation::headerSize): (JSC::PreciseAllocation::basePointer const): * heap/SlotVisitor.cpp: (JSC::SlotVisitor::appendHiddenSlowImpl): (JSC::SlotVisitor::appendToMarkStack): * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::appendUnbarriered): (JSC::SlotVisitor::appendHiddenUnbarriered): * heap/Subspace.h: * heap/SubspaceInlines.h: (JSC::Subspace::forEachPreciseAllocation): (JSC::Subspace::forEachMarkedCell): (JSC::Subspace::forEachMarkedCellInParallel): (JSC::Subspace::forEachLiveCell): (JSC::Subspace::forEachLargeAllocation): Deleted. * heap/WeakBlock.cpp: (JSC::WeakBlock::visit): * heap/WeakSet.cpp: (JSC::WeakSet::sweep): * llint/LowLevelInterpreter.asm: * runtime/ButterflyInlines.h: (JSC::Butterfly::reallocArrayRightIfPossible): * runtime/OptionsList.h: * runtime/SamplingProfiler.cpp: (JSC::SamplingProfiler::SamplingProfiler): * tools/VMInspector.cpp: (JSC::VMInspector::isInHeap): * tools/VMInspectorInlines.h: (JSC::VMInspector::verifyCell): Canonical link: https://commits.webkit.org/217365@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252302 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-09 03:45:18 +00:00
heap/PreciseAllocation.cpp
JSC GC should support TLCs (thread local caches) https://bugs.webkit.org/show_bug.cgi?id=181559 Reviewed by Mark Lam and Saam Barati. Source/JavaScriptCore: This is a big step towards object distancing by site origin. This patch implements TLCs, or thread-local caches, which allow each thread to allocate from its own free lists. It also means that any given thread can context-switch TLCs. This will allow us to do separate allocation for separate site origins. Eventually, once we reshape how MarkedBlock looks, this will allow us to have a hard distancing constraint between objects from different origins. In this new design, every "size class" is represented as a BlockDirectory (formerly known as MarkedAllocator, prior to r226822). This contains a bag of blocks allocated using some aligned memory allocator (which roughly represents which cage you came out of), and anyone using the same allocator can share those blocks - but so long as they are in that BlockDirectory, they will have the size and type of that directory. Previously, each BlockDirectory had exactly one FreeList. Now, each BlockDirectory has a double-linked-list of LocalAllocators, each of which has a FreeList. To decide which LocalAllocator to allocate out of, we need a ThreadLocalCache and a BlockDirectory. The directory gives us an offset-within-the-ThreadLocalCache, which we simply call the Allocator (which is just a POD type that contains a 32-bit offset). Each allocation starts by figuring out what Allocator it wants (often we have this information at JIT time). Then the allocation loads its ThreadLocalCache::Data from a fast TLS slot. Then we add the Allocator offset to the ThreadLocalCache::Data to get the LocalAllocator. Note that we use offsets as opposed to indices to make it easy to do the math on each allocation (if LocalAllocator had a weird size then every allocation would have to do an imul). This is a definite slow-down on GC-heavy benchmarks, but by a small margin, and only on unusually heavy tests. For example, boyer and splay are both 3% regressed, but the Octane geomean is just fine. The JetStream score regressed by 0.5% with p = 0.08 (so maybe there is something there, but it's not significant according to our threshold). Relanding after fixing ARM64 bug in AssemblyHelpers::emitAllocateWithNonNullAllocator(). That function needs to be careful to avoid using the scratch register because the FTL will call it in disallow-scratch-register mode. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * b3/B3LowerToAir.cpp: * b3/B3PatchpointSpecial.cpp: (JSC::B3::PatchpointSpecial::admitsStack): * b3/B3StackmapSpecial.cpp: (JSC::B3::StackmapSpecial::forEachArgImpl): (JSC::B3::StackmapSpecial::isArgValidForRep): * b3/B3StackmapValue.cpp: (JSC::B3::StackmapValue::appendSomeRegisterWithClobber): * b3/B3StackmapValue.h: * b3/B3Validate.cpp: * b3/B3ValueRep.cpp: (JSC::B3::ValueRep::addUsedRegistersTo const): (JSC::B3::ValueRep::dump const): (WTF::printInternal): * b3/B3ValueRep.h: (JSC::B3::ValueRep::ValueRep): * bytecode/AccessCase.cpp: (JSC::AccessCase::generateImpl): * bytecode/ObjectAllocationProfile.h: (JSC::ObjectAllocationProfile::ObjectAllocationProfile): (JSC::ObjectAllocationProfile::clear): * bytecode/ObjectAllocationProfileInlines.h: (JSC::ObjectAllocationProfile::initializeProfile): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::emitAllocateRawObject): (JSC::DFG::SpeculativeJIT::compileMakeRope): (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage): (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage): (JSC::DFG::SpeculativeJIT::compileCreateThis): (JSC::DFG::SpeculativeJIT::compileNewObject): * dfg/DFGSpeculativeJIT.h: (JSC::DFG::SpeculativeJIT::emitAllocateJSCell): (JSC::DFG::SpeculativeJIT::emitAllocateJSObject): * ftl/FTLAbstractHeapRepository.h: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileMakeRope): (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewObject): (JSC::FTL::DFG::LowerDFGToB3::allocatePropertyStorageWithSizeImpl): (JSC::FTL::DFG::LowerDFGToB3::allocateHeapCell): (JSC::FTL::DFG::LowerDFGToB3::allocateObject): (JSC::FTL::DFG::LowerDFGToB3::allocatorForSize): (JSC::FTL::DFG::LowerDFGToB3::allocateVariableSizedObject): (JSC::FTL::DFG::LowerDFGToB3::allocateVariableSizedCell): * heap/Allocator.cpp: Added. (JSC::Allocator::cellSize const): * heap/Allocator.h: Added. (JSC::Allocator::Allocator): (JSC::Allocator::offset const): (JSC::Allocator::operator== const): (JSC::Allocator::operator!= const): (JSC::Allocator::operator bool const): * heap/AllocatorInlines.h: Added. (JSC::Allocator::allocate const): (JSC::Allocator::tryAllocate const): * heap/BlockDirectory.cpp: (JSC::BlockDirectory::BlockDirectory): (JSC::BlockDirectory::findBlockForAllocation): (JSC::BlockDirectory::stopAllocating): (JSC::BlockDirectory::prepareForAllocation): (JSC::BlockDirectory::stopAllocatingForGood): (JSC::BlockDirectory::resumeAllocating): (JSC::BlockDirectory::endMarking): (JSC::BlockDirectory::isFreeListedCell): (JSC::BlockDirectory::didConsumeFreeList): Deleted. (JSC::BlockDirectory::tryAllocateWithoutCollecting): Deleted. (JSC::BlockDirectory::allocateIn): Deleted. (JSC::BlockDirectory::tryAllocateIn): Deleted. (JSC::BlockDirectory::doTestCollectionsIfNeeded): Deleted. (JSC::BlockDirectory::allocateSlowCase): Deleted. * heap/BlockDirectory.h: (JSC::BlockDirectory::cellKind const): (JSC::BlockDirectory::allocator const): (JSC::BlockDirectory::freeList const): Deleted. (JSC::BlockDirectory::offsetOfFreeList): Deleted. (JSC::BlockDirectory::offsetOfCellSize): Deleted. * heap/BlockDirectoryInlines.h: (JSC::BlockDirectory::isFreeListedCell const): Deleted. (JSC::BlockDirectory::allocate): Deleted. * heap/CompleteSubspace.cpp: (JSC::CompleteSubspace::CompleteSubspace): (JSC::CompleteSubspace::allocatorFor): (JSC::CompleteSubspace::allocate): (JSC::CompleteSubspace::allocateNonVirtual): (JSC::CompleteSubspace::allocatorForSlow): (JSC::CompleteSubspace::allocateSlow): (JSC::CompleteSubspace::tryAllocateSlow): * heap/CompleteSubspace.h: (JSC::CompleteSubspace::allocatorForSizeStep): (JSC::CompleteSubspace::allocatorForNonVirtual): * heap/FreeList.h: * heap/GCDeferralContext.h: * heap/Heap.cpp: (JSC::Heap::Heap): (JSC::Heap::lastChanceToFinalize): * heap/Heap.h: (JSC::Heap::threadLocalCacheLayout): * heap/IsoCellSet.h: * heap/IsoSubspace.cpp: (JSC::IsoSubspace::IsoSubspace): (JSC::IsoSubspace::allocatorFor): (JSC::IsoSubspace::allocate): (JSC::IsoSubspace::allocateNonVirtual): * heap/IsoSubspace.h: (JSC::IsoSubspace::allocatorForNonVirtual): * heap/LocalAllocator.cpp: Added. (JSC::LocalAllocator::LocalAllocator): (JSC::LocalAllocator::reset): (JSC::LocalAllocator::~LocalAllocator): (JSC::LocalAllocator::stopAllocating): (JSC::LocalAllocator::resumeAllocating): (JSC::LocalAllocator::prepareForAllocation): (JSC::LocalAllocator::stopAllocatingForGood): (JSC::LocalAllocator::allocateSlowCase): (JSC::LocalAllocator::didConsumeFreeList): (JSC::LocalAllocator::tryAllocateWithoutCollecting): (JSC::LocalAllocator::allocateIn): (JSC::LocalAllocator::tryAllocateIn): (JSC::LocalAllocator::doTestCollectionsIfNeeded): (JSC::LocalAllocator::isFreeListedCell const): * heap/LocalAllocator.h: Added. (JSC::LocalAllocator::offsetOfFreeList): (JSC::LocalAllocator::offsetOfCellSize): * heap/LocalAllocatorInlines.h: Added. (JSC::LocalAllocator::allocate): * heap/MarkedSpace.cpp: (JSC::MarkedSpace::stopAllocatingForGood): * heap/MarkedSpace.h: * heap/SlotVisitor.cpp: * heap/SlotVisitor.h: * heap/Subspace.h: * heap/ThreadLocalCache.cpp: Added. (JSC::ThreadLocalCache::create): (JSC::ThreadLocalCache::ThreadLocalCache): (JSC::ThreadLocalCache::~ThreadLocalCache): (JSC::ThreadLocalCache::allocateData): (JSC::ThreadLocalCache::destroyData): (JSC::ThreadLocalCache::installSlow): (JSC::ThreadLocalCache::installData): (JSC::ThreadLocalCache::allocatorSlow): (JSC::ThreadLocalCache::destructor): * heap/ThreadLocalCache.h: Added. (JSC::ThreadLocalCache::offsetOfSize): (JSC::ThreadLocalCache::offsetOfFirstAllocator): * heap/ThreadLocalCacheInlines.h: Added. (JSC::ThreadLocalCache::getImpl): (JSC::ThreadLocalCache::get): (JSC::ThreadLocalCache::install): (JSC::ThreadLocalCache::allocator): (JSC::ThreadLocalCache::tryGetAllocator): * heap/ThreadLocalCacheLayout.cpp: Added. (JSC::ThreadLocalCacheLayout::ThreadLocalCacheLayout): (JSC::ThreadLocalCacheLayout::~ThreadLocalCacheLayout): (JSC::ThreadLocalCacheLayout::allocateOffset): (JSC::ThreadLocalCacheLayout::snapshot): (JSC::ThreadLocalCacheLayout::directory): * heap/ThreadLocalCacheLayout.h: Added. * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::emitAllocateWithNonNullAllocator): (JSC::AssemblyHelpers::emitAllocate): (JSC::AssemblyHelpers::emitAllocateVariableSized): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::vm): (JSC::AssemblyHelpers::emitAllocateJSCell): (JSC::AssemblyHelpers::emitAllocateJSObject): (JSC::AssemblyHelpers::emitAllocateJSObjectWithKnownSize): (JSC::AssemblyHelpers::emitAllocateWithNonNullAllocator): Deleted. (JSC::AssemblyHelpers::emitAllocate): Deleted. (JSC::AssemblyHelpers::emitAllocateVariableSized): Deleted. * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_new_object): (JSC::JIT::emit_op_create_this): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_new_object): (JSC::JIT::emit_op_create_this): * runtime/ButterflyInlines.h: (JSC::Butterfly::createUninitialized): (JSC::Butterfly::tryCreate): (JSC::Butterfly::growArrayRight): * runtime/DirectArguments.cpp: (JSC::DirectArguments::overrideThings): * runtime/GenericArgumentsInlines.h: (JSC::GenericArguments<Type>::initModifiedArgumentsDescriptor): * runtime/HashMapImpl.h: (JSC::HashMapBuffer::create): * runtime/JSArray.cpp: (JSC::JSArray::tryCreateUninitializedRestricted): (JSC::JSArray::unshiftCountSlowCase): * runtime/JSArray.h: (JSC::JSArray::tryCreate): * runtime/JSArrayBufferView.cpp: (JSC::JSArrayBufferView::ConstructionContext::ConstructionContext): * runtime/JSCellInlines.h: (JSC::tryAllocateCellHelper): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::JSGlobalObject): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::threadLocalCache const): * runtime/JSLock.cpp: (JSC::JSLock::didAcquireLock): * runtime/Options.h: * runtime/RegExpMatchesArray.h: (JSC::tryCreateUninitializedRegExpMatchesArray): * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: * runtime/VMEntryScope.cpp: (JSC::VMEntryScope::VMEntryScope): Source/WTF: * wtf/Bitmap.h: Just fixing a compile error. Canonical link: https://commits.webkit.org/197951@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227617 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-25 19:32:00 +00:00
heap/LocalAllocator.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
heap/MachineStackMarker.cpp
heap/MarkStack.cpp
GC constraint solving should be parallel https://bugs.webkit.org/show_bug.cgi?id=179934 Reviewed by JF Bastien. PerformanceTests: Added a version of splay that measures latency in a way that run-jsc-benchmarks groks. * Octane/splay.js: Added. (this.Setup.setup.setup): (this.TearDown.tearDown.tearDown): (Benchmark): (BenchmarkResult): (BenchmarkResult.prototype.valueOf): (BenchmarkSuite): (alert): (Math.random): (BenchmarkSuite.ResetRNG): (RunStep): (BenchmarkSuite.RunSuites): (BenchmarkSuite.CountBenchmarks): (BenchmarkSuite.GeometricMean): (BenchmarkSuite.GeometricMeanTime): (BenchmarkSuite.AverageAbovePercentile): (BenchmarkSuite.GeometricMeanLatency): (BenchmarkSuite.FormatScore): (BenchmarkSuite.prototype.NotifyStep): (BenchmarkSuite.prototype.NotifyResult): (BenchmarkSuite.prototype.NotifyError): (BenchmarkSuite.prototype.RunSingleBenchmark): (RunNextSetup): (RunNextBenchmark): (RunNextTearDown): (BenchmarkSuite.prototype.RunStep): (GeneratePayloadTree): (GenerateKey): (SplayUpdateStats): (InsertNewNode): (SplaySetup): (SplayTearDown): (SplayRun): (SplayTree): (SplayTree.prototype.isEmpty): (SplayTree.prototype.insert): (SplayTree.prototype.remove): (SplayTree.prototype.find): (SplayTree.prototype.findMax): (SplayTree.prototype.findGreatestLessThan): (SplayTree.prototype.exportKeys): (SplayTree.prototype.splay_): (SplayTree.Node): (SplayTree.Node.prototype.traverse_): (report): (start): Source/JavaScriptCore: This makes it possible to do constraint solving in parallel. This looks like a 1% Speedometer speed-up. It's more than 1% on trunk-Speedometer. The constraint solver supports running constraints in parallel in two different ways: - Run multiple constraints in parallel to each other. This only works for constraints that can tolerate other constraints running concurrently to them (constraint.concurrency() == ConstraintConcurrency::Concurrent). This is the most basic kind of parallelism that the constraint solver supports. All constraints except the JSC SPI constraints are concurrent. We could probably make them concurrent, but I'm playing it safe for now. - A constraint can create parallel work for itself, which the constraint solver will interleave with other stuff. A constraint can report that it has parallel work by returning ConstraintParallelism::Parallel from its executeImpl() function. Then the solver will allow that constraint's doParallelWorkImpl() function to run on as many GC marker threads as are available, for as long as that function wants to run. It's not possible to have a non-concurrent constraint that creates parallel work. The parallelism is implemented in terms of the existing GC marker threads. This turns out to be most natural for two reasons: - No need to start any other threads. - The constraints all want to be passed a SlotVisitor. Running on the marker threads means having access to those threads' SlotVisitors. Also, it means less load balancing. The solver will create work on each marking thread's SlotVisitor. When the solver is done "stealing" a marker thread, that thread will have work it can start doing immediately. Before this change, we had to contribute the work found by the constraint solver to the global worklist so that it could be distributed to the marker threads by load balancing. This change probably helps to avoid that load balancing step. A lot of this change is about making it easy to iterate GC data structures in parallel. This change makes almost all constraints parallel-enabled, but only the DOM's output constraint uses the parallel work API. That constraint iterates the marked cells in two subspaces. This change makes it very easy to compose parallel iterators over subspaces, allocators, blocks, and cells. The marked cell parallel iterator is composed out of parallel iterators for the others. A parallel iterator is just an iterator that can do an atomic next() very quickly. We abstract them using RefPtr<SharedTask<...()>>, where ... is the type returned from the iterator. We know it's done when it returns a falsish version of ... (in the current code, that's always a pointer type, so done is indicated by null). * API/JSMarkingConstraintPrivate.cpp: (JSContextGroupAddMarkingConstraint): * API/JSVirtualMachine.mm: (scanExternalObjectGraph): (scanExternalRememberedSet): * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/AccessCase.cpp: (JSC::AccessCase::propagateTransitions const): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::visitWeakly): (JSC::CodeBlock::shouldJettisonDueToOldAge): (JSC::shouldMarkTransition): (JSC::CodeBlock::propagateTransitions): (JSC::CodeBlock::determineLiveness): * dfg/DFGWorklist.cpp: * ftl/FTLCompile.cpp: (JSC::FTL::compile): * heap/ConstraintParallelism.h: Added. (WTF::printInternal): * heap/Heap.cpp: (JSC::Heap::Heap): (JSC::Heap::addToRememberedSet): (JSC::Heap::runFixpointPhase): (JSC::Heap::stopThePeriphery): (JSC::Heap::resumeThePeriphery): (JSC::Heap::addCoreConstraints): (JSC::Heap::setBonusVisitorTask): (JSC::Heap::runTaskInParallel): (JSC::Heap::forEachSlotVisitor): Deleted. * heap/Heap.h: (JSC::Heap::worldIsRunning const): (JSC::Heap::runFunctionInParallel): * heap/HeapInlines.h: (JSC::Heap::worldIsStopped const): (JSC::Heap::isMarked): (JSC::Heap::incrementDeferralDepth): (JSC::Heap::decrementDeferralDepth): (JSC::Heap::decrementDeferralDepthAndGCIfNeeded): (JSC::Heap::forEachSlotVisitor): (JSC::Heap::collectorBelievesThatTheWorldIsStopped const): Deleted. (JSC::Heap::isMarkedConcurrently): Deleted. * heap/HeapSnapshotBuilder.cpp: (JSC::HeapSnapshotBuilder::appendNode): * heap/LargeAllocation.h: (JSC::LargeAllocation::isMarked): (JSC::LargeAllocation::isMarkedConcurrently): Deleted. * heap/LockDuringMarking.h: (JSC::lockDuringMarking): * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::parallelNotEmptyBlockSource): * heap/MarkedAllocator.h: * heap/MarkedBlock.h: (JSC::MarkedBlock::aboutToMark): (JSC::MarkedBlock::isMarked): (JSC::MarkedBlock::areMarksStaleWithDependency): Deleted. (JSC::MarkedBlock::isMarkedConcurrently): Deleted. * heap/MarkedSpace.h: (JSC::MarkedSpace::activeWeakSetsBegin): (JSC::MarkedSpace::activeWeakSetsEnd): (JSC::MarkedSpace::newActiveWeakSetsBegin): (JSC::MarkedSpace::newActiveWeakSetsEnd): * heap/MarkingConstraint.cpp: (JSC::MarkingConstraint::MarkingConstraint): (JSC::MarkingConstraint::execute): (JSC::MarkingConstraint::quickWorkEstimate): (JSC::MarkingConstraint::workEstimate): (JSC::MarkingConstraint::doParallelWork): (JSC::MarkingConstraint::finishParallelWork): (JSC::MarkingConstraint::doParallelWorkImpl): (JSC::MarkingConstraint::finishParallelWorkImpl): * heap/MarkingConstraint.h: (JSC::MarkingConstraint::lastExecuteParallelism const): (JSC::MarkingConstraint::parallelism const): (JSC::MarkingConstraint::quickWorkEstimate): Deleted. (JSC::MarkingConstraint::workEstimate): Deleted. * heap/MarkingConstraintSet.cpp: (JSC::MarkingConstraintSet::MarkingConstraintSet): (JSC::MarkingConstraintSet::add): (JSC::MarkingConstraintSet::executeConvergence): (JSC::MarkingConstraintSet::executeConvergenceImpl): (JSC::MarkingConstraintSet::executeAll): (JSC::MarkingConstraintSet::ExecutionContext::ExecutionContext): Deleted. (JSC::MarkingConstraintSet::ExecutionContext::didVisitSomething const): Deleted. (JSC::MarkingConstraintSet::ExecutionContext::shouldTimeOut const): Deleted. (JSC::MarkingConstraintSet::ExecutionContext::drain): Deleted. (JSC::MarkingConstraintSet::ExecutionContext::didExecute const): Deleted. (JSC::MarkingConstraintSet::ExecutionContext::execute): Deleted. (): Deleted. * heap/MarkingConstraintSet.h: * heap/MarkingConstraintSolver.cpp: Added. (JSC::MarkingConstraintSolver::MarkingConstraintSolver): (JSC::MarkingConstraintSolver::~MarkingConstraintSolver): (JSC::MarkingConstraintSolver::didVisitSomething const): (JSC::MarkingConstraintSolver::execute): (JSC::MarkingConstraintSolver::drain): (JSC::MarkingConstraintSolver::converge): (JSC::MarkingConstraintSolver::runExecutionThread): (JSC::MarkingConstraintSolver::didExecute): * heap/MarkingConstraintSolver.h: Added. * heap/OpaqueRootSet.h: Removed. * heap/ParallelSourceAdapter.h: Added. (JSC::ParallelSourceAdapter::ParallelSourceAdapter): (JSC::createParallelSourceAdapter): * heap/SimpleMarkingConstraint.cpp: Added. (JSC::SimpleMarkingConstraint::SimpleMarkingConstraint): (JSC::SimpleMarkingConstraint::~SimpleMarkingConstraint): (JSC::SimpleMarkingConstraint::quickWorkEstimate): (JSC::SimpleMarkingConstraint::executeImpl): * heap/SimpleMarkingConstraint.h: Added. * heap/SlotVisitor.cpp: (JSC::SlotVisitor::didStartMarking): (JSC::SlotVisitor::reset): (JSC::SlotVisitor::appendToMarkStack): (JSC::SlotVisitor::visitChildren): (JSC::SlotVisitor::updateMutatorIsStopped): (JSC::SlotVisitor::mutatorIsStoppedIsUpToDate const): (JSC::SlotVisitor::drain): (JSC::SlotVisitor::performIncrementOfDraining): (JSC::SlotVisitor::didReachTermination): (JSC::SlotVisitor::hasWork): (JSC::SlotVisitor::drainFromShared): (JSC::SlotVisitor::drainInParallelPassively): (JSC::SlotVisitor::waitForTermination): (JSC::SlotVisitor::addOpaqueRoot): Deleted. (JSC::SlotVisitor::containsOpaqueRoot const): Deleted. (JSC::SlotVisitor::containsOpaqueRootTriState const): Deleted. (JSC::SlotVisitor::mergeIfNecessary): Deleted. (JSC::SlotVisitor::mergeOpaqueRootsIfProfitable): Deleted. (JSC::SlotVisitor::mergeOpaqueRoots): Deleted. * heap/SlotVisitor.h: * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::addOpaqueRoot): (JSC::SlotVisitor::containsOpaqueRoot const): (JSC::SlotVisitor::vm): (JSC::SlotVisitor::vm const): * heap/Subspace.cpp: (JSC::Subspace::parallelAllocatorSource): (JSC::Subspace::parallelNotEmptyMarkedBlockSource): * heap/Subspace.h: * heap/SubspaceInlines.h: (JSC::Subspace::forEachMarkedCellInParallel): * heap/VisitCounter.h: Added. (JSC::VisitCounter::VisitCounter): (JSC::VisitCounter::visitCount const): * heap/VisitingTimeout.h: Removed. * heap/WeakBlock.cpp: (JSC::WeakBlock::specializedVisit): * runtime/Structure.cpp: (JSC::Structure::isCheapDuringGC): (JSC::Structure::markIfCheap): Source/WebCore: No new tests because no change in behavior. This change is best tested using DOM-GC-intensive benchmarks like Speedometer and Dromaeo. This parallelizes the DOM's output constraint, and makes some small changes to make this more scalable. * ForwardingHeaders/heap/SimpleMarkingConstraint.h: Added. * ForwardingHeaders/heap/VisitingTimeout.h: Removed. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/DOMGCOutputConstraint.cpp: Added. (WebCore::DOMGCOutputConstraint::DOMGCOutputConstraint): (WebCore::DOMGCOutputConstraint::~DOMGCOutputConstraint): (WebCore::DOMGCOutputConstraint::executeImpl): (WebCore::DOMGCOutputConstraint::doParallelWorkImpl): (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl): * bindings/js/DOMGCOutputConstraint.h: Added. * bindings/js/WebCoreJSClientData.cpp: (WebCore::JSVMClientData::initNormalWorld): * dom/Node.cpp: (WebCore::Node::eventTargetDataConcurrently): (WebCore::Node::ensureEventTargetData): (WebCore::Node::clearEventTargetData): Source/WTF: This does some changes to make it easier to do parallel constraint solving: - I finally removed dependencyWith. This was a silly construct whose only purpose is to confuse people about what it means to have a dependency chain. I took that as an opportunity to grealy simplify the GC's use of dependency chaining. - Added more logic to Deque<>, since I use it for part of the load balancer. - Made it possible to profile lock contention. See https://bugs.webkit.org/show_bug.cgi?id=180250#c0 for some preliminary measurements. - Introduced holdLockIf, which makes it easy to perform predicated lock acquisition. We use that to pick a lock in WebCore. - Introduced CountingLock. It's like WTF::Lock except it also enables optimistic read transactions sorta like Java's StampedLock. * WTF.xcodeproj/project.pbxproj: * wtf/Atomics.h: (WTF::dependency): (WTF::DependencyWith::DependencyWith): Deleted. (WTF::dependencyWith): Deleted. * wtf/BitVector.h: (WTF::BitVector::iterator::operator++): * wtf/CMakeLists.txt: * wtf/ConcurrentPtrHashSet.cpp: Added. (WTF::ConcurrentPtrHashSet::ConcurrentPtrHashSet): (WTF::ConcurrentPtrHashSet::~ConcurrentPtrHashSet): (WTF::ConcurrentPtrHashSet::deleteOldTables): (WTF::ConcurrentPtrHashSet::clear): (WTF::ConcurrentPtrHashSet::initialize): (WTF::ConcurrentPtrHashSet::addSlow): (WTF::ConcurrentPtrHashSet::resizeIfNecessary): (WTF::ConcurrentPtrHashSet::resizeAndAdd): (WTF::ConcurrentPtrHashSet::Table::create): * wtf/ConcurrentPtrHashSet.h: Added. (WTF::ConcurrentPtrHashSet::contains): (WTF::ConcurrentPtrHashSet::add): (WTF::ConcurrentPtrHashSet::size const): (WTF::ConcurrentPtrHashSet::Table::maxLoad const): (WTF::ConcurrentPtrHashSet::hash): (WTF::ConcurrentPtrHashSet::cast): (WTF::ConcurrentPtrHashSet::containsImpl const): (WTF::ConcurrentPtrHashSet::addImpl): * wtf/Deque.h: (WTF::inlineCapacity>::takeFirst): * wtf/FastMalloc.h: * wtf/Lock.cpp: (WTF::LockBase::lockSlow): * wtf/Locker.h: (WTF::holdLockIf): * wtf/ScopedLambda.h: * wtf/SharedTask.h: (WTF::SharedTask<PassedResultType): (WTF::SharedTask<ResultType): Deleted. * wtf/StackShot.h: Added. (WTF::StackShot::StackShot): (WTF::StackShot::operator=): (WTF::StackShot::array const): (WTF::StackShot::size const): (WTF::StackShot::operator bool const): (WTF::StackShot::operator== const): (WTF::StackShot::hash const): (WTF::StackShot::isHashTableDeletedValue const): (WTF::StackShot::operator> const): (WTF::StackShot::deletedValueArray): (WTF::StackShotHash::hash): (WTF::StackShotHash::equal): * wtf/StackShotProfiler.h: Added. (WTF::StackShotProfiler::StackShotProfiler): (WTF::StackShotProfiler::profile): (WTF::StackShotProfiler::run): Tools: * Scripts/run-jsc-benchmarks: Add splay-latency test, since this change needed to be carefully validated with that benchmark. * TestWebKitAPI/CMakeLists.txt: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WTF/ConcurrentPtrHashSet.cpp: Added. This has unit tests of the new concurrent data structure. The tests focus on correctness under serial execution, which appears to be enough for now (it's so easy to catch a concurrency bug by just running the GC). (TestWebKitAPI::TEST): Canonical link: https://commits.webkit.org/196360@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225524 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-05 17:53:57 +00:00
heap/MarkStackMergingConstraint.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
heap/MarkedBlock.cpp
heap/MarkedSpace.cpp
heap/MarkingConstraint.cpp
heap/MarkingConstraintSet.cpp
GC constraint solving should be parallel https://bugs.webkit.org/show_bug.cgi?id=179934 Reviewed by JF Bastien. PerformanceTests: Added a version of splay that measures latency in a way that run-jsc-benchmarks groks. * Octane/splay.js: Added. (this.Setup.setup.setup): (this.TearDown.tearDown.tearDown): (Benchmark): (BenchmarkResult): (BenchmarkResult.prototype.valueOf): (BenchmarkSuite): (alert): (Math.random): (BenchmarkSuite.ResetRNG): (RunStep): (BenchmarkSuite.RunSuites): (BenchmarkSuite.CountBenchmarks): (BenchmarkSuite.GeometricMean): (BenchmarkSuite.GeometricMeanTime): (BenchmarkSuite.AverageAbovePercentile): (BenchmarkSuite.GeometricMeanLatency): (BenchmarkSuite.FormatScore): (BenchmarkSuite.prototype.NotifyStep): (BenchmarkSuite.prototype.NotifyResult): (BenchmarkSuite.prototype.NotifyError): (BenchmarkSuite.prototype.RunSingleBenchmark): (RunNextSetup): (RunNextBenchmark): (RunNextTearDown): (BenchmarkSuite.prototype.RunStep): (GeneratePayloadTree): (GenerateKey): (SplayUpdateStats): (InsertNewNode): (SplaySetup): (SplayTearDown): (SplayRun): (SplayTree): (SplayTree.prototype.isEmpty): (SplayTree.prototype.insert): (SplayTree.prototype.remove): (SplayTree.prototype.find): (SplayTree.prototype.findMax): (SplayTree.prototype.findGreatestLessThan): (SplayTree.prototype.exportKeys): (SplayTree.prototype.splay_): (SplayTree.Node): (SplayTree.Node.prototype.traverse_): (report): (start): Source/JavaScriptCore: This makes it possible to do constraint solving in parallel. This looks like a 1% Speedometer speed-up. It's more than 1% on trunk-Speedometer. The constraint solver supports running constraints in parallel in two different ways: - Run multiple constraints in parallel to each other. This only works for constraints that can tolerate other constraints running concurrently to them (constraint.concurrency() == ConstraintConcurrency::Concurrent). This is the most basic kind of parallelism that the constraint solver supports. All constraints except the JSC SPI constraints are concurrent. We could probably make them concurrent, but I'm playing it safe for now. - A constraint can create parallel work for itself, which the constraint solver will interleave with other stuff. A constraint can report that it has parallel work by returning ConstraintParallelism::Parallel from its executeImpl() function. Then the solver will allow that constraint's doParallelWorkImpl() function to run on as many GC marker threads as are available, for as long as that function wants to run. It's not possible to have a non-concurrent constraint that creates parallel work. The parallelism is implemented in terms of the existing GC marker threads. This turns out to be most natural for two reasons: - No need to start any other threads. - The constraints all want to be passed a SlotVisitor. Running on the marker threads means having access to those threads' SlotVisitors. Also, it means less load balancing. The solver will create work on each marking thread's SlotVisitor. When the solver is done "stealing" a marker thread, that thread will have work it can start doing immediately. Before this change, we had to contribute the work found by the constraint solver to the global worklist so that it could be distributed to the marker threads by load balancing. This change probably helps to avoid that load balancing step. A lot of this change is about making it easy to iterate GC data structures in parallel. This change makes almost all constraints parallel-enabled, but only the DOM's output constraint uses the parallel work API. That constraint iterates the marked cells in two subspaces. This change makes it very easy to compose parallel iterators over subspaces, allocators, blocks, and cells. The marked cell parallel iterator is composed out of parallel iterators for the others. A parallel iterator is just an iterator that can do an atomic next() very quickly. We abstract them using RefPtr<SharedTask<...()>>, where ... is the type returned from the iterator. We know it's done when it returns a falsish version of ... (in the current code, that's always a pointer type, so done is indicated by null). * API/JSMarkingConstraintPrivate.cpp: (JSContextGroupAddMarkingConstraint): * API/JSVirtualMachine.mm: (scanExternalObjectGraph): (scanExternalRememberedSet): * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/AccessCase.cpp: (JSC::AccessCase::propagateTransitions const): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::visitWeakly): (JSC::CodeBlock::shouldJettisonDueToOldAge): (JSC::shouldMarkTransition): (JSC::CodeBlock::propagateTransitions): (JSC::CodeBlock::determineLiveness): * dfg/DFGWorklist.cpp: * ftl/FTLCompile.cpp: (JSC::FTL::compile): * heap/ConstraintParallelism.h: Added. (WTF::printInternal): * heap/Heap.cpp: (JSC::Heap::Heap): (JSC::Heap::addToRememberedSet): (JSC::Heap::runFixpointPhase): (JSC::Heap::stopThePeriphery): (JSC::Heap::resumeThePeriphery): (JSC::Heap::addCoreConstraints): (JSC::Heap::setBonusVisitorTask): (JSC::Heap::runTaskInParallel): (JSC::Heap::forEachSlotVisitor): Deleted. * heap/Heap.h: (JSC::Heap::worldIsRunning const): (JSC::Heap::runFunctionInParallel): * heap/HeapInlines.h: (JSC::Heap::worldIsStopped const): (JSC::Heap::isMarked): (JSC::Heap::incrementDeferralDepth): (JSC::Heap::decrementDeferralDepth): (JSC::Heap::decrementDeferralDepthAndGCIfNeeded): (JSC::Heap::forEachSlotVisitor): (JSC::Heap::collectorBelievesThatTheWorldIsStopped const): Deleted. (JSC::Heap::isMarkedConcurrently): Deleted. * heap/HeapSnapshotBuilder.cpp: (JSC::HeapSnapshotBuilder::appendNode): * heap/LargeAllocation.h: (JSC::LargeAllocation::isMarked): (JSC::LargeAllocation::isMarkedConcurrently): Deleted. * heap/LockDuringMarking.h: (JSC::lockDuringMarking): * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::parallelNotEmptyBlockSource): * heap/MarkedAllocator.h: * heap/MarkedBlock.h: (JSC::MarkedBlock::aboutToMark): (JSC::MarkedBlock::isMarked): (JSC::MarkedBlock::areMarksStaleWithDependency): Deleted. (JSC::MarkedBlock::isMarkedConcurrently): Deleted. * heap/MarkedSpace.h: (JSC::MarkedSpace::activeWeakSetsBegin): (JSC::MarkedSpace::activeWeakSetsEnd): (JSC::MarkedSpace::newActiveWeakSetsBegin): (JSC::MarkedSpace::newActiveWeakSetsEnd): * heap/MarkingConstraint.cpp: (JSC::MarkingConstraint::MarkingConstraint): (JSC::MarkingConstraint::execute): (JSC::MarkingConstraint::quickWorkEstimate): (JSC::MarkingConstraint::workEstimate): (JSC::MarkingConstraint::doParallelWork): (JSC::MarkingConstraint::finishParallelWork): (JSC::MarkingConstraint::doParallelWorkImpl): (JSC::MarkingConstraint::finishParallelWorkImpl): * heap/MarkingConstraint.h: (JSC::MarkingConstraint::lastExecuteParallelism const): (JSC::MarkingConstraint::parallelism const): (JSC::MarkingConstraint::quickWorkEstimate): Deleted. (JSC::MarkingConstraint::workEstimate): Deleted. * heap/MarkingConstraintSet.cpp: (JSC::MarkingConstraintSet::MarkingConstraintSet): (JSC::MarkingConstraintSet::add): (JSC::MarkingConstraintSet::executeConvergence): (JSC::MarkingConstraintSet::executeConvergenceImpl): (JSC::MarkingConstraintSet::executeAll): (JSC::MarkingConstraintSet::ExecutionContext::ExecutionContext): Deleted. (JSC::MarkingConstraintSet::ExecutionContext::didVisitSomething const): Deleted. (JSC::MarkingConstraintSet::ExecutionContext::shouldTimeOut const): Deleted. (JSC::MarkingConstraintSet::ExecutionContext::drain): Deleted. (JSC::MarkingConstraintSet::ExecutionContext::didExecute const): Deleted. (JSC::MarkingConstraintSet::ExecutionContext::execute): Deleted. (): Deleted. * heap/MarkingConstraintSet.h: * heap/MarkingConstraintSolver.cpp: Added. (JSC::MarkingConstraintSolver::MarkingConstraintSolver): (JSC::MarkingConstraintSolver::~MarkingConstraintSolver): (JSC::MarkingConstraintSolver::didVisitSomething const): (JSC::MarkingConstraintSolver::execute): (JSC::MarkingConstraintSolver::drain): (JSC::MarkingConstraintSolver::converge): (JSC::MarkingConstraintSolver::runExecutionThread): (JSC::MarkingConstraintSolver::didExecute): * heap/MarkingConstraintSolver.h: Added. * heap/OpaqueRootSet.h: Removed. * heap/ParallelSourceAdapter.h: Added. (JSC::ParallelSourceAdapter::ParallelSourceAdapter): (JSC::createParallelSourceAdapter): * heap/SimpleMarkingConstraint.cpp: Added. (JSC::SimpleMarkingConstraint::SimpleMarkingConstraint): (JSC::SimpleMarkingConstraint::~SimpleMarkingConstraint): (JSC::SimpleMarkingConstraint::quickWorkEstimate): (JSC::SimpleMarkingConstraint::executeImpl): * heap/SimpleMarkingConstraint.h: Added. * heap/SlotVisitor.cpp: (JSC::SlotVisitor::didStartMarking): (JSC::SlotVisitor::reset): (JSC::SlotVisitor::appendToMarkStack): (JSC::SlotVisitor::visitChildren): (JSC::SlotVisitor::updateMutatorIsStopped): (JSC::SlotVisitor::mutatorIsStoppedIsUpToDate const): (JSC::SlotVisitor::drain): (JSC::SlotVisitor::performIncrementOfDraining): (JSC::SlotVisitor::didReachTermination): (JSC::SlotVisitor::hasWork): (JSC::SlotVisitor::drainFromShared): (JSC::SlotVisitor::drainInParallelPassively): (JSC::SlotVisitor::waitForTermination): (JSC::SlotVisitor::addOpaqueRoot): Deleted. (JSC::SlotVisitor::containsOpaqueRoot const): Deleted. (JSC::SlotVisitor::containsOpaqueRootTriState const): Deleted. (JSC::SlotVisitor::mergeIfNecessary): Deleted. (JSC::SlotVisitor::mergeOpaqueRootsIfProfitable): Deleted. (JSC::SlotVisitor::mergeOpaqueRoots): Deleted. * heap/SlotVisitor.h: * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::addOpaqueRoot): (JSC::SlotVisitor::containsOpaqueRoot const): (JSC::SlotVisitor::vm): (JSC::SlotVisitor::vm const): * heap/Subspace.cpp: (JSC::Subspace::parallelAllocatorSource): (JSC::Subspace::parallelNotEmptyMarkedBlockSource): * heap/Subspace.h: * heap/SubspaceInlines.h: (JSC::Subspace::forEachMarkedCellInParallel): * heap/VisitCounter.h: Added. (JSC::VisitCounter::VisitCounter): (JSC::VisitCounter::visitCount const): * heap/VisitingTimeout.h: Removed. * heap/WeakBlock.cpp: (JSC::WeakBlock::specializedVisit): * runtime/Structure.cpp: (JSC::Structure::isCheapDuringGC): (JSC::Structure::markIfCheap): Source/WebCore: No new tests because no change in behavior. This change is best tested using DOM-GC-intensive benchmarks like Speedometer and Dromaeo. This parallelizes the DOM's output constraint, and makes some small changes to make this more scalable. * ForwardingHeaders/heap/SimpleMarkingConstraint.h: Added. * ForwardingHeaders/heap/VisitingTimeout.h: Removed. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/DOMGCOutputConstraint.cpp: Added. (WebCore::DOMGCOutputConstraint::DOMGCOutputConstraint): (WebCore::DOMGCOutputConstraint::~DOMGCOutputConstraint): (WebCore::DOMGCOutputConstraint::executeImpl): (WebCore::DOMGCOutputConstraint::doParallelWorkImpl): (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl): * bindings/js/DOMGCOutputConstraint.h: Added. * bindings/js/WebCoreJSClientData.cpp: (WebCore::JSVMClientData::initNormalWorld): * dom/Node.cpp: (WebCore::Node::eventTargetDataConcurrently): (WebCore::Node::ensureEventTargetData): (WebCore::Node::clearEventTargetData): Source/WTF: This does some changes to make it easier to do parallel constraint solving: - I finally removed dependencyWith. This was a silly construct whose only purpose is to confuse people about what it means to have a dependency chain. I took that as an opportunity to grealy simplify the GC's use of dependency chaining. - Added more logic to Deque<>, since I use it for part of the load balancer. - Made it possible to profile lock contention. See https://bugs.webkit.org/show_bug.cgi?id=180250#c0 for some preliminary measurements. - Introduced holdLockIf, which makes it easy to perform predicated lock acquisition. We use that to pick a lock in WebCore. - Introduced CountingLock. It's like WTF::Lock except it also enables optimistic read transactions sorta like Java's StampedLock. * WTF.xcodeproj/project.pbxproj: * wtf/Atomics.h: (WTF::dependency): (WTF::DependencyWith::DependencyWith): Deleted. (WTF::dependencyWith): Deleted. * wtf/BitVector.h: (WTF::BitVector::iterator::operator++): * wtf/CMakeLists.txt: * wtf/ConcurrentPtrHashSet.cpp: Added. (WTF::ConcurrentPtrHashSet::ConcurrentPtrHashSet): (WTF::ConcurrentPtrHashSet::~ConcurrentPtrHashSet): (WTF::ConcurrentPtrHashSet::deleteOldTables): (WTF::ConcurrentPtrHashSet::clear): (WTF::ConcurrentPtrHashSet::initialize): (WTF::ConcurrentPtrHashSet::addSlow): (WTF::ConcurrentPtrHashSet::resizeIfNecessary): (WTF::ConcurrentPtrHashSet::resizeAndAdd): (WTF::ConcurrentPtrHashSet::Table::create): * wtf/ConcurrentPtrHashSet.h: Added. (WTF::ConcurrentPtrHashSet::contains): (WTF::ConcurrentPtrHashSet::add): (WTF::ConcurrentPtrHashSet::size const): (WTF::ConcurrentPtrHashSet::Table::maxLoad const): (WTF::ConcurrentPtrHashSet::hash): (WTF::ConcurrentPtrHashSet::cast): (WTF::ConcurrentPtrHashSet::containsImpl const): (WTF::ConcurrentPtrHashSet::addImpl): * wtf/Deque.h: (WTF::inlineCapacity>::takeFirst): * wtf/FastMalloc.h: * wtf/Lock.cpp: (WTF::LockBase::lockSlow): * wtf/Locker.h: (WTF::holdLockIf): * wtf/ScopedLambda.h: * wtf/SharedTask.h: (WTF::SharedTask<PassedResultType): (WTF::SharedTask<ResultType): Deleted. * wtf/StackShot.h: Added. (WTF::StackShot::StackShot): (WTF::StackShot::operator=): (WTF::StackShot::array const): (WTF::StackShot::size const): (WTF::StackShot::operator bool const): (WTF::StackShot::operator== const): (WTF::StackShot::hash const): (WTF::StackShot::isHashTableDeletedValue const): (WTF::StackShot::operator> const): (WTF::StackShot::deletedValueArray): (WTF::StackShotHash::hash): (WTF::StackShotHash::equal): * wtf/StackShotProfiler.h: Added. (WTF::StackShotProfiler::StackShotProfiler): (WTF::StackShotProfiler::profile): (WTF::StackShotProfiler::run): Tools: * Scripts/run-jsc-benchmarks: Add splay-latency test, since this change needed to be carefully validated with that benchmark. * TestWebKitAPI/CMakeLists.txt: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WTF/ConcurrentPtrHashSet.cpp: Added. This has unit tests of the new concurrent data structure. The tests focus on correctness under serial execution, which appears to be enough for now (it's so easy to catch a concurrency bug by just running the GC). (TestWebKitAPI::TEST): Canonical link: https://commits.webkit.org/196360@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225524 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-05 17:53:57 +00:00
heap/MarkingConstraintSolver.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
heap/MutatorScheduler.cpp
heap/MutatorState.cpp
heap/RootMarkReason.cpp
GC constraint solving should be parallel https://bugs.webkit.org/show_bug.cgi?id=179934 Reviewed by JF Bastien. PerformanceTests: Added a version of splay that measures latency in a way that run-jsc-benchmarks groks. * Octane/splay.js: Added. (this.Setup.setup.setup): (this.TearDown.tearDown.tearDown): (Benchmark): (BenchmarkResult): (BenchmarkResult.prototype.valueOf): (BenchmarkSuite): (alert): (Math.random): (BenchmarkSuite.ResetRNG): (RunStep): (BenchmarkSuite.RunSuites): (BenchmarkSuite.CountBenchmarks): (BenchmarkSuite.GeometricMean): (BenchmarkSuite.GeometricMeanTime): (BenchmarkSuite.AverageAbovePercentile): (BenchmarkSuite.GeometricMeanLatency): (BenchmarkSuite.FormatScore): (BenchmarkSuite.prototype.NotifyStep): (BenchmarkSuite.prototype.NotifyResult): (BenchmarkSuite.prototype.NotifyError): (BenchmarkSuite.prototype.RunSingleBenchmark): (RunNextSetup): (RunNextBenchmark): (RunNextTearDown): (BenchmarkSuite.prototype.RunStep): (GeneratePayloadTree): (GenerateKey): (SplayUpdateStats): (InsertNewNode): (SplaySetup): (SplayTearDown): (SplayRun): (SplayTree): (SplayTree.prototype.isEmpty): (SplayTree.prototype.insert): (SplayTree.prototype.remove): (SplayTree.prototype.find): (SplayTree.prototype.findMax): (SplayTree.prototype.findGreatestLessThan): (SplayTree.prototype.exportKeys): (SplayTree.prototype.splay_): (SplayTree.Node): (SplayTree.Node.prototype.traverse_): (report): (start): Source/JavaScriptCore: This makes it possible to do constraint solving in parallel. This looks like a 1% Speedometer speed-up. It's more than 1% on trunk-Speedometer. The constraint solver supports running constraints in parallel in two different ways: - Run multiple constraints in parallel to each other. This only works for constraints that can tolerate other constraints running concurrently to them (constraint.concurrency() == ConstraintConcurrency::Concurrent). This is the most basic kind of parallelism that the constraint solver supports. All constraints except the JSC SPI constraints are concurrent. We could probably make them concurrent, but I'm playing it safe for now. - A constraint can create parallel work for itself, which the constraint solver will interleave with other stuff. A constraint can report that it has parallel work by returning ConstraintParallelism::Parallel from its executeImpl() function. Then the solver will allow that constraint's doParallelWorkImpl() function to run on as many GC marker threads as are available, for as long as that function wants to run. It's not possible to have a non-concurrent constraint that creates parallel work. The parallelism is implemented in terms of the existing GC marker threads. This turns out to be most natural for two reasons: - No need to start any other threads. - The constraints all want to be passed a SlotVisitor. Running on the marker threads means having access to those threads' SlotVisitors. Also, it means less load balancing. The solver will create work on each marking thread's SlotVisitor. When the solver is done "stealing" a marker thread, that thread will have work it can start doing immediately. Before this change, we had to contribute the work found by the constraint solver to the global worklist so that it could be distributed to the marker threads by load balancing. This change probably helps to avoid that load balancing step. A lot of this change is about making it easy to iterate GC data structures in parallel. This change makes almost all constraints parallel-enabled, but only the DOM's output constraint uses the parallel work API. That constraint iterates the marked cells in two subspaces. This change makes it very easy to compose parallel iterators over subspaces, allocators, blocks, and cells. The marked cell parallel iterator is composed out of parallel iterators for the others. A parallel iterator is just an iterator that can do an atomic next() very quickly. We abstract them using RefPtr<SharedTask<...()>>, where ... is the type returned from the iterator. We know it's done when it returns a falsish version of ... (in the current code, that's always a pointer type, so done is indicated by null). * API/JSMarkingConstraintPrivate.cpp: (JSContextGroupAddMarkingConstraint): * API/JSVirtualMachine.mm: (scanExternalObjectGraph): (scanExternalRememberedSet): * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/AccessCase.cpp: (JSC::AccessCase::propagateTransitions const): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::visitWeakly): (JSC::CodeBlock::shouldJettisonDueToOldAge): (JSC::shouldMarkTransition): (JSC::CodeBlock::propagateTransitions): (JSC::CodeBlock::determineLiveness): * dfg/DFGWorklist.cpp: * ftl/FTLCompile.cpp: (JSC::FTL::compile): * heap/ConstraintParallelism.h: Added. (WTF::printInternal): * heap/Heap.cpp: (JSC::Heap::Heap): (JSC::Heap::addToRememberedSet): (JSC::Heap::runFixpointPhase): (JSC::Heap::stopThePeriphery): (JSC::Heap::resumeThePeriphery): (JSC::Heap::addCoreConstraints): (JSC::Heap::setBonusVisitorTask): (JSC::Heap::runTaskInParallel): (JSC::Heap::forEachSlotVisitor): Deleted. * heap/Heap.h: (JSC::Heap::worldIsRunning const): (JSC::Heap::runFunctionInParallel): * heap/HeapInlines.h: (JSC::Heap::worldIsStopped const): (JSC::Heap::isMarked): (JSC::Heap::incrementDeferralDepth): (JSC::Heap::decrementDeferralDepth): (JSC::Heap::decrementDeferralDepthAndGCIfNeeded): (JSC::Heap::forEachSlotVisitor): (JSC::Heap::collectorBelievesThatTheWorldIsStopped const): Deleted. (JSC::Heap::isMarkedConcurrently): Deleted. * heap/HeapSnapshotBuilder.cpp: (JSC::HeapSnapshotBuilder::appendNode): * heap/LargeAllocation.h: (JSC::LargeAllocation::isMarked): (JSC::LargeAllocation::isMarkedConcurrently): Deleted. * heap/LockDuringMarking.h: (JSC::lockDuringMarking): * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::parallelNotEmptyBlockSource): * heap/MarkedAllocator.h: * heap/MarkedBlock.h: (JSC::MarkedBlock::aboutToMark): (JSC::MarkedBlock::isMarked): (JSC::MarkedBlock::areMarksStaleWithDependency): Deleted. (JSC::MarkedBlock::isMarkedConcurrently): Deleted. * heap/MarkedSpace.h: (JSC::MarkedSpace::activeWeakSetsBegin): (JSC::MarkedSpace::activeWeakSetsEnd): (JSC::MarkedSpace::newActiveWeakSetsBegin): (JSC::MarkedSpace::newActiveWeakSetsEnd): * heap/MarkingConstraint.cpp: (JSC::MarkingConstraint::MarkingConstraint): (JSC::MarkingConstraint::execute): (JSC::MarkingConstraint::quickWorkEstimate): (JSC::MarkingConstraint::workEstimate): (JSC::MarkingConstraint::doParallelWork): (JSC::MarkingConstraint::finishParallelWork): (JSC::MarkingConstraint::doParallelWorkImpl): (JSC::MarkingConstraint::finishParallelWorkImpl): * heap/MarkingConstraint.h: (JSC::MarkingConstraint::lastExecuteParallelism const): (JSC::MarkingConstraint::parallelism const): (JSC::MarkingConstraint::quickWorkEstimate): Deleted. (JSC::MarkingConstraint::workEstimate): Deleted. * heap/MarkingConstraintSet.cpp: (JSC::MarkingConstraintSet::MarkingConstraintSet): (JSC::MarkingConstraintSet::add): (JSC::MarkingConstraintSet::executeConvergence): (JSC::MarkingConstraintSet::executeConvergenceImpl): (JSC::MarkingConstraintSet::executeAll): (JSC::MarkingConstraintSet::ExecutionContext::ExecutionContext): Deleted. (JSC::MarkingConstraintSet::ExecutionContext::didVisitSomething const): Deleted. (JSC::MarkingConstraintSet::ExecutionContext::shouldTimeOut const): Deleted. (JSC::MarkingConstraintSet::ExecutionContext::drain): Deleted. (JSC::MarkingConstraintSet::ExecutionContext::didExecute const): Deleted. (JSC::MarkingConstraintSet::ExecutionContext::execute): Deleted. (): Deleted. * heap/MarkingConstraintSet.h: * heap/MarkingConstraintSolver.cpp: Added. (JSC::MarkingConstraintSolver::MarkingConstraintSolver): (JSC::MarkingConstraintSolver::~MarkingConstraintSolver): (JSC::MarkingConstraintSolver::didVisitSomething const): (JSC::MarkingConstraintSolver::execute): (JSC::MarkingConstraintSolver::drain): (JSC::MarkingConstraintSolver::converge): (JSC::MarkingConstraintSolver::runExecutionThread): (JSC::MarkingConstraintSolver::didExecute): * heap/MarkingConstraintSolver.h: Added. * heap/OpaqueRootSet.h: Removed. * heap/ParallelSourceAdapter.h: Added. (JSC::ParallelSourceAdapter::ParallelSourceAdapter): (JSC::createParallelSourceAdapter): * heap/SimpleMarkingConstraint.cpp: Added. (JSC::SimpleMarkingConstraint::SimpleMarkingConstraint): (JSC::SimpleMarkingConstraint::~SimpleMarkingConstraint): (JSC::SimpleMarkingConstraint::quickWorkEstimate): (JSC::SimpleMarkingConstraint::executeImpl): * heap/SimpleMarkingConstraint.h: Added. * heap/SlotVisitor.cpp: (JSC::SlotVisitor::didStartMarking): (JSC::SlotVisitor::reset): (JSC::SlotVisitor::appendToMarkStack): (JSC::SlotVisitor::visitChildren): (JSC::SlotVisitor::updateMutatorIsStopped): (JSC::SlotVisitor::mutatorIsStoppedIsUpToDate const): (JSC::SlotVisitor::drain): (JSC::SlotVisitor::performIncrementOfDraining): (JSC::SlotVisitor::didReachTermination): (JSC::SlotVisitor::hasWork): (JSC::SlotVisitor::drainFromShared): (JSC::SlotVisitor::drainInParallelPassively): (JSC::SlotVisitor::waitForTermination): (JSC::SlotVisitor::addOpaqueRoot): Deleted. (JSC::SlotVisitor::containsOpaqueRoot const): Deleted. (JSC::SlotVisitor::containsOpaqueRootTriState const): Deleted. (JSC::SlotVisitor::mergeIfNecessary): Deleted. (JSC::SlotVisitor::mergeOpaqueRootsIfProfitable): Deleted. (JSC::SlotVisitor::mergeOpaqueRoots): Deleted. * heap/SlotVisitor.h: * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::addOpaqueRoot): (JSC::SlotVisitor::containsOpaqueRoot const): (JSC::SlotVisitor::vm): (JSC::SlotVisitor::vm const): * heap/Subspace.cpp: (JSC::Subspace::parallelAllocatorSource): (JSC::Subspace::parallelNotEmptyMarkedBlockSource): * heap/Subspace.h: * heap/SubspaceInlines.h: (JSC::Subspace::forEachMarkedCellInParallel): * heap/VisitCounter.h: Added. (JSC::VisitCounter::VisitCounter): (JSC::VisitCounter::visitCount const): * heap/VisitingTimeout.h: Removed. * heap/WeakBlock.cpp: (JSC::WeakBlock::specializedVisit): * runtime/Structure.cpp: (JSC::Structure::isCheapDuringGC): (JSC::Structure::markIfCheap): Source/WebCore: No new tests because no change in behavior. This change is best tested using DOM-GC-intensive benchmarks like Speedometer and Dromaeo. This parallelizes the DOM's output constraint, and makes some small changes to make this more scalable. * ForwardingHeaders/heap/SimpleMarkingConstraint.h: Added. * ForwardingHeaders/heap/VisitingTimeout.h: Removed. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/DOMGCOutputConstraint.cpp: Added. (WebCore::DOMGCOutputConstraint::DOMGCOutputConstraint): (WebCore::DOMGCOutputConstraint::~DOMGCOutputConstraint): (WebCore::DOMGCOutputConstraint::executeImpl): (WebCore::DOMGCOutputConstraint::doParallelWorkImpl): (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl): * bindings/js/DOMGCOutputConstraint.h: Added. * bindings/js/WebCoreJSClientData.cpp: (WebCore::JSVMClientData::initNormalWorld): * dom/Node.cpp: (WebCore::Node::eventTargetDataConcurrently): (WebCore::Node::ensureEventTargetData): (WebCore::Node::clearEventTargetData): Source/WTF: This does some changes to make it easier to do parallel constraint solving: - I finally removed dependencyWith. This was a silly construct whose only purpose is to confuse people about what it means to have a dependency chain. I took that as an opportunity to grealy simplify the GC's use of dependency chaining. - Added more logic to Deque<>, since I use it for part of the load balancer. - Made it possible to profile lock contention. See https://bugs.webkit.org/show_bug.cgi?id=180250#c0 for some preliminary measurements. - Introduced holdLockIf, which makes it easy to perform predicated lock acquisition. We use that to pick a lock in WebCore. - Introduced CountingLock. It's like WTF::Lock except it also enables optimistic read transactions sorta like Java's StampedLock. * WTF.xcodeproj/project.pbxproj: * wtf/Atomics.h: (WTF::dependency): (WTF::DependencyWith::DependencyWith): Deleted. (WTF::dependencyWith): Deleted. * wtf/BitVector.h: (WTF::BitVector::iterator::operator++): * wtf/CMakeLists.txt: * wtf/ConcurrentPtrHashSet.cpp: Added. (WTF::ConcurrentPtrHashSet::ConcurrentPtrHashSet): (WTF::ConcurrentPtrHashSet::~ConcurrentPtrHashSet): (WTF::ConcurrentPtrHashSet::deleteOldTables): (WTF::ConcurrentPtrHashSet::clear): (WTF::ConcurrentPtrHashSet::initialize): (WTF::ConcurrentPtrHashSet::addSlow): (WTF::ConcurrentPtrHashSet::resizeIfNecessary): (WTF::ConcurrentPtrHashSet::resizeAndAdd): (WTF::ConcurrentPtrHashSet::Table::create): * wtf/ConcurrentPtrHashSet.h: Added. (WTF::ConcurrentPtrHashSet::contains): (WTF::ConcurrentPtrHashSet::add): (WTF::ConcurrentPtrHashSet::size const): (WTF::ConcurrentPtrHashSet::Table::maxLoad const): (WTF::ConcurrentPtrHashSet::hash): (WTF::ConcurrentPtrHashSet::cast): (WTF::ConcurrentPtrHashSet::containsImpl const): (WTF::ConcurrentPtrHashSet::addImpl): * wtf/Deque.h: (WTF::inlineCapacity>::takeFirst): * wtf/FastMalloc.h: * wtf/Lock.cpp: (WTF::LockBase::lockSlow): * wtf/Locker.h: (WTF::holdLockIf): * wtf/ScopedLambda.h: * wtf/SharedTask.h: (WTF::SharedTask<PassedResultType): (WTF::SharedTask<ResultType): Deleted. * wtf/StackShot.h: Added. (WTF::StackShot::StackShot): (WTF::StackShot::operator=): (WTF::StackShot::array const): (WTF::StackShot::size const): (WTF::StackShot::operator bool const): (WTF::StackShot::operator== const): (WTF::StackShot::hash const): (WTF::StackShot::isHashTableDeletedValue const): (WTF::StackShot::operator> const): (WTF::StackShot::deletedValueArray): (WTF::StackShotHash::hash): (WTF::StackShotHash::equal): * wtf/StackShotProfiler.h: Added. (WTF::StackShotProfiler::StackShotProfiler): (WTF::StackShotProfiler::profile): (WTF::StackShotProfiler::run): Tools: * Scripts/run-jsc-benchmarks: Add splay-latency test, since this change needed to be carefully validated with that benchmark. * TestWebKitAPI/CMakeLists.txt: * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * TestWebKitAPI/Tests/WTF/ConcurrentPtrHashSet.cpp: Added. This has unit tests of the new concurrent data structure. The tests focus on correctness under serial execution, which appears to be enough for now (it's so easy to catch a concurrency bug by just running the GC). (TestWebKitAPI::TEST): Canonical link: https://commits.webkit.org/196360@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225524 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-05 17:53:57 +00:00
heap/SimpleMarkingConstraint.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
heap/SlotVisitor.cpp
heap/SpaceTimeMutatorScheduler.cpp
heap/StochasticSpaceTimeMutatorScheduler.cpp
heap/StopIfNecessaryTimer.cpp
heap/Subspace.cpp
heap/SynchronousStopTheWorldMutatorScheduler.cpp
heap/Synchronousness.cpp
Implement a GC verifier. https://bugs.webkit.org/show_bug.cgi?id=217274 rdar://56255683 Reviewed by Filip Pizlo and Saam Barati. Source/JavaScriptCore: The idea behind the GC verifier is that in the GC End phase before we finalize and sweep, we'll do a simple stop the world synchronous full GC with the VerifierSlotVisitor. The VerifierSlotVisitor will collect it's own information on whether a JS cell should be marked or not. After this verifier GC pass, we'll compare the mark results. If the verifier GC says a cell should be marked, then the real GC should have marked the cell. The reverse is not true: if the verifier does not mark a cell, it is still OK for the real GC to mark it. For example, in an eden GC, all old generation cells would be considered mark by the real GC though the verifier would know better if they are already dead. Implementation details: 1. SlotVisitor (only used by the real GC) now inherits from a new abstract class, AbstractSlotVisitor. VerifierSlotVisitor (only used by the verifier GC) also inherits from AbstractSlotVisitor. 2. AbstractSlotVisitor declares many virtual methods. SlotVisitor implements some of these virtual methods as inline and final. If the client is invoking one these methods and knows that it will be operating on a SlotVisitor, the method being final allows it to be inlined into the client instead of going through the virtual dispatch. For the VerifierSlotVisitor, these methods will always be invoked by virtual dispatch via the AbstractSlotVisitor abstraction. 3. Almost all methods that takes a SlotVisitor previously (with a few exceptions) will now be templatized, and specialized to either take a SlotVisitor or an AbstractSlotVisitor. The cell MethodTable will now have 2 versions of visitChildren and visitOutputConstraints: one for SlotVisitor, and one for AbstractSlotVisitor. The reason we don't wire the 2nd version to VerifierSlotVisitor (instead of AbstractSlotVisitor) is because we don't need the GC verifier to run at top speed (though we don't want it to be too slow). Also, having hooks for using an AbstractSlotVisitor gives us more utility for implementing other types of GC checkers / analyzers in the future as subclasses of AbstractSlotVisitor. 4. Some minority of methods that used to take a SlotVisitor but are not critical to performance, will now just take an AbstractSlotVisitor instead. For example, see TypeProfilerLog::visit(). 5. isReachableFromOpaqueRoots() methods will also only take an AbstractSlotVisitor. The reason this is OK is because isReachableFromOpaqueRoots() only uses the visitor's addOpaqueRoot() and containsOpaqueRoot() methods, which are implemented in the AbstractSlotVisitor itself. For SlotVisitor, the m_opaqueRoot field will reference Heap::m_opaqueRoots. For VerifierSlotVisitor, the m_opaqueRoot field will reference its own opaque roots storage. This implementation of addOpaqueRoot() is perf neutral for SlotVisitor because where it would previously invoke m_heap.m_opaqueRoots.add(), it will now invoke m_opaqueRoot.add() instead where m_opaqueRoot points to m_heap.m_opaqueRoots. Ditto for AbstractSlotVisitor::containsOpaqueRoot(). 6. When reifying a templatized visit method, we do it in 2 ways: a. Implement the template method as an ALWAYS_INLINE Impl method, and have 2 visit methods (taking a SlotVisitor and an AbstractSlotVisitor respectively) inline the Impl method. For example, see JSObject::visitChildrenImpl(). b. Just templatize the visit method, and explicitly instantiate it with a SlotVisitor and an AbstractSlotVisitor. For example, see DesiredTransition::visitChildren(). The reason we need form (a) is if: i. we need to export the visit methods. For example, see JSObject:visitChildren(). Note: A Clang engineer told me that "there's no way to export an explicit instantiation that will make it a strong symbol." This is because "C++ does not provide any standard way to guarantee that an explicit instantiation is unique, and Clang hasn't added any extension to do so." ii. the visit method is an override of a virtual method. For example, see DFG::Scannable::visitChildren() and DFG::Graph::visitChildren(). Otherwise, we'll prefer form (b) as it is natural C++. 7. Because templatizing all the visit methods requires a lot of boiler plate code, we introduce some macros in SlotVisitorMacros.h to reduce some of the boiler plate burden. We especially try to do this for methods of form (a) (see (6) above) which require more boiler plate. 8. The driver of the real GC is MarkingConstraintSet::executeConvergence() which runs with the MarkingConstraintSolver. The driver of the verifier GC is Heap::verifyGC(), which has a loop to drain marked objects and execute contraints. 9. The GC verifier is built in by default but disabled. The relevant options are: JSC_verifyGC and JSC_verboseVerifyGC. JSC_verifyGC will enable the GC verifier. If JSC_verifyGC is true and the verifier finds a cell that is erroneously not marked by the real GC, it will dump an error message and then crash with a RELEASE_ASSERT. JSC_verboseVerifyGC will enable the GC verifier along with some more heavy weight record keeping (i.e. tracking the parent / owner cell that marked a cell, and capturing the call stack when the marked cell is appended to the mark stack). If JSC_verboseVerifyGC is true and the verifier finds a cell that is erroneously not marked by the real GC, it will dump the parent cell and captured stack along with an error message before crashing. This extra information provides the starting point for debugging GC bugs found by the verifier. Enabling JSC_verboseVerifyGC will automatically enable JSC_verifyGC. 10. Non-determinism in the real GC. The GC verifier's algorithm relies on the real GC being deterministic. However, there are a few places where this is not true: a. Marking conservative roots on the mutator stacks. By the time the verifier GC runs (in the GC End phase), the mutator stacks will look completely different than what the real GC saw. To work around this, if the verifier is enabled, then every conservative root captured by the real GC will also be added to the verifier's mark stack. When running verifyGC() in the End phase, the conservative root scans will be treated as no-ops. b. CodeBlock::shouldJettisonDueToOldAge() may return a different value. This is possible because the codeBlock may be in mid compilation while the real GC is in progress. CodeBlock::shouldVisitStrongly() calls shouldJettisonDueToOldAge(), and may see an old LLInt codeBlock whose timeToLive has expired. As a result, shouldJettisonDueToOldAge() returns true and shouldVisitStrongly() will return false for the real GC, leading to it not marking the codeBlock. However, before the verifier GC gets to run, baseline compilation on the codeBlock may finish. As a baseline codeBlock now, it gets a longer time to live. As a result, when the verifier GC runs, shouldJettisonDueToOldAge() will return false, and shouldVisitStrongly() in turn returns true. This results in the verifier GC marking the codeBlock (and its children) when the real GC did not, which leads to a false error. This is not a real error because if the real GC did not mark the code block, it will simply get jettisoned, and can be reinstantiated when needed later. There's no GC bug here. However, we do need to work around this to prevent the false error for the GC verifier. The work around is to introduce a CodeBlock::m_visitChildrenSkippedDueToOldAge flag that records what the real GC decided in shouldJettisonDueToOldAge(). This allows the verifier GC to replay the same decision and get a consistent result. c. CodeBlock::propagateTransitions() will only do a best effort at visiting cells in ICs, etc. If a cell is not already strongly marked by the time CodeBlock::propagateTransitions() checks it, propagateTransitions() will not mark other cells that are reachable from it. Since the real GC does marking on concurrent threads, marking order is not deterministic. CodeBlock::propagateTransitions() may or may not see a cell as already marked by the time it runs. The verifier GC may mark some of these cells in a different order than the real GC. As a result, in the verifier GC, CodeBlock::propagateTransitions() may see a cell as marked (and therefore, visit its children) when it did not for the real GC. To work around this, we currently add a SuppressGCVerifierScope to CodeBlock::propagateTransitions() to pessimize the verifier, and assume that propagateTransitions() will mark nothing. SuppressGCVerifierScope is a blunt hammer that stops the verifier GC from analyzing all cells potentially reachable via CodeBlock::propagateTransitions(). In the future, it may be possible to refine this and track which cells were actually skipped over (like we did for shouldJettisonDueToOldAge()). However, this decision tracking needs to be done in the real GC, and can be very expensive in terms of performance. The shouldJettisonDueToOldAge() case is rare, and as such lends itself to this more fine grain tracking without hurting performance. The decisions made in CodeBlock::propagateTransitions() are not as rare, and hence, it would hurt performance if we did fine grain decision tracking there (at least or now). 11. Marking in the verifier GC. The real GC tracks cell marks using a Bitmap in the MarkedBlocks. The verifier GC keeps tracks of MarkedBlock cell marks using a Bitmap on the side, stashed away in a HashMap. To improve the verifier marking performance, we reserve a void* m_verifierMemo pointer in the MarkedBlock, which the verifier will employ to cache its MarkedBlockData for that MarkedBlock. This allows the verifier to get to its side Bitmap without having to do a HashMap look up for every cell. Size-wise, in the current 16K MarkBlocks, there is previously room for 1005.5 atoms after reserving space for the MarkedBlock::Footer. Since we can never allocate half an atom anyway, that .5 atom gives us the 8 bytes we need for the m_verifierMemo pointer, which we'll put in the MarkedBlock::Footer. With this patch, each MarkedBlock will now have exactly 1005 atoms available for allocation. I ran JetStream2 and Speedometer2 locally on a MacBookAir10,1, MacBookPro16,1, and a 12.9” 4th Gen iPad Pro. The benchmark results for these were all neutral. The design of the GC verifier is such that it incurs almost no additional runtime memory overhead if not in use. Code size does increase significantly because there are now 2 variants of most of the methods that take a SlotVisitor. When in use, the additional runtime memory is encapsulated in the VerifierSlotVisitor, which is instantiated and destructed every GC cycle. Hence, it can affect peak memory usage during GCs, but the cost is transient. It does not persist past the GC End phase. * API/JSAPIWrapperObject.h: * API/JSAPIWrapperObject.mm: (JSAPIWrapperObjectHandleOwner::isReachableFromOpaqueRoots): (JSC::JSAPIWrapperObject::visitChildrenImpl): (JSC::JSAPIWrapperObject::visitChildren): Deleted. * API/JSCallbackObject.cpp: * API/JSCallbackObject.h: (JSC::JSCallbackObjectData::visitChildren): (JSC::JSCallbackObjectData::JSPrivatePropertyMap::visitChildren): (JSC::JSCallbackObject<Parent>::visitChildrenImpl): * API/JSManagedValue.mm: (JSManagedValueHandleOwner::isReachableFromOpaqueRoots): * API/JSMarkingConstraintPrivate.cpp: (JSC::isMarked): (JSContextGroupAddMarkingConstraint): * API/JSVirtualMachine.mm: (scanExternalObjectGraph): (scanExternalRememberedSet): * API/JSVirtualMachineInternal.h: * API/MarkedJSValueRefArray.cpp: (JSC::MarkedJSValueRefArray::visitAggregate): * API/MarkedJSValueRefArray.h: * API/glib/JSAPIWrapperGlobalObject.cpp: (JSC::JSAPIWrapperGlobalObject::visitChildren): Deleted. * API/glib/JSAPIWrapperGlobalObject.h: * API/glib/JSAPIWrapperObjectGLib.cpp: (JSAPIWrapperObjectHandleOwner::isReachableFromOpaqueRoots): (JSC::JSAPIWrapperObject::visitChildrenImpl): (JSC::JSAPIWrapperObject::visitChildren): Deleted. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Scripts/wkbuiltins/builtins_generate_internals_wrapper_header.py: (BuiltinsInternalsWrapperHeaderGenerator): * Scripts/wkbuiltins/builtins_generate_internals_wrapper_implementation.py: (BuiltinsInternalsWrapperImplementationGenerator.generate_visit_method): * Scripts/wkbuiltins/builtins_templates.py: * Sources.txt: * bytecode/AccessCase.cpp: (JSC::AccessCase::propagateTransitions const): (JSC::AccessCase::visitAggregateImpl const): (JSC::AccessCase::visitAggregate const): Deleted. * bytecode/AccessCase.h: * bytecode/ByValInfo.cpp: (JSC::ByValInfo::visitAggregateImpl): (JSC::ByValInfo::visitAggregate): Deleted. * bytecode/ByValInfo.h: * bytecode/CheckPrivateBrandStatus.cpp: (JSC::CheckPrivateBrandStatus::visitAggregateImpl): (JSC::CheckPrivateBrandStatus::markIfCheap): (JSC::CheckPrivateBrandStatus::visitAggregate): Deleted. * bytecode/CheckPrivateBrandStatus.h: * bytecode/CheckPrivateBrandVariant.cpp: (JSC::CheckPrivateBrandVariant::markIfCheap): (JSC::CheckPrivateBrandVariant::visitAggregateImpl): (JSC::CheckPrivateBrandVariant::visitAggregate): Deleted. * bytecode/CheckPrivateBrandVariant.h: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::CodeBlock): (JSC::CodeBlock::visitChildrenImpl): (JSC::CodeBlock::visitChildren): (JSC::CodeBlock::shouldVisitStrongly): (JSC::CodeBlock::shouldJettisonDueToOldAge): (JSC::shouldMarkTransition): (JSC::CodeBlock::propagateTransitions): (JSC::CodeBlock::determineLiveness): (JSC::CodeBlock::finalizeUnconditionally): (JSC::CodeBlock::visitOSRExitTargets): (JSC::CodeBlock::stronglyVisitStrongReferences): (JSC::CodeBlock::stronglyVisitWeakReferences): * bytecode/CodeBlock.h: * bytecode/DeleteByIdVariant.cpp: (JSC::DeleteByIdVariant::visitAggregateImpl): (JSC::DeleteByIdVariant::markIfCheap): (JSC::DeleteByIdVariant::visitAggregate): Deleted. * bytecode/DeleteByIdVariant.h: * bytecode/DeleteByStatus.cpp: (JSC::DeleteByStatus::visitAggregateImpl): (JSC::DeleteByStatus::markIfCheap): (JSC::DeleteByStatus::visitAggregate): Deleted. * bytecode/DeleteByStatus.h: * bytecode/DirectEvalCodeCache.cpp: (JSC::DirectEvalCodeCache::visitAggregateImpl): (JSC::DirectEvalCodeCache::visitAggregate): Deleted. * bytecode/DirectEvalCodeCache.h: * bytecode/ExecutableToCodeBlockEdge.cpp: (JSC::ExecutableToCodeBlockEdge::visitChildrenImpl): (JSC::ExecutableToCodeBlockEdge::visitOutputConstraintsImpl): (JSC::ExecutableToCodeBlockEdge::runConstraint): (JSC::ExecutableToCodeBlockEdge::visitChildren): Deleted. (JSC::ExecutableToCodeBlockEdge::visitOutputConstraints): Deleted. * bytecode/ExecutableToCodeBlockEdge.h: * bytecode/GetByIdVariant.cpp: (JSC::GetByIdVariant::visitAggregateImpl): (JSC::GetByIdVariant::markIfCheap): (JSC::GetByIdVariant::visitAggregate): Deleted. * bytecode/GetByIdVariant.h: * bytecode/GetByStatus.cpp: (JSC::GetByStatus::visitAggregateImpl): (JSC::GetByStatus::markIfCheap): (JSC::GetByStatus::visitAggregate): Deleted. * bytecode/GetByStatus.h: * bytecode/InByIdStatus.cpp: (JSC::InByIdStatus::markIfCheap): * bytecode/InByIdStatus.h: * bytecode/InByIdVariant.cpp: (JSC::InByIdVariant::markIfCheap): * bytecode/InByIdVariant.h: * bytecode/InternalFunctionAllocationProfile.h: (JSC::InternalFunctionAllocationProfile::visitAggregate): * bytecode/ObjectAllocationProfile.h: (JSC::ObjectAllocationProfileBase::visitAggregate): (JSC::ObjectAllocationProfileWithPrototype::visitAggregate): * bytecode/PolymorphicAccess.cpp: (JSC::PolymorphicAccess::propagateTransitions const): (JSC::PolymorphicAccess::visitAggregateImpl): (JSC::PolymorphicAccess::visitAggregate): Deleted. * bytecode/PolymorphicAccess.h: * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::markIfCheap): * bytecode/PutByIdStatus.h: * bytecode/PutByIdVariant.cpp: (JSC::PutByIdVariant::markIfCheap): * bytecode/PutByIdVariant.h: * bytecode/RecordedStatuses.cpp: (JSC::RecordedStatuses::visitAggregateImpl): (JSC::RecordedStatuses::markIfCheap): (JSC::RecordedStatuses::visitAggregate): Deleted. * bytecode/RecordedStatuses.h: * bytecode/SetPrivateBrandStatus.cpp: (JSC::SetPrivateBrandStatus::visitAggregateImpl): (JSC::SetPrivateBrandStatus::markIfCheap): (JSC::SetPrivateBrandStatus::visitAggregate): Deleted. * bytecode/SetPrivateBrandStatus.h: * bytecode/SetPrivateBrandVariant.cpp: (JSC::SetPrivateBrandVariant::markIfCheap): (JSC::SetPrivateBrandVariant::visitAggregateImpl): (JSC::SetPrivateBrandVariant::visitAggregate): Deleted. * bytecode/SetPrivateBrandVariant.h: * bytecode/StructureSet.cpp: (JSC::StructureSet::markIfCheap const): * bytecode/StructureSet.h: * bytecode/StructureStubInfo.cpp: (JSC::StructureStubInfo::visitAggregateImpl): (JSC::StructureStubInfo::propagateTransitions): (JSC::StructureStubInfo::visitAggregate): Deleted. * bytecode/StructureStubInfo.h: * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::visitChildrenImpl): (JSC::UnlinkedCodeBlock::visitChildren): Deleted. * bytecode/UnlinkedCodeBlock.h: * bytecode/UnlinkedFunctionExecutable.cpp: (JSC::UnlinkedFunctionExecutable::visitChildrenImpl): (JSC::UnlinkedFunctionExecutable::visitChildren): Deleted. * bytecode/UnlinkedFunctionExecutable.h: * debugger/DebuggerScope.cpp: (JSC::DebuggerScope::visitChildrenImpl): (JSC::DebuggerScope::visitChildren): Deleted. * debugger/DebuggerScope.h: * dfg/DFGDesiredTransitions.cpp: (JSC::DFG::DesiredTransition::visitChildren): (JSC::DFG::DesiredTransitions::visitChildren): * dfg/DFGDesiredTransitions.h: * dfg/DFGDesiredWeakReferences.cpp: (JSC::DFG::DesiredWeakReferences::visitChildren): * dfg/DFGDesiredWeakReferences.h: * dfg/DFGGraph.cpp: (JSC::DFG::Graph::visitChildrenImpl): (JSC::DFG::Graph::visitChildren): * dfg/DFGGraph.h: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::isKnownToBeLiveDuringGC): (JSC::DFG::Plan::isKnownToBeLiveAfterGC): * dfg/DFGPlan.h: * dfg/DFGPlanInlines.h: (JSC::DFG::Plan::iterateCodeBlocksForGC): * dfg/DFGSafepoint.cpp: (JSC::DFG::Safepoint::checkLivenessAndVisitChildren): (JSC::DFG::Safepoint::isKnownToBeLiveDuringGC): (JSC::DFG::Safepoint::isKnownToBeLiveAfterGC): * dfg/DFGSafepoint.h: * dfg/DFGScannable.h: * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::visitWeakReferences): (JSC::DFG::Worklist::removeDeadPlans): * dfg/DFGWorklist.h: * dfg/DFGWorklistInlines.h: (JSC::DFG::iterateCodeBlocksForGC): (JSC::DFG::Worklist::iterateCodeBlocksForGC): * heap/AbstractSlotVisitor.h: Added. (JSC::AbstractSlotVisitor::Context::cell const): (JSC::AbstractSlotVisitor::SuppressGCVerifierScope::SuppressGCVerifierScope): (JSC::AbstractSlotVisitor::SuppressGCVerifierScope::~SuppressGCVerifierScope): (JSC::AbstractSlotVisitor::DefaultMarkingViolationAssertionScope::DefaultMarkingViolationAssertionScope): (JSC::AbstractSlotVisitor::collectorMarkStack): (JSC::AbstractSlotVisitor::mutatorMarkStack): (JSC::AbstractSlotVisitor::collectorMarkStack const): (JSC::AbstractSlotVisitor::mutatorMarkStack const): (JSC::AbstractSlotVisitor::isEmpty): (JSC::AbstractSlotVisitor::setIgnoreNewOpaqueRoots): (JSC::AbstractSlotVisitor::visitCount const): (JSC::AbstractSlotVisitor::addToVisitCount): (JSC::AbstractSlotVisitor::rootMarkReason const): (JSC::AbstractSlotVisitor::setRootMarkReason): (JSC::AbstractSlotVisitor::didRace): (JSC::AbstractSlotVisitor::codeName const): (JSC::SetRootMarkReasonScope::SetRootMarkReasonScope): (JSC::SetRootMarkReasonScope::~SetRootMarkReasonScope): * heap/AbstractSlotVisitorInlines.h: Added. (JSC::AbstractSlotVisitor::Context::Context): (JSC::AbstractSlotVisitor::Context::~Context): (JSC::AbstractSlotVisitor::AbstractSlotVisitor): (JSC::AbstractSlotVisitor::heap const): (JSC::AbstractSlotVisitor::vm): (JSC::AbstractSlotVisitor::vm const): (JSC::AbstractSlotVisitor::addOpaqueRoot): (JSC::AbstractSlotVisitor::containsOpaqueRoot const): (JSC::AbstractSlotVisitor::append): (JSC::AbstractSlotVisitor::appendHidden): (JSC::AbstractSlotVisitor::appendHiddenUnbarriered): (JSC::AbstractSlotVisitor::appendValues): (JSC::AbstractSlotVisitor::appendValuesHidden): (JSC::AbstractSlotVisitor::appendUnbarriered): (JSC::AbstractSlotVisitor::parentCell const): (JSC::AbstractSlotVisitor::reset): * heap/HandleSet.cpp: (JSC::HandleSet::visitStrongHandles): * heap/HandleSet.h: * heap/Heap.cpp: (JSC::Heap::iterateExecutingAndCompilingCodeBlocks): (JSC::Heap::iterateExecutingAndCompilingCodeBlocksWithoutHoldingLocks): (JSC::Heap::runEndPhase): (JSC::Heap::willStartCollection): (JSC::scanExternalRememberedSet): (JSC::serviceSamplingProfiler): (JSC::Heap::addCoreConstraints): (JSC::Heap::verifyGC): (JSC::Heap::isAnalyzingHeap const): Deleted. * heap/Heap.h: (JSC::Heap::isMarkingForGCVerifier const): (JSC::Heap::numOpaqueRoots const): Deleted. * heap/HeapInlines.h: (JSC::Heap::isMarked): * heap/HeapProfiler.cpp: (JSC::HeapProfiler::setActiveHeapAnalyzer): * heap/IsoCellSet.h: * heap/IsoCellSetInlines.h: (JSC::IsoCellSet::forEachMarkedCellInParallel): * heap/JITStubRoutineSet.cpp: (JSC::JITStubRoutineSet::traceMarkedStubRoutines): * heap/JITStubRoutineSet.h: (JSC::JITStubRoutineSet::traceMarkedStubRoutines): * heap/MarkStackMergingConstraint.cpp: (JSC::MarkStackMergingConstraint::prepareToExecuteImpl): (JSC::MarkStackMergingConstraint::executeImplImpl): (JSC::MarkStackMergingConstraint::executeImpl): * heap/MarkStackMergingConstraint.h: * heap/MarkedBlock.h: (JSC::MarkedBlock::Handle::atomAt const): (JSC::MarkedBlock::setVerifierMemo): (JSC::MarkedBlock::verifierMemo const): * heap/MarkedSpace.cpp: (JSC::MarkedSpace::visitWeakSets): * heap/MarkedSpace.h: * heap/MarkingConstraint.cpp: (JSC::MarkingConstraint::execute): (JSC::MarkingConstraint::executeSynchronously): (JSC::MarkingConstraint::prepareToExecute): (JSC::MarkingConstraint::doParallelWork): (JSC::MarkingConstraint::prepareToExecuteImpl): * heap/MarkingConstraint.h: * heap/MarkingConstraintExecutorPair.h: Added. (JSC::MarkingConstraintExecutorPair::MarkingConstraintExecutorPair): (JSC::MarkingConstraintExecutorPair::execute): * heap/MarkingConstraintSet.cpp: (JSC::MarkingConstraintSet::add): (JSC::MarkingConstraintSet::executeAllSynchronously): (JSC::MarkingConstraintSet::executeAll): Deleted. * heap/MarkingConstraintSet.h: (JSC::MarkingConstraintSet::add): * heap/MarkingConstraintSolver.cpp: * heap/MarkingConstraintSolver.h: * heap/SimpleMarkingConstraint.cpp: (JSC::SimpleMarkingConstraint::SimpleMarkingConstraint): (JSC::SimpleMarkingConstraint::executeImplImpl): (JSC::SimpleMarkingConstraint::executeImpl): * heap/SimpleMarkingConstraint.h: * heap/SlotVisitor.cpp: (JSC::SlotVisitor::SlotVisitor): (JSC::SlotVisitor::reset): (JSC::SlotVisitor::appendSlow): (JSC::SlotVisitor::addParallelConstraintTask): * heap/SlotVisitor.h: (JSC::SlotVisitor::collectorMarkStack): Deleted. (JSC::SlotVisitor::mutatorMarkStack): Deleted. (JSC::SlotVisitor::collectorMarkStack const): Deleted. (JSC::SlotVisitor::mutatorMarkStack const): Deleted. (JSC::SlotVisitor::isEmpty): Deleted. (JSC::SlotVisitor::isFirstVisit const): Deleted. (JSC::SlotVisitor::bytesVisited const): Deleted. (JSC::SlotVisitor::visitCount const): Deleted. (JSC::SlotVisitor::addToVisitCount): Deleted. (JSC::SlotVisitor::isAnalyzingHeap const): Deleted. (JSC::SlotVisitor::heapAnalyzer const): Deleted. (JSC::SlotVisitor::rootMarkReason const): Deleted. (JSC::SlotVisitor::setRootMarkReason): Deleted. (JSC::SlotVisitor::markingVersion const): Deleted. (JSC::SlotVisitor::mutatorIsStopped const): Deleted. (JSC::SlotVisitor::rightToRun): Deleted. (JSC::SlotVisitor::didRace): Deleted. (JSC::SlotVisitor::setIgnoreNewOpaqueRoots): Deleted. (JSC::SlotVisitor::codeName const): Deleted. (JSC::SetRootMarkReasonScope::SetRootMarkReasonScope): Deleted. (JSC::SetRootMarkReasonScope::~SetRootMarkReasonScope): Deleted. * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::isMarked const): (JSC::SlotVisitor::addOpaqueRoot): Deleted. (JSC::SlotVisitor::containsOpaqueRoot const): Deleted. (JSC::SlotVisitor::heap const): Deleted. (JSC::SlotVisitor::vm): Deleted. (JSC::SlotVisitor::vm const): Deleted. * heap/SlotVisitorMacros.h: Added. * heap/Subspace.h: * heap/SubspaceInlines.h: (JSC::Subspace::forEachMarkedCellInParallel): * heap/VerifierSlotVisitor.cpp: Added. (JSC::MarkerData::MarkerData): (JSC::VerifierSlotVisitor::MarkedBlockData::MarkedBlockData): (JSC::VerifierSlotVisitor::MarkedBlockData::addMarkerData): (JSC::VerifierSlotVisitor::MarkedBlockData::markerData const): (JSC::VerifierSlotVisitor::PreciseAllocationData::PreciseAllocationData): (JSC::VerifierSlotVisitor::PreciseAllocationData::markerData const): (JSC::VerifierSlotVisitor::PreciseAllocationData::addMarkerData): (JSC::VerifierSlotVisitor::VerifierSlotVisitor): (JSC::VerifierSlotVisitor::~VerifierSlotVisitor): (JSC::VerifierSlotVisitor::addParallelConstraintTask): (JSC::VerifierSlotVisitor::executeConstraintTasks): (JSC::VerifierSlotVisitor::append): (JSC::VerifierSlotVisitor::appendToMarkStack): (JSC::VerifierSlotVisitor::appendUnbarriered): (JSC::VerifierSlotVisitor::appendHiddenUnbarriered): (JSC::VerifierSlotVisitor::drain): (JSC::VerifierSlotVisitor::dumpMarkerData): (JSC::VerifierSlotVisitor::isFirstVisit const): (JSC::VerifierSlotVisitor::isMarked const): (JSC::VerifierSlotVisitor::markAuxiliary): (JSC::VerifierSlotVisitor::mutatorIsStopped const): (JSC::VerifierSlotVisitor::testAndSetMarked): (JSC::VerifierSlotVisitor::setMarkedAndAppendToMarkStack): (JSC::VerifierSlotVisitor::visitAsConstraint): (JSC::VerifierSlotVisitor::visitChildren): * heap/VerifierSlotVisitor.h: Added. (JSC::VerifierSlotVisitor::MarkedBlockData::block const): (JSC::VerifierSlotVisitor::MarkedBlockData::atoms const): (JSC::VerifierSlotVisitor::MarkedBlockData::isMarked): (JSC::VerifierSlotVisitor::MarkedBlockData::testAndSetMarked): (JSC::VerifierSlotVisitor::PreciseAllocationData::allocation const): (JSC::VerifierSlotVisitor::appendSlow): * heap/VerifierSlotVisitorInlines.h: Added. (JSC::VerifierSlotVisitor::forEachLiveCell): (JSC::VerifierSlotVisitor::forEachLivePreciseAllocation): (JSC::VerifierSlotVisitor::forEachLiveMarkedBlockCell): * heap/VisitCounter.h: (JSC::VisitCounter::VisitCounter): (JSC::VisitCounter::visitor const): * heap/WeakBlock.cpp: (JSC::WeakBlock::specializedVisit): (JSC::WeakBlock::visitImpl): (JSC::WeakBlock::visit): * heap/WeakBlock.h: * heap/WeakHandleOwner.cpp: (JSC::WeakHandleOwner::isReachableFromOpaqueRoots): * heap/WeakHandleOwner.h: * heap/WeakSet.cpp: * heap/WeakSet.h: (JSC::WeakSet::visit): * interpreter/ShadowChicken.cpp: (JSC::ShadowChicken::visitChildren): * interpreter/ShadowChicken.h: * jit/GCAwareJITStubRoutine.cpp: (JSC::MarkingGCAwareJITStubRoutine::markRequiredObjectsInternalImpl): (JSC::MarkingGCAwareJITStubRoutine::markRequiredObjectsInternal): (JSC::GCAwareJITStubRoutine::markRequiredObjectsInternal): Deleted. * jit/GCAwareJITStubRoutine.h: (JSC::GCAwareJITStubRoutine::markRequiredObjects): (JSC::GCAwareJITStubRoutine::markRequiredObjectsInternal): * jit/JITWorklist.cpp: * jit/PolymorphicCallStubRoutine.cpp: (JSC::PolymorphicCallStubRoutine::markRequiredObjectsInternalImpl): (JSC::PolymorphicCallStubRoutine::markRequiredObjectsInternal): * jit/PolymorphicCallStubRoutine.h: * runtime/AbstractModuleRecord.cpp: (JSC::AbstractModuleRecord::visitChildrenImpl): (JSC::AbstractModuleRecord::visitChildren): Deleted. * runtime/AbstractModuleRecord.h: * runtime/ArgList.cpp: (JSC::MarkedArgumentBuffer::markLists): * runtime/ArgList.h: * runtime/CacheableIdentifier.h: * runtime/CacheableIdentifierInlines.h: (JSC::CacheableIdentifier::visitAggregate const): * runtime/ClassInfo.h: (JSC::MethodTable::visitChildren const): (JSC::MethodTable::visitOutputConstraints const): * runtime/ClonedArguments.cpp: (JSC::ClonedArguments::visitChildrenImpl): (JSC::ClonedArguments::visitChildren): Deleted. * runtime/ClonedArguments.h: * runtime/DirectArguments.cpp: (JSC::DirectArguments::visitChildrenImpl): (JSC::DirectArguments::visitChildren): Deleted. * runtime/DirectArguments.h: * runtime/EvalExecutable.cpp: (JSC::EvalExecutable::visitChildrenImpl): (JSC::EvalExecutable::visitChildren): Deleted. * runtime/EvalExecutable.h: * runtime/Exception.cpp: (JSC::Exception::visitChildrenImpl): (JSC::Exception::visitChildren): Deleted. * runtime/Exception.h: * runtime/FunctionExecutable.cpp: (JSC::FunctionExecutable::visitChildrenImpl): (JSC::FunctionExecutable::visitChildren): Deleted. * runtime/FunctionExecutable.h: * runtime/FunctionRareData.cpp: (JSC::FunctionRareData::visitChildrenImpl): (JSC::FunctionRareData::visitChildren): Deleted. * runtime/FunctionRareData.h: * runtime/GenericArguments.h: * runtime/GenericArgumentsInlines.h: (JSC::GenericArguments<Type>::visitChildrenImpl): (JSC::GenericArguments<Type>::visitChildren): Deleted. * runtime/GetterSetter.cpp: (JSC::GetterSetter::visitChildrenImpl): (JSC::GetterSetter::visitChildren): Deleted. * runtime/GetterSetter.h: * runtime/HashMapImpl.cpp: (JSC::HashMapBucket<Data>::visitChildrenImpl): (JSC::HashMapImpl<HashMapBucket>::visitChildrenImpl): (JSC::HashMapBucket<Data>::visitChildren): Deleted. (JSC::HashMapImpl<HashMapBucket>::visitChildren): Deleted. * runtime/HashMapImpl.h: * runtime/InternalFunction.cpp: (JSC::InternalFunction::visitChildrenImpl): (JSC::InternalFunction::visitChildren): Deleted. * runtime/InternalFunction.h: * runtime/IntlCollator.cpp: (JSC::IntlCollator::visitChildrenImpl): (JSC::IntlCollator::visitChildren): Deleted. * runtime/IntlCollator.h: * runtime/IntlDateTimeFormat.cpp: (JSC::IntlDateTimeFormat::visitChildrenImpl): (JSC::IntlDateTimeFormat::visitChildren): Deleted. * runtime/IntlDateTimeFormat.h: * runtime/IntlLocale.cpp: (JSC::IntlLocale::visitChildrenImpl): (JSC::IntlLocale::visitChildren): Deleted. * runtime/IntlLocale.h: * runtime/IntlNumberFormat.cpp: (JSC::IntlNumberFormat::visitChildrenImpl): (JSC::IntlNumberFormat::visitChildren): Deleted. * runtime/IntlNumberFormat.h: * runtime/IntlPluralRules.cpp: (JSC::IntlPluralRules::visitChildrenImpl): (JSC::IntlPluralRules::visitChildren): Deleted. * runtime/IntlPluralRules.h: * runtime/IntlRelativeTimeFormat.cpp: (JSC::IntlRelativeTimeFormat::visitChildrenImpl): (JSC::IntlRelativeTimeFormat::visitChildren): Deleted. * runtime/IntlRelativeTimeFormat.h: * runtime/IntlSegmentIterator.cpp: (JSC::IntlSegmentIterator::visitChildrenImpl): (JSC::IntlSegmentIterator::visitChildren): Deleted. * runtime/IntlSegmentIterator.h: * runtime/IntlSegments.cpp: (JSC::IntlSegments::visitChildrenImpl): (JSC::IntlSegments::visitChildren): Deleted. * runtime/IntlSegments.h: * runtime/JSArrayBufferView.cpp: (JSC::JSArrayBufferView::visitChildrenImpl): (JSC::JSArrayBufferView::visitChildren): Deleted. * runtime/JSArrayBufferView.h: * runtime/JSArrayIterator.cpp: (JSC::JSArrayIterator::visitChildrenImpl): (JSC::JSArrayIterator::visitChildren): Deleted. * runtime/JSArrayIterator.h: * runtime/JSAsyncGenerator.cpp: (JSC::JSAsyncGenerator::visitChildrenImpl): (JSC::JSAsyncGenerator::visitChildren): Deleted. * runtime/JSAsyncGenerator.h: * runtime/JSBigInt.cpp: (JSC::JSBigInt::visitChildrenImpl): (JSC::JSBigInt::visitChildren): Deleted. * runtime/JSBigInt.h: * runtime/JSBoundFunction.cpp: (JSC::JSBoundFunction::visitChildrenImpl): (JSC::JSBoundFunction::visitChildren): Deleted. * runtime/JSBoundFunction.h: * runtime/JSCallee.cpp: (JSC::JSCallee::visitChildrenImpl): (JSC::JSCallee::visitChildren): Deleted. * runtime/JSCallee.h: * runtime/JSCell.h: * runtime/JSCellInlines.h: (JSC::JSCell::visitChildrenImpl): (JSC::JSCell::visitOutputConstraintsImpl): (JSC::JSCell::visitChildren): Deleted. (JSC::JSCell::visitOutputConstraints): Deleted. * runtime/JSFinalizationRegistry.cpp: (JSC::JSFinalizationRegistry::visitChildrenImpl): (JSC::JSFinalizationRegistry::visitChildren): Deleted. * runtime/JSFinalizationRegistry.h: * runtime/JSFunction.cpp: (JSC::JSFunction::visitChildrenImpl): (JSC::JSFunction::visitChildren): Deleted. * runtime/JSFunction.h: * runtime/JSGenerator.cpp: (JSC::JSGenerator::visitChildrenImpl): (JSC::JSGenerator::visitChildren): Deleted. * runtime/JSGenerator.h: * runtime/JSGenericTypedArrayView.h: * runtime/JSGenericTypedArrayViewInlines.h: (JSC::JSGenericTypedArrayView<Adaptor>::visitChildrenImpl): (JSC::JSGenericTypedArrayView<Adaptor>::visitChildren): Deleted. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::visitChildrenImpl): (JSC::JSGlobalObject::visitChildren): Deleted. * runtime/JSGlobalObject.h: * runtime/JSImmutableButterfly.cpp: (JSC::JSImmutableButterfly::visitChildrenImpl): (JSC::JSImmutableButterfly::visitChildren): Deleted. * runtime/JSImmutableButterfly.h: * runtime/JSInternalFieldObjectImpl.h: * runtime/JSInternalFieldObjectImplInlines.h: (JSC::JSInternalFieldObjectImpl<passedNumberOfInternalFields>::visitChildrenImpl): (JSC::JSInternalFieldObjectImpl<passedNumberOfInternalFields>::visitChildren): Deleted. * runtime/JSLexicalEnvironment.cpp: (JSC::JSLexicalEnvironment::visitChildrenImpl): (JSC::JSLexicalEnvironment::visitChildren): Deleted. * runtime/JSLexicalEnvironment.h: * runtime/JSMapIterator.cpp: (JSC::JSMapIterator::visitChildrenImpl): (JSC::JSMapIterator::visitChildren): Deleted. * runtime/JSMapIterator.h: * runtime/JSModuleEnvironment.cpp: (JSC::JSModuleEnvironment::visitChildrenImpl): (JSC::JSModuleEnvironment::visitChildren): Deleted. * runtime/JSModuleEnvironment.h: * runtime/JSModuleNamespaceObject.cpp: (JSC::JSModuleNamespaceObject::visitChildrenImpl): (JSC::JSModuleNamespaceObject::visitChildren): Deleted. * runtime/JSModuleNamespaceObject.h: * runtime/JSModuleRecord.cpp: (JSC::JSModuleRecord::visitChildrenImpl): (JSC::JSModuleRecord::visitChildren): Deleted. * runtime/JSModuleRecord.h: * runtime/JSNativeStdFunction.cpp: (JSC::JSNativeStdFunction::visitChildrenImpl): (JSC::JSNativeStdFunction::visitChildren): Deleted. * runtime/JSNativeStdFunction.h: * runtime/JSObject.cpp: (JSC::JSObject::markAuxiliaryAndVisitOutOfLineProperties): (JSC::JSObject::visitButterfly): (JSC::JSObject::visitButterflyImpl): (JSC::JSObject::visitChildrenImpl): (JSC::JSFinalObject::visitChildrenImpl): (JSC::JSObject::visitChildren): Deleted. (JSC::JSFinalObject::visitChildren): Deleted. * runtime/JSObject.h: * runtime/JSPromise.cpp: (JSC::JSPromise::visitChildrenImpl): (JSC::JSPromise::visitChildren): Deleted. * runtime/JSPromise.h: * runtime/JSPropertyNameEnumerator.cpp: (JSC::JSPropertyNameEnumerator::visitChildrenImpl): (JSC::JSPropertyNameEnumerator::visitChildren): Deleted. * runtime/JSPropertyNameEnumerator.h: * runtime/JSProxy.cpp: (JSC::JSProxy::visitChildrenImpl): (JSC::JSProxy::visitChildren): Deleted. * runtime/JSProxy.h: * runtime/JSScope.cpp: (JSC::JSScope::visitChildrenImpl): (JSC::JSScope::visitChildren): Deleted. * runtime/JSScope.h: * runtime/JSSegmentedVariableObject.cpp: (JSC::JSSegmentedVariableObject::visitChildrenImpl): (JSC::JSSegmentedVariableObject::visitChildren): Deleted. * runtime/JSSegmentedVariableObject.h: * runtime/JSSetIterator.cpp: (JSC::JSSetIterator::visitChildrenImpl): (JSC::JSSetIterator::visitChildren): Deleted. * runtime/JSSetIterator.h: * runtime/JSString.cpp: (JSC::JSString::visitChildrenImpl): (JSC::JSString::visitChildren): Deleted. * runtime/JSString.h: * runtime/JSStringIterator.cpp: (JSC::JSStringIterator::visitChildrenImpl): (JSC::JSStringIterator::visitChildren): Deleted. * runtime/JSStringIterator.h: * runtime/JSSymbolTableObject.cpp: (JSC::JSSymbolTableObject::visitChildrenImpl): (JSC::JSSymbolTableObject::visitChildren): Deleted. * runtime/JSSymbolTableObject.h: * runtime/JSWeakObjectRef.cpp: (JSC::JSWeakObjectRef::visitChildrenImpl): (JSC::JSWeakObjectRef::visitChildren): Deleted. * runtime/JSWeakObjectRef.h: * runtime/JSWithScope.cpp: (JSC::JSWithScope::visitChildrenImpl): (JSC::JSWithScope::visitChildren): Deleted. * runtime/JSWithScope.h: * runtime/JSWrapperObject.cpp: (JSC::JSWrapperObject::visitChildrenImpl): (JSC::JSWrapperObject::visitChildren): Deleted. * runtime/JSWrapperObject.h: * runtime/LazyClassStructure.cpp: (JSC::LazyClassStructure::visit): * runtime/LazyClassStructure.h: * runtime/LazyProperty.h: * runtime/LazyPropertyInlines.h: (JSC::ElementType>::visit): * runtime/ModuleProgramExecutable.cpp: (JSC::ModuleProgramExecutable::visitChildrenImpl): (JSC::ModuleProgramExecutable::visitChildren): Deleted. * runtime/ModuleProgramExecutable.h: * runtime/Options.cpp: (JSC::Options::recomputeDependentOptions): * runtime/OptionsList.h: * runtime/ProgramExecutable.cpp: (JSC::ProgramExecutable::visitChildrenImpl): (JSC::ProgramExecutable::visitChildren): Deleted. * runtime/ProgramExecutable.h: * runtime/PropertyMapHashTable.h: * runtime/PropertyTable.cpp: (JSC::PropertyTable::visitChildrenImpl): (JSC::PropertyTable::visitChildren): Deleted. * runtime/ProxyObject.cpp: (JSC::ProxyObject::visitChildrenImpl): (JSC::ProxyObject::visitChildren): Deleted. * runtime/ProxyObject.h: * runtime/ProxyRevoke.cpp: (JSC::ProxyRevoke::visitChildrenImpl): (JSC::ProxyRevoke::visitChildren): Deleted. * runtime/ProxyRevoke.h: * runtime/RegExpCachedResult.cpp: (JSC::RegExpCachedResult::visitAggregateImpl): (JSC::RegExpCachedResult::visitAggregate): Deleted. * runtime/RegExpCachedResult.h: * runtime/RegExpGlobalData.cpp: (JSC::RegExpGlobalData::visitAggregateImpl): (JSC::RegExpGlobalData::visitAggregate): Deleted. * runtime/RegExpGlobalData.h: * runtime/RegExpObject.cpp: (JSC::RegExpObject::visitChildrenImpl): (JSC::RegExpObject::visitChildren): Deleted. * runtime/RegExpObject.h: * runtime/SamplingProfiler.cpp: (JSC::SamplingProfiler::visit): * runtime/SamplingProfiler.h: * runtime/ScopedArguments.cpp: (JSC::ScopedArguments::visitChildrenImpl): (JSC::ScopedArguments::visitChildren): Deleted. * runtime/ScopedArguments.h: * runtime/SimpleTypedArrayController.cpp: (JSC::SimpleTypedArrayController::JSArrayBufferOwner::isReachableFromOpaqueRoots): * runtime/SimpleTypedArrayController.h: * runtime/SmallStrings.cpp: (JSC::SmallStrings::visitStrongReferences): * runtime/SmallStrings.h: * runtime/SparseArrayValueMap.cpp: (JSC::SparseArrayValueMap::visitChildrenImpl): (JSC::SparseArrayValueMap::visitChildren): Deleted. * runtime/SparseArrayValueMap.h: * runtime/StackFrame.cpp: (JSC::StackFrame::visitChildren): Deleted. * runtime/StackFrame.h: (JSC::StackFrame::visitChildren): * runtime/Structure.cpp: (JSC::Structure::visitChildrenImpl): (JSC::Structure::isCheapDuringGC): (JSC::Structure::markIfCheap): (JSC::Structure::visitChildren): Deleted. * runtime/Structure.h: * runtime/StructureChain.cpp: (JSC::StructureChain::visitChildrenImpl): (JSC::StructureChain::visitChildren): Deleted. * runtime/StructureChain.h: * runtime/StructureRareData.cpp: (JSC::StructureRareData::visitChildrenImpl): (JSC::StructureRareData::visitChildren): Deleted. * runtime/StructureRareData.h: * runtime/SymbolTable.cpp: (JSC::SymbolTable::visitChildrenImpl): (JSC::SymbolTable::visitChildren): Deleted. * runtime/SymbolTable.h: * runtime/TypeProfilerLog.cpp: (JSC::TypeProfilerLog::visit): * runtime/TypeProfilerLog.h: * runtime/VM.h: (JSC::VM::isAnalyzingHeap const): (JSC::VM::activeHeapAnalyzer const): (JSC::VM::setActiveHeapAnalyzer): * runtime/WeakMapImpl.cpp: (JSC::WeakMapImpl<WeakMapBucket>::visitChildrenImpl): (JSC::WeakMapImpl<WeakMapBucket<WeakMapBucketDataKey>>::visitOutputConstraints): (JSC::WeakMapImpl<BucketType>::visitOutputConstraints): (JSC::WeakMapImpl<WeakMapBucket>::visitChildren): Deleted. (JSC::WeakMapImpl<WeakMapBucket<WeakMapBucketDataKeyValue>>::visitOutputConstraints): Deleted. * runtime/WeakMapImpl.h: (JSC::WeakMapBucket::visitAggregate): * tools/JSDollarVM.cpp: (JSC::JSDollarVM::visitChildrenImpl): (JSC::JSDollarVM::visitChildren): Deleted. * tools/JSDollarVM.h: * wasm/WasmGlobal.cpp: (JSC::Wasm::Global::visitAggregateImpl): (JSC::Wasm::Global::visitAggregate): Deleted. * wasm/WasmGlobal.h: * wasm/WasmTable.cpp: (JSC::Wasm::Table::visitAggregateImpl): (JSC::Wasm::Table::visitAggregate): Deleted. * wasm/WasmTable.h: * wasm/js/JSToWasmICCallee.cpp: (JSC::JSToWasmICCallee::visitChildrenImpl): (JSC::JSToWasmICCallee::visitChildren): Deleted. * wasm/js/JSToWasmICCallee.h: * wasm/js/JSWebAssemblyCodeBlock.cpp: (JSC::JSWebAssemblyCodeBlock::visitChildrenImpl): (JSC::JSWebAssemblyCodeBlock::visitChildren): Deleted. * wasm/js/JSWebAssemblyCodeBlock.h: * wasm/js/JSWebAssemblyGlobal.cpp: (JSC::JSWebAssemblyGlobal::visitChildrenImpl): (JSC::JSWebAssemblyGlobal::visitChildren): Deleted. * wasm/js/JSWebAssemblyGlobal.h: * wasm/js/JSWebAssemblyInstance.cpp: (JSC::JSWebAssemblyInstance::visitChildrenImpl): (JSC::JSWebAssemblyInstance::visitChildren): Deleted. * wasm/js/JSWebAssemblyInstance.h: * wasm/js/JSWebAssemblyMemory.cpp: (JSC::JSWebAssemblyMemory::visitChildrenImpl): (JSC::JSWebAssemblyMemory::visitChildren): Deleted. * wasm/js/JSWebAssemblyMemory.h: * wasm/js/JSWebAssemblyModule.cpp: (JSC::JSWebAssemblyModule::visitChildrenImpl): (JSC::JSWebAssemblyModule::visitChildren): Deleted. * wasm/js/JSWebAssemblyModule.h: * wasm/js/JSWebAssemblyTable.cpp: (JSC::JSWebAssemblyTable::visitChildrenImpl): (JSC::JSWebAssemblyTable::visitChildren): Deleted. * wasm/js/JSWebAssemblyTable.h: * wasm/js/WebAssemblyFunction.cpp: (JSC::WebAssemblyFunction::visitChildrenImpl): (JSC::WebAssemblyFunction::visitChildren): Deleted. * wasm/js/WebAssemblyFunction.h: * wasm/js/WebAssemblyFunctionBase.cpp: (JSC::WebAssemblyFunctionBase::visitChildrenImpl): (JSC::WebAssemblyFunctionBase::visitChildren): Deleted. * wasm/js/WebAssemblyFunctionBase.h: * wasm/js/WebAssemblyModuleRecord.cpp: (JSC::WebAssemblyModuleRecord::visitChildrenImpl): (JSC::WebAssemblyModuleRecord::visitChildren): Deleted. * wasm/js/WebAssemblyModuleRecord.h: * wasm/js/WebAssemblyWrapperFunction.cpp: (JSC::WebAssemblyWrapperFunction::visitChildrenImpl): (JSC::WebAssemblyWrapperFunction::visitChildren): Deleted. * wasm/js/WebAssemblyWrapperFunction.h: Source/WebCore: 1. Added support for the GC verifier. 2. Also removed NodeFilterCondition::visitAggregate() because it is not used. 3. Rebased bindings test results. * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::visitReferencedIndexes const): * Modules/indexeddb/IDBObjectStore.h: * Modules/indexeddb/IDBTransaction.cpp: (WebCore::IDBTransaction::visitReferencedObjectStores const): * Modules/indexeddb/IDBTransaction.h: * Modules/webaudio/AudioBuffer.cpp: (WebCore::AudioBuffer::visitChannelWrappers): * Modules/webaudio/AudioBuffer.h: * bindings/js/DOMGCOutputConstraint.cpp: (WebCore::DOMGCOutputConstraint::executeImplImpl): (WebCore::DOMGCOutputConstraint::executeImpl): * bindings/js/DOMGCOutputConstraint.h: * bindings/js/JSAbortControllerCustom.cpp: (WebCore::JSAbortController::visitAdditionalChildren): * bindings/js/JSAbortSignalCustom.cpp: (WebCore::JSAbortSignalOwner::isReachableFromOpaqueRoots): * bindings/js/JSAttrCustom.cpp: (WebCore::JSAttr::visitAdditionalChildren): * bindings/js/JSAudioBufferCustom.cpp: (WebCore::JSAudioBuffer::visitAdditionalChildren): * bindings/js/JSAudioTrackCustom.cpp: (WebCore::JSAudioTrack::visitAdditionalChildren): * bindings/js/JSAudioTrackListCustom.cpp: (WebCore::JSAudioTrackList::visitAdditionalChildren): * bindings/js/JSAudioWorkletProcessorCustom.cpp: (WebCore::JSAudioWorkletProcessor::visitAdditionalChildren): * bindings/js/JSCSSRuleCustom.cpp: (WebCore::JSCSSRule::visitAdditionalChildren): * bindings/js/JSCSSRuleListCustom.cpp: (WebCore::JSCSSRuleListOwner::isReachableFromOpaqueRoots): * bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::JSCSSStyleDeclaration::visitAdditionalChildren): * bindings/js/JSCallbackData.cpp: (WebCore::JSCallbackDataWeak::visitJSFunction): (WebCore::JSCallbackDataWeak::WeakOwner::isReachableFromOpaqueRoots): * bindings/js/JSCallbackData.h: * bindings/js/JSCanvasRenderingContext2DCustom.cpp: (WebCore::JSCanvasRenderingContext2DOwner::isReachableFromOpaqueRoots): (WebCore::JSCanvasRenderingContext2D::visitAdditionalChildren): * bindings/js/JSCustomEventCustom.cpp: (WebCore::JSCustomEvent::visitAdditionalChildren): * bindings/js/JSDOMBuiltinConstructorBase.cpp: (WebCore::JSDOMBuiltinConstructorBase::visitChildrenImpl): (WebCore::JSDOMBuiltinConstructorBase::visitChildren): Deleted. * bindings/js/JSDOMBuiltinConstructorBase.h: * bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::visitChildrenImpl): (WebCore::JSDOMGlobalObject::visitChildren): Deleted. * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMGuardedObject.h: * bindings/js/JSDOMQuadCustom.cpp: (WebCore::JSDOMQuad::visitAdditionalChildren): * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::visitAdditionalChildren): * bindings/js/JSDeprecatedCSSOMValueCustom.cpp: (WebCore::JSDeprecatedCSSOMValueOwner::isReachableFromOpaqueRoots): * bindings/js/JSDocumentCustom.cpp: (WebCore::JSDocument::visitAdditionalChildren): * bindings/js/JSErrorEventCustom.cpp: (WebCore::JSErrorEvent::visitAdditionalChildren): * bindings/js/JSEventListener.cpp: (WebCore::JSEventListener::visitJSFunctionImpl): (WebCore::JSEventListener::visitJSFunction): * bindings/js/JSEventListener.h: * bindings/js/JSEventTargetCustom.cpp: (WebCore::JSEventTarget::visitAdditionalChildren): * bindings/js/JSFetchEventCustom.cpp: (WebCore::JSFetchEvent::visitAdditionalChildren): * bindings/js/JSHTMLCanvasElementCustom.cpp: (WebCore::JSHTMLCanvasElement::visitAdditionalChildren): * bindings/js/JSHTMLTemplateElementCustom.cpp: (WebCore::JSHTMLTemplateElement::visitAdditionalChildren): * bindings/js/JSHistoryCustom.cpp: (WebCore::JSHistory::visitAdditionalChildren): * bindings/js/JSIDBCursorCustom.cpp: (WebCore::JSIDBCursor::visitAdditionalChildren): * bindings/js/JSIDBCursorWithValueCustom.cpp: (WebCore::JSIDBCursorWithValue::visitAdditionalChildren): * bindings/js/JSIDBIndexCustom.cpp: (WebCore::JSIDBIndex::visitAdditionalChildren): * bindings/js/JSIDBObjectStoreCustom.cpp: (WebCore::JSIDBObjectStore::visitAdditionalChildren): * bindings/js/JSIDBRequestCustom.cpp: (WebCore::JSIDBRequest::visitAdditionalChildren): * bindings/js/JSIDBTransactionCustom.cpp: (WebCore::JSIDBTransaction::visitAdditionalChildren): * bindings/js/JSIntersectionObserverCustom.cpp: (WebCore::JSIntersectionObserver::visitAdditionalChildren): * bindings/js/JSIntersectionObserverEntryCustom.cpp: (WebCore::JSIntersectionObserverEntry::visitAdditionalChildren): * bindings/js/JSMessageChannelCustom.cpp: (WebCore::JSMessageChannel::visitAdditionalChildren): * bindings/js/JSMessageEventCustom.cpp: (WebCore::JSMessageEvent::visitAdditionalChildren): * bindings/js/JSMessagePortCustom.cpp: (WebCore::JSMessagePort::visitAdditionalChildren): * bindings/js/JSMutationObserverCustom.cpp: (WebCore::JSMutationObserver::visitAdditionalChildren): (WebCore::JSMutationObserverOwner::isReachableFromOpaqueRoots): * bindings/js/JSMutationRecordCustom.cpp: (WebCore::JSMutationRecord::visitAdditionalChildren): * bindings/js/JSNavigatorCustom.cpp: (WebCore::JSNavigator::visitAdditionalChildren): * bindings/js/JSNodeCustom.cpp: (WebCore::isReachableFromDOM): (WebCore::JSNodeOwner::isReachableFromOpaqueRoots): (WebCore::JSNode::visitAdditionalChildren): * bindings/js/JSNodeIteratorCustom.cpp: (WebCore::JSNodeIterator::visitAdditionalChildren): * bindings/js/JSNodeListCustom.cpp: (WebCore::JSNodeListOwner::isReachableFromOpaqueRoots): * bindings/js/JSOffscreenCanvasRenderingContext2DCustom.cpp: (WebCore::JSOffscreenCanvasRenderingContext2DOwner::isReachableFromOpaqueRoots): (WebCore::JSOffscreenCanvasRenderingContext2D::visitAdditionalChildren): * bindings/js/JSPaintRenderingContext2DCustom.cpp: (WebCore::JSPaintRenderingContext2DOwner::isReachableFromOpaqueRoots): (WebCore::JSPaintRenderingContext2D::visitAdditionalChildren): * bindings/js/JSPaintWorkletGlobalScopeCustom.cpp: (WebCore::JSPaintWorkletGlobalScope::visitAdditionalChildren): * bindings/js/JSPaymentMethodChangeEventCustom.cpp: (WebCore::JSPaymentMethodChangeEvent::visitAdditionalChildren): * bindings/js/JSPaymentResponseCustom.cpp: (WebCore::JSPaymentResponse::visitAdditionalChildren): * bindings/js/JSPerformanceObserverCustom.cpp: (WebCore::JSPerformanceObserver::visitAdditionalChildren): (WebCore::JSPerformanceObserverOwner::isReachableFromOpaqueRoots): * bindings/js/JSPopStateEventCustom.cpp: (WebCore::JSPopStateEvent::visitAdditionalChildren): * bindings/js/JSPromiseRejectionEventCustom.cpp: (WebCore::JSPromiseRejectionEvent::visitAdditionalChildren): * bindings/js/JSResizeObserverCustom.cpp: (WebCore::JSResizeObserver::visitAdditionalChildren): * bindings/js/JSResizeObserverEntryCustom.cpp: (WebCore::JSResizeObserverEntry::visitAdditionalChildren): * bindings/js/JSSVGViewSpecCustom.cpp: (WebCore::JSSVGViewSpec::visitAdditionalChildren): * bindings/js/JSServiceWorkerGlobalScopeCustom.cpp: (WebCore::JSServiceWorkerGlobalScope::visitAdditionalChildren): * bindings/js/JSStaticRangeCustom.cpp: (WebCore::JSStaticRange::visitAdditionalChildren): * bindings/js/JSStyleSheetCustom.cpp: (WebCore::JSStyleSheet::visitAdditionalChildren): * bindings/js/JSTextTrackCueCustom.cpp: (WebCore::JSTextTrackCueOwner::isReachableFromOpaqueRoots): (WebCore::JSTextTrackCue::visitAdditionalChildren): * bindings/js/JSTextTrackCustom.cpp: (WebCore::JSTextTrack::visitAdditionalChildren): * bindings/js/JSTextTrackListCustom.cpp: (WebCore::JSTextTrackList::visitAdditionalChildren): * bindings/js/JSTreeWalkerCustom.cpp: (WebCore::JSTreeWalker::visitAdditionalChildren): * bindings/js/JSUndoItemCustom.cpp: (WebCore::JSUndoItem::visitAdditionalChildren): (WebCore::JSUndoItemOwner::isReachableFromOpaqueRoots): * bindings/js/JSValueInWrappedObject.h: (WebCore::JSValueInWrappedObject::visit const): * bindings/js/JSVideoTrackCustom.cpp: (WebCore::JSVideoTrack::visitAdditionalChildren): * bindings/js/JSVideoTrackListCustom.cpp: (WebCore::JSVideoTrackList::visitAdditionalChildren): * bindings/js/JSWebGL2RenderingContextCustom.cpp: (WebCore::JSWebGL2RenderingContext::visitAdditionalChildren): * bindings/js/JSWebGLRenderingContextCustom.cpp: (WebCore::JSWebGLRenderingContext::visitAdditionalChildren): * bindings/js/JSWorkerGlobalScopeBase.cpp: (WebCore::JSWorkerGlobalScopeBase::visitChildrenImpl): (WebCore::JSWorkerGlobalScopeBase::visitChildren): Deleted. * bindings/js/JSWorkerGlobalScopeBase.h: * bindings/js/JSWorkerGlobalScopeCustom.cpp: (WebCore::JSWorkerGlobalScope::visitAdditionalChildren): * bindings/js/JSWorkerNavigatorCustom.cpp: (WebCore::JSWorkerNavigator::visitAdditionalChildren): * bindings/js/JSWorkletGlobalScopeBase.cpp: (WebCore::JSWorkletGlobalScopeBase::visitChildrenImpl): (WebCore::JSWorkletGlobalScopeBase::visitChildren): Deleted. * bindings/js/JSWorkletGlobalScopeBase.h: * bindings/js/JSXMLHttpRequestCustom.cpp: (WebCore::JSXMLHttpRequest::visitAdditionalChildren): * bindings/js/JSXPathResultCustom.cpp: (WebCore::JSXPathResult::visitAdditionalChildren): * bindings/js/WebCoreTypedArrayController.cpp: (WebCore::WebCoreTypedArrayController::JSArrayBufferOwner::isReachableFromOpaqueRoots): * bindings/js/WebCoreTypedArrayController.h: * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): (GenerateImplementation): (GenerateCallbackHeaderContent): (GenerateCallbackImplementationContent): (GenerateIterableDefinition): * bindings/scripts/test/JS/JSDOMWindow.cpp: (WebCore::JSDOMWindow::subspaceForImpl): * bindings/scripts/test/JS/JSDedicatedWorkerGlobalScope.cpp: (WebCore::JSDedicatedWorkerGlobalScope::subspaceForImpl): * bindings/scripts/test/JS/JSExposedToWorkerAndWindow.cpp: (WebCore::JSExposedToWorkerAndWindow::subspaceForImpl): (WebCore::JSExposedToWorkerAndWindowOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSExposedToWorkerAndWindow.h: * bindings/scripts/test/JS/JSPaintWorkletGlobalScope.cpp: (WebCore::JSPaintWorkletGlobalScope::subspaceForImpl): * bindings/scripts/test/JS/JSServiceWorkerGlobalScope.cpp: (WebCore::JSServiceWorkerGlobalScope::subspaceForImpl): * bindings/scripts/test/JS/JSTestCEReactions.cpp: (WebCore::JSTestCEReactions::subspaceForImpl): (WebCore::JSTestCEReactionsOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestCEReactions.h: * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: (WebCore::JSTestCEReactionsStringifier::subspaceForImpl): (WebCore::JSTestCEReactionsStringifierOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestCEReactionsStringifier.h: * bindings/scripts/test/JS/JSTestCallTracer.cpp: (WebCore::JSTestCallTracer::subspaceForImpl): (WebCore::JSTestCallTracerOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestCallTracer.h: * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: (WebCore::JSTestClassWithJSBuiltinConstructor::subspaceForImpl): (WebCore::JSTestClassWithJSBuiltinConstructorOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h: * bindings/scripts/test/JS/JSTestConditionalIncludes.cpp: (WebCore::JSTestConditionalIncludes::subspaceForImpl): (WebCore::JSTestConditionalIncludesOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestConditionalIncludes.h: * bindings/scripts/test/JS/JSTestConditionallyReadWrite.cpp: (WebCore::JSTestConditionallyReadWrite::subspaceForImpl): (WebCore::JSTestConditionallyReadWriteOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestConditionallyReadWrite.h: * bindings/scripts/test/JS/JSTestDOMJIT.cpp: (WebCore::JSTestDOMJIT::subspaceForImpl): * bindings/scripts/test/JS/JSTestDefaultToJSON.cpp: (WebCore::JSTestDefaultToJSON::subspaceForImpl): (WebCore::JSTestDefaultToJSONOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestDefaultToJSON.h: * bindings/scripts/test/JS/JSTestDefaultToJSONFilteredByExposed.cpp: (WebCore::JSTestDefaultToJSONFilteredByExposed::subspaceForImpl): (WebCore::JSTestDefaultToJSONFilteredByExposedOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestDefaultToJSONFilteredByExposed.h: * bindings/scripts/test/JS/JSTestDefaultToJSONIndirectInheritance.cpp: (WebCore::JSTestDefaultToJSONIndirectInheritance::subspaceForImpl): * bindings/scripts/test/JS/JSTestDefaultToJSONInherit.cpp: (WebCore::JSTestDefaultToJSONInherit::subspaceForImpl): * bindings/scripts/test/JS/JSTestDefaultToJSONInheritFinal.cpp: (WebCore::JSTestDefaultToJSONInheritFinal::subspaceForImpl): * bindings/scripts/test/JS/JSTestDomainSecurity.cpp: (WebCore::JSTestDomainSecurity::subspaceForImpl): (WebCore::JSTestDomainSecurityOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestDomainSecurity.h: * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: (WebCore::JSTestEnabledBySetting::subspaceForImpl): (WebCore::JSTestEnabledBySettingOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestEnabledBySetting.h: * bindings/scripts/test/JS/JSTestEnabledForContext.cpp: (WebCore::JSTestEnabledForContext::subspaceForImpl): (WebCore::JSTestEnabledForContextOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestEnabledForContext.h: * bindings/scripts/test/JS/JSTestEventConstructor.cpp: (WebCore::JSTestEventConstructor::subspaceForImpl): * bindings/scripts/test/JS/JSTestEventTarget.cpp: (WebCore::JSTestEventTarget::subspaceForImpl): * bindings/scripts/test/JS/JSTestException.cpp: (WebCore::JSTestException::subspaceForImpl): (WebCore::JSTestExceptionOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestException.h: * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: (WebCore::JSTestGenerateIsReachable::subspaceForImpl): (WebCore::JSTestGenerateIsReachableOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestGenerateIsReachable.h: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: (WebCore::JSTestGlobalObject::subspaceForImpl): (WebCore::JSTestGlobalObjectOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestGlobalObject.h: * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp: (WebCore::JSTestIndexedSetterNoIdentifier::subspaceForImpl): (WebCore::JSTestIndexedSetterNoIdentifierOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp: (WebCore::JSTestIndexedSetterThrowingException::subspaceForImpl): (WebCore::JSTestIndexedSetterThrowingExceptionOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.h: * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: (WebCore::JSTestIndexedSetterWithIdentifier::subspaceForImpl): (WebCore::JSTestIndexedSetterWithIdentifierOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestInterface.cpp: (WebCore::jsTestInterfacePrototypeFunction_entriesCaller): (WebCore::JSTestInterface::subspaceForImpl): (WebCore::JSTestInterfaceOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestInterface.h: * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: (WebCore::JSTestInterfaceLeadingUnderscore::subspaceForImpl): (WebCore::JSTestInterfaceLeadingUnderscoreOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.h: * bindings/scripts/test/JS/JSTestIterable.cpp: (WebCore::jsTestIterablePrototypeFunction_entriesCaller): (WebCore::JSTestIterable::subspaceForImpl): (WebCore::JSTestIterableOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestIterable.h: * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp: (WebCore::JSTestJSBuiltinConstructor::subspaceForImpl): * bindings/scripts/test/JS/JSTestLegacyFactoryFunction.cpp: (WebCore::JSTestLegacyFactoryFunction::subspaceForImpl): (WebCore::JSTestLegacyFactoryFunctionOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestLegacyFactoryFunction.h: * bindings/scripts/test/JS/JSTestLegacyNoInterfaceObject.cpp: (WebCore::JSTestLegacyNoInterfaceObject::subspaceForImpl): (WebCore::JSTestLegacyNoInterfaceObjectOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestLegacyNoInterfaceObject.h: * bindings/scripts/test/JS/JSTestLegacyOverrideBuiltIns.cpp: (WebCore::JSTestLegacyOverrideBuiltIns::subspaceForImpl): (WebCore::JSTestLegacyOverrideBuiltInsOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestLegacyOverrideBuiltIns.h: * bindings/scripts/test/JS/JSTestMapLike.cpp: (WebCore::JSTestMapLike::subspaceForImpl): (WebCore::JSTestMapLikeOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestMapLike.h: * bindings/scripts/test/JS/JSTestMapLikeWithOverriddenOperations.cpp: (WebCore::JSTestMapLikeWithOverriddenOperations::subspaceForImpl): (WebCore::JSTestMapLikeWithOverriddenOperationsOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestMapLikeWithOverriddenOperations.h: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp: (WebCore::JSTestNamedAndIndexedSetterNoIdentifier::subspaceForImpl): (WebCore::JSTestNamedAndIndexedSetterNoIdentifierOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp: (WebCore::JSTestNamedAndIndexedSetterThrowingException::subspaceForImpl): (WebCore::JSTestNamedAndIndexedSetterThrowingExceptionOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.h: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: (WebCore::JSTestNamedAndIndexedSetterWithIdentifier::subspaceForImpl): (WebCore::JSTestNamedAndIndexedSetterWithIdentifierOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp: (WebCore::JSTestNamedDeleterNoIdentifier::subspaceForImpl): (WebCore::JSTestNamedDeleterNoIdentifierOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp: (WebCore::JSTestNamedDeleterThrowingException::subspaceForImpl): (WebCore::JSTestNamedDeleterThrowingExceptionOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.h: * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: (WebCore::JSTestNamedDeleterWithIdentifier::subspaceForImpl): (WebCore::JSTestNamedDeleterWithIdentifierOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp: (WebCore::JSTestNamedDeleterWithIndexedGetter::subspaceForImpl): (WebCore::JSTestNamedDeleterWithIndexedGetterOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.h: * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp: (WebCore::JSTestNamedGetterCallWith::subspaceForImpl): (WebCore::JSTestNamedGetterCallWithOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestNamedGetterCallWith.h: * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp: (WebCore::JSTestNamedGetterNoIdentifier::subspaceForImpl): (WebCore::JSTestNamedGetterNoIdentifierOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: (WebCore::JSTestNamedGetterWithIdentifier::subspaceForImpl): (WebCore::JSTestNamedGetterWithIdentifierOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp: (WebCore::JSTestNamedSetterNoIdentifier::subspaceForImpl): (WebCore::JSTestNamedSetterNoIdentifierOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.h: * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp: (WebCore::JSTestNamedSetterThrowingException::subspaceForImpl): (WebCore::JSTestNamedSetterThrowingExceptionOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.h: * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: (WebCore::JSTestNamedSetterWithIdentifier::subspaceForImpl): (WebCore::JSTestNamedSetterWithIdentifierOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.h: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: (WebCore::JSTestNamedSetterWithIndexedGetter::subspaceForImpl): (WebCore::JSTestNamedSetterWithIndexedGetterOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.h: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: (WebCore::JSTestNamedSetterWithIndexedGetterAndSetter::subspaceForImpl): (WebCore::JSTestNamedSetterWithIndexedGetterAndSetterOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.h: * bindings/scripts/test/JS/JSTestNamedSetterWithLegacyOverrideBuiltIns.cpp: (WebCore::JSTestNamedSetterWithLegacyOverrideBuiltIns::subspaceForImpl): (WebCore::JSTestNamedSetterWithLegacyOverrideBuiltInsOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestNamedSetterWithLegacyOverrideBuiltIns.h: * bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeableProperties.cpp: (WebCore::JSTestNamedSetterWithLegacyUnforgeableProperties::subspaceForImpl): (WebCore::JSTestNamedSetterWithLegacyUnforgeablePropertiesOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeableProperties.h: * bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns.cpp: (WebCore::JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns::subspaceForImpl): (WebCore::JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltInsOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns.h: * bindings/scripts/test/JS/JSTestNode.cpp: (WebCore::jsTestNodePrototypeFunction_entriesCaller): (WebCore::JSTestNode::subspaceForImpl): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::JSTestObj::subspaceForImpl): (WebCore::JSTestObj::visitChildrenImpl): (WebCore::JSTestObjOwner::isReachableFromOpaqueRoots): (WebCore::JSTestObj::visitChildren): Deleted. * bindings/scripts/test/JS/JSTestObj.h: * bindings/scripts/test/JS/JSTestOperationConditional.cpp: (WebCore::JSTestOperationConditional::subspaceForImpl): (WebCore::JSTestOperationConditionalOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestOperationConditional.h: * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: (WebCore::JSTestOverloadedConstructors::subspaceForImpl): (WebCore::JSTestOverloadedConstructorsOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestOverloadedConstructors.h: * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: (WebCore::JSTestOverloadedConstructorsWithSequence::subspaceForImpl): (WebCore::JSTestOverloadedConstructorsWithSequenceOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h: * bindings/scripts/test/JS/JSTestPluginInterface.cpp: (WebCore::JSTestPluginInterface::subspaceForImpl): (WebCore::JSTestPluginInterfaceOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestPluginInterface.h: * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: (WebCore::JSTestPromiseRejectionEvent::subspaceForImpl): * bindings/scripts/test/JS/JSTestReadOnlyMapLike.cpp: (WebCore::JSTestReadOnlyMapLike::subspaceForImpl): (WebCore::JSTestReadOnlyMapLikeOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestReadOnlyMapLike.h: * bindings/scripts/test/JS/JSTestReadOnlySetLike.cpp: (WebCore::JSTestReadOnlySetLike::subspaceForImpl): (WebCore::JSTestReadOnlySetLikeOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestReadOnlySetLike.h: * bindings/scripts/test/JS/JSTestReportExtraMemoryCost.cpp: (WebCore::JSTestReportExtraMemoryCost::subspaceForImpl): (WebCore::JSTestReportExtraMemoryCost::visitChildrenImpl): (WebCore::JSTestReportExtraMemoryCostOwner::isReachableFromOpaqueRoots): (WebCore::JSTestReportExtraMemoryCost::visitChildren): Deleted. * bindings/scripts/test/JS/JSTestReportExtraMemoryCost.h: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: (WebCore::JSTestSerializedScriptValueInterface::subspaceForImpl): (WebCore::JSTestSerializedScriptValueInterface::visitChildrenImpl): (WebCore::JSTestSerializedScriptValueInterfaceOwner::isReachableFromOpaqueRoots): (WebCore::JSTestSerializedScriptValueInterface::visitChildren): Deleted. * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h: * bindings/scripts/test/JS/JSTestSetLike.cpp: (WebCore::JSTestSetLike::subspaceForImpl): (WebCore::JSTestSetLikeOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestSetLike.h: * bindings/scripts/test/JS/JSTestSetLikeWithOverriddenOperations.cpp: (WebCore::JSTestSetLikeWithOverriddenOperations::subspaceForImpl): (WebCore::JSTestSetLikeWithOverriddenOperationsOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestSetLikeWithOverriddenOperations.h: * bindings/scripts/test/JS/JSTestStringifier.cpp: (WebCore::JSTestStringifier::subspaceForImpl): (WebCore::JSTestStringifierOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestStringifier.h: * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: (WebCore::JSTestStringifierAnonymousOperation::subspaceForImpl): (WebCore::JSTestStringifierAnonymousOperationOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.h: * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: (WebCore::JSTestStringifierNamedOperation::subspaceForImpl): (WebCore::JSTestStringifierNamedOperationOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestStringifierNamedOperation.h: * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: (WebCore::JSTestStringifierOperationImplementedAs::subspaceForImpl): (WebCore::JSTestStringifierOperationImplementedAsOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.h: * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: (WebCore::JSTestStringifierOperationNamedToString::subspaceForImpl): (WebCore::JSTestStringifierOperationNamedToStringOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.h: * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: (WebCore::JSTestStringifierReadOnlyAttribute::subspaceForImpl): (WebCore::JSTestStringifierReadOnlyAttributeOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.h: * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: (WebCore::JSTestStringifierReadWriteAttribute::subspaceForImpl): (WebCore::JSTestStringifierReadWriteAttributeOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.h: * bindings/scripts/test/JS/JSTestTypedefs.cpp: (WebCore::JSTestTypedefs::subspaceForImpl): (WebCore::JSTestTypedefsOwner::isReachableFromOpaqueRoots): * bindings/scripts/test/JS/JSTestTypedefs.h: * bindings/scripts/test/JS/JSWorkerGlobalScope.cpp: (WebCore::JSWorkerGlobalScope::subspaceForImpl): * bindings/scripts/test/JS/JSWorkletGlobalScope.cpp: (WebCore::JSWorkletGlobalScope::subspaceForImpl): * dom/ActiveDOMCallback.h: (WebCore::ActiveDOMCallback::visitJSFunction): * dom/EventListener.h: (WebCore::EventListener::visitJSFunction): * dom/EventTarget.cpp: (WebCore::EventTarget::visitJSEventListeners): * dom/EventTarget.h: * dom/MutationRecord.cpp: * dom/MutationRecord.h: * dom/NodeFilterCondition.h: (WebCore::NodeFilterCondition::visitAggregate): Deleted. * dom/StaticRange.cpp: (WebCore::StaticRange::visitNodesConcurrently const): * dom/StaticRange.h: * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::addMembersToOpaqueRoots): * html/canvas/WebGL2RenderingContext.h: * html/canvas/WebGLFramebuffer.cpp: (WebCore::WebGLFramebuffer::addMembersToOpaqueRoots): * html/canvas/WebGLFramebuffer.h: * html/canvas/WebGLProgram.cpp: (WebCore::WebGLProgram::addMembersToOpaqueRoots): * html/canvas/WebGLProgram.h: * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::addMembersToOpaqueRoots): * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGLTransformFeedback.cpp: (WebCore::WebGLTransformFeedback::addMembersToOpaqueRoots): * html/canvas/WebGLTransformFeedback.h: * html/canvas/WebGLVertexArrayObjectBase.cpp: (WebCore::WebGLVertexArrayObjectBase::addMembersToOpaqueRoots): * html/canvas/WebGLVertexArrayObjectBase.h: Canonical link: https://commits.webkit.org/234335@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273138 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-19 15:51:15 +00:00
heap/VerifierSlotVisitor.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
heap/VisitRaceKey.cpp
heap/Weak.cpp
heap/WeakBlock.cpp
heap/WeakHandleOwner.cpp
heap/WeakSet.cpp
heap/WriteBarrierSupport.cpp
inspector/AsyncStackTrace.cpp
inspector/ConsoleMessage.cpp
inspector/ContentSearchUtilities.cpp
inspector/IdentifiersFactory.cpp
inspector/InjectedScript.cpp
inspector/InjectedScriptBase.cpp
inspector/InjectedScriptHost.cpp
inspector/InjectedScriptManager.cpp
inspector/InjectedScriptModule.cpp
inspector/InspectorAgentRegistry.cpp
inspector/InspectorFrontendRouter.cpp
inspector/InspectorBackendDispatcher.cpp
Web Inspector: allow inspector to pause provisional page load and restore its state https://bugs.webkit.org/show_bug.cgi?id=204170 Reviewed by Devin Rousso. Source/JavaScriptCore: Added an option to Target domain to pause all new targets on start waiting for explicit 'resume' command from the inspector front-end. This allows to configure inspector backend (including user agent overrides, breakpoints and instrumentation) before navigation starts. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * inspector/InspectorTarget.cpp: Added. (Inspector::InspectorTarget::pause): (Inspector::InspectorTarget::resume): (Inspector::InspectorTarget::setResumeCallback): * inspector/InspectorTarget.h: * inspector/agents/InspectorTargetAgent.cpp: (Inspector::InspectorTargetAgent::willDestroyFrontendAndBackend): (Inspector::InspectorTargetAgent::setPauseOnStart): (Inspector::InspectorTargetAgent::resume): (Inspector::buildTargetInfoObject): (Inspector::InspectorTargetAgent::targetCreated): (Inspector::InspectorTargetAgent::targetDestroyed): * inspector/agents/InspectorTargetAgent.h: * inspector/protocol/Target.json: Source/WebInspectorUI: All new targets are now automatically paused on start. For such provisional targets target manager will run regular initilization code (enable agents etc.) and then resume loading of the target. Responses and events from the target are defferred until the target is committed and becomes current main target. When the target manager receives event that the provisional target has been committed all accumulated protocol messages are replayed and going forward all new missages will be dispatched as usual. * UserInterface/Controllers/TargetManager.js: (WI.TargetManager): (WI.TargetManager.prototype.targetCreated): (WI.TargetManager.prototype.didCommitProvisionalTarget): (WI.TargetManager.prototype.targetDestroyed): (WI.TargetManager.prototype.dispatchMessageFromTarget): (WI.TargetManager.prototype._createTarget): (WI.TargetManager.prototype._checkAndHandlePageTargetTransition): (WI.TargetManager.prototype._checkAndHandlePageTargetTermination): * UserInterface/Protocol/Connection.js: (InspectorBackend.Connection): (InspectorBackend.Connection.prototype.addProvisionalMessage): (InspectorBackend.Connection.prototype.dispatchProvisionalMessages): * UserInterface/Protocol/MultiplexingBackendTarget.js: (WI.MultiplexingBackendTarget.prototype.initialize): * UserInterface/Protocol/PageTarget.js: (WI.PageTarget): * UserInterface/Protocol/Target.js: (WI.Target.prototype.initialize): (WI.Target.prototype.get isProvisional): (WI.Target.prototype.get isPaused): (WI.Target.prototype.didCommitProvisionalTarget): * UserInterface/Protocol/WorkerTarget.js: Source/WebKit: Provisional page loading can be deffered if inspector front-end is connected. This allows to configure inspector backend in the provisional page before load request is sent. If inspector front-end is not connected provisional loading will conitinue exactly as before. Tests: http/tests/inspector/target/pause-on-inline-debugger-statement.html http/tests/inspector/target/provisional-load-cancels-previous-load.html * UIProcess/InspectorTargetProxy.cpp: (WebKit::InspectorTargetProxy::disconnect): * UIProcess/WebPageInspectorController.cpp: (WebKit::WebPageInspectorController::shouldPauseLoading const): (WebKit::WebPageInspectorController::setContinueLoadingCallback): * UIProcess/WebPageInspectorController.h: * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::continueNavigationInNewProcess): LayoutTests: Test that provisional loading which starts before previos provisional loading commits will be correctly handled by the insepctor. Test that script execution will break on debugger statement in inline scripts in case of cross origin navigation and PSON. * http/tests/inspector/target/pause-on-inline-debugger-statement-expected.txt: Added. * http/tests/inspector/target/pause-on-inline-debugger-statement.html: Added. * http/tests/inspector/target/provisional-load-cancels-previous-load-expected.txt: Added. * http/tests/inspector/target/provisional-load-cancels-previous-load.html: Added. * http/tests/inspector/target/resources/inline-debugger-statement.html: Added. * http/tests/inspector/target/target-events-for-provisional-page-expected.txt: * http/tests/inspector/target/target-events-for-provisional-page.html: Canonical link: https://commits.webkit.org/218059@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-12-04 08:24:13 +00:00
inspector/InspectorTarget.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
inspector/JSGlobalObjectConsoleClient.cpp
Web Inspector: rename `ScriptDebugServer` subclasses/methods https://bugs.webkit.org/show_bug.cgi?id=215363 <rdar://problem/67310441> Reviewed by Brian Burg. r266074 merged `Inspector::ScriptDebugServer` into `JSC::Debugger`. All subclasses and functions should be renamed to match this change. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectDebugger.h: Renamed from Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.h. * inspector/JSGlobalObjectDebugger.cpp: Renamed from Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp. * inspector/JSGlobalObjectInspectorController.h: * inspector/JSGlobalObjectInspectorController.cpp: * inspector/agents/InspectorAuditAgent.h: * inspector/agents/InspectorAuditAgent.cpp: * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: * inspector/agents/InspectorRuntimeAgent.h: * inspector/agents/InspectorRuntimeAgent.cpp: * inspector/agents/InspectorScriptProfilerAgent.cpp: * inspector/agents/JSGlobalObjectDebuggerAgent.cpp: * inspector/remote/RemoteInspectionTarget.cpp: * inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm: Source/WebCore: * Headers.cmake: * Sources.txt: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorController.h: * inspector/InspectorController.cpp: * inspector/PageDebugger.h: Renamed from Source/WebCore/inspector/PageScriptDebugServer.h. * inspector/PageDebugger.cpp: Renamed from Source/WebCore/inspector/PageScriptDebugServer.cpp. * inspector/mac/PageDebuggerMac.mm: Renamed from Source/WebCore/inspector/mac/PageScriptDebugServerMac.mm. * inspector/WorkerDebugger.h: Renamed from Source/WebCore/inspector/WorkerScriptDebugServer.h. * inspector/WorkerDebugger.cpp: Renamed from Source/WebCore/inspector/WorkerScriptDebugServer.cpp. * inspector/WorkerInspectorController.h: * inspector/WorkerInspectorController.cpp: * inspector/agents/InspectorTimelineAgent.cpp: * inspector/agents/page/PageDebuggerAgent.cpp: Canonical link: https://commits.webkit.org/228554@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266077 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-24 18:40:30 +00:00
inspector/JSGlobalObjectDebugger.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
inspector/JSGlobalObjectInspectorController.cpp
inspector/JSInjectedScriptHost.cpp
inspector/JSInjectedScriptHostPrototype.cpp
inspector/JSJavaScriptCallFrame.cpp
inspector/JSJavaScriptCallFramePrototype.cpp
inspector/JavaScriptCallFrame.cpp
inspector/PerGlobalObjectWrapperWorld.cpp
inspector/ScriptArguments.cpp
inspector/ScriptCallFrame.cpp
inspector/ScriptCallStack.cpp
inspector/ScriptCallStackFactory.cpp
Setup WebCore build to start using unified sources. https://bugs.webkit.org/show_bug.cgi?id=178362 Reviewed by Tim Horton. .: Pass features to the unified source bundler script. * Source/cmake/WebKitCommon.cmake: * Source/cmake/WebKitFeatures.cmake: * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: Change comments in source list files. Also, pass explicit names for build files. * CMakeLists.txt: * PlatformGTK.cmake: * PlatformMac.cmake: * Sources.txt: * SourcesGTK.txt: * SourcesMac.txt: Source/WebCore: This patch adds all the long tooling needed to start adding unified sources to WebCore. Most of the source list files are empty to start but will be filled over the next few days. I started by moving all the non-derived bindings code to unified sources to make sure everything worked correctly. * CMakeLists.txt: * Configurations/GenerateUnifiedSources.xcconfig: Added. * Configurations/WebCore.xcconfig: * PlatformMac.cmake: * Sources.txt: Added. * SourcesCocoa.txt: Added. * SourcesIOS.txt: Added. * SourcesMac.txt: Added. * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSMediaStreamCapabilitiesCustom.cpp: Removed. No one seems to use this... Source/WTF: There are a number of changes to the bundler script. First, it is now possible to enable or disable building files based on if the associated feature flag is enabled or not. The syntax for this is similar to how we do #ifs in C++ code. e.g. #if ENABLE_APPLE_PAY myApplePayFile.cpp #endif would enable myApplePayFile.cpp if and only if the APPLE_PAY feature define is set. I also changed comments from # to // to make it less likely they would be confused with a #if. Finally, this patch enables bundling files in the same relative directory across source list files. Previously, if SourcesCocoa.txt had platform/cf/foo.cpp and SourcesMac.txt had platform/cf/bar.cpp those files would not be put in the same unified source bundle. Now, those files will be put into the same bundle but bar.cpp will always follow foo.cpp. The idea is that by putting more specific files after more general files we can avoid random build failures. * Scripts/generate-unified-source-bundles.rb: Canonical link: https://commits.webkit.org/194673@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223621 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-18 19:14:51 +00:00
// Derived Sources
JSC build should use unified sources for derived sources https://bugs.webkit.org/show_bug.cgi?id=177421 Reviewed by JF Bastien. .: * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch make a couple of changes: 1) Make derived sources added to relevant bundles. I was going to add JSCBuiltins.cpp to runtime but that kept breaking the windows build. I'll get back to it later 2) Move the derived location of some sources both for clarity and for ease of use. 3) Make auto generator scripts able to create directories if needed. 4) Move some scripts from the top level of the JavaScriptCore directory to a more appropriate directory. 5) Move some CMake generation commands around for clarity. * CMakeLists.txt: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Scripts/lazywriter.py: (LazyFileWriter.close): * Sources.txt: * inspector/scripts/generate-inspector-protocol-bindings.py: (IncrementalFileWriter.close): * yarr/create_regex_tables: Renamed from Source/JavaScriptCore/create_regex_tables. * yarr/generateYarrCanonicalizeUnicode: Renamed from Source/JavaScriptCore/generateYarrCanonicalizeUnicode. Source/WTF: The script now needs to determine if a file is from a derived source. This is only relevant for the CMake build since the script needs to provide a list of the bundled source files. If the script does not provide the full path for derived sources then CMake will be unable to find them and the build will fail. Additionally, I move the error message for the Xcode build outside the main loop. This means that the error message will contain all the files you need to add to Xcode and all those files will now be written in DerivedSources so they should be easier to add. * Scripts/generate-unified-source-bundles.rb: Canonical link: https://commits.webkit.org/193793@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-26 15:34:19 +00:00
inspector/InspectorBackendDispatchers.cpp
inspector/InspectorFrontendDispatchers.cpp
inspector/InspectorProtocolObjects.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
inspector/agents/InspectorAgent.cpp
Web Inspector: Audit: create new IDL type for exposing special functionality in test context https://bugs.webkit.org/show_bug.cgi?id=193149 <rdar://problem/46801218> Reviewed by Joseph Pecoraro. Source/JavaScriptCore: Create a new `AuditAgent` (and various subclasses for different inspection targets) * inspector/protocol/Audit.json: Added. Add a `run` command that is a simpler version of `Runtime.evaluate`, except that it expects a function string instead of an arbitrary JavaScript expression. Add `setup` and `teardown` commands that create a JavaScript object that will be passed in to the test as an argument. Keep this object alive so that tests can add to the object and have later tests use what was added. * inspector/agents/InspectorAuditAgent.h: Added. * inspector/agents/InspectorAuditAgent.cpp: Added. (Inspector::InspectorAuditAgent::InspectorAuditAgent): (Inspector::InspectorAuditAgent::didCreateFrontendAndBackend): (Inspector::InspectorAuditAgent::willDestroyFrontendAndBackend): (Inspector::InspectorAuditAgent::setup): (Inspector::InspectorAuditAgent::run): (Inspector::InspectorAuditAgent::teardown): (Inspector::InspectorAuditAgent::hasActiveAudit): (Inspector::InspectorAuditAgent::populateAuditObject): * inspector/agents/JSGlobalObjectAuditAgent.h: Added. * inspector/agents/JSGlobalObjectAuditAgent.cpp: Added. (Inspector::JSGlobalObjectAuditAgent::JSGlobalObjectAuditAgent): (Inspector::JSGlobalObjectAuditAgent::injectedScriptForEval): * inspector/JSGlobalObjectInspectorController.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::connectFrontend): (Inspector::JSGlobalObjectInspectorController::jsAgentContext): Added. (Inspector::JSGlobalObjectInspectorController::createLazyAgents): Added. * inspector/InjectedScript.h: * inspector/InjectedScript.cpp: (Inspector::InjectedScript::execute): Added. (Inspector::InjectedScript::arrayFromVector): Added. Create a version of `evaluate` that accepts a list of values to be passed in as arguments to the function that was created by the `eval` of the given `functionString`. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.execute): Added. (InjectedScript.prototype.evaluate): (InjectedScript.prototype.evaluateOnCallFrame): (InjectedScript.prototype._evaluateAndWrap): (InjectedScript.prototype._wrapAndSaveCall): Added. (InjectedScript.prototype._wrapCall): Added. (InjectedScript.prototype._evaluateOn): Refactor the `eval` and `saveResult` logic to allow for more flexibility for other callers. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * UnifiedSources-input.xcfilelist: Source/WebCore: Tests: inspector/audit/run.html inspector/audit/setup.html inspector/audit/teardown.html Create a new `AuditAgent` (and various subclasses for different inspection targets), as well as `InspectorAuditAccessibilityObject` and `InspectorAuditDOMObject` objects that will be injected into the test function to allow for more advanced testing. * inspector/InspectorAuditAccessibilityObject.idl: Added. * inspector/InspectorAuditAccessibilityObject.h: Added. (WebCore::InspectorAuditAccessibilityObject::create): * inspector/InspectorAuditAccessibilityObject.cpp: Added. (WebCore::InspectorAuditAccessibilityObject::InspectorAuditAccessibilityObject): * inspector/InspectorAuditDOMObject.idl: Added. * inspector/InspectorAuditDOMObject.h: Added. (WebCore::InspectorAuditDOMObject::create): * inspector/InspectorAuditDOMObject.cpp: Added. (WebCore::InspectorAuditDOMObject::InspectorAuditDOMObject): * inspector/agents/page/PageAuditAgent.h: Added. * inspector/agents/page/PageAuditAgent.cpp: Added. (WebCore::PageAuditAgent::PageAuditAgent): (WebCore::PageAuditAgent::injectedScriptForEval): (WebCore::PageAuditAgent::populateAuditObject): (WebCore::PageAuditAgent::muteConsole): (WebCore::PageAuditAgent::unmuteConsole): * inspector/agents/worker/WorkerAuditAgent.h: Added. * inspector/agents/worker/WorkerAuditAgent.cpp: Added. (WebCore::WorkerAuditAgent::WorkerAuditAgent): (WebCore::WorkerAuditAgent::injectedScriptForEval): * inspector/InspectorController.cpp: (WebCore::InspectorController::createLazyAgents): * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::createLazyAgents): * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * UnifiedSources-input.xcfilelist: * WebCore.xcodeproj/project.pbxproj: Source/WebInspectorUI: Add `AuditAgent` getters and plumbing. * UserInterface/Protocol/Target.js: (WI.Target.prototype.get AuditAgent): Added. * UserInterface/Models/AuditTestCase.js: (WI.AuditTestCase.prototype.async run): * UserInterface/Controllers/AuditManager.js: (WI.AuditManager.prototype.async start): * .eslintrc: LayoutTests: * inspector/audit/resources/audit-utilities.js: (TestPage.registerInitializer.InspectorTest.Audit.setupAudit): Added. (TestPage.registerInitializer.InspectorTest.Audit.teardownAudit): Added. * inspector/audit/run.html: Added. * inspector/audit/run-expected.txt: Added. * inspector/audit/setup.html: Added. * inspector/audit/setup-expected.txt: Added. * inspector/audit/teardown.html: Added. * inspector/audit/teardown-expected.txt: Added. * inspector/canvas/create-context-2d-expected.txt: * inspector/canvas/create-context-bitmaprenderer-expected.txt: * inspector/canvas/create-context-webgl-expected.txt: * inspector/canvas/create-context-webgl2-expected.txt: * inspector/canvas/create-context-webmetal-expected.txt: * inspector/canvas/recording-2d-expected.txt: * inspector/canvas/recording-webgl-expected.txt: * inspector/canvas/recording-webgl-snapshots-expected.txt: * inspector/model/remote-object-expected.txt: * inspector/model/stack-trace-expected.txt: Canonical link: https://commits.webkit.org/207945@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239976 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-15 08:25:33 +00:00
inspector/agents/InspectorAuditAgent.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
inspector/agents/InspectorConsoleAgent.cpp
inspector/agents/InspectorDebuggerAgent.cpp
inspector/agents/InspectorHeapAgent.cpp
inspector/agents/InspectorRuntimeAgent.cpp
inspector/agents/InspectorScriptProfilerAgent.cpp
Web Inspector: Keep Web Inspector window alive across process swaps (PSON) (Remote Inspector) https://bugs.webkit.org/show_bug.cgi?id=191494 <rdar://problem/45469854> Reviewed by Devin Rousso. Source/JavaScriptCore: * CMakeLists.txt: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: New domain and resources. * inspector/protocol/Target.json: Added. New protocol domain, modeled after Worker.json, to allow for multiplexing between different targets. * inspector/InspectorTarget.h: Each target will instantiate an InspectorTarget and must provide an identifier, type, and means of connecting/disconnecting to a frontend channel. * inspector/agents/InspectorTargetAgent.cpp: Added. (Inspector::InspectorTargetAgent::InspectorTargetAgent): (Inspector::InspectorTargetAgent::didCreateFrontendAndBackend): (Inspector::InspectorTargetAgent::willDestroyFrontendAndBackend): (Inspector::InspectorTargetAgent::exists): (Inspector::InspectorTargetAgent::initialized): (Inspector::InspectorTargetAgent::sendMessageToTarget): (Inspector::InspectorTargetAgent::sendMessageFromTargetToFrontend): (Inspector::targetTypeToProtocolType): (Inspector::buildTargetInfoObject): (Inspector::InspectorTargetAgent::targetCreated): (Inspector::InspectorTargetAgent::targetTerminated): (Inspector::InspectorTargetAgent::connectToTargets): (Inspector::InspectorTargetAgent::disconnectFromTargets): * inspector/agents/InspectorTargetAgent.h: Added. TargetAgent holds a list of targets, and connects/disconnects to each of the targets when a frontend connects/disconnects. * inspector/scripts/codegen/generator.py: Better enum casing of ServiceWorker. Source/WebCore: * inspector/InspectorClient.h: (WebCore::InspectorClient::allowRemoteInspectionToPageDirectly const): Provide a hook so that a client may wish to allow direct remote inspection of the Page. This is used by WebKitLegacy only. * page/Page.cpp: (Page::Page): Only enable the PageDebuggable if the client wishes remote inspection of the Page directly. This is used by WebKitLegacy only. * inspector/InspectorController.cpp: (WebCore::InspectorController::connectFrontend): * inspector/InspectorController.h: * page/PageDebuggable.cpp: (WebCore::PageDebuggable::connect): (WebCore::PageDebuggable::disconnect): * page/PageDebuggable.h: When a frontend connects, always enable the developer extras for the Page. This is pretty much only for the remote path, which allows inspection if developer extras were not already enabled (iOS). This simplifies the logic, and toggling developer extras after it was already enabled is not really important. Source/WebInspectorUI: This starts introducing multi-target support into the Web Inspector frontend. Specifically a backend connection that is persistent, but has the ability to connect to and transition between Page targets received through that backend connection. This patch introduces the concept of a "Backend Target" which is the single connection that the frontend contains to a backend. The old way of connecting directly to a target is still supported. In that case the frontend constructs a DirectBackendTarget for the debuggable type the frontend was spawns for. However, if the frontend opens and has a TargetAgent, then it is likely connected to a multi-target supporting backend and instead constructs a MultiplexingBackendTarget, and will receive further information about sub-targets to connect to. The only sub-target at the moment is a Page sub-target. As part of bringing up multi-target support this adds a few measures to handle situations where the frontend is playing fast and loose with agents. When the frontend does `FooAgent.method` it intends that to be performed on the "main" target being debugged. Likewise when the frontend loops over targets it expects them to be the debuggable targets. This patch profiles a new implementation of `WI.mainTarget` and `WI.targets` to match the assumptions being made by the frontend. - In a direct-target world, there is a single target which should be used for global agents and in WI.targets. - In a multi-target world, the page target is the one that should be used for global agents and WI.targets is the list of sub-targets (excluding the MultiplexingBackendTarget). In a multi-target world, there are now commonly two Targets. The MultiplexingBackendTarget and a PageTarget sub-target. In the future this may include more targets, such as ServiceWorkers, DedicatedWorkers, and perhaps even frames. In a multi-target world, the frontend is immediately told about targets as soon as it opens (via Target.targetCreated). In order to support this, frontend initialization happens without a main target being available. So this makes a few small changes to frontend initialization to perform a bit of work once we know what the main target is. During a page transition the frontend is told to destroy existing targets and is soon after told about any new page targets (via Target.targetDestroyed and Target.targetCreated). The frontend special cases this page transition. It expects only one Page target to be alive at any time, accessible through WI.pageTarget. When a page transition happens the WI.pageTarget changes, and the frontend performs a bit of work to prepare the UI to handle the transition: `<Manager>.transitionPageTarget` / WI.Notification.TransitionPageTarget. For the most part the UI behaves fine as long once there are main frame change and main resource change events, but those other events allow the frontend to respond to the specific page transition cases. * UserInterface/Base/Main.js: (WI.loaded): (WI.initializeBackendTarget): (WI.initializePageTarget): (WI.transitionPageTarget): (WI.terminatePageTarget): (WI.resetMainExecutionContext): (WI.redirectGlobalAgentsToConnection): (WI.contentLoaded): New global functions for target initialization and page transitioning. * UserInterface/Test/Test.js: (WI.loaded): (WI.initializeBackendTarget): (WI.initializePageTarget): (WI.transitionPageTarget): (WI.terminatePageTarget): (WI.resetMainExecutionContext): (WI.redirectGlobalAgentsToConnection): New global functions for target initialization. Tests continue to be a direct connection to the Page. * UserInterface/Protocol/TargetObserver.js: (WI.TargetObserver.prototype.targetCreated): (WI.TargetObserver.prototype.targetDestroyed): (WI.TargetObserver.prototype.dispatchMessageFromTarget): New observer goes to the manager. * UserInterface/Controllers/TargetManager.js: (WI.TargetManager): (WI.TargetManager.prototype.get targets): (WI.TargetManager.prototype.get allTargets): (WI.TargetManager.prototype.targetForIdentifier): (WI.TargetManager.prototype.targetCreated): (WI.TargetManager.prototype.targetDestroyed): (WI.TargetManager.prototype.dispatchMessageFromTarget): (WI.TargetManager.prototype.createMultiplexingBackendTarget): (WI.TargetManager.prototype.createDirectBackendTarget): (WI.TargetManager.prototype._addTarget): (WI.TargetManager.prototype._removeTarget): (WI.TargetManager.prototype._createTarget): (WI.TargetManager.prototype._checkAndHandlePageTargetTransition): (WI.TargetManager.prototype._checkAndHandlePageTargetTermination): (WI.TargetManager.prototype.addTarget): Deleted. (WI.TargetManager.prototype.removeTarget): Deleted. (WI.TargetManager.prototype.initializeMainTarget): Deleted. TargetManager is where we handle creating and destroying targets and their connections. In order to simplify things a bit we make `WI.targets`, which goes through `get targets()` an array instead of a Set. And this includes only the sub-targets. * UserInterface/Controllers/WorkerManager.js: (WI.WorkerManager.prototype.workerCreated): (WI.WorkerManager.prototype.workerTerminated): Workers are still special-target-like things that multiplex through WorkerAgent instead of TargetAgent. We'd like to promote these to be full targets in the future. * UserInterface/Protocol/DirectBackendTarget.js: Renamed from Source/WebInspectorUI/UserInterface/Protocol/MainTarget.js. (WI.DirectBackendTarget): (WI.DirectBackendTarget.connectionInfoForDebuggable): (WI.DirectBackendTarget.prototype.get mainResource): (WI.DirectBackendTarget.prototype.set mainResource): This is the only "MainTarget" class. It is the backend target for a direct connection. * UserInterface/Protocol/MultiplexingBackendTarget.js: (WI.MultiplexingBackendTarget): (WI.MultiplexingBackendTarget.prototype.initialize): (WI.MultiplexingBackendTarget.prototype.get name): (WI.MultiplexingBackendTarget.prototype.get executionContext): (WI.MultiplexingBackendTarget.prototype.get mainResource): This is the new backend target for a multi-target connection. We don't expect it to be treated like other targets, so we don't expect anyone to ask it for resources/executionContext/name info. * UserInterface/Controllers/RuntimeManager.js: (WI.TargetManager.prototype.evaluateInInspectedWindow): This can be triggered by watch expressions before any target, and therefore execution context, is available. Just return null, when an execution context is available those clients will try again. * UserInterface/Debug/Bootstrap.js: Provide an WI.isEngineeringBuild boolean that can be used for various debugging features. * UserInterface/Main.html: * UserInterface/Test.html: New resources. * UserInterface/Protocol/InspectorBackend.js: (InspectorBackendClass.prototype.dispatch): (InspectorBackendClass.prototype.runAfterPendingDispatches): (InspectorBackend.Agent): `InspectorBackend.mainConnection` was renamed `InspectorBackend.backendConnection`. * UserInterface/Protocol/Connection.js: (InspectorBackend.Connection): (InspectorBackend.Connection.prototype._dispatchResponse): (InspectorBackend.Connection.prototype._sendCommandToBackendWithCallback): (InspectorBackend.Connection.prototype._sendCommandToBackendExpectingPromise): (InspectorBackend.BackendConnection): (InspectorBackend.BackendConnection.prototype.sendMessageToBackend): (InspectorBackend.WorkerConnection): (InspectorBackend.TargetConnection): (InspectorBackend.TargetConnection.sendMessageToBackend): Use a global sequence id to make filtering a bit easier in protocol tracing. TargetConnection is identical to WorkerConnection except it uses TargetAgent instead of WorkerAgent to perform multiplexing. * UserInterface/Protocol/JavaScriptContextTarget.js: (WI.JavaScriptContextTarget): * UserInterface/Protocol/PageTarget.js: (WI.PageTarget): (WI.PageTarget.prototype.get displayName): Specialized target types. * UserInterface/Views/DebuggerSidebarPanel.js: (WI.DebuggerSidebarPanel): (WI.DebuggerSidebarPanel.prototype._targetAdded): (WI.DebuggerSidebarPanel.prototype._targetRemoved): (WI.DebuggerSidebarPanel.prototype._updateCallStackTreeOutline): * UserInterface/Views/SourceCodeTextEditor.js: (WI.SourceCodeTextEditor.prototype._targetAdded): (WI.SourceCodeTextEditor.prototype._targetRemoved): (WI.SourceCodeTextEditor.prototype._callFramesDidChange): (WI.SourceCodeTextEditor.prototype._updateThreadIndicatorWidget): (WI.SourceCodeTextEditor.prototype._reinsertAllThreadIndicators): * UserInterface/Views/QuickConsole.js: (WI.QuickConsole.prototype.initializeMainExecutionContextPathComponent): (WI.QuickConsole.prototype._targetAdded): (WI.QuickConsole.prototype._targetRemoved): We make target added get called with all targets, including the MultiplexingBackendTarget and PageTargets, both of which would not have happened before. Before it was only WorkerTargets. Make these sites a little more robust for the type of target they expect to be able to handle. * UserInterface/Base/Object.js: * UserInterface/Controllers/DOMManager.js: (WI.DOMManager): (WI.DOMManager.prototype.transitionPageTarget): (WI.DOMManager.prototype.requestDocument): (WI.DOMManager.prototype._setDocument): * UserInterface/Controllers/NetworkManager.js: (WI.NetworkManager): (WI.NetworkManager.prototype.transitionPageTarget): (WI.NetworkManager.prototype.executionContextCreated): (WI.NetworkManager.prototype._processMainFrameResourceTreePayload): * UserInterface/Models/DefaultDashboard.js: (WI.DefaultDashboard): (WI.DefaultDashboard.prototype._mainResourceDidChange): (WI.DefaultDashboard.prototype._transitionPageTarget): * UserInterface/Views/NetworkTableContentView.js: (WI.NetworkTableContentView): (WI.NetworkTableContentView.prototype._mainResourceDidChange): (WI.NetworkTableContentView.prototype._transitionPageTarget): Special case handling when performing a page transition. * UserInterface/Views/SettingsTabContentView.js: * UserInterface/Debug/UncaughtExceptionReporter.js: Document reloads are not supported right now. Source/WebKit: To support process swapping a slim Web Inspector backend lives in the UIProcess. The Web Inspector frontend connects to it and is told about sub-targets, namely pages, that it can further connect to. When performing a process swap the backend tells the frontend to destroy existing targets and create new targets. In the UIProcess the WebPageProxy has a WebPageInspectorController, with a single TargetAgent holding InspectorTargetProxies to targets it knows about. Inspector protocol messages go through this inspector controller and are routed to the WebPage and its WebCore::Page's InspectorController. The WebPageProxy decides when to close and expose new page targets during process swap, or basically any time it reconnects to a WebProcess. So this patch also makes Web Inspector stay alive and reconnect to a page when the inspected page crashes! In the WebContentProcess the WebPage has a WebPageInspectorTarget. It also has a WebPageInspectorTargetController in anticipation of further sub-targets within the page (workers, frames) but none exist at the moment. The WebPage relies on the WebPageProxy to know when to expose this target as a debuggable. * Sources.txt: * WebKit.xcodeproj/project.pbxproj: New files. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::encode const): (WebKit::WebPageCreationParameters::decode): * Shared/WebPageCreationParameters.h: Remote inspector state can now stay in the UIProcess and does not need to be passed down to the WebContentProcess. * UIProcess/WebPageDebuggable.cpp: Copied from Source/WebCore/page/PageDebuggable.cpp. (WebKit::WebPageDebuggable::WebPageDebuggable): (WebKit::WebPageDebuggable::name const): (WebKit::WebPageDebuggable::url const): (WebKit::WebPageDebuggable::hasLocalDebugger const): (WebKit::WebPageDebuggable::connect): (WebKit::WebPageDebuggable::disconnect): (WebKit::WebPageDebuggable::dispatchMessageFromRemote): (WebKit::WebPageDebuggable::setIndicating): (WebKit::WebPageDebuggable::setNameOverride): * UIProcess/WebPageDebuggable.h: Copied from Source/WebCore/page/PageDebuggable.h. Remote debuggable entry point into the UIProcess for a page. This is pretty much identical to the PageDebuggable in WebCore. * Scripts/webkit/messages.py: * UIProcess/WebPageProxy.messages.in: * UIProcess/WebPageProxy.cpp: (WebKit::m_resetRecentCrashCountTimer): (WebKit::WebPageProxy::finishAttachingToWebProcess): (WebKit::WebPageProxy::close): (WebKit::WebPageProxy::createInspectorTarget): (WebKit::WebPageProxy::destroyInspectorTarget): (WebKit::WebPageProxy::sendMessageToInspectorFrontend): (WebKit::WebPageProxy::setIndicating): (WebKit::WebPageProxy::allowsRemoteInspection const): (WebKit::WebPageProxy::setAllowsRemoteInspection): (WebKit::WebPageProxy::remoteInspectionNameOverride const): (WebKit::WebPageProxy::setRemoteInspectionNameOverride): (WebKit::WebPageProxy::remoteInspectorInformationDidChange): (WebKit::WebPageProxy::clearInspectorTargets): (WebKit::WebPageProxy::createInspectorTargets): (WebKit::WebPageProxy::didCommitLoadForFrame): (WebKit::WebPageProxy::didReceiveTitleForFrame): (WebKit::WebPageProxy::creationParameters): * UIProcess/WebPageProxy.h: (WebKit::WebPageProxy::inspectorController): (WebKit::WebPageProxy::allowsRemoteInspection const): Deleted. (WebKit::WebPageProxy::remoteInspectionNameOverride const): Deleted. Own more inspector state in the UIProcess including a debuggable and inspector controller. * UIProcess/WebPageInspectorController.h: Added. * UIProcess/WebPageInspectorController.cpp: Added. (WebKit::WebPageInspectorController::WebPageInspectorController): (WebKit::WebPageInspectorController::pageClosed): (WebKit::WebPageInspectorController::hasLocalFrontend const): (WebKit::WebPageInspectorController::hasRemoteFrontend const): (WebKit::WebPageInspectorController::connectFrontend): (WebKit::WebPageInspectorController::disconnectFrontend): (WebKit::WebPageInspectorController::disconnectAllFrontends): (WebKit::WebPageInspectorController::dispatchMessageFromFrontend): (WebKit::WebPageInspectorController::setIndicating): (WebKit::WebPageInspectorController::clearTargets): (WebKit::WebPageInspectorController::createInspectorTarget): (WebKit::WebPageInspectorController::destroyInspectorTarget): (WebKit::WebPageInspectorController::sendMessageToInspectorFrontend): InspectorController with a single TargetAgent in the UIProcess. * UIProcess/WebPageInspectorTargetAgent.h: * UIProcess/WebPageInspectorTargetAgent.cpp: (WebKit::WebPageInspectorTargetAgent::WebPageInspectorTargetAgent): (WebKit::WebPageInspectorTargetAgent::frontendChannel): Target agent implementation. * UIProcess/InspectorTargetProxy.cpp: (WebKit::InspectorTargetProxy::create): (WebKit::InspectorTargetProxy::InspectorTargetProxy): (WebKit::InspectorTargetProxy::connect): (WebKit::InspectorTargetProxy::disconnect): (WebKit::InspectorTargetProxy::sendMessageToTargetBackend): * UIProcess/InspectorTargetProxy.h: UIProcess proxy for an InspectorTarget in the WebContentProcess. * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::processForNavigationInternal): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_shouldAttachDrawingAreaOnPageTransition): (WebKit::WebPage::connectInspector): (WebKit::WebPage::disconnectInspector): (WebKit::WebPage::sendMessageToTargetBackend): (WebKit::WebPage::setIndicating): (WebKit::WebPage::setAllowsRemoteInspection): Deleted. (WebKit::WebPage::setRemoteInspectionNameOverride): Deleted. * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: * WebProcess/WebPage/WebPageInspectorTarget.h: * WebProcess/WebPage/WebPageInspectorTarget.cpp: (WebKit::WebPageInspectorTarget::WebPageInspectorTarget): (WebKit::WebPageInspectorTarget::identifier const): (WebKit::WebPageInspectorTarget::connect): (WebKit::WebPageInspectorTarget::disconnect): (WebKit::WebPageInspectorTarget::sendMessageToTargetBackend): InspectorTarget for this WebPage. * WebProcess/WebPage/WebPageInspectorTargetController.cpp: Added. (WebKit::WebPageInspectorTargetController::WebPageInspectorTargetController): (WebKit::WebPageInspectorTargetController::~WebPageInspectorTargetController): (WebKit::WebPageInspectorTargetController::addTarget): (WebKit::WebPageInspectorTargetController::removeTarget): (WebKit::WebPageInspectorTargetController::connectInspector): (WebKit::WebPageInspectorTargetController::disconnectInspector): (WebKit::WebPageInspectorTargetController::sendMessageToTargetBackend): (WebKit::WebPageInspectorTargetController::sendMessageToTargetFrontend): * WebProcess/WebPage/WebPageInspectorTargetController.h: * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.h: * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp: (WebKit::WebPageInspectorTargetFrontendChannel::create): (WebKit::WebPageInspectorTargetFrontendChannel::WebPageInspectorTargetFrontendChannel): (WebKit::WebPageInspectorTargetFrontendChannel::sendMessageToFrontend): Preparation for more target managment in the WebContentProcess. Source/WebKitLegacy/mac: * WebCoreSupport/WebInspectorClient.h: WebKitLegacy will still have remote inspection of the Page directly. LayoutTests: * inspector/unit-tests/target-manager.html: WI.targets has switched to being an array instead of a set. Canonical link: https://commits.webkit.org/206396@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238192 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-14 21:03:49 +00:00
inspector/agents/InspectorTargetAgent.cpp
Web Inspector: Audit: create new IDL type for exposing special functionality in test context https://bugs.webkit.org/show_bug.cgi?id=193149 <rdar://problem/46801218> Reviewed by Joseph Pecoraro. Source/JavaScriptCore: Create a new `AuditAgent` (and various subclasses for different inspection targets) * inspector/protocol/Audit.json: Added. Add a `run` command that is a simpler version of `Runtime.evaluate`, except that it expects a function string instead of an arbitrary JavaScript expression. Add `setup` and `teardown` commands that create a JavaScript object that will be passed in to the test as an argument. Keep this object alive so that tests can add to the object and have later tests use what was added. * inspector/agents/InspectorAuditAgent.h: Added. * inspector/agents/InspectorAuditAgent.cpp: Added. (Inspector::InspectorAuditAgent::InspectorAuditAgent): (Inspector::InspectorAuditAgent::didCreateFrontendAndBackend): (Inspector::InspectorAuditAgent::willDestroyFrontendAndBackend): (Inspector::InspectorAuditAgent::setup): (Inspector::InspectorAuditAgent::run): (Inspector::InspectorAuditAgent::teardown): (Inspector::InspectorAuditAgent::hasActiveAudit): (Inspector::InspectorAuditAgent::populateAuditObject): * inspector/agents/JSGlobalObjectAuditAgent.h: Added. * inspector/agents/JSGlobalObjectAuditAgent.cpp: Added. (Inspector::JSGlobalObjectAuditAgent::JSGlobalObjectAuditAgent): (Inspector::JSGlobalObjectAuditAgent::injectedScriptForEval): * inspector/JSGlobalObjectInspectorController.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::connectFrontend): (Inspector::JSGlobalObjectInspectorController::jsAgentContext): Added. (Inspector::JSGlobalObjectInspectorController::createLazyAgents): Added. * inspector/InjectedScript.h: * inspector/InjectedScript.cpp: (Inspector::InjectedScript::execute): Added. (Inspector::InjectedScript::arrayFromVector): Added. Create a version of `evaluate` that accepts a list of values to be passed in as arguments to the function that was created by the `eval` of the given `functionString`. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.execute): Added. (InjectedScript.prototype.evaluate): (InjectedScript.prototype.evaluateOnCallFrame): (InjectedScript.prototype._evaluateAndWrap): (InjectedScript.prototype._wrapAndSaveCall): Added. (InjectedScript.prototype._wrapCall): Added. (InjectedScript.prototype._evaluateOn): Refactor the `eval` and `saveResult` logic to allow for more flexibility for other callers. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * UnifiedSources-input.xcfilelist: Source/WebCore: Tests: inspector/audit/run.html inspector/audit/setup.html inspector/audit/teardown.html Create a new `AuditAgent` (and various subclasses for different inspection targets), as well as `InspectorAuditAccessibilityObject` and `InspectorAuditDOMObject` objects that will be injected into the test function to allow for more advanced testing. * inspector/InspectorAuditAccessibilityObject.idl: Added. * inspector/InspectorAuditAccessibilityObject.h: Added. (WebCore::InspectorAuditAccessibilityObject::create): * inspector/InspectorAuditAccessibilityObject.cpp: Added. (WebCore::InspectorAuditAccessibilityObject::InspectorAuditAccessibilityObject): * inspector/InspectorAuditDOMObject.idl: Added. * inspector/InspectorAuditDOMObject.h: Added. (WebCore::InspectorAuditDOMObject::create): * inspector/InspectorAuditDOMObject.cpp: Added. (WebCore::InspectorAuditDOMObject::InspectorAuditDOMObject): * inspector/agents/page/PageAuditAgent.h: Added. * inspector/agents/page/PageAuditAgent.cpp: Added. (WebCore::PageAuditAgent::PageAuditAgent): (WebCore::PageAuditAgent::injectedScriptForEval): (WebCore::PageAuditAgent::populateAuditObject): (WebCore::PageAuditAgent::muteConsole): (WebCore::PageAuditAgent::unmuteConsole): * inspector/agents/worker/WorkerAuditAgent.h: Added. * inspector/agents/worker/WorkerAuditAgent.cpp: Added. (WebCore::WorkerAuditAgent::WorkerAuditAgent): (WebCore::WorkerAuditAgent::injectedScriptForEval): * inspector/InspectorController.cpp: (WebCore::InspectorController::createLazyAgents): * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::createLazyAgents): * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * UnifiedSources-input.xcfilelist: * WebCore.xcodeproj/project.pbxproj: Source/WebInspectorUI: Add `AuditAgent` getters and plumbing. * UserInterface/Protocol/Target.js: (WI.Target.prototype.get AuditAgent): Added. * UserInterface/Models/AuditTestCase.js: (WI.AuditTestCase.prototype.async run): * UserInterface/Controllers/AuditManager.js: (WI.AuditManager.prototype.async start): * .eslintrc: LayoutTests: * inspector/audit/resources/audit-utilities.js: (TestPage.registerInitializer.InspectorTest.Audit.setupAudit): Added. (TestPage.registerInitializer.InspectorTest.Audit.teardownAudit): Added. * inspector/audit/run.html: Added. * inspector/audit/run-expected.txt: Added. * inspector/audit/setup.html: Added. * inspector/audit/setup-expected.txt: Added. * inspector/audit/teardown.html: Added. * inspector/audit/teardown-expected.txt: Added. * inspector/canvas/create-context-2d-expected.txt: * inspector/canvas/create-context-bitmaprenderer-expected.txt: * inspector/canvas/create-context-webgl-expected.txt: * inspector/canvas/create-context-webgl2-expected.txt: * inspector/canvas/create-context-webmetal-expected.txt: * inspector/canvas/recording-2d-expected.txt: * inspector/canvas/recording-webgl-expected.txt: * inspector/canvas/recording-webgl-snapshots-expected.txt: * inspector/model/remote-object-expected.txt: * inspector/model/stack-trace-expected.txt: Canonical link: https://commits.webkit.org/207945@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239976 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-15 08:25:33 +00:00
inspector/agents/JSGlobalObjectAuditAgent.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
inspector/agents/JSGlobalObjectDebuggerAgent.cpp
inspector/agents/JSGlobalObjectRuntimeAgent.cpp
interpreter/AbstractPC.cpp
interpreter/CLoopStack.cpp
interpreter/CallFrame.cpp
interpreter/Interpreter.cpp
interpreter/ShadowChicken.cpp
interpreter/StackVisitor.cpp
jit/AssemblyHelpers.cpp
Merge all the JIT worklists into a shared worklist https://bugs.webkit.org/show_bug.cgi?id=226207 Reviewed by Saam Barati. Delete the DFG and FTL worklists and refactor JITWorklist to handle the compilation for all tiers. This reduces the total number of compiler threads while allowing each tier to use more threads whenever necessary. The default configuration is for the worklist to have 3 threads, baseline can use up to all 3 threads and DFG and FTL follow the previous limits set through JSC::Options. Right now, the worklist will only do work on upper tiers when all lower tiers have no pending tasks or have exceeded the maximum number of concurrent compilations. i.e. by default we only DFG compile when there are no baseline tasks in the queue and we only FTL compile when we either have no DFG tasks in the queue OR there are already 2 DFG compilations in progress. * API/JSVirtualMachine.mm: (+[JSVirtualMachine setNumberOfDFGCompilerThreads:]): (+[JSVirtualMachine setNumberOfFTLCompilerThreads:]): * API/tests/testapi.mm: (runJITThreadLimitTests): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::checkIfOptimizationThresholdReached): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCommon.h: (JSC::DFG::verboseCompilationEnabled): (JSC::DFG::logCompilationChanges): (JSC::DFG::shouldDumpGraphAtEachPhase): (JSC::DFG::shouldDumpDisassembly): * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): (JSC::DFG::compile): * dfg/DFGDriver.h: * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.h: * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: (JSC::DFG::OSRAvailabilityAnalysisPhase::run): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOperations.cpp: (JSC::DFG::triggerFTLReplacementCompile): (JSC::DFG::tierUpCommon): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::Plan): (JSC::DFG::Plan::codeSize const): (JSC::DFG::Plan::finalizeInGC): (JSC::DFG::Plan::notifyReady): (JSC::DFG::Plan::cancel): (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::finalize): (JSC::DFG::Plan::iterateCodeBlocksForGC): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::isKnownToBeLiveDuringGC): (JSC::DFG::Plan::isKnownToBeLiveAfterGC): * dfg/DFGPlan.h: * dfg/DFGPlanInlines.h: Removed. * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): * dfg/DFGWorklist.cpp: Removed. * dfg/DFGWorklist.h: Removed. * dfg/DFGWorklistInlines.h: Removed. * ftl/FTLCompile.h: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::buildExitArguments): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (JSC::FTL::verboseCompilationEnabled): (JSC::FTL::shouldDumpDisassembly): * heap/Heap.cpp: (JSC::Heap::completeAllJITPlans): (JSC::Heap::iterateExecutingAndCompilingCodeBlocks): (JSC::Heap::removeDeadCompilerWorklistEntries): (JSC::Heap::stopThePeriphery): (JSC::Heap::suspendCompilerThreads): (JSC::Heap::resumeCompilerThreads): (JSC::Heap::addCoreConstraints): * heap/Heap.h: * heap/RootMarkReason.h: * jit/JIT.cpp: (JSC::JIT::compileAndLinkWithoutFinalizing): (JSC::JIT::codeSize const): (JSC::JIT::compileTimeStats): * jit/JIT.h: * jit/JITBaselinePlan.cpp: Copied from Source/JavaScriptCore/ftl/FTLState.cpp. (JSC::JITBaselinePlan::JITBaselinePlan): (JSC::JITBaselinePlan::compileInThreadImpl): (JSC::JITBaselinePlan::codeSize const): (JSC::JITBaselinePlan::finalize): * jit/JITBaselinePlan.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITCompilationKey.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.cpp. (JSC::JITCompilationKey::dump const): * jit/JITCompilationKey.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.h. (JSC::JITCompilationKey::JITCompilationKey): (JSC::JITCompilationKey::operator! const): (JSC::JITCompilationKey::isHashTableDeletedValue const): (JSC::JITCompilationKey::mode const): (JSC::JITCompilationKey::operator== const): (JSC::JITCompilationKey::hash const): (JSC::JITCompilationKeyHash::hash): (JSC::JITCompilationKeyHash::equal): * jit/JITCompilationMode.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.cpp. (WTF::printInternal): * jit/JITCompilationMode.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.h. (JSC::isFTL): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITPlan.cpp: Added. (JSC::JITPlan::JITPlan): (JSC::JITPlan::cancel): (JSC::JITPlan::notifyCompiling): (JSC::JITPlan::notifyReady): (JSC::JITPlan::tier const): (JSC::JITPlan::key): (JSC::JITPlan::isKnownToBeLiveAfterGC): (JSC::JITPlan::isKnownToBeLiveDuringGC): (JSC::JITPlan::iterateCodeBlocksForGC): (JSC::JITPlan::checkLivenessAndVisitChildren): (JSC::JITPlan::computeCompileTimes const): (JSC::JITPlan::reportCompileTimes const): (JSC::JITPlan::compileInThread): * jit/JITPlan.h: Added. (JSC::JITPlan::~JITPlan): (JSC::JITPlan::vm const): (JSC::JITPlan::codeBlock const): (JSC::JITPlan::thread const): (JSC::JITPlan::mode const): (JSC::JITPlan::stage const): (JSC::JITPlan::isFTL const): (JSC::JITPlan::finalizeInGC): * jit/JITPlanStage.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.cpp. * jit/JITSafepoint.cpp: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.cpp. (JSC::Safepoint::Safepoint): (JSC::Safepoint::~Safepoint): (JSC::Safepoint::begin): (JSC::Safepoint::cancel): * jit/JITSafepoint.h: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.h. * jit/JITScannable.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITWorklist.cpp: (JSC::JITWorklist::JITWorklist): (JSC::JITWorklist::~JITWorklist): (JSC::JITWorklist::existingGlobalWorklistOrNull): (JSC::JITWorklist::ensureGlobalWorklist): (JSC::JITWorklist::enqueue): (JSC::JITWorklist::queueLength const): (JSC::JITWorklist::suspendAllThreads): (JSC::JITWorklist::resumeAllThreads): (JSC::JITWorklist::compilationState): (JSC::JITWorklist::completeAllReadyPlansForVM): (JSC::JITWorklist::waitUntilAllPlansForVMAreReady): (JSC::JITWorklist::completeAllPlansForVM): (JSC::JITWorklist::cancelAllPlansForVM): (JSC::JITWorklist::removeDeadPlans): (JSC::JITWorklist::setMaximumNumberOfConcurrentDFGCompilations): (JSC::JITWorklist::setMaximumNumberOfConcurrentFTLCompilations): (JSC::JITWorklist::visitWeakReferences): (JSC::JITWorklist::dump const): (JSC::JITWorklist::removeAllReadyPlansForVM): (JSC::JITWorklist::removeMatchingPlansForVM): * jit/JITWorklist.h: (JSC::JITWorklist::static_cast<size_t>): * jit/JITWorklistInlines.h: Renamed from Source/JavaScriptCore/dfg/DFGScannable.h. (JSC::JITWorklist::iterateCodeBlocksForGC): * jit/JITWorklistThread.cpp: Added. (JSC::JITWorklistThread::JITWorklistThread): (JSC::JITWorklistThread::name const): (JSC::JITWorklistThread::poll): (JSC::JITWorklistThread::work): (JSC::JITWorklistThread::threadDidStart): (JSC::JITWorklistThread::threadIsStopping): * jit/JITWorklistThread.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.h. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::jitCompileAndSetHeuristics): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::~VM): Canonical link: https://commits.webkit.org/238161@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 15:15:22 +00:00
jit/BaselineJITPlan.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
jit/BinarySwitch.cpp
jit/CCallHelpers.cpp
jit/CachedRecovery.cpp
jit/CallFrameShuffleData.cpp
jit/CallFrameShuffler.cpp
jit/CallFrameShuffler32_64.cpp
jit/CallFrameShuffler64.cpp
jit/ExecutableAllocationFuzz.cpp
jit/ExecutableAllocator.cpp
jit/GCAwareJITStubRoutine.cpp
jit/GPRInfo.cpp
jit/ICStats.cpp
jit/IntrinsicEmitter.cpp
jit/JIT.cpp
jit/JITAddGenerator.cpp
jit/JITArithmetic.cpp
jit/JITArithmetic32_64.cpp
jit/JITBitAndGenerator.cpp
jit/JITBitOrGenerator.cpp
jit/JITBitXorGenerator.cpp
jit/JITCall.cpp
jit/JITCall32_64.cpp
jit/JITCode.cpp
[JSC] Implement a B3::Compilation replacement for wasm-llint https://bugs.webkit.org/show_bug.cgi?id=220585 Patch by Xan López <xan@igalia.com> on 2021-01-18 Reviewed by Yusuke Suzuki. Move B3Compilation, B3OpaqueByproducts and B3OpaqueByproduct to jit/. They are used by non-B3 code and they are not really B3 specific. Also rename B3CompilationPtrTag to JITCompilationPtrTag. * CMakeLists.txt: add new source files. * JavaScriptCore.xcodeproj/project.pbxproj: ditto. * Sources.txt: ditto. * b3/B3Compile.cpp: (JSC::B3::compile): use JITCompilationPtrTag. * b3/B3Compile.h: change includes. * b3/B3DataSection.h: ditto. * b3/B3Procedure.cpp: ditto. * b3/B3Procedure.h: ditto. * b3/air/testair.cpp: use JITCompilationPtrTag. * b3/testb3.h: change includes. (invoke): * b3/testb3_6.cpp: (testInterpreter): use JITCompilationPtrTag. (testEntrySwitchSimple): ditto. (testEntrySwitchNoEntrySwitch): ditto. (testEntrySwitchWithCommonPaths): ditto. (testEntrySwitchWithCommonPathsAndNonTrivialEntrypoint): ditto. (testEntrySwitchLoop): ditto. * ftl/FTLJITCode.h: use JSC::OpaqueByproducts. * ftl/FTLOutput.h: change includes. * jit/JITCompilation.cpp: Renamed from Source/JavaScriptCore/b3/B3Compilation.cpp. (JSC::Compilation::Compilation): * jit/JITCompilation.h: Renamed from Source/JavaScriptCore/b3/B3Compilation.h. (JSC::Compilation::code const): (JSC::Compilation::codeRef const): * jit/JITOpaqueByproduct.h: Renamed from Source/JavaScriptCore/b3/B3OpaqueByproduct.h. * jit/JITOpaqueByproducts.cpp: Renamed from Source/JavaScriptCore/b3/B3OpaqueByproducts.cpp. * jit/JITOpaqueByproducts.h: Renamed from Source/JavaScriptCore/b3/B3OpaqueByproducts.h. * runtime/JSCPtrTag.h: rename B3CompilationPtrTag to JITCompilationPtrTag. * wasm/WasmB3IRGenerator.h: use JSC::OpaqueByproducts. * wasm/WasmBBQPlan.cpp: use JSC::Compilation. (JSC::Wasm::BBQPlan::work): (JSC::Wasm::BBQPlan::didCompleteCompilation): * wasm/WasmBinding.h: change includes. * wasm/WasmCallee.h: ditto. * wasm/WasmFormat.h: use JSC::Compilation. * wasm/WasmLLIntPlan.cpp: ditto. (JSC::Wasm::LLIntPlan::didCompleteCompilation): * wasm/WasmLLIntPlan.h: use JITCompilationPtrTag. * wasm/WasmModule.h: ditto. * wasm/WasmOMGForOSREntryPlan.cpp: use JSC::Compilation. (JSC::Wasm::OMGForOSREntryPlan::work): * wasm/WasmOMGPlan.cpp: ditto. (JSC::Wasm::OMGPlan::work): * wasm/WasmParser.h: change includes. * wasm/js/WasmToJS.h: ditto. Canonical link: https://commits.webkit.org/233130@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271594 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-01-19 00:24:52 +00:00
jit/JITCompilation.cpp
Merge all the JIT worklists into a shared worklist https://bugs.webkit.org/show_bug.cgi?id=226207 Reviewed by Saam Barati. Delete the DFG and FTL worklists and refactor JITWorklist to handle the compilation for all tiers. This reduces the total number of compiler threads while allowing each tier to use more threads whenever necessary. The default configuration is for the worklist to have 3 threads, baseline can use up to all 3 threads and DFG and FTL follow the previous limits set through JSC::Options. Right now, the worklist will only do work on upper tiers when all lower tiers have no pending tasks or have exceeded the maximum number of concurrent compilations. i.e. by default we only DFG compile when there are no baseline tasks in the queue and we only FTL compile when we either have no DFG tasks in the queue OR there are already 2 DFG compilations in progress. * API/JSVirtualMachine.mm: (+[JSVirtualMachine setNumberOfDFGCompilerThreads:]): (+[JSVirtualMachine setNumberOfFTLCompilerThreads:]): * API/tests/testapi.mm: (runJITThreadLimitTests): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::checkIfOptimizationThresholdReached): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCommon.h: (JSC::DFG::verboseCompilationEnabled): (JSC::DFG::logCompilationChanges): (JSC::DFG::shouldDumpGraphAtEachPhase): (JSC::DFG::shouldDumpDisassembly): * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): (JSC::DFG::compile): * dfg/DFGDriver.h: * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.h: * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: (JSC::DFG::OSRAvailabilityAnalysisPhase::run): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOperations.cpp: (JSC::DFG::triggerFTLReplacementCompile): (JSC::DFG::tierUpCommon): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::Plan): (JSC::DFG::Plan::codeSize const): (JSC::DFG::Plan::finalizeInGC): (JSC::DFG::Plan::notifyReady): (JSC::DFG::Plan::cancel): (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::finalize): (JSC::DFG::Plan::iterateCodeBlocksForGC): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::isKnownToBeLiveDuringGC): (JSC::DFG::Plan::isKnownToBeLiveAfterGC): * dfg/DFGPlan.h: * dfg/DFGPlanInlines.h: Removed. * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): * dfg/DFGWorklist.cpp: Removed. * dfg/DFGWorklist.h: Removed. * dfg/DFGWorklistInlines.h: Removed. * ftl/FTLCompile.h: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::buildExitArguments): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (JSC::FTL::verboseCompilationEnabled): (JSC::FTL::shouldDumpDisassembly): * heap/Heap.cpp: (JSC::Heap::completeAllJITPlans): (JSC::Heap::iterateExecutingAndCompilingCodeBlocks): (JSC::Heap::removeDeadCompilerWorklistEntries): (JSC::Heap::stopThePeriphery): (JSC::Heap::suspendCompilerThreads): (JSC::Heap::resumeCompilerThreads): (JSC::Heap::addCoreConstraints): * heap/Heap.h: * heap/RootMarkReason.h: * jit/JIT.cpp: (JSC::JIT::compileAndLinkWithoutFinalizing): (JSC::JIT::codeSize const): (JSC::JIT::compileTimeStats): * jit/JIT.h: * jit/JITBaselinePlan.cpp: Copied from Source/JavaScriptCore/ftl/FTLState.cpp. (JSC::JITBaselinePlan::JITBaselinePlan): (JSC::JITBaselinePlan::compileInThreadImpl): (JSC::JITBaselinePlan::codeSize const): (JSC::JITBaselinePlan::finalize): * jit/JITBaselinePlan.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITCompilationKey.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.cpp. (JSC::JITCompilationKey::dump const): * jit/JITCompilationKey.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.h. (JSC::JITCompilationKey::JITCompilationKey): (JSC::JITCompilationKey::operator! const): (JSC::JITCompilationKey::isHashTableDeletedValue const): (JSC::JITCompilationKey::mode const): (JSC::JITCompilationKey::operator== const): (JSC::JITCompilationKey::hash const): (JSC::JITCompilationKeyHash::hash): (JSC::JITCompilationKeyHash::equal): * jit/JITCompilationMode.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.cpp. (WTF::printInternal): * jit/JITCompilationMode.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.h. (JSC::isFTL): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITPlan.cpp: Added. (JSC::JITPlan::JITPlan): (JSC::JITPlan::cancel): (JSC::JITPlan::notifyCompiling): (JSC::JITPlan::notifyReady): (JSC::JITPlan::tier const): (JSC::JITPlan::key): (JSC::JITPlan::isKnownToBeLiveAfterGC): (JSC::JITPlan::isKnownToBeLiveDuringGC): (JSC::JITPlan::iterateCodeBlocksForGC): (JSC::JITPlan::checkLivenessAndVisitChildren): (JSC::JITPlan::computeCompileTimes const): (JSC::JITPlan::reportCompileTimes const): (JSC::JITPlan::compileInThread): * jit/JITPlan.h: Added. (JSC::JITPlan::~JITPlan): (JSC::JITPlan::vm const): (JSC::JITPlan::codeBlock const): (JSC::JITPlan::thread const): (JSC::JITPlan::mode const): (JSC::JITPlan::stage const): (JSC::JITPlan::isFTL const): (JSC::JITPlan::finalizeInGC): * jit/JITPlanStage.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.cpp. * jit/JITSafepoint.cpp: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.cpp. (JSC::Safepoint::Safepoint): (JSC::Safepoint::~Safepoint): (JSC::Safepoint::begin): (JSC::Safepoint::cancel): * jit/JITSafepoint.h: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.h. * jit/JITScannable.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITWorklist.cpp: (JSC::JITWorklist::JITWorklist): (JSC::JITWorklist::~JITWorklist): (JSC::JITWorklist::existingGlobalWorklistOrNull): (JSC::JITWorklist::ensureGlobalWorklist): (JSC::JITWorklist::enqueue): (JSC::JITWorklist::queueLength const): (JSC::JITWorklist::suspendAllThreads): (JSC::JITWorklist::resumeAllThreads): (JSC::JITWorklist::compilationState): (JSC::JITWorklist::completeAllReadyPlansForVM): (JSC::JITWorklist::waitUntilAllPlansForVMAreReady): (JSC::JITWorklist::completeAllPlansForVM): (JSC::JITWorklist::cancelAllPlansForVM): (JSC::JITWorklist::removeDeadPlans): (JSC::JITWorklist::setMaximumNumberOfConcurrentDFGCompilations): (JSC::JITWorklist::setMaximumNumberOfConcurrentFTLCompilations): (JSC::JITWorklist::visitWeakReferences): (JSC::JITWorklist::dump const): (JSC::JITWorklist::removeAllReadyPlansForVM): (JSC::JITWorklist::removeMatchingPlansForVM): * jit/JITWorklist.h: (JSC::JITWorklist::static_cast<size_t>): * jit/JITWorklistInlines.h: Renamed from Source/JavaScriptCore/dfg/DFGScannable.h. (JSC::JITWorklist::iterateCodeBlocksForGC): * jit/JITWorklistThread.cpp: Added. (JSC::JITWorklistThread::JITWorklistThread): (JSC::JITWorklistThread::name const): (JSC::JITWorklistThread::poll): (JSC::JITWorklistThread::work): (JSC::JITWorklistThread::threadDidStart): (JSC::JITWorklistThread::threadIsStopping): * jit/JITWorklistThread.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.h. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::jitCompileAndSetHeuristics): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::~VM): Canonical link: https://commits.webkit.org/238161@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 15:15:22 +00:00
jit/JITCompilationKey.cpp
jit/JITCompilationMode.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
jit/JITDisassembler.cpp
jit/JITDivGenerator.cpp
jit/JITExceptions.cpp
jit/JITInlineCacheGenerator.cpp
jit/JITLeftShiftGenerator.cpp
jit/JITMulGenerator.cpp
jit/JITNegGenerator.cpp
[JSC] Implement a B3::Compilation replacement for wasm-llint https://bugs.webkit.org/show_bug.cgi?id=220585 Patch by Xan López <xan@igalia.com> on 2021-01-18 Reviewed by Yusuke Suzuki. Move B3Compilation, B3OpaqueByproducts and B3OpaqueByproduct to jit/. They are used by non-B3 code and they are not really B3 specific. Also rename B3CompilationPtrTag to JITCompilationPtrTag. * CMakeLists.txt: add new source files. * JavaScriptCore.xcodeproj/project.pbxproj: ditto. * Sources.txt: ditto. * b3/B3Compile.cpp: (JSC::B3::compile): use JITCompilationPtrTag. * b3/B3Compile.h: change includes. * b3/B3DataSection.h: ditto. * b3/B3Procedure.cpp: ditto. * b3/B3Procedure.h: ditto. * b3/air/testair.cpp: use JITCompilationPtrTag. * b3/testb3.h: change includes. (invoke): * b3/testb3_6.cpp: (testInterpreter): use JITCompilationPtrTag. (testEntrySwitchSimple): ditto. (testEntrySwitchNoEntrySwitch): ditto. (testEntrySwitchWithCommonPaths): ditto. (testEntrySwitchWithCommonPathsAndNonTrivialEntrypoint): ditto. (testEntrySwitchLoop): ditto. * ftl/FTLJITCode.h: use JSC::OpaqueByproducts. * ftl/FTLOutput.h: change includes. * jit/JITCompilation.cpp: Renamed from Source/JavaScriptCore/b3/B3Compilation.cpp. (JSC::Compilation::Compilation): * jit/JITCompilation.h: Renamed from Source/JavaScriptCore/b3/B3Compilation.h. (JSC::Compilation::code const): (JSC::Compilation::codeRef const): * jit/JITOpaqueByproduct.h: Renamed from Source/JavaScriptCore/b3/B3OpaqueByproduct.h. * jit/JITOpaqueByproducts.cpp: Renamed from Source/JavaScriptCore/b3/B3OpaqueByproducts.cpp. * jit/JITOpaqueByproducts.h: Renamed from Source/JavaScriptCore/b3/B3OpaqueByproducts.h. * runtime/JSCPtrTag.h: rename B3CompilationPtrTag to JITCompilationPtrTag. * wasm/WasmB3IRGenerator.h: use JSC::OpaqueByproducts. * wasm/WasmBBQPlan.cpp: use JSC::Compilation. (JSC::Wasm::BBQPlan::work): (JSC::Wasm::BBQPlan::didCompleteCompilation): * wasm/WasmBinding.h: change includes. * wasm/WasmCallee.h: ditto. * wasm/WasmFormat.h: use JSC::Compilation. * wasm/WasmLLIntPlan.cpp: ditto. (JSC::Wasm::LLIntPlan::didCompleteCompilation): * wasm/WasmLLIntPlan.h: use JITCompilationPtrTag. * wasm/WasmModule.h: ditto. * wasm/WasmOMGForOSREntryPlan.cpp: use JSC::Compilation. (JSC::Wasm::OMGForOSREntryPlan::work): * wasm/WasmOMGPlan.cpp: ditto. (JSC::Wasm::OMGPlan::work): * wasm/WasmParser.h: change includes. * wasm/js/WasmToJS.h: ditto. Canonical link: https://commits.webkit.org/233130@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271594 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-01-19 00:24:52 +00:00
jit/JITOpaqueByproducts.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
jit/JITOpcodes.cpp
jit/JITOpcodes32_64.cpp
jit/JITOperations.cpp
Merge all the JIT worklists into a shared worklist https://bugs.webkit.org/show_bug.cgi?id=226207 Reviewed by Saam Barati. Delete the DFG and FTL worklists and refactor JITWorklist to handle the compilation for all tiers. This reduces the total number of compiler threads while allowing each tier to use more threads whenever necessary. The default configuration is for the worklist to have 3 threads, baseline can use up to all 3 threads and DFG and FTL follow the previous limits set through JSC::Options. Right now, the worklist will only do work on upper tiers when all lower tiers have no pending tasks or have exceeded the maximum number of concurrent compilations. i.e. by default we only DFG compile when there are no baseline tasks in the queue and we only FTL compile when we either have no DFG tasks in the queue OR there are already 2 DFG compilations in progress. * API/JSVirtualMachine.mm: (+[JSVirtualMachine setNumberOfDFGCompilerThreads:]): (+[JSVirtualMachine setNumberOfFTLCompilerThreads:]): * API/tests/testapi.mm: (runJITThreadLimitTests): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::checkIfOptimizationThresholdReached): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCommon.h: (JSC::DFG::verboseCompilationEnabled): (JSC::DFG::logCompilationChanges): (JSC::DFG::shouldDumpGraphAtEachPhase): (JSC::DFG::shouldDumpDisassembly): * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): (JSC::DFG::compile): * dfg/DFGDriver.h: * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.h: * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: (JSC::DFG::OSRAvailabilityAnalysisPhase::run): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOperations.cpp: (JSC::DFG::triggerFTLReplacementCompile): (JSC::DFG::tierUpCommon): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::Plan): (JSC::DFG::Plan::codeSize const): (JSC::DFG::Plan::finalizeInGC): (JSC::DFG::Plan::notifyReady): (JSC::DFG::Plan::cancel): (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::finalize): (JSC::DFG::Plan::iterateCodeBlocksForGC): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::isKnownToBeLiveDuringGC): (JSC::DFG::Plan::isKnownToBeLiveAfterGC): * dfg/DFGPlan.h: * dfg/DFGPlanInlines.h: Removed. * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): * dfg/DFGWorklist.cpp: Removed. * dfg/DFGWorklist.h: Removed. * dfg/DFGWorklistInlines.h: Removed. * ftl/FTLCompile.h: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::buildExitArguments): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (JSC::FTL::verboseCompilationEnabled): (JSC::FTL::shouldDumpDisassembly): * heap/Heap.cpp: (JSC::Heap::completeAllJITPlans): (JSC::Heap::iterateExecutingAndCompilingCodeBlocks): (JSC::Heap::removeDeadCompilerWorklistEntries): (JSC::Heap::stopThePeriphery): (JSC::Heap::suspendCompilerThreads): (JSC::Heap::resumeCompilerThreads): (JSC::Heap::addCoreConstraints): * heap/Heap.h: * heap/RootMarkReason.h: * jit/JIT.cpp: (JSC::JIT::compileAndLinkWithoutFinalizing): (JSC::JIT::codeSize const): (JSC::JIT::compileTimeStats): * jit/JIT.h: * jit/JITBaselinePlan.cpp: Copied from Source/JavaScriptCore/ftl/FTLState.cpp. (JSC::JITBaselinePlan::JITBaselinePlan): (JSC::JITBaselinePlan::compileInThreadImpl): (JSC::JITBaselinePlan::codeSize const): (JSC::JITBaselinePlan::finalize): * jit/JITBaselinePlan.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITCompilationKey.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.cpp. (JSC::JITCompilationKey::dump const): * jit/JITCompilationKey.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.h. (JSC::JITCompilationKey::JITCompilationKey): (JSC::JITCompilationKey::operator! const): (JSC::JITCompilationKey::isHashTableDeletedValue const): (JSC::JITCompilationKey::mode const): (JSC::JITCompilationKey::operator== const): (JSC::JITCompilationKey::hash const): (JSC::JITCompilationKeyHash::hash): (JSC::JITCompilationKeyHash::equal): * jit/JITCompilationMode.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.cpp. (WTF::printInternal): * jit/JITCompilationMode.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.h. (JSC::isFTL): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITPlan.cpp: Added. (JSC::JITPlan::JITPlan): (JSC::JITPlan::cancel): (JSC::JITPlan::notifyCompiling): (JSC::JITPlan::notifyReady): (JSC::JITPlan::tier const): (JSC::JITPlan::key): (JSC::JITPlan::isKnownToBeLiveAfterGC): (JSC::JITPlan::isKnownToBeLiveDuringGC): (JSC::JITPlan::iterateCodeBlocksForGC): (JSC::JITPlan::checkLivenessAndVisitChildren): (JSC::JITPlan::computeCompileTimes const): (JSC::JITPlan::reportCompileTimes const): (JSC::JITPlan::compileInThread): * jit/JITPlan.h: Added. (JSC::JITPlan::~JITPlan): (JSC::JITPlan::vm const): (JSC::JITPlan::codeBlock const): (JSC::JITPlan::thread const): (JSC::JITPlan::mode const): (JSC::JITPlan::stage const): (JSC::JITPlan::isFTL const): (JSC::JITPlan::finalizeInGC): * jit/JITPlanStage.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.cpp. * jit/JITSafepoint.cpp: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.cpp. (JSC::Safepoint::Safepoint): (JSC::Safepoint::~Safepoint): (JSC::Safepoint::begin): (JSC::Safepoint::cancel): * jit/JITSafepoint.h: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.h. * jit/JITScannable.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITWorklist.cpp: (JSC::JITWorklist::JITWorklist): (JSC::JITWorklist::~JITWorklist): (JSC::JITWorklist::existingGlobalWorklistOrNull): (JSC::JITWorklist::ensureGlobalWorklist): (JSC::JITWorklist::enqueue): (JSC::JITWorklist::queueLength const): (JSC::JITWorklist::suspendAllThreads): (JSC::JITWorklist::resumeAllThreads): (JSC::JITWorklist::compilationState): (JSC::JITWorklist::completeAllReadyPlansForVM): (JSC::JITWorklist::waitUntilAllPlansForVMAreReady): (JSC::JITWorklist::completeAllPlansForVM): (JSC::JITWorklist::cancelAllPlansForVM): (JSC::JITWorklist::removeDeadPlans): (JSC::JITWorklist::setMaximumNumberOfConcurrentDFGCompilations): (JSC::JITWorklist::setMaximumNumberOfConcurrentFTLCompilations): (JSC::JITWorklist::visitWeakReferences): (JSC::JITWorklist::dump const): (JSC::JITWorklist::removeAllReadyPlansForVM): (JSC::JITWorklist::removeMatchingPlansForVM): * jit/JITWorklist.h: (JSC::JITWorklist::static_cast<size_t>): * jit/JITWorklistInlines.h: Renamed from Source/JavaScriptCore/dfg/DFGScannable.h. (JSC::JITWorklist::iterateCodeBlocksForGC): * jit/JITWorklistThread.cpp: Added. (JSC::JITWorklistThread::JITWorklistThread): (JSC::JITWorklistThread::name const): (JSC::JITWorklistThread::poll): (JSC::JITWorklistThread::work): (JSC::JITWorklistThread::threadDidStart): (JSC::JITWorklistThread::threadIsStopping): * jit/JITWorklistThread.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.h. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::jitCompileAndSetHeuristics): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::~VM): Canonical link: https://commits.webkit.org/238161@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 15:15:22 +00:00
jit/JITPlan.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
jit/JITPropertyAccess.cpp
jit/JITPropertyAccess32_64.cpp
jit/JITRightShiftGenerator.cpp
Merge all the JIT worklists into a shared worklist https://bugs.webkit.org/show_bug.cgi?id=226207 Reviewed by Saam Barati. Delete the DFG and FTL worklists and refactor JITWorklist to handle the compilation for all tiers. This reduces the total number of compiler threads while allowing each tier to use more threads whenever necessary. The default configuration is for the worklist to have 3 threads, baseline can use up to all 3 threads and DFG and FTL follow the previous limits set through JSC::Options. Right now, the worklist will only do work on upper tiers when all lower tiers have no pending tasks or have exceeded the maximum number of concurrent compilations. i.e. by default we only DFG compile when there are no baseline tasks in the queue and we only FTL compile when we either have no DFG tasks in the queue OR there are already 2 DFG compilations in progress. * API/JSVirtualMachine.mm: (+[JSVirtualMachine setNumberOfDFGCompilerThreads:]): (+[JSVirtualMachine setNumberOfFTLCompilerThreads:]): * API/tests/testapi.mm: (runJITThreadLimitTests): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::checkIfOptimizationThresholdReached): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCommon.h: (JSC::DFG::verboseCompilationEnabled): (JSC::DFG::logCompilationChanges): (JSC::DFG::shouldDumpGraphAtEachPhase): (JSC::DFG::shouldDumpDisassembly): * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): (JSC::DFG::compile): * dfg/DFGDriver.h: * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.h: * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: (JSC::DFG::OSRAvailabilityAnalysisPhase::run): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOperations.cpp: (JSC::DFG::triggerFTLReplacementCompile): (JSC::DFG::tierUpCommon): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::Plan): (JSC::DFG::Plan::codeSize const): (JSC::DFG::Plan::finalizeInGC): (JSC::DFG::Plan::notifyReady): (JSC::DFG::Plan::cancel): (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::finalize): (JSC::DFG::Plan::iterateCodeBlocksForGC): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::isKnownToBeLiveDuringGC): (JSC::DFG::Plan::isKnownToBeLiveAfterGC): * dfg/DFGPlan.h: * dfg/DFGPlanInlines.h: Removed. * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): * dfg/DFGWorklist.cpp: Removed. * dfg/DFGWorklist.h: Removed. * dfg/DFGWorklistInlines.h: Removed. * ftl/FTLCompile.h: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::buildExitArguments): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (JSC::FTL::verboseCompilationEnabled): (JSC::FTL::shouldDumpDisassembly): * heap/Heap.cpp: (JSC::Heap::completeAllJITPlans): (JSC::Heap::iterateExecutingAndCompilingCodeBlocks): (JSC::Heap::removeDeadCompilerWorklistEntries): (JSC::Heap::stopThePeriphery): (JSC::Heap::suspendCompilerThreads): (JSC::Heap::resumeCompilerThreads): (JSC::Heap::addCoreConstraints): * heap/Heap.h: * heap/RootMarkReason.h: * jit/JIT.cpp: (JSC::JIT::compileAndLinkWithoutFinalizing): (JSC::JIT::codeSize const): (JSC::JIT::compileTimeStats): * jit/JIT.h: * jit/JITBaselinePlan.cpp: Copied from Source/JavaScriptCore/ftl/FTLState.cpp. (JSC::JITBaselinePlan::JITBaselinePlan): (JSC::JITBaselinePlan::compileInThreadImpl): (JSC::JITBaselinePlan::codeSize const): (JSC::JITBaselinePlan::finalize): * jit/JITBaselinePlan.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITCompilationKey.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.cpp. (JSC::JITCompilationKey::dump const): * jit/JITCompilationKey.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.h. (JSC::JITCompilationKey::JITCompilationKey): (JSC::JITCompilationKey::operator! const): (JSC::JITCompilationKey::isHashTableDeletedValue const): (JSC::JITCompilationKey::mode const): (JSC::JITCompilationKey::operator== const): (JSC::JITCompilationKey::hash const): (JSC::JITCompilationKeyHash::hash): (JSC::JITCompilationKeyHash::equal): * jit/JITCompilationMode.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.cpp. (WTF::printInternal): * jit/JITCompilationMode.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.h. (JSC::isFTL): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITPlan.cpp: Added. (JSC::JITPlan::JITPlan): (JSC::JITPlan::cancel): (JSC::JITPlan::notifyCompiling): (JSC::JITPlan::notifyReady): (JSC::JITPlan::tier const): (JSC::JITPlan::key): (JSC::JITPlan::isKnownToBeLiveAfterGC): (JSC::JITPlan::isKnownToBeLiveDuringGC): (JSC::JITPlan::iterateCodeBlocksForGC): (JSC::JITPlan::checkLivenessAndVisitChildren): (JSC::JITPlan::computeCompileTimes const): (JSC::JITPlan::reportCompileTimes const): (JSC::JITPlan::compileInThread): * jit/JITPlan.h: Added. (JSC::JITPlan::~JITPlan): (JSC::JITPlan::vm const): (JSC::JITPlan::codeBlock const): (JSC::JITPlan::thread const): (JSC::JITPlan::mode const): (JSC::JITPlan::stage const): (JSC::JITPlan::isFTL const): (JSC::JITPlan::finalizeInGC): * jit/JITPlanStage.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.cpp. * jit/JITSafepoint.cpp: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.cpp. (JSC::Safepoint::Safepoint): (JSC::Safepoint::~Safepoint): (JSC::Safepoint::begin): (JSC::Safepoint::cancel): * jit/JITSafepoint.h: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.h. * jit/JITScannable.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITWorklist.cpp: (JSC::JITWorklist::JITWorklist): (JSC::JITWorklist::~JITWorklist): (JSC::JITWorklist::existingGlobalWorklistOrNull): (JSC::JITWorklist::ensureGlobalWorklist): (JSC::JITWorklist::enqueue): (JSC::JITWorklist::queueLength const): (JSC::JITWorklist::suspendAllThreads): (JSC::JITWorklist::resumeAllThreads): (JSC::JITWorklist::compilationState): (JSC::JITWorklist::completeAllReadyPlansForVM): (JSC::JITWorklist::waitUntilAllPlansForVMAreReady): (JSC::JITWorklist::completeAllPlansForVM): (JSC::JITWorklist::cancelAllPlansForVM): (JSC::JITWorklist::removeDeadPlans): (JSC::JITWorklist::setMaximumNumberOfConcurrentDFGCompilations): (JSC::JITWorklist::setMaximumNumberOfConcurrentFTLCompilations): (JSC::JITWorklist::visitWeakReferences): (JSC::JITWorklist::dump const): (JSC::JITWorklist::removeAllReadyPlansForVM): (JSC::JITWorklist::removeMatchingPlansForVM): * jit/JITWorklist.h: (JSC::JITWorklist::static_cast<size_t>): * jit/JITWorklistInlines.h: Renamed from Source/JavaScriptCore/dfg/DFGScannable.h. (JSC::JITWorklist::iterateCodeBlocksForGC): * jit/JITWorklistThread.cpp: Added. (JSC::JITWorklistThread::JITWorklistThread): (JSC::JITWorklistThread::name const): (JSC::JITWorklistThread::poll): (JSC::JITWorklistThread::work): (JSC::JITWorklistThread::threadDidStart): (JSC::JITWorklistThread::threadIsStopping): * jit/JITWorklistThread.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.h. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::jitCompileAndSetHeuristics): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::~VM): Canonical link: https://commits.webkit.org/238161@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 15:15:22 +00:00
jit/JITSafepoint.cpp
jit/JITSizeStatistics.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
jit/JITStubRoutine.cpp
jit/JITSubGenerator.cpp
jit/JITThunks.cpp
jit/JITToDFGDeferredCompilationCallback.cpp
jit/JITWorklist.cpp
Merge all the JIT worklists into a shared worklist https://bugs.webkit.org/show_bug.cgi?id=226207 Reviewed by Saam Barati. Delete the DFG and FTL worklists and refactor JITWorklist to handle the compilation for all tiers. This reduces the total number of compiler threads while allowing each tier to use more threads whenever necessary. The default configuration is for the worklist to have 3 threads, baseline can use up to all 3 threads and DFG and FTL follow the previous limits set through JSC::Options. Right now, the worklist will only do work on upper tiers when all lower tiers have no pending tasks or have exceeded the maximum number of concurrent compilations. i.e. by default we only DFG compile when there are no baseline tasks in the queue and we only FTL compile when we either have no DFG tasks in the queue OR there are already 2 DFG compilations in progress. * API/JSVirtualMachine.mm: (+[JSVirtualMachine setNumberOfDFGCompilerThreads:]): (+[JSVirtualMachine setNumberOfFTLCompilerThreads:]): * API/tests/testapi.mm: (runJITThreadLimitTests): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::checkIfOptimizationThresholdReached): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCommon.h: (JSC::DFG::verboseCompilationEnabled): (JSC::DFG::logCompilationChanges): (JSC::DFG::shouldDumpGraphAtEachPhase): (JSC::DFG::shouldDumpDisassembly): * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): (JSC::DFG::compile): * dfg/DFGDriver.h: * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.h: * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: (JSC::DFG::OSRAvailabilityAnalysisPhase::run): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOperations.cpp: (JSC::DFG::triggerFTLReplacementCompile): (JSC::DFG::tierUpCommon): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::Plan): (JSC::DFG::Plan::codeSize const): (JSC::DFG::Plan::finalizeInGC): (JSC::DFG::Plan::notifyReady): (JSC::DFG::Plan::cancel): (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::finalize): (JSC::DFG::Plan::iterateCodeBlocksForGC): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::isKnownToBeLiveDuringGC): (JSC::DFG::Plan::isKnownToBeLiveAfterGC): * dfg/DFGPlan.h: * dfg/DFGPlanInlines.h: Removed. * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): * dfg/DFGWorklist.cpp: Removed. * dfg/DFGWorklist.h: Removed. * dfg/DFGWorklistInlines.h: Removed. * ftl/FTLCompile.h: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::buildExitArguments): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (JSC::FTL::verboseCompilationEnabled): (JSC::FTL::shouldDumpDisassembly): * heap/Heap.cpp: (JSC::Heap::completeAllJITPlans): (JSC::Heap::iterateExecutingAndCompilingCodeBlocks): (JSC::Heap::removeDeadCompilerWorklistEntries): (JSC::Heap::stopThePeriphery): (JSC::Heap::suspendCompilerThreads): (JSC::Heap::resumeCompilerThreads): (JSC::Heap::addCoreConstraints): * heap/Heap.h: * heap/RootMarkReason.h: * jit/JIT.cpp: (JSC::JIT::compileAndLinkWithoutFinalizing): (JSC::JIT::codeSize const): (JSC::JIT::compileTimeStats): * jit/JIT.h: * jit/JITBaselinePlan.cpp: Copied from Source/JavaScriptCore/ftl/FTLState.cpp. (JSC::JITBaselinePlan::JITBaselinePlan): (JSC::JITBaselinePlan::compileInThreadImpl): (JSC::JITBaselinePlan::codeSize const): (JSC::JITBaselinePlan::finalize): * jit/JITBaselinePlan.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITCompilationKey.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.cpp. (JSC::JITCompilationKey::dump const): * jit/JITCompilationKey.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.h. (JSC::JITCompilationKey::JITCompilationKey): (JSC::JITCompilationKey::operator! const): (JSC::JITCompilationKey::isHashTableDeletedValue const): (JSC::JITCompilationKey::mode const): (JSC::JITCompilationKey::operator== const): (JSC::JITCompilationKey::hash const): (JSC::JITCompilationKeyHash::hash): (JSC::JITCompilationKeyHash::equal): * jit/JITCompilationMode.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.cpp. (WTF::printInternal): * jit/JITCompilationMode.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.h. (JSC::isFTL): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITPlan.cpp: Added. (JSC::JITPlan::JITPlan): (JSC::JITPlan::cancel): (JSC::JITPlan::notifyCompiling): (JSC::JITPlan::notifyReady): (JSC::JITPlan::tier const): (JSC::JITPlan::key): (JSC::JITPlan::isKnownToBeLiveAfterGC): (JSC::JITPlan::isKnownToBeLiveDuringGC): (JSC::JITPlan::iterateCodeBlocksForGC): (JSC::JITPlan::checkLivenessAndVisitChildren): (JSC::JITPlan::computeCompileTimes const): (JSC::JITPlan::reportCompileTimes const): (JSC::JITPlan::compileInThread): * jit/JITPlan.h: Added. (JSC::JITPlan::~JITPlan): (JSC::JITPlan::vm const): (JSC::JITPlan::codeBlock const): (JSC::JITPlan::thread const): (JSC::JITPlan::mode const): (JSC::JITPlan::stage const): (JSC::JITPlan::isFTL const): (JSC::JITPlan::finalizeInGC): * jit/JITPlanStage.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.cpp. * jit/JITSafepoint.cpp: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.cpp. (JSC::Safepoint::Safepoint): (JSC::Safepoint::~Safepoint): (JSC::Safepoint::begin): (JSC::Safepoint::cancel): * jit/JITSafepoint.h: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.h. * jit/JITScannable.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITWorklist.cpp: (JSC::JITWorklist::JITWorklist): (JSC::JITWorklist::~JITWorklist): (JSC::JITWorklist::existingGlobalWorklistOrNull): (JSC::JITWorklist::ensureGlobalWorklist): (JSC::JITWorklist::enqueue): (JSC::JITWorklist::queueLength const): (JSC::JITWorklist::suspendAllThreads): (JSC::JITWorklist::resumeAllThreads): (JSC::JITWorklist::compilationState): (JSC::JITWorklist::completeAllReadyPlansForVM): (JSC::JITWorklist::waitUntilAllPlansForVMAreReady): (JSC::JITWorklist::completeAllPlansForVM): (JSC::JITWorklist::cancelAllPlansForVM): (JSC::JITWorklist::removeDeadPlans): (JSC::JITWorklist::setMaximumNumberOfConcurrentDFGCompilations): (JSC::JITWorklist::setMaximumNumberOfConcurrentFTLCompilations): (JSC::JITWorklist::visitWeakReferences): (JSC::JITWorklist::dump const): (JSC::JITWorklist::removeAllReadyPlansForVM): (JSC::JITWorklist::removeMatchingPlansForVM): * jit/JITWorklist.h: (JSC::JITWorklist::static_cast<size_t>): * jit/JITWorklistInlines.h: Renamed from Source/JavaScriptCore/dfg/DFGScannable.h. (JSC::JITWorklist::iterateCodeBlocksForGC): * jit/JITWorklistThread.cpp: Added. (JSC::JITWorklistThread::JITWorklistThread): (JSC::JITWorklistThread::name const): (JSC::JITWorklistThread::poll): (JSC::JITWorklistThread::work): (JSC::JITWorklistThread::threadDidStart): (JSC::JITWorklistThread::threadIsStopping): * jit/JITWorklistThread.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.h. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::jitCompileAndSetHeuristics): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::~VM): Canonical link: https://commits.webkit.org/238161@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 15:15:22 +00:00
jit/JITWorklistThread.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
jit/PCToCodeOriginMap.cpp
jit/PolymorphicCallStubRoutine.cpp
jit/Reg.cpp
jit/RegisterAtOffset.cpp
jit/RegisterAtOffsetList.cpp
jit/RegisterSet.cpp
jit/Repatch.cpp
jit/ScratchRegisterAllocator.cpp
jit/SetupVarargsFrame.cpp
Implement some common Baseline JIT slow paths using JIT thunks. https://bugs.webkit.org/show_bug.cgi?id=225682 Reviewed by Filip Pizlo. Source/JavaScriptCore: This patch implements the following changes: 1. Implement exception handling thunks: a. handleExceptionGenerator, which calls operationLookupExceptionHandler(). b. handleExceptionWithCallFrameRollbackGenerator, which calls operationLookupExceptionHandlerFromCallerFrame(). All the JIT tiers were emitting their own copy of these routines to call these operation, one per CodeBlock. We now emit 2 thunks for these and have all the tiers just jump to them. PolymorphicAccess also now uses the handleExceptionGenerator thunk. DFG::JITCompiler::compileExceptionHandlers() has one small behavior difference before it calls operationLookupExceptionHandlerFromCallerFrame(): it first re-sets the top of stack for the function where we are about to throw a StackOverflowError from. This re-setting of top of stack is useless because we're imminently unwinding out of at least this frame for the StackOverflowError. Hence, it is ok to use the handleExceptionWithCallFrameRollbackGenerator thunk here as well. Note that no other tiers does this re-setting of top of stack. FTLLowerDFGToB3 has one case using operationLookupExceptionHandlerFromCallerFrame() which cannot be refactored to use these thunks because it does additional work to throw a StackOverflowError. A different thunk will be needed. I left it alone for now. 2. Introduce JITThunks::existingCTIStub(ThunkGenerator, NoLockingNecessaryTag) so that a thunk can get a pointer to another thunk without locking the JITThunks lock. Otherwise, deadlock ensues. 3. Change SlowPathCall to emit and use thunks instead of emitting a blob of code to call a slow path function for every bytecode in a CodeBlock. 4. Introduce JITThunks::ctiSlowPathFunctionStub() to manage these SlowPathFunction thunks. 5. Introduce JITThunks::preinitializeAggressiveCTIThunks() to initialize these thunks at VM initialization time. Pre-initializing them has multiple benefits: a. the thunks are not scattered through out JIT memory, thereby reducing fragmentation. b. we don't spend time at runtime compiling them when the user is interacting with the VM. Conceptually, these thunks can be VM independent and can be shared by VMs process-wide. However, it will require some additional work. For now, the thunks remain bound to a specific VM instance. These changes are only enabled when ENABLE(EXTRA_CTI_THUNKS), which is currently only available for ARM64 and non-Windows x86_64. This patch has passed JSC tests on AS Mac. With this patch, --dumpLinkBufferStats shows the following changes in emitted JIT code size (using a single run of the CLI version of JetStream2 on AS Mac): Base New Diff BaselineJIT: 89089964 (84.962811 MB) 84624776 (80.704475 MB) 0.95x (reduction) DFG: 39117360 (37.305222 MB) 36415264 (34.728302 MB) 0.93x (reduction) Thunk: 23230968 (22.154778 MB) 23130336 (22.058807 MB) 1.00x InlineCache: 22027416 (21.006981 MB) 21969728 (20.951965 MB) 1.00x FTL: 6575772 (6.271145 MB) 6097336 (5.814873 MB) 0.93x (reduction) Wasm: 2302724 (2.196049 MB) 2301956 (2.195316 MB) 1.00x YarrJIT: 1538956 (1.467663 MB) 1522488 (1.451958 MB) 0.99x CSSJIT: 0 0 Uncategorized: 0 0 * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.h: (JSC::CodeBlock::offsetOfInstructionsRawPointer): * bytecode/PolymorphicAccess.cpp: (JSC::AccessGenerationState::emitExplicitExceptionHandler): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::compileExceptionHandlers): (JSC::DFG::JITCompiler::link): * dfg/DFGJITCompiler.h: * ftl/FTLCompile.cpp: (JSC::FTL::compile): * ftl/FTLLink.cpp: (JSC::FTL::link): * jit/JIT.cpp: (JSC::JIT::link): (JSC::JIT::privateCompileExceptionHandlers): * jit/JIT.h: * jit/JITThunks.cpp: (JSC::JITThunks::existingCTIStub): (JSC::JITThunks::ctiSlowPathFunctionStub): (JSC::JITThunks::preinitializeExtraCTIThunks): * jit/JITThunks.h: * jit/SlowPathCall.cpp: Added. (JSC::JITSlowPathCall::call): (JSC::JITSlowPathCall::generateThunk): * jit/SlowPathCall.h: * jit/ThunkGenerators.cpp: (JSC::handleExceptionGenerator): (JSC::handleExceptionWithCallFrameRollbackGenerator): (JSC::popThunkStackPreservesAndHandleExceptionGenerator): * jit/ThunkGenerators.h: * runtime/CommonSlowPaths.h: * runtime/SlowPathFunction.h: Added. * runtime/VM.cpp: (JSC::VM::VM): Source/WTF: Introduce ENABLE(EXTRA_CTI_THUNKS) flag to guard the use of these new thunks. Currently, the thunks are 64-bit only, and only supported for ARM64 and non-Windows X86_64. The reason it is not supported for Windows as well is because Windows only has 4 argument registers. In this patch, the thunks do not use that many registers yet, but there will be more thunks coming that will require the use of up to 6 argument registers. * wtf/PlatformEnable.h: Canonical link: https://commits.webkit.org/237639@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277383 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-12 19:11:25 +00:00
jit/SlowPathCall.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
jit/TagRegistersMode.cpp
jit/TempRegisterSet.cpp
jit/ThunkGenerators.cpp
llint/LLIntCLoop.cpp
llint/LLIntData.cpp
llint/LLIntEntrypoint.cpp
llint/LLIntExceptions.cpp
llint/LLIntSlowPaths.cpp
llint/LLIntThunks.cpp
parser/Lexer.cpp
parser/ModuleAnalyzer.cpp
parser/Nodes.cpp
parser/NodesAnalyzeModule.cpp
parser/Parser.cpp
parser/ParserArena.cpp
parser/SourceProvider.cpp
parser/SourceProviderCache.cpp
parser/UnlinkedSourceCode.cpp
parser/VariableEnvironment.cpp
profiler/ProfilerBytecode.cpp
profiler/ProfilerBytecodeSequence.cpp
profiler/ProfilerBytecodes.cpp
profiler/ProfilerCompilation.cpp
profiler/ProfilerCompilationKind.cpp
profiler/ProfilerCompiledBytecode.cpp
profiler/ProfilerDatabase.cpp
profiler/ProfilerEvent.cpp
profiler/ProfilerJettisonReason.cpp
profiler/ProfilerOSRExit.cpp
profiler/ProfilerOSRExitSite.cpp
profiler/ProfilerOrigin.cpp
profiler/ProfilerOriginStack.cpp
profiler/ProfilerProfiledBytecodes.cpp
profiler/ProfilerUID.cpp
runtime/AbstractModuleRecord.cpp
Implement Promise.any and AggregateError https://bugs.webkit.org/show_bug.cgi?id=202566 Reviewed by Yusuke Suzuki. JSTests: * test262/config.yaml: * test262/expectations.yaml: Source/JavaScriptCore: `Promise.any` resolves when any of the given `promises` resolve, but only rejects if _all_ of the given `promises` reject. In order to support aggregating all of the `reason` values for all of the rejections, a new error type `AggregateError` is introduced which has an `get errors` that returns an aggregated array of the `reason` values. * builtins/PromiseConstructor.js: (all.newResolveElement): (allSettled.newResolveRejectElements): (any): Added. (any.newRejectElement): Added. * runtime/JSPromiseConstructor.cpp: * builtins/BuiltinNames.h: * bytecode/LinkTimeConstant.h: * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::errorStructure const): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::initializeAggregateErrorConstructor): Added. (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): Expose `@AggregateError` for builtins. * runtime/AggregateError.h: Added. (JSC::AggregateError::destroy): (JSC::AggregateError::subspaceFor): (JSC::AggregateError::createStructure): (JSC::AggregateError::create): (JSC::AggregateError::errors const): * runtime/AggregateError.cpp: Added. (JSC::AggregateError::AggregateError): (JSC::AggregateError::visitChildren): (JSC::AggregateError::create): (JSC::AggregateError::finishCreation): * runtime/AggregateErrorPrototype.h: Added. * runtime/AggregateErrorPrototype.cpp: Added. (JSC::AggregateErrorPrototype::AggregateErrorPrototype): (JSC::AggregateErrorPrototype::finishCreation): (JSC::aggregateErrorPrototypeAccessorErrors): * runtime/AggregateErrorConstructor.h: Added. * runtime/AggregateErrorConstructor.cpp: Added. (JSC::callAggregateErrorConstructor): (JSC::constructAggregateErrorConstructor): (JSC::AggregateErrorConstructor::AggregateErrorConstructor): (JSC::AggregateErrorConstructor::finishCreation): * runtime/ErrorType.h: * runtime/ErrorType.cpp: (JSC::errorTypeName): * runtime/VM.h: * runtime/VM.cpp: (JSC::VM::VM): Make an `IsoSubspace` for `AggregateError` as it has a different size than `ErrorInstance`. * runtime/ErrorInstance.h: (JSC::ErrorInstance::create): * runtime/ErrorInstance.cpp: (JSC::ErrorInstance::finishCreation): * wasm/js/JSWebAssemblyCompileError.cpp: (JSC::JSWebAssemblyCompileError::create): * wasm/js/JSWebAssemblyLinkError.cpp: (JSC::JSWebAssemblyLinkError::create): * wasm/js/JSWebAssemblyRuntimeError.cpp: (JSC::JSWebAssemblyRuntimeError::create): Assign to `ErrorInstance` member variables inside `ErrorInstance::finishCreation` instead of inside `ErrorInstance::create` so that subclasses don't have to do the work as well. * runtime/Error.cpp: (JSC::createError): * runtime/ErrorPrototype.h: (JSC::ErrorPrototype::createStructure): * runtime/NativeErrorPrototype.h: (JSC::NativeErrorPrototype::createStructure): Drive-by: fix incorrect usage of `ErrorInstanceType` since `ErrorPrototype` does not inherit from `ErrorInstance` (and therefore neither does `NativeErrorPrototype`). * runtime/ArgList.h: Add `WTF_MAKE_NONMOVABLE` to `MarkedArgumentBuffer`. * Sources.txt: * JavaScriptCore.xcodeproj/project.pbxproj: Source/WebInspectorUI: * UserInterface/Models/IssueMessage.js: Mark `AggregateError` as a `WI.IssueMessage.Type.SemanticIssue`. Canonical link: https://commits.webkit.org/223544@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260273 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-17 19:31:08 +00:00
runtime/AggregateError.cpp
runtime/AggregateErrorConstructor.cpp
runtime/AggregateErrorPrototype.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/ArgList.cpp
runtime/ArrayBuffer.cpp
runtime/ArrayBufferView.cpp
runtime/ArrayConstructor.cpp
runtime/ArrayConventions.cpp
runtime/ArrayIteratorPrototype.cpp
runtime/ArrayPrototype.cpp
runtime/AsyncFromSyncIteratorPrototype.cpp
runtime/AsyncGeneratorFunctionConstructor.cpp
runtime/AsyncGeneratorFunctionPrototype.cpp
runtime/AsyncGeneratorPrototype.cpp
runtime/AsyncIteratorPrototype.cpp
runtime/AtomicsObject.cpp
runtime/AsyncFunctionConstructor.cpp
runtime/AsyncFunctionPrototype.cpp
runtime/BasicBlockLocation.cpp
[ESNext][BigInt] Implement BigIntConstructor and BigIntPrototype https://bugs.webkit.org/show_bug.cgi?id=175359 Reviewed by Yusuke Suzuki. JSTests: * bigIntTests.yaml: * stress/big-int-as-key.js: Added. * stress/big-int-constructor-gc.js: Added. * stress/big-int-constructor-oom.js: Added. * stress/big-int-constructor-properties.js: Added. * stress/big-int-constructor-prototype-prop-descriptor.js: Added. * stress/big-int-constructor-prototype.js: Added. * stress/big-int-constructor.js: Added. * stress/big-int-function-apply.js: * stress/big-int-length.js: Added. * stress/big-int-prop-descriptor.js: Added. * stress/big-int-proto-constructor.js: Added. * stress/big-int-proto-name.js: Added. * stress/big-int-prototype-properties.js: Added. * stress/big-int-prototype-proto.js: Added. * stress/big-int-prototype-value-of.js: Added. * stress/big-int-prototype-symbol-to-string-tag.js: Added. * stress/big-int-prototype-to-string-apply.js: Added. * stress/big-int-to-object.js: Added. * stress/big-int-to-string.js: Added. Source/JavaScriptCore: This patch is implementing BigIntConstructor and BigIntPrototype following spec[1, 2]. As addition, we are also implementing BigIntObject warapper to handle ToObject(v) abstract operation when "v" is a BigInt primitive. With these classes, now it's possible to syntetize BigInt.prototype and then call "toString", "valueOf" and "toLocaleString" when the primitive is a BigInt. BigIntConstructor exposes an API to parse other primitives such as Number, Boolean and String to BigInt. We decided to skip parseInt implementation, since it was removed from spec. [1] - https://tc39.github.io/proposal-bigint/#sec-bigint-constructor [2] - https://tc39.github.io/proposal-bigint/#sec-properties-of-the-bigint-prototype-object * CMakeLists.txt: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * jsc.cpp: * runtime/BigIntConstructor.cpp: Added. (JSC::BigIntConstructor::BigIntConstructor): (JSC::BigIntConstructor::finishCreation): (JSC::isSafeInteger): (JSC::toBigInt): (JSC::callBigIntConstructor): (JSC::bigIntConstructorFuncAsUintN): (JSC::bigIntConstructorFuncAsIntN): * runtime/BigIntConstructor.h: Added. (JSC::BigIntConstructor::create): (JSC::BigIntConstructor::createStructure): * runtime/BigIntObject.cpp: Added. (JSC::BigIntObject::BigIntObject): (JSC::BigIntObject::finishCreation): (JSC::BigIntObject::toStringName): (JSC::BigIntObject::defaultValue): * runtime/BigIntObject.h: Added. (JSC::BigIntObject::create): (JSC::BigIntObject::internalValue const): (JSC::BigIntObject::createStructure): * runtime/BigIntPrototype.cpp: Added. (JSC::BigIntPrototype::BigIntPrototype): (JSC::BigIntPrototype::finishCreation): (JSC::toThisBigIntValue): (JSC::bigIntProtoFuncToString): (JSC::bigIntProtoFuncToLocaleString): (JSC::bigIntProtoFuncValueOf): * runtime/BigIntPrototype.h: Added. (JSC::BigIntPrototype::create): (JSC::BigIntPrototype::createStructure): * runtime/IntlCollator.cpp: (JSC::IntlCollator::initializeCollator): * runtime/IntlNumberFormat.cpp: (JSC::IntlNumberFormat::initializeNumberFormat): * runtime/JSBigInt.cpp: (JSC::JSBigInt::createFrom): (JSC::JSBigInt::parseInt): (JSC::JSBigInt::toObject const): * runtime/JSBigInt.h: * runtime/JSCJSValue.cpp: (JSC::JSValue::synthesizePrototype const): * runtime/JSCPoisonedPtr.cpp: * runtime/JSCell.cpp: (JSC::JSCell::toObjectSlow const): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::bigIntPrototype const): (JSC::JSGlobalObject::bigIntObjectStructure const): * runtime/StructureCache.h: * runtime/StructureInlines.h: (JSC::prototypeForLookupPrimitiveImpl): Canonical link: https://commits.webkit.org/197062@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-02 23:38:36 +00:00
runtime/BigIntConstructor.cpp
runtime/BigIntObject.cpp
runtime/BigIntPrototype.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/BooleanConstructor.cpp
runtime/BooleanObject.cpp
runtime/BooleanPrototype.cpp
[ESNext] Implement private methods https://bugs.webkit.org/show_bug.cgi?id=194434 Reviewed by Filip Pizlo. JSTests: * stress/private-brand-installed-after-super-call-from-arrow-function.js: Added. * stress/private-brand-installed-after-super-call-from-eval.js: Added. * stress/private-method-brand-check.js: Added. * stress/private-method-change-attribute-from-branded-structure.js: Added. * stress/private-method-change-prototype-from-branded-structure.js: Added. * stress/private-method-check-private-brand-ic.js: Added. * stress/private-method-check-structure-miss.js: Added. * stress/private-method-comparison.js: Added. * stress/private-method-delete-property-from-branded-structure.js: Added. * stress/private-method-extends-brand-check.js: Added. * stress/private-method-get-and-call.js: Added. * stress/private-method-invalid-multiple-brand-installation.js: Added. * stress/private-method-invalidate-compiled-with-constant-symbol.js: Added. * stress/private-method-nested-class.js: Added. * stress/private-method-on-sealed-objects.js: Added. * stress/private-method-on-uncacheable-dictionary.js: Added. * stress/private-method-polymorphic-with-constant-symbol.js: Added. * stress/private-method-set-brand-should-have-write-barrier.js: Added. * stress/private-method-untyped-use.js: Added. * stress/private-method-with-uncacheable-dictionary-transition.js: Added. * stress/private-methods-inline-cache.js: Added. * stress/private-methods-megamorphic-ic.js: Added. * stress/private-methods-on-proxy.js: Added. * stress/private-methods-poly-ic-multiple-classes.js: Added. * stress/private-methods-poly-ic-single-class.js: Added. * stress/private-names-available-on-direct-eval.js: Added. * test262/config.yaml: Source/JavaScriptCore: This patch is adding support to private methods following the specification on https://tc39.es/proposal-private-methods/. This is introducing a new way to declare private methods on class syntax. Private methods are only accessible within classes they were declared, and only can be called from objects that are instance of these classes. To guarantee such rules, the proposal presents the concept of Brand Check. During class evaluation, if a private method is present, a `brand` is installed in this class. Every instance of such class then gets this brand installed during `[[Construct]]` operation. It means that an object can have multiple brands (e.g when there is also private methods declared on super class). Before accessing a private method, there is a check to validate if the target of the call has the brand of callee method. The brand check mechanism is implemented using a `@privateBrand` stored on class scope. Here is a representation of how this mechanism works: ``` class C { #m() { return 3; } method() { return this.#m(); } } let c = new C(); console.log(c.method()); // prints 3 ``` Generated bytecode for the following representation: ``` { // class lexical scope const @privateBrand = @createPrivateSymbol(); const #m = function () { return 3; } C.prototype.method = function() { @check_private_brand(this, @privateBrand); return #m.call(this); } C = function() { @set_private_brand(this, @privateBrand); } } let c = new C(); console.log(c.method()); // prints 3 ``` # Resolving correct brand to check In the case of shadowing or nested scope, we need to emit brand checks to the right private brand. See code below: ``` class C { #m() { return 3; } method() { return this.#m();} A = class { #m2() { return 3; } foo(o) { return o.#m(); } } } ``` The call of "#m" in `foo` refers to "C::#m". In such case, we need to check C's private brand, instead of A's private brand. To perform the proper check, we first resolve scope of "#m" and then check the private brand of this scope (the scope where the private method and brand are stored is the same). So the bytecode to lookup the right brand is: ``` mov loc9, arg1 resolve_scope loc10, "#m" get_from_scope loc11, loc10, "@privateBrand" check_private_brand loc9, loc11 get_from_scope loc11, loc10, "#m" // setup call frame call loc11, ... // ... ``` # Brand check mechanism We are introducing in this patch 2 new bytecodes to allow brand check of objects: `op_set_brand` and `op_check_brand`. `op_set_brand` sets a new brand in an object, so we can perform the brand check later when accessing private methods. This operations throws when trying to add the same brand twice in an Object. `op_check_brand` checks if the given object contains the brand we are looking for. It traverses the brand chain to verify if the brand is present, and throws `TypeError` otherwise. We are also introducing a subclass for Structure called BrandedStructure. It is used to store brands and to allow brand check mechanism. BrandedStructure stores a brand and a parent pointer to another BrandedStructure that allow us traverse the brand chain. With `BrandedStructure`, we can then infer that a given object has the brand we are looking for just checking its structureId. This is a very good optimization, since we can reduce most of brand checks to structure checks. We created a new kind of transition called `SetBrand` that happens when `op_set_brand` is executed. This allow us to cache such kind of trasitions on trasition table using the key `<brand->uid, 0, TransitionKind::SetBrand>`. During this transition, we take previous structure and apply one of the following rules: 1. If it's a BrandedStructure, we then set it to `m_parentBrand`, to allow proper brand chain check. 2. If it's not a BrandedStructure, we set `m_parentBrand` to `nullptr`, meaning that this is the first brand being added to the object with this structure. For now, we are using the flag `isBrandedStructure` to identify that a given Structure is a BrandedStructure. This is done to avoid changes on places where we are checking for `vm.structureStructure()`. However, if we ever need space on Structure, this flag is a good candidate to be deleted and we can move to a solution that uses `vm.brandedStructureStructure()`; # JIT Support This patch also includes initial JIT support for `set_private_brand` and `check_private_brand`. On Baseline JIT, we are using `JITPravateBrandAccessGenerator` to support IC for both operands. On `DFGByteCodeParser` we are trying to inline brand access whenever possible, and fallbacking to `SetPrivateBrand` and `CheckPrivateBrand` otherwise. Those nodes are not being optimized at their full potential, but the code generated by them is also relying on `JITPrivateBrandAccessGenerator` to have IC support for both DFG and FTL. During DFG parsing, we try to reduce those access to `CheckIsConstant` and `CheckStructure` (with `PutStructure` for `set_private_brand` cases) based on available profiled data. This is meant to make brand checks almost free on DFG/FTL tiers when we have a single evaluation of a class, since the `CheckIsConstant` can be eliminated by the constant-folded scope load, and the `CheckStructure` is very likely to be redundant to any other `CheckStructure` that can be performed on receiver when we have a finite structure set. For instance, when we have a brand check on a path-of-no-return to a `GetByOffset` sequence on the same receiver, the `CheckStructure` for the brand check will enable CSE of the `CheckStructure` that would happen for that `GetByOffset`. Such design is possible because brand checks supports polymorphic access very similr to what we have for `GetByOffset` sequences. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/BuiltinExecutables.cpp: (JSC::BuiltinExecutables::createDefaultConstructor): (JSC::BuiltinExecutables::createExecutable): * builtins/BuiltinExecutables.h: We are adding a new parameter `PrivateBrandRequirement` to propagate when a default constructor needs to emit code to setup private brand on instances. * builtins/BuiltinNames.h: Adding `@privateBrand` that we use to store private brand on class's scope. * bytecode/AccessCase.cpp: (JSC::AccessCase::createCheckPrivateBrand): (JSC::AccessCase::createSetPrivateBrand): (JSC::AccessCase::requiresIdentifierNameMatch const): (JSC::AccessCase::requiresInt32PropertyCheck const): (JSC::AccessCase::needsScratchFPR const): (JSC::AccessCase::forEachDependentCell const): (JSC::AccessCase::doesCalls const): (JSC::AccessCase::canReplace const): (JSC::AccessCase::dump const): (JSC::AccessCase::generateWithGuard): (JSC::AccessCase::generateImpl): * bytecode/AccessCase.h: (JSC::AccessCase::structure const): (JSC::AccessCase::newStructure const): * bytecode/BytecodeList.rb: * bytecode/BytecodeUseDef.cpp: (JSC::computeUsesForBytecodeIndexImpl): (JSC::computeDefsForBytecodeIndexImpl): * bytecode/CheckPrivateBrandStatus.cpp: Added. (JSC::CheckPrivateBrandStatus::appendVariant): (JSC::CheckPrivateBrandStatus::computeForBaseline): (JSC::CheckPrivateBrandStatus::CheckPrivateBrandStatus): (JSC::CheckPrivateBrandStatus::computeForStubInfoWithoutExitSiteFeedback): (JSC::CheckPrivateBrandStatus::computeFor): (JSC::CheckPrivateBrandStatus::slowVersion const): (JSC::CheckPrivateBrandStatus::merge): (JSC::CheckPrivateBrandStatus::filter): (JSC::CheckPrivateBrandStatus::singleIdentifier const): (JSC::CheckPrivateBrandStatus::visitAggregate): (JSC::CheckPrivateBrandStatus::markIfCheap): (JSC::CheckPrivateBrandStatus::finalize): (JSC::CheckPrivateBrandStatus::dump const): * bytecode/CheckPrivateBrandStatus.h: Added. * bytecode/CheckPrivateBrandVariant.cpp: Added. (JSC::CheckPrivateBrandVariant::CheckPrivateBrandVariant): (JSC::CheckPrivateBrandVariant::~CheckPrivateBrandVariant): (JSC::CheckPrivateBrandVariant::attemptToMerge): (JSC::CheckPrivateBrandVariant::markIfCheap): (JSC::CheckPrivateBrandVariant::finalize): (JSC::CheckPrivateBrandVariant::visitAggregate): (JSC::CheckPrivateBrandVariant::dump const): (JSC::CheckPrivateBrandVariant::dumpInContext const): * bytecode/CheckPrivateBrandVariant.h: Added. (JSC::CheckPrivateBrandVariant::structureSet const): (JSC::CheckPrivateBrandVariant::structureSet): (JSC::CheckPrivateBrandVariant::identifier const): (JSC::CheckPrivateBrandVariant::overlaps): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::finalizeLLIntInlineCaches): * bytecode/ExecutableInfo.h: (JSC::ExecutableInfo::ExecutableInfo): (JSC::ExecutableInfo::privateBrandRequirement const): * bytecode/PolymorphicAccess.cpp: (JSC::PolymorphicAccess::regenerate): (WTF::printInternal): * bytecode/RecordedStatuses.cpp: (JSC::RecordedStatuses::operator=): (JSC::RecordedStatuses::addCheckPrivateBrandStatus): (JSC::RecordedStatuses::addSetPrivateBrandStatus): (JSC::RecordedStatuses::visitAggregate): (JSC::RecordedStatuses::markIfCheap): * bytecode/RecordedStatuses.h: (JSC::RecordedStatuses::forEachVector): * bytecode/SetPrivateBrandStatus.cpp: Added. (JSC::SetPrivateBrandStatus::appendVariant): (JSC::SetPrivateBrandStatus::computeForBaseline): (JSC::SetPrivateBrandStatus::SetPrivateBrandStatus): (JSC::SetPrivateBrandStatus::computeForStubInfoWithoutExitSiteFeedback): (JSC::SetPrivateBrandStatus::computeFor): (JSC::SetPrivateBrandStatus::slowVersion const): (JSC::SetPrivateBrandStatus::merge): (JSC::SetPrivateBrandStatus::filter): (JSC::SetPrivateBrandStatus::singleIdentifier const): (JSC::SetPrivateBrandStatus::visitAggregate): (JSC::SetPrivateBrandStatus::markIfCheap): (JSC::SetPrivateBrandStatus::finalize): (JSC::SetPrivateBrandStatus::dump const): * bytecode/SetPrivateBrandStatus.h: Added. * bytecode/SetPrivateBrandVariant.cpp: Added. (JSC::SetPrivateBrandVariant::SetPrivateBrandVariant): (JSC::SetPrivateBrandVariant::~SetPrivateBrandVariant): (JSC::SetPrivateBrandVariant::attemptToMerge): (JSC::SetPrivateBrandVariant::markIfCheap): (JSC::SetPrivateBrandVariant::finalize): (JSC::SetPrivateBrandVariant::visitAggregate): (JSC::SetPrivateBrandVariant::dump const): (JSC::SetPrivateBrandVariant::dumpInContext const): * bytecode/SetPrivateBrandVariant.h: Added. (JSC::SetPrivateBrandVariant::oldStructure const): (JSC::SetPrivateBrandVariant::newStructure const): (JSC::SetPrivateBrandVariant::identifier const): (JSC::SetPrivateBrandVariant::overlaps): * bytecode/StructureStubInfo.cpp: (JSC::StructureStubInfo::reset): * bytecode/StructureStubInfo.h: * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::privateBrandRequirement const): * bytecode/UnlinkedCodeBlockGenerator.h: (JSC::UnlinkedCodeBlockGenerator::privateBrandRequirement const): * bytecode/UnlinkedFunctionExecutable.cpp: (JSC::generateUnlinkedFunctionCodeBlock): (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable): * bytecode/UnlinkedFunctionExecutable.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): We changed BytecodeGenerator for FunctionNode and EvalNode to propagate parentScope PrivateNameEnvironment. These environments stores private name entries that are visible into the scope of the function/eval. This is required to identify the kind of access a private name is referring to, since it can be a private field or a private method. (JSC::BytecodeGenerator::instantiateLexicalVariables): (JSC::BytecodeGenerator::emitGetPrivateName): (JSC::BytecodeGenerator::emitCreatePrivateBrand): The process to create a private brand is as follows: 1. Create a PrivateSymbol using `@createPrivateSymbol`. 2. Store this symbol into a given scope (i.e class lexical scope) on `@privateBrand` variable. (JSC::BytecodeGenerator::emitInstallPrivateBrand): (JSC::BytecodeGenerator::emitGetPrivateBrand): We added `m_privateNamesStack` to BytecodeGenerator to represent the scope chain of available private names while generating bytecode. (JSC::BytecodeGenerator::emitCheckPrivateBrand): (JSC::BytecodeGenerator::isPrivateMethod): (JSC::BytecodeGenerator::pushPrivateAccessNames): (JSC::BytecodeGenerator::popPrivateAccessNames): (JSC::BytecodeGenerator::getAvailablePrivateAccessNames): (JSC::BytecodeGenerator::emitNewDefaultConstructor): (JSC::BytecodeGenerator::emitNewClassFieldInitializerFunction): (JSC::BytecodeGenerator::emitDirectGetByVal): Deleted. * bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::privateBrandRequirement const): (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::makeFunction): This change is required to properly propagate PrivateBrandRequirement to arrow functions that can potentially call `super()`. * bytecompiler/NodesCodegen.cpp: (JSC::PropertyListNode::emitDeclarePrivateFieldNames): (JSC::PropertyListNode::emitBytecode): (JSC::PropertyListNode::emitPutConstantProperty): (JSC::BaseDotNode::emitGetPropertyValue): Adding support to properly access private method. Since we store private methods on class lexical scope, we need a different set of instructions to access a private method. (JSC::BaseDotNode::emitPutProperty): In the case of we trying to write in a private method, we need to throw a TypeError according to specification (https://tc39.es/proposal-private-methods/#sec-privatefieldset). (JSC::FunctionCallValueNode::emitBytecode): (JSC::PostfixNode::emitDot): (JSC::PrefixNode::emitDot): (JSC::ClassExprNode::emitBytecode): * debugger/DebuggerCallFrame.cpp: (JSC::DebuggerCallFrame::evaluateWithScopeExtension): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): (JSC::DFG::AbstractInterpreter<AbstractStateType>::filterICStatus): * dfg/DFGArgumentsEliminationPhase.cpp: * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCapabilities.cpp: (JSC::DFG::capabilityLevel): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGClobbersExitState.cpp: (JSC::DFG::clobbersExitState): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGGraph.h: * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * dfg/DFGJITCompiler.h: (JSC::DFG::JITCompiler::addPrivateBrandAccess): * dfg/DFGMayExit.cpp: * dfg/DFGNode.h: (JSC::DFG::Node::hasCheckPrivateBrandStatus): (JSC::DFG::Node::checkPrivateBrandStatus): (JSC::DFG::Node::hasSetPrivateBrandStatus): (JSC::DFG::Node::setPrivateBrandStatus): * dfg/DFGNodeType.h: * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCheckPrivateBrand): (JSC::DFG::SpeculativeJIT::compileSetPrivateBrand): * dfg/DFGSpeculativeJIT.h: * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStoreBarrierInsertionPhase.cpp: * dfg/DFGVarargsForwardingPhase.cpp: * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compilePrivateBrandAccess): (JSC::FTL::DFG::LowerDFGToB3::compileCheckPrivateBrand): (JSC::FTL::DFG::LowerDFGToB3::compileSetPrivateBrand): * interpreter/Interpreter.cpp: (JSC::eval): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::link): * jit/JIT.h: * jit/JITInlineCacheGenerator.cpp: (JSC::JITPrivateBrandAccessGenerator::JITPrivateBrandAccessGenerator): (JSC::JITPrivateBrandAccessGenerator::generateFastPath): (JSC::JITPrivateBrandAccessGenerator::finalize): * jit/JITInlineCacheGenerator.h: (JSC::JITPrivateBrandAccessGenerator::JITPrivateBrandAccessGenerator): (JSC::JITPrivateBrandAccessGenerator::slowPathJump const): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): (JSC::getPrivateName): * jit/JITOperations.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_set_private_brand): (JSC::JIT::emitSlow_op_set_private_brand): (JSC::JIT::emit_op_check_private_brand): (JSC::JIT::emitSlow_op_check_private_brand): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emit_op_set_private_brand): (JSC::JIT::emitSlow_op_set_private_brand): (JSC::JIT::emit_op_check_private_brand): (JSC::JIT::emitSlow_op_check_private_brand): * jit/Repatch.cpp: (JSC::tryCacheCheckPrivateBrand): (JSC::repatchCheckPrivateBrand): (JSC::tryCacheSetPrivateBrand): (JSC::repatchSetPrivateBrand): (JSC::resetCheckPrivateBrand): (JSC::resetSetPrivateBrand): * jit/Repatch.h: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * parser/Nodes.cpp: (JSC::FunctionMetadataNode::FunctionMetadataNode): * parser/Nodes.h: (JSC::BaseDotNode::isPrivateMember const): (JSC::BaseDotNode::isPrivateField const): Deleted. * parser/Parser.cpp: (JSC::Parser<LexerType>::parseClass): (JSC::Parser<LexerType>::parseMemberExpression): * parser/Parser.h: (JSC::Scope::declarePrivateMethod): (JSC::Scope::declarePrivateField): (JSC::Parser<LexerType>::parse): (JSC::parse): (JSC::Scope::declarePrivateName): Deleted. * parser/ParserModes.h: * parser/SyntaxChecker.h: (JSC::SyntaxChecker::createDotAccess): * parser/VariableEnvironment.cpp: (JSC::VariableEnvironment::declarePrivateMethod): * parser/VariableEnvironment.h: (JSC::VariableEnvironmentEntry::isPrivateField const): (JSC::VariableEnvironmentEntry::isPrivateMethod const): (JSC::VariableEnvironmentEntry::setIsPrivateField): (JSC::VariableEnvironmentEntry::setIsPrivateMethod): (JSC::PrivateNameEntry::isMethod const): (JSC::PrivateNameEntry::isPrivateMethodOrAcessor const): (JSC::VariableEnvironment::addPrivateName): (JSC::VariableEnvironment::declarePrivateField): (JSC::VariableEnvironment::declarePrivateMethod): (JSC::VariableEnvironment::privateNameEnvironment const): (JSC::VariableEnvironment::hasPrivateMethodOrAccessor const): (JSC::VariableEnvironment::addPrivateNamesFrom): (JSC::VariableEnvironmentEntry::isPrivateName const): Deleted. (JSC::VariableEnvironmentEntry::setIsPrivateName): Deleted. (JSC::VariableEnvironment::declarePrivateName): Deleted. * runtime/CachedTypes.cpp: (JSC::CachedCodeBlockRareData::encode): (JSC::CachedCodeBlockRareData::decode const): (JSC::CachedFunctionExecutableRareData::encode): (JSC::CachedFunctionExecutableRareData::decode const): (JSC::CachedFunctionExecutable::privateBrandRequirement const): (JSC::CachedCodeBlock::derivedContextType const): (JSC::CachedFunctionExecutable::encode): (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable): (JSC::CachedCodeBlock::needsClassFieldInitializer const): Deleted. * runtime/CodeCache.cpp: (JSC::generateUnlinkedCodeBlockImpl): (JSC::generateUnlinkedCodeBlock): (JSC::generateUnlinkedCodeBlockForDirectEval): (JSC::CodeCache::getUnlinkedGlobalFunctionExecutable): * runtime/CodeCache.h: * runtime/DirectEvalExecutable.cpp: (JSC::DirectEvalExecutable::create): (JSC::DirectEvalExecutable::DirectEvalExecutable): * runtime/DirectEvalExecutable.h: * runtime/EvalExecutable.cpp: (JSC::EvalExecutable::EvalExecutable): * runtime/EvalExecutable.h: (JSC::EvalExecutable::executableInfo const): (JSC::EvalExecutable::privateBrandRequirement const): * runtime/ExceptionHelpers.cpp: (JSC::createInvalidPrivateNameError): * runtime/IndirectEvalExecutable.cpp: (JSC::IndirectEvalExecutable::IndirectEvalExecutable): * runtime/JSObject.h: * runtime/JSObjectInlines.h: (JSC::JSObject::checkPrivateBrand): (JSC::JSObject::setPrivateBrand): * runtime/JSScope.cpp: (JSC::JSScope::collectClosureVariablesUnderTDZ): * runtime/JSScope.h: * runtime/ModuleProgramExecutable.h: * runtime/Options.cpp: (JSC::Options::recomputeDependentOptions): * runtime/OptionsList.h: * runtime/ProgramExecutable.h: * runtime/Structure.cpp: (JSC::Structure::materializePropertyTable): (JSC::BrandedStructure::BrandedStructure): (JSC::BrandedStructure::create): (JSC::BrandedStructure::checkBrand): (JSC::Structure::setBrandTransitionFromExistingStructureImpl): (JSC::Structure::setBrandTransitionFromExistingStructureConcurrently): (JSC::Structure::setBrandTransition): * runtime/Structure.h: (JSC::Structure::finishCreation): * runtime/StructureInlines.h: (JSC::Structure::create): (JSC::Structure::forEachPropertyConcurrently): * runtime/StructureTransitionTable.h: * runtime/SymbolTable.cpp: (JSC::SymbolTable::cloneScopePart): * runtime/SymbolTable.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Canonical link: https://commits.webkit.org/233852@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272580 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-09 16:30:24 +00:00
runtime/BrandedStructure.cpp
JSScript should not keep bytecode cache in memory https://bugs.webkit.org/show_bug.cgi?id=198482 Reviewed by Saam Barati. When JSScript writes to the cache, we keep the in-memory serialized bytecode alive. Instead, we should only ever hold the memory mapped bytecode cache to avoid using too much memory. * API/JSScript.mm: (-[JSScript writeCache:]): * API/tests/testapi.mm: (testBytecodeCacheWithSyntaxError): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * jsc.cpp: * parser/SourceProvider.h: * runtime/BytecodeCacheError.cpp: Added. (JSC::BytecodeCacheError::StandardError::isValid const): (JSC::BytecodeCacheError::StandardError::message const): (JSC::BytecodeCacheError::WriteError::isValid const): (JSC::BytecodeCacheError::WriteError::message const): (JSC::BytecodeCacheError::operator=): (JSC::BytecodeCacheError::isValid const): (JSC::BytecodeCacheError::message const): * runtime/BytecodeCacheError.h: Added. (JSC::BytecodeCacheError::StandardError::StandardError): (JSC::BytecodeCacheError::WriteError::WriteError): * runtime/CachedBytecode.h: (JSC::CachedBytecode::create): * runtime/CachedTypes.cpp: (JSC::Encoder::Encoder): (JSC::Encoder::release): (JSC::Encoder::releaseMapped): (JSC::encodeCodeBlock): (JSC::encodeFunctionCodeBlock): * runtime/CachedTypes.h: * runtime/CodeCache.cpp: (JSC::serializeBytecode): * runtime/CodeCache.h: * runtime/Completion.cpp: (JSC::generateProgramBytecode): (JSC::generateModuleBytecode): * runtime/Completion.h: Canonical link: https://commits.webkit.org/212521@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246060 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-06-04 11:14:10 +00:00
runtime/BytecodeCacheError.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/CallData.cpp
Add support for incremental bytecode cache updates https://bugs.webkit.org/show_bug.cgi?id=195000 Reviewed by Filip Pizlo. Source/JavaScriptCore: Add support for incremental updates to the bytecode cache. The cache is constructed as follows: - When the cache is empty, the initial payload can be added to the BytecodeCache by calling BytecodeCache::addGlobalUpdate. This represents the encoded top-level UnlinkedCodeBlock. - Afterwards, updates can be added by calling BytecodeCache::addFunctionUpdate. The update is applied by appending the encoded UnlinkedFunctionCodeBlock to the existing cache and updating the CachedFunctionExecutableMetadata and the offset of the new CachedFunctionCodeBlock in the owner CachedFunctionExecutable. * API/JSScript.mm: (-[JSScript readCache]): (-[JSScript isUsingBytecodeCache]): (-[JSScript init]): (-[JSScript cachedBytecode]): (-[JSScript writeCache:]): * API/JSScriptInternal.h: * API/JSScriptSourceProvider.h: * API/JSScriptSourceProvider.mm: (JSScriptSourceProvider::cachedBytecode const): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/UnlinkedFunctionExecutable.cpp: (JSC::generateUnlinkedFunctionCodeBlock): * jsc.cpp: (ShellSourceProvider::~ShellSourceProvider): (ShellSourceProvider::cachePath const): (ShellSourceProvider::loadBytecode const): (ShellSourceProvider::ShellSourceProvider): (ShellSourceProvider::cacheEnabled): * parser/SourceProvider.h: (JSC::SourceProvider::cachedBytecode const): (JSC::SourceProvider::updateCache const): (JSC::SourceProvider::commitCachedBytecode const): * runtime/CachePayload.cpp: Copied from Source/JavaScriptCore/API/JSScriptInternal.h. (JSC::CachePayload::makeMappedPayload): (JSC::CachePayload::makeMallocPayload): (JSC::CachePayload::makeEmptyPayload): (JSC::CachePayload::CachePayload): (JSC::CachePayload::~CachePayload): (JSC::CachePayload::operator=): (JSC::CachePayload::freeData): * runtime/CachePayload.h: Copied from Source/JavaScriptCore/API/JSScriptInternal.h. (JSC::CachePayload::data const): (JSC::CachePayload::size const): (JSC::CachePayload::CachePayload): * runtime/CacheUpdate.cpp: Copied from Source/JavaScriptCore/API/JSScriptInternal.h. (JSC::CacheUpdate::CacheUpdate): (JSC::CacheUpdate::operator=): (JSC::CacheUpdate::isGlobal const): (JSC::CacheUpdate::asGlobal const): (JSC::CacheUpdate::asFunction const): * runtime/CacheUpdate.h: Copied from Source/JavaScriptCore/API/JSScriptInternal.h. * runtime/CachedBytecode.cpp: Added. (JSC::CachedBytecode::addGlobalUpdate): (JSC::CachedBytecode::addFunctionUpdate): (JSC::CachedBytecode::copyLeafExecutables): (JSC::CachedBytecode::commitUpdates const): * runtime/CachedBytecode.h: Added. (JSC::CachedBytecode::create): (JSC::CachedBytecode::leafExecutables): (JSC::CachedBytecode::data const): (JSC::CachedBytecode::size const): (JSC::CachedBytecode::hasUpdates const): (JSC::CachedBytecode::sizeForUpdate const): (JSC::CachedBytecode::CachedBytecode): * runtime/CachedTypes.cpp: (JSC::Encoder::addLeafExecutable): (JSC::Encoder::release): (JSC::Decoder::Decoder): (JSC::Decoder::create): (JSC::Decoder::size const): (JSC::Decoder::offsetOf): (JSC::Decoder::ptrForOffsetFromBase): (JSC::Decoder::addLeafExecutable): (JSC::VariableLengthObject::VariableLengthObject): (JSC::VariableLengthObject::buffer const): (JSC::CachedPtrOffsets::offsetOffset): (JSC::CachedWriteBarrierOffsets::ptrOffset): (JSC::CachedFunctionExecutable::features const): (JSC::CachedFunctionExecutable::hasCapturedVariables const): (JSC::CachedFunctionExecutableOffsets::codeBlockForCallOffset): (JSC::CachedFunctionExecutableOffsets::codeBlockForConstructOffset): (JSC::CachedFunctionExecutableOffsets::metadataOffset): (JSC::CachedFunctionExecutable::encode): (JSC::CachedFunctionExecutable::decode const): (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable): (JSC::encodeCodeBlock): (JSC::encodeFunctionCodeBlock): (JSC::decodeCodeBlockImpl): (JSC::isCachedBytecodeStillValid): * runtime/CachedTypes.h: (JSC::VariableLengthObjectBase::VariableLengthObjectBase): (JSC::decodeCodeBlock): * runtime/CodeCache.cpp: (JSC::CodeCache::getUnlinkedGlobalCodeBlock): (JSC::CodeCache::updateCache): (JSC::CodeCache::write): (JSC::writeCodeBlock): (JSC::serializeBytecode): * runtime/CodeCache.h: (JSC::SourceCodeValue::SourceCodeValue): (JSC::CodeCacheMap::findCacheAndUpdateAge): (JSC::CodeCacheMap::fetchFromDiskImpl): * runtime/Completion.cpp: (JSC::generateProgramBytecode): (JSC::generateModuleBytecode): * runtime/Completion.h: * runtime/LeafExecutable.cpp: Copied from Source/JavaScriptCore/API/JSScriptSourceProvider.mm. (JSC::LeafExecutable::operator+ const): * runtime/LeafExecutable.h: Copied from Source/JavaScriptCore/API/JSScriptSourceProvider.mm. (JSC::LeafExecutable::LeafExecutable): (JSC::LeafExecutable::base const): Tools: Exit when the initial run to generate bytecode fails. * Scripts/jsc-stress-test-helpers/bytecode-cache-test-helper.sh: Canonical link: https://commits.webkit.org/211061@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244143 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-10 19:18:20 +00:00
runtime/CachePayload.cpp
runtime/CacheUpdate.cpp
Replace uses of Box<Identifier> with a new CacheableIdentifier class. https://bugs.webkit.org/show_bug.cgi?id=205544 <rdar://problem/58041800> Reviewed by Saam Barati. JSTests: * stress/racy-gc-cleanup-of-identifier-after-mutator-stops-running.js: Added. Source/JavaScriptCore: The introduction of the use of Box<Identifier> was to get around having to ref/deref the underlying UniqedStringImpl in Identifiers from the compiler and GC threads. However, it proves to be difficult to control when these Box<Identifier>s get destructed, and requires that we find all the places in the compier and GC threads where this can happen, and apply keep alive tactics there to defer destruction of the Box<Identifier> to the mutator thread. This patch fixes this by replacing uses of Box<Identifier> with CacheableIdentifier, which is effectively a tagged union of a JSCell* or a UniquedStringImpl*. The JSCell*, in this case, can be either a Symbol* or a JSString* that is backed by an atom string. The VM runtime ensures that we'll never try to cache an identifier from a JSCell that is not one of these. This CacheableIdentifier can be destructed from the compiler or GC thread. Since it doesn't hold a ref of the underlying UniquedStringImpl, it won't try to deref it on destruction. Instead, we'll need to visit CacheableIdentifiers during GC scans to keep the JSCell in it alive, and that JSCell will, in turn, keep the underlying UniquedStringImpl alive. This patch also does the following: 1. Add a visitAggregate() method to StructureStubInfo, PolymorphicAccess, and AccessCase to visit the CacheableIdentifier's JSCell identifier. This visitAggregate() is called from CodeBlock::stronglyVisitStrongReferences(). When we write barrier a CodeBlock, it guarantees that its visitAggregate() methods is called. However, it does not guarantee that its propagateTransitions() method will be called. Since the CacheableIdentifier's reference to a cell should be a strong reference, visiting it via a StructureStubInfo::visitAggregate() method is the right thing to do. See https://bugs.webkit.org/show_bug.cgi?id=205544#c7 for an example of why propagateTransitions() doesn't always do the job. StructureStubInfo::visitWeakReferences() is also inappropriate for this because it is only called after all marking is done. It is also not meant to keep cells alive but merely for clearing weak references to dead cells. 2. Also add to visitAggregate() for ModuleNamespaceData's m_identifier in GetByStatus::markIfCheap(). 3. Remove previously applied keep alive tactics to work around Box<Identifier> destruction. This also retores the allowance to destruct DFG::Plans on a compiler thread. 4. Added a JSString:getValueImpl() helper. 5. Added a write barrier in DFG and FTL JITFinalizer's finalizeCommon() to ensure that frozen values are scanned by the GC. During compilation, the frozen values were previously protected by the Plan. After finalization, they should be protected by the CodeBlock. Hence, we should barrier the CodeBlock since the last GC scan of the CodeBlock may have happened before the frozen values were registered with the CodeBlock. GC considerations: ================== The following also addresses Yusuke's concerns in https://bugs.webkit.org/show_bug.cgi?id=205544#c10. CacheableIdentifier is only stored as fields in 4 classes/structs: 1. AccessCase::m_identifier 2. GetByIdVariant::m_identifier 3. ModuleNamespaceData::m_identifier 4. StructureStubInfo::m_getByIdSelfIdentifier AccessCase::m_identifier ======================== While the access case is being created and added in tryCacheGetBy(), the CacheableIdentifier is still on the stack and protected from the GC. At the bottom of tryCacheGetBy(), StructureStubInfo::addAccessCase() is called to add the access case. StructureStubInfo::addAccessCase() will barrier the owner CodeBlock at its end, and CodeBlock::stronglyVisitStrongReferences() will visit the StructureStubInfo, which in turn visits the AccessCase. StructureStubInfo::visitAggregate() has been added for this purpose. GetByIdVariant::m_identifier ============================ GetByIdVariant is only stored in GetByStatus. Both GetByIdVariant and GetByStatus are only created and handled in the DFG/FTL compiler threads. While the compiler thread is working with them, they are safe from the GC because the GC won't collect objects until the compiler thread is at a SafePoint. At compiler SafePoints, any GetByStatus that needs to be persisted is stored in DFG::Plan::m_recordedStatuses. The Plan will visit the m_recordedStatuses in Plan::checkLivenessAndVisitChildren(). At the end of compilation, Plan::m_recordedStatuses is transferred over to the owner CodeBlock's DFG::CommonData in Plan::finalizeWithoutNotifyingCallback(). Plan::finalizeWithoutNotifyingCallback() will also barrier the owner CodeBlock at its end. Thereafter, CodeBlock::stronglyVisitStrongReferences() will visit the recordedStatuses. ModuleNamespaceData::m_identifier ================================= ModuleNamespaceData is only stored in a GetByStatus, and is therefore protected similarly as the GetByIdVariant::m_identifier case above. StructureStubInfo::m_getByIdSelfIdentifier ========================================== StructureStubInfo::initGetByIdSelf() is called from inside tryCacheGetBy(). StructureStubInfo::initGetByIdSelf() will barrier the owner CodeBlock. The CacheableIdentifier here is protected in the same way as the AccessCase::m_identifier case above. DesiredIdentifiers ================== The compiler thread may also stash a CacheableIdentifier's uid in its DesiredIdentifiers. Normally, the identifiers stashed in DesiredIdentifiers are from identifiers that the CodeBlock already knows abut and manages (e.g. from GetByIds). For uids from a cell-based CacheableIdentifier variable is passed to a GetByVal, we need kep the cell alive in order to keep the uid alive. This is achieved by freezing the cell with freezeStrong() in the op_get_by_val case in the DFG BytecodeParser. Reseting a StructureStubInfo while its IC code is still executing on the stack ============================================================================== The concern is that IC code may call slow path / getter functions that may in turn: 1. reset the IC, and 2. run the GC. This can be a problem if: 1. there is a scenario where we return from the slow path / getter function and run IC code that uses the cell / uid from the CacheableIdentifier. This is because the StructureStubInfo is what visits the that cell, which in turn its uid alive. Once the StructureStubInfo is reset, it will no longer be associated with any AccessCase or the m_getByIdSelfIdentifier. As such they will not be visited, and the CacheableIdentifier may be collected by the GC. In practice, the generated IC code never uses the cell / uid after it calls any slow path / getter function. I've verified this by auditing the code generation in InlineAccess::generateSelfInAccess() and PolymorphicAccess::regenerate(). Hence, there's no issue with using a collected cell / uid. 2. there is a scenario where a slow path / getter function makes use of the cell / uid from the CacheableIdentifier but does not protect it. The only 2 slow path functions: operationGetByValGeneric() operationGetByValOptimize() operationGetByValGeneric() does not use any CacheableIdentifier from the StructureStubInfo. operationGetByValOptimize() modifies the StructureStubInfo in tryCacheGetBy() under the protection of a GCSafeConcurrentJSLocker, and can reset the StructureStubInfo. However, it does not use any CacheableIdentifier after that. Hence, there's also no GC issue here. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/AccessCase.cpp: (JSC::AccessCase::AccessCase): (JSC::AccessCase::create): (JSC::AccessCase::fromStructureStubInfo): (JSC::AccessCase::commit): (JSC::AccessCase::canReplace const): (JSC::AccessCase::dump const): (JSC::AccessCase::visitAggregate const): (JSC::AccessCase::generateWithGuard): (JSC::AccessCase::generateImpl): * bytecode/AccessCase.h: (JSC::AccessCase::uid const): (JSC::AccessCase::identifier const): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::propagateTransitions): (JSC::CodeBlock::stronglyVisitStrongReferences): * bytecode/GetByIdVariant.cpp: (JSC::GetByIdVariant::GetByIdVariant): (JSC::GetByIdVariant::attemptToMerge): (JSC::GetByIdVariant::visitAggregate): (JSC::GetByIdVariant::dumpInContext const): * bytecode/GetByIdVariant.h: (JSC::GetByIdVariant::identifier const): (JSC::GetByIdVariant::overlaps): * bytecode/GetByStatus.cpp: (JSC::GetByStatus::computeFromLLInt): (JSC::GetByStatus::computeFor): (JSC::GetByStatus::computeForStubInfoWithoutExitSiteFeedback): (JSC::GetByStatus::visitAggregate): (JSC::GetByStatus::singleIdentifier const): * bytecode/GetByStatus.h: * bytecode/GetterSetterAccessCase.cpp: (JSC::GetterSetterAccessCase::GetterSetterAccessCase): (JSC::GetterSetterAccessCase::create): * bytecode/GetterSetterAccessCase.h: * bytecode/InstanceOfAccessCase.cpp: (JSC::InstanceOfAccessCase::InstanceOfAccessCase): * bytecode/IntrinsicGetterAccessCase.cpp: (JSC::IntrinsicGetterAccessCase::IntrinsicGetterAccessCase): (JSC::IntrinsicGetterAccessCase::create): * bytecode/IntrinsicGetterAccessCase.h: * bytecode/ModuleNamespaceAccessCase.cpp: (JSC::ModuleNamespaceAccessCase::ModuleNamespaceAccessCase): (JSC::ModuleNamespaceAccessCase::create): * bytecode/ModuleNamespaceAccessCase.h: * bytecode/PolymorphicAccess.cpp: (JSC::PolymorphicAccess::visitAggregate): (JSC::PolymorphicAccess::regenerate): * bytecode/PolymorphicAccess.h: * bytecode/ProxyableAccessCase.cpp: (JSC::ProxyableAccessCase::ProxyableAccessCase): (JSC::ProxyableAccessCase::create): * bytecode/ProxyableAccessCase.h: * bytecode/RecordedStatuses.cpp: (JSC::RecordedStatuses::visitAggregate): * bytecode/RecordedStatuses.h: * bytecode/StructureStubInfo.cpp: (JSC::StructureStubInfo::initGetByIdSelf): (JSC::StructureStubInfo::addAccessCase): (JSC::StructureStubInfo::visitAggregate): * bytecode/StructureStubInfo.h: (JSC::StructureStubInfo::getByIdSelfIdentifier): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseGetById): (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGDesiredIdentifiers.cpp: (JSC::DFG::DesiredIdentifiers::ensure): (JSC::DFG::DesiredIdentifiers::at const): (JSC::DFG::DesiredIdentifiers::reallyAdd): (JSC::DFG::DesiredIdentifiers::processCodeBlockIdentifiersIfNeeded): Deleted. * dfg/DFGDesiredIdentifiers.h: * dfg/DFGJITFinalizer.cpp: (JSC::DFG::JITFinalizer::finalizeCommon): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::~Plan): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::cancel): * dfg/DFGPlan.h: (JSC::DFG::Plan::keepAliveIdentifier): Deleted. * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::removeAllReadyPlansForVM): (JSC::DFG::Worklist::removeDeadPlans): (JSC::DFG::Worklist::removeNonCompilingPlansForVM): (JSC::DFG::Worklist::deleteCancelledPlansForVM): Deleted. * dfg/DFGWorklist.h: * ftl/FTLJITFinalizer.cpp: (JSC::FTL::JITFinalizer::finalizeCommon): * jit/JITOperations.cpp: * jit/Repatch.cpp: (JSC::tryCacheGetBy): (JSC::repatchGetBy): (JSC::tryCacheArrayGetByVal): (JSC::tryCacheInstanceOf): * jit/Repatch.h: * runtime/CacheableIdentifier.cpp: Added. (JSC::CacheableIdentifier::dump const): * runtime/CacheableIdentifier.h: Added. (JSC::CacheableIdentifier::CacheableIdentifier): (JSC::CacheableIdentifier::isUid const): (JSC::CacheableIdentifier::isCell const): (JSC::CacheableIdentifier::isSymbol const): (JSC::CacheableIdentifier::operator bool const): * runtime/CacheableIdentifierInlines.h: Added. (JSC::CacheableIdentifier::CacheableIdentifier): (JSC::CacheableIdentifier::cell const): (JSC::CacheableIdentifier::uid const): (JSC::CacheableIdentifier::isCacheableIdentifierCell): (JSC::CacheableIdentifier::isSymbolCell const): (JSC::CacheableIdentifier::isStringCell const): (JSC::CacheableIdentifier::setCellBits): (JSC::CacheableIdentifier::setUidBits): (JSC::CacheableIdentifier::visitAggregate const): (JSC::CacheableIdentifier::operator== const): (JSC::CacheableIdentifier::operator!= const): * runtime/ExceptionHelpers.cpp: (JSC::functionCallBase): * runtime/JSString.h: (JSC::JSString::getValueImpl const): * runtime/VM.cpp: (JSC::VM::ensureWatchpointSetForImpureProperty): (JSC::VM::addImpureProperty): (JSC::VM::registerWatchpointForImpureProperty): Deleted. * runtime/VM.h: Source/WebCore: * bindings/js/CommonVM.cpp: (WebCore::addImpureProperty): Canonical link: https://commits.webkit.org/219286@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254464 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-13 23:55:57 +00:00
runtime/CacheableIdentifier.cpp
Add support for incremental bytecode cache updates https://bugs.webkit.org/show_bug.cgi?id=195000 Reviewed by Filip Pizlo. Source/JavaScriptCore: Add support for incremental updates to the bytecode cache. The cache is constructed as follows: - When the cache is empty, the initial payload can be added to the BytecodeCache by calling BytecodeCache::addGlobalUpdate. This represents the encoded top-level UnlinkedCodeBlock. - Afterwards, updates can be added by calling BytecodeCache::addFunctionUpdate. The update is applied by appending the encoded UnlinkedFunctionCodeBlock to the existing cache and updating the CachedFunctionExecutableMetadata and the offset of the new CachedFunctionCodeBlock in the owner CachedFunctionExecutable. * API/JSScript.mm: (-[JSScript readCache]): (-[JSScript isUsingBytecodeCache]): (-[JSScript init]): (-[JSScript cachedBytecode]): (-[JSScript writeCache:]): * API/JSScriptInternal.h: * API/JSScriptSourceProvider.h: * API/JSScriptSourceProvider.mm: (JSScriptSourceProvider::cachedBytecode const): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/UnlinkedFunctionExecutable.cpp: (JSC::generateUnlinkedFunctionCodeBlock): * jsc.cpp: (ShellSourceProvider::~ShellSourceProvider): (ShellSourceProvider::cachePath const): (ShellSourceProvider::loadBytecode const): (ShellSourceProvider::ShellSourceProvider): (ShellSourceProvider::cacheEnabled): * parser/SourceProvider.h: (JSC::SourceProvider::cachedBytecode const): (JSC::SourceProvider::updateCache const): (JSC::SourceProvider::commitCachedBytecode const): * runtime/CachePayload.cpp: Copied from Source/JavaScriptCore/API/JSScriptInternal.h. (JSC::CachePayload::makeMappedPayload): (JSC::CachePayload::makeMallocPayload): (JSC::CachePayload::makeEmptyPayload): (JSC::CachePayload::CachePayload): (JSC::CachePayload::~CachePayload): (JSC::CachePayload::operator=): (JSC::CachePayload::freeData): * runtime/CachePayload.h: Copied from Source/JavaScriptCore/API/JSScriptInternal.h. (JSC::CachePayload::data const): (JSC::CachePayload::size const): (JSC::CachePayload::CachePayload): * runtime/CacheUpdate.cpp: Copied from Source/JavaScriptCore/API/JSScriptInternal.h. (JSC::CacheUpdate::CacheUpdate): (JSC::CacheUpdate::operator=): (JSC::CacheUpdate::isGlobal const): (JSC::CacheUpdate::asGlobal const): (JSC::CacheUpdate::asFunction const): * runtime/CacheUpdate.h: Copied from Source/JavaScriptCore/API/JSScriptInternal.h. * runtime/CachedBytecode.cpp: Added. (JSC::CachedBytecode::addGlobalUpdate): (JSC::CachedBytecode::addFunctionUpdate): (JSC::CachedBytecode::copyLeafExecutables): (JSC::CachedBytecode::commitUpdates const): * runtime/CachedBytecode.h: Added. (JSC::CachedBytecode::create): (JSC::CachedBytecode::leafExecutables): (JSC::CachedBytecode::data const): (JSC::CachedBytecode::size const): (JSC::CachedBytecode::hasUpdates const): (JSC::CachedBytecode::sizeForUpdate const): (JSC::CachedBytecode::CachedBytecode): * runtime/CachedTypes.cpp: (JSC::Encoder::addLeafExecutable): (JSC::Encoder::release): (JSC::Decoder::Decoder): (JSC::Decoder::create): (JSC::Decoder::size const): (JSC::Decoder::offsetOf): (JSC::Decoder::ptrForOffsetFromBase): (JSC::Decoder::addLeafExecutable): (JSC::VariableLengthObject::VariableLengthObject): (JSC::VariableLengthObject::buffer const): (JSC::CachedPtrOffsets::offsetOffset): (JSC::CachedWriteBarrierOffsets::ptrOffset): (JSC::CachedFunctionExecutable::features const): (JSC::CachedFunctionExecutable::hasCapturedVariables const): (JSC::CachedFunctionExecutableOffsets::codeBlockForCallOffset): (JSC::CachedFunctionExecutableOffsets::codeBlockForConstructOffset): (JSC::CachedFunctionExecutableOffsets::metadataOffset): (JSC::CachedFunctionExecutable::encode): (JSC::CachedFunctionExecutable::decode const): (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable): (JSC::encodeCodeBlock): (JSC::encodeFunctionCodeBlock): (JSC::decodeCodeBlockImpl): (JSC::isCachedBytecodeStillValid): * runtime/CachedTypes.h: (JSC::VariableLengthObjectBase::VariableLengthObjectBase): (JSC::decodeCodeBlock): * runtime/CodeCache.cpp: (JSC::CodeCache::getUnlinkedGlobalCodeBlock): (JSC::CodeCache::updateCache): (JSC::CodeCache::write): (JSC::writeCodeBlock): (JSC::serializeBytecode): * runtime/CodeCache.h: (JSC::SourceCodeValue::SourceCodeValue): (JSC::CodeCacheMap::findCacheAndUpdateAge): (JSC::CodeCacheMap::fetchFromDiskImpl): * runtime/Completion.cpp: (JSC::generateProgramBytecode): (JSC::generateModuleBytecode): * runtime/Completion.h: * runtime/LeafExecutable.cpp: Copied from Source/JavaScriptCore/API/JSScriptSourceProvider.mm. (JSC::LeafExecutable::operator+ const): * runtime/LeafExecutable.h: Copied from Source/JavaScriptCore/API/JSScriptSourceProvider.mm. (JSC::LeafExecutable::LeafExecutable): (JSC::LeafExecutable::base const): Tools: Exit when the initial run to generate bytecode fails. * Scripts/jsc-stress-test-helpers/bytecode-cache-test-helper.sh: Canonical link: https://commits.webkit.org/211061@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244143 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-10 19:18:20 +00:00
runtime/CachedBytecode.cpp
[JSC] Cache toString / valueOf / @@toPrimitive for major cases https://bugs.webkit.org/show_bug.cgi?id=216061 Reviewed by Saam Barati. JSTests: * stress/delete-cached-to-primitive-property.js: Added. (shouldBe): (object.__proto__.Symbol.toPrimitive): * stress/delete-cached-to-string-property.js: Added. (shouldBe): (object.__proto__.toString): * stress/delete-cached-value-of-property.js: Added. (shouldBe): (shouldThrow): (object.__proto__.valueOf): * stress/hide-cached-to-primitive-property.js: Added. (shouldBe): (object.__proto__.Symbol.toPrimitive): * stress/hide-cached-to-string-property.js: Added. (shouldBe): (object.__proto__.toString): * stress/hide-cached-value-of-property.js: Added. (shouldBe): (object.__proto__.valueOf): * stress/replace-cached-to-primitive-property.js: Added. (shouldBe): (object.__proto__.Symbol.toPrimitive): * stress/replace-cached-to-string-property.js: Added. (shouldBe): (object.__proto__.toString): * stress/replace-cached-value-of-property.js: Added. (shouldBe): (object.__proto__.valueOf): Source/JavaScriptCore: When toPrimitive is called, we need to look-up three properties at most to perform operation. And these special properties do not have caching mechanism at all. We found that Speedometer2/EmberJS-Debug-TodoMVC is using very much time for this property look-up. We should have caching mechanism in StructureRareData, which should be similar to @@toStringTag & Object#toString caching mechanism. This patch generalizes @@toStringTag & Object#toString caching mechanism as SpecialPropertyCache. And we accelerate toString / valueOf / @@toPrimitive look-ups in toPrimitive with this caching mechanism. This patch improved Speedometer2/EmberJS-Debug-TodoMVC by 10%. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/Watchpoint.cpp: * bytecode/Watchpoint.h: * runtime/CachedSpecialPropertyAdaptiveStructureWatchpoint.cpp: Renamed from Source/JavaScriptCore/runtime/ObjectToStringAdaptiveStructureWatchpoint.cpp. (JSC::CachedSpecialPropertyAdaptiveStructureWatchpoint::CachedSpecialPropertyAdaptiveStructureWatchpoint): (JSC::CachedSpecialPropertyAdaptiveStructureWatchpoint::install): (JSC::CachedSpecialPropertyAdaptiveStructureWatchpoint::fireInternal): * runtime/CachedSpecialPropertyAdaptiveStructureWatchpoint.h: Renamed from Source/JavaScriptCore/runtime/ObjectToStringAdaptiveStructureWatchpoint.h. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::objectProtoToStringFunction const): * runtime/JSObject.cpp: (JSC::callToPrimitiveFunction): (JSC::JSObject::ordinaryToPrimitive const): (JSC::JSObject::toPrimitive const): * runtime/ObjectPrototype.cpp: (JSC::ObjectPrototype::finishCreation): (JSC::objectProtoFuncToString): * runtime/Structure.h: * runtime/StructureInlines.h: (JSC::Structure::cacheSpecialProperty): (JSC::Structure::setObjectToStringValue): Deleted. * runtime/StructureRareData.cpp: (JSC::StructureRareData::visitChildren): (JSC::StructureRareData::ensureSpecialPropertyCacheSlow): (JSC::StructureRareData::giveUpOnSpecialPropertyCache): (JSC::StructureRareData::cacheSpecialPropertySlow): (JSC::StructureRareData::clearCachedSpecialProperty): (JSC::StructureRareData::finalizeUnconditionally): (JSC::CachedSpecialPropertyAdaptiveInferredPropertyValueWatchpoint::CachedSpecialPropertyAdaptiveInferredPropertyValueWatchpoint): (JSC::CachedSpecialPropertyAdaptiveInferredPropertyValueWatchpoint::isValid const): (JSC::CachedSpecialPropertyAdaptiveInferredPropertyValueWatchpoint::handleFire): (JSC::StructureRareData::setObjectToStringValue): Deleted. (JSC::StructureRareData::clearObjectToStringValue): Deleted. (JSC::ObjectToStringAdaptiveInferredPropertyValueWatchpoint::ObjectToStringAdaptiveInferredPropertyValueWatchpoint): Deleted. (JSC::ObjectToStringAdaptiveInferredPropertyValueWatchpoint::isValid const): Deleted. (JSC::ObjectToStringAdaptiveInferredPropertyValueWatchpoint::handleFire): Deleted. * runtime/StructureRareData.h: * runtime/StructureRareDataInlines.h: (JSC::StructureRareData::cachedSpecialProperty const): (JSC::StructureRareData::canCacheSpecialProperty): (JSC::StructureRareData::ensureSpecialPropertyCache): (JSC::StructureRareData::cacheSpecialProperty): (JSC::StructureRareData::objectToStringValue const): Deleted. Canonical link: https://commits.webkit.org/228956@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266567 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-04 01:03:33 +00:00
runtime/CachedSpecialPropertyAdaptiveStructureWatchpoint.cpp
Cache bytecode to disk https://bugs.webkit.org/show_bug.cgi?id=192782 <rdar://problem/46084932> Reviewed by Keith Miller. Source/JavaScriptCore: Add the logic to serialize and deserialize the new JSC bytecode. For now, the cache is only used for tests. Each class that can be serialized has a counterpart in CachedTypes, which handles the decoding and encoding. When decoding, the cached objects are mmap'd from disk, but only used for creating instances of the respective in-memory version of each object. Ideally, the mmap'd objects should be used at runtime in the future. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/BuiltinNames.cpp: (JSC::BuiltinNames::BuiltinNames): * builtins/BuiltinNames.h: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::setConstantIdentifierSetRegisters): * bytecode/CodeBlock.h: * bytecode/HandlerInfo.h: (JSC::UnlinkedHandlerInfo::UnlinkedHandlerInfo): * bytecode/InstructionStream.h: * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::addSetConstant): (JSC::UnlinkedCodeBlock::constantIdentifierSets): * bytecode/UnlinkedEvalCodeBlock.h: * bytecode/UnlinkedFunctionCodeBlock.h: * bytecode/UnlinkedFunctionExecutable.h: * bytecode/UnlinkedGlobalCodeBlock.h: (JSC::UnlinkedGlobalCodeBlock::UnlinkedGlobalCodeBlock): * bytecode/UnlinkedMetadataTable.h: * bytecode/UnlinkedModuleProgramCodeBlock.h: * bytecode/UnlinkedProgramCodeBlock.h: * interpreter/Interpreter.cpp: * jsc.cpp: (functionQuit): (runJSC): * parser/SourceCode.h: * parser/SourceCodeKey.h: (JSC::SourceCodeKey::operator!= const): * parser/UnlinkedSourceCode.h: * parser/VariableEnvironment.h: * runtime/CachedTypes.cpp: Added. (JSC::Encoder::Allocation::buffer const): (JSC::Encoder::Allocation::offset const): (JSC::Encoder::Allocation::Allocation): (JSC::Encoder::Encoder): (JSC::Encoder::vm): (JSC::Encoder::malloc): (JSC::Encoder::offsetOf): (JSC::Encoder::cachePtr): (JSC::Encoder::offsetForPtr): (JSC::Encoder::release): (JSC::Encoder::Page::Page): (JSC::Encoder::Page::malloc): (JSC::Encoder::Page::buffer const): (JSC::Encoder::Page::size const): (JSC::Encoder::Page::getOffset const): (JSC::Encoder::allocateNewPage): (JSC::Decoder::Decoder): (JSC::Decoder::~Decoder): (JSC::Decoder::vm): (JSC::Decoder::offsetOf): (JSC::Decoder::cacheOffset): (JSC::Decoder::addFinalizer): (JSC::encode): (JSC::decode): (JSC::VariableLengthObject::buffer const): (JSC::VariableLengthObject::allocate): (JSC::CachedPtr::encode): (JSC::CachedPtr::decode const): (JSC::CachedPtr::operator-> const): (JSC::CachedPtr::get const): (JSC::CachedRefPtr::encode): (JSC::CachedRefPtr::decode const): (JSC::CachedWriteBarrier::encode): (JSC::CachedWriteBarrier::decode const): (JSC::CachedVector::encode): (JSC::CachedVector::decode const): (JSC::CachedPair::encode): (JSC::CachedPair::decode const): (JSC::CachedHashMap::encode): (JSC::CachedHashMap::decode const): (JSC::CachedUniquedStringImpl::encode): (JSC::CachedUniquedStringImpl::decode const): (JSC::CachedStringImpl::encode): (JSC::CachedStringImpl::decode const): (JSC::CachedString::encode): (JSC::CachedString::decode const): (JSC::CachedIdentifier::encode): (JSC::CachedIdentifier::decode const): (JSC::CachedOptional::encode): (JSC::CachedOptional::decode const): (JSC::CachedOptional::decodeAsPtr const): (JSC::CachedSimpleJumpTable::encode): (JSC::CachedSimpleJumpTable::decode const): (JSC::CachedStringJumpTable::encode): (JSC::CachedStringJumpTable::decode const): (JSC::CachedCodeBlockRareData::encode): (JSC::CachedCodeBlockRareData::decode const): (JSC::CachedBitVector::encode): (JSC::CachedBitVector::decode const): (JSC::CachedHashSet::encode): (JSC::CachedHashSet::decode const): (JSC::CachedConstantIdentifierSetEntry::encode): (JSC::CachedConstantIdentifierSetEntry::decode const): (JSC::CachedVariableEnvironment::encode): (JSC::CachedVariableEnvironment::decode const): (JSC::CachedArray::encode): (JSC::CachedArray::decode const): (JSC::CachedScopedArgumentsTable::encode): (JSC::CachedScopedArgumentsTable::decode const): (JSC::CachedSymbolTableEntry::encode): (JSC::CachedSymbolTableEntry::decode const): (JSC::CachedSymbolTable::encode): (JSC::CachedSymbolTable::decode const): (JSC::CachedImmutableButterfly::encode): (JSC::CachedImmutableButterfly::decode const): (JSC::CachedRegExp::encode): (JSC::CachedRegExp::decode const): (JSC::CachedTemplateObjectDescriptor::encode): (JSC::CachedTemplateObjectDescriptor::decode const): (JSC::CachedBigInt::encode): (JSC::CachedBigInt::decode const): (JSC::CachedJSValue::encode): (JSC::CachedJSValue::decode const): (JSC::CachedInstructionStream::encode): (JSC::CachedInstructionStream::decode const): (JSC::CachedMetadataTable::encode): (JSC::CachedMetadataTable::decode const): (JSC::CachedSourceOrigin::encode): (JSC::CachedSourceOrigin::decode const): (JSC::CachedTextPosition::encode): (JSC::CachedTextPosition::decode const): (JSC::CachedSourceProviderShape::encode): (JSC::CachedSourceProviderShape::decode const): (JSC::CachedStringSourceProvider::encode): (JSC::CachedStringSourceProvider::decode const): (JSC::CachedWebAssemblySourceProvider::encode): (JSC::CachedWebAssemblySourceProvider::decode const): (JSC::CachedSourceProvider::encode): (JSC::CachedSourceProvider::decode const): (JSC::CachedUnlinkedSourceCodeShape::encode): (JSC::CachedUnlinkedSourceCodeShape::decode const): (JSC::CachedSourceCode::encode): (JSC::CachedSourceCode::decode const): (JSC::CachedFunctionExecutable::firstLineOffset const): (JSC::CachedFunctionExecutable::lineCount const): (JSC::CachedFunctionExecutable::unlinkedFunctionNameStart const): (JSC::CachedFunctionExecutable::unlinkedBodyStartColumn const): (JSC::CachedFunctionExecutable::unlinkedBodyEndColumn const): (JSC::CachedFunctionExecutable::startOffset const): (JSC::CachedFunctionExecutable::sourceLength const): (JSC::CachedFunctionExecutable::parametersStartOffset const): (JSC::CachedFunctionExecutable::typeProfilingStartOffset const): (JSC::CachedFunctionExecutable::typeProfilingEndOffset const): (JSC::CachedFunctionExecutable::parameterCount const): (JSC::CachedFunctionExecutable::features const): (JSC::CachedFunctionExecutable::sourceParseMode const): (JSC::CachedFunctionExecutable::isInStrictContext const): (JSC::CachedFunctionExecutable::hasCapturedVariables const): (JSC::CachedFunctionExecutable::isBuiltinFunction const): (JSC::CachedFunctionExecutable::isBuiltinDefaultClassConstructor const): (JSC::CachedFunctionExecutable::constructAbility const): (JSC::CachedFunctionExecutable::constructorKind const): (JSC::CachedFunctionExecutable::functionMode const): (JSC::CachedFunctionExecutable::scriptMode const): (JSC::CachedFunctionExecutable::superBinding const): (JSC::CachedFunctionExecutable::derivedContextType const): (JSC::CachedFunctionExecutable::name const): (JSC::CachedFunctionExecutable::ecmaName const): (JSC::CachedFunctionExecutable::inferredName const): (JSC::CachedCodeBlock::instructions const): (JSC::CachedCodeBlock::thisRegister const): (JSC::CachedCodeBlock::scopeRegister const): (JSC::CachedCodeBlock::globalObjectRegister const): (JSC::CachedCodeBlock::sourceURLDirective const): (JSC::CachedCodeBlock::sourceMappingURLDirective const): (JSC::CachedCodeBlock::usesEval const): (JSC::CachedCodeBlock::isStrictMode const): (JSC::CachedCodeBlock::isConstructor const): (JSC::CachedCodeBlock::hasCapturedVariables const): (JSC::CachedCodeBlock::isBuiltinFunction const): (JSC::CachedCodeBlock::superBinding const): (JSC::CachedCodeBlock::scriptMode const): (JSC::CachedCodeBlock::isArrowFunctionContext const): (JSC::CachedCodeBlock::isClassContext const): (JSC::CachedCodeBlock::wasCompiledWithDebuggingOpcodes const): (JSC::CachedCodeBlock::constructorKind const): (JSC::CachedCodeBlock::derivedContextType const): (JSC::CachedCodeBlock::evalContextType const): (JSC::CachedCodeBlock::hasTailCalls const): (JSC::CachedCodeBlock::lineCount const): (JSC::CachedCodeBlock::endColumn const): (JSC::CachedCodeBlock::numVars const): (JSC::CachedCodeBlock::numCalleeLocals const): (JSC::CachedCodeBlock::numParameters const): (JSC::CachedCodeBlock::features const): (JSC::CachedCodeBlock::parseMode const): (JSC::CachedCodeBlock::codeType const): (JSC::CachedCodeBlock::rareData const): (JSC::CachedProgramCodeBlock::encode): (JSC::CachedProgramCodeBlock::decode const): (JSC::CachedModuleCodeBlock::encode): (JSC::CachedModuleCodeBlock::decode const): (JSC::CachedEvalCodeBlock::encode): (JSC::CachedEvalCodeBlock::decode const): (JSC::CachedFunctionCodeBlock::encode): (JSC::CachedFunctionCodeBlock::decode const): (JSC::UnlinkedFunctionCodeBlock::UnlinkedFunctionCodeBlock): (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): (JSC::CachedCodeBlock<CodeBlockType>::decode const): (JSC::UnlinkedProgramCodeBlock::UnlinkedProgramCodeBlock): (JSC::UnlinkedModuleProgramCodeBlock::UnlinkedModuleProgramCodeBlock): (JSC::UnlinkedEvalCodeBlock::UnlinkedEvalCodeBlock): (JSC::CachedFunctionExecutable::encode): (JSC::CachedFunctionExecutable::decode const): (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable): (JSC::CachedCodeBlock<CodeBlockType>::encode): (JSC::CachedSourceCodeKey::encode): (JSC::CachedSourceCodeKey::decode const): (JSC::CacheEntry::encode): (JSC::CacheEntry:: const): (JSC:: const): (JSC::encodeCodeBlock): (JSC::decodeCodeBlockImpl): * runtime/CachedTypes.h: Copied from Source/JavaScriptCore/bytecode/UnlinkedGlobalCodeBlock.h. (JSC::decodeCodeBlock): * runtime/CodeCache.cpp: (JSC::CodeCacheMap::pruneSlowCase): (JSC::CodeCache::getUnlinkedGlobalCodeBlock): (JSC::CodeCache::getUnlinkedGlobalFunctionExecutable): (JSC::CodeCache::write): * runtime/CodeCache.h: (JSC::CodeCacheMap::begin): (JSC::CodeCacheMap::end): (JSC::CodeCacheMap::fetchFromDiskImpl): (JSC::CodeCacheMap::findCacheAndUpdateAge): (JSC::writeCodeBlock): * runtime/JSBigInt.cpp: * runtime/JSBigInt.h: * runtime/Options.cpp: (JSC::recomputeDependentOptions): * runtime/RegExp.h: * runtime/ScopedArgumentsTable.h: * runtime/StackFrame.h: * runtime/StructureInlines.h: * runtime/SymbolTable.h: Source/WTF: BitVectors have to be friends with JSC::CacheBitVector to allow serializing its buffer as part of the bytecode cache encoding. * wtf/BitVector.h: Tools: Add test helper to execute bytecode-cache tests: it executes each test twice, the first with JSC_diskCachePath set to a temporary directory and second with JSC_forceDiskCache=true (in addition to the cache path) to guarantee that only the disk cache is being used and no new UnlinkedCodeBlocks are being created. * Scripts/jsc-stress-test-helpers/bytecode-cache-test-helper.sh: Added. * Scripts/run-jsc-stress-tests: Canonical link: https://commits.webkit.org/208177@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240255 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-22 18:00:14 +00:00
runtime/CachedTypes.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/CatchScope.cpp
runtime/ClassInfo.cpp
runtime/ClonedArguments.cpp
runtime/CodeCache.cpp
runtime/CodeSpecializationKind.cpp
runtime/CommonIdentifiers.cpp
runtime/CommonSlowPaths.cpp
runtime/CompilationResult.cpp
runtime/Completion.cpp
runtime/ConfigFile.cpp
runtime/ConsoleClient.cpp
runtime/ConsoleObject.cpp
runtime/ConstantMode.cpp
runtime/ConstructData.cpp
runtime/ControlFlowProfiler.cpp
runtime/CustomGetterSetter.cpp
runtime/DOMAttributeGetterSetter.cpp
runtime/DataView.cpp
runtime/DateConstructor.cpp
runtime/DateConversion.cpp
runtime/DateInstance.cpp
runtime/DatePrototype.cpp
runtime/DirectArguments.cpp
runtime/DirectArgumentsOffset.cpp
runtime/DirectEvalExecutable.cpp
runtime/DoublePredictionFuzzerAgent.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/DumpContext.cpp
Not using strict mode within ClassDeclaration statement https://bugs.webkit.org/show_bug.cgi?id=205578 <rdar://problem/58194589> Reviewed by Yusuke Suzuki. JSTests: * stress/inline-strict-delete.js: Added. (assert): (bar): (foo): * stress/superclass-expression-strictness.js: Added. (f.try.c): (f): Source/JavaScriptCore: We correctly set strict mode when parsing classes, but we did not set it when emitting bytecode. However, that means that we can now have a subset of a code block's bytecode that must be run in strict mode, even when the code block itself is not strict. As it turns out, there are only ten opcodes that need to be aware of strictness, so an extra `mode` operand was added to these opcodes. The mode then needs to be propagated through baseline, DFG and FTL. * API/APICallbackFunction.h: (JSC::APICallbackFunction::call): * API/JSCallbackObjectFunctions.h: (JSC::JSCallbackObject<Parent>::call): * API/JSContextRef.cpp: (JSContextGetGlobalObject): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/BytecodeDumper.cpp: * bytecode/BytecodeGeneratorification.cpp: (JSC::BytecodeGeneratorification::run): * bytecode/BytecodeList.rb: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpAssumingJITType const): (JSC::CodeBlock::finishCreation): * bytecode/CodeBlock.h: (JSC::CodeBlock::isConstructor const): (JSC::CodeBlock::isKnownCell): * bytecode/ExecutableInfo.h: (JSC::ExecutableInfo::ExecutableInfo): (JSC::ExecutableInfo::usesEval const): * bytecode/Fits.h: * bytecode/InlineCallFrame.cpp: (JSC::InlineCallFrame::dumpInContext const): * bytecode/InlineCallFrame.h: (JSC::InlineCallFrame::isInStrictContext const): * bytecode/PutByIdFlags.cpp: (WTF::printInternal): * bytecode/PutByIdFlags.h: (JSC::PutByIdFlags::create): (JSC::PutByIdFlags::createDirect): (JSC::PutByIdFlags::isDirect const): (JSC::PutByIdFlags::ecmaMode const): (JSC::PutByIdFlags::PutByIdFlags): * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::computeFromLLInt): * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::isConstructor const): * bytecode/UnlinkedCodeBlockGenerator.h: (JSC::UnlinkedCodeBlockGenerator::needsClassFieldInitializer const): * bytecode/UnlinkedFunctionExecutable.cpp: (JSC::generateUnlinkedFunctionCodeBlock): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitGetFromScope): (JSC::BytecodeGenerator::emitPutToScope): (JSC::BytecodeGenerator::emitPutById): (JSC::BytecodeGenerator::emitDirectPutById): (JSC::BytecodeGenerator::emitDeleteById): (JSC::BytecodeGenerator::emitPutByVal): (JSC::BytecodeGenerator::emitDirectPutByVal): (JSC::BytecodeGenerator::emitDeleteByVal): (JSC::BytecodeGenerator::emitCall): (JSC::BytecodeGenerator::emitPushFunctionNameScope): (JSC::BytecodeGenerator::emitReadOnlyExceptionIfNeeded): (JSC::BytecodeGenerator::emitToThis): * bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::ecmaMode const): (JSC::StrictModeScope::StrictModeScope): * bytecompiler/NodesCodegen.cpp: (JSC::AssignResolveNode::emitBytecode): (JSC::EmptyLetExpression::emitBytecode): (JSC::ForInNode::emitLoopHeader): (JSC::ForOfNode::emitBytecode): (JSC::ClassExprNode::emitBytecode): (JSC::BindingNode::bindValue const): (JSC::AssignmentElementNode::bindValue const): * debugger/DebuggerCallFrame.cpp: (JSC::DebuggerCallFrame::thisValue const): (JSC::DebuggerCallFrame::evaluateWithScopeExtension): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::isToThisAnIdentity): (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::addCall): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::handleDOMJITCall): (JSC::DFG::ByteCodeParser::handleDeleteById): (JSC::DFG::ByteCodeParser::emitPutById): (JSC::DFG::ByteCodeParser::handlePutById): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::handlePutByVal): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupToThis): * dfg/DFGGraph.h: (JSC::DFG::Graph::globalThisObjectFor): * dfg/DFGNode.h: (JSC::DFG::Node::hasECMAMode): (JSC::DFG::Node::ecmaMode): * dfg/DFGOpInfo.h: (JSC::DFG::OpInfo::OpInfo): * dfg/DFGOperations.cpp: * dfg/DFGPreciseLocalClobberize.h: (JSC::DFG::PreciseLocalClobberizeAdaptor::readTop): * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileDoublePutByVal): (JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray): (JSC::DFG::SpeculativeJIT::compilePutByValForCellWithString): (JSC::DFG::SpeculativeJIT::compilePutByValForCellWithSymbol): (JSC::DFG::SpeculativeJIT::compilePutDynamicVar): (JSC::DFG::SpeculativeJIT::compilePutByIdFlush): (JSC::DFG::SpeculativeJIT::compilePutById): (JSC::DFG::SpeculativeJIT::compilePutByIdDirect): (JSC::DFG::SpeculativeJIT::compilePutByIdWithThis): (JSC::DFG::SpeculativeJIT::compileToThis): (JSC::DFG::SpeculativeJIT::cachedPutById): * dfg/DFGSpeculativeJIT.h: * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::emitCall): (JSC::DFG::SpeculativeJIT::compile): (JSC::DFG::SpeculativeJIT::compileDeleteById): (JSC::DFG::SpeculativeJIT::compileDeleteByVal): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileToThis): (JSC::FTL::DFG::LowerDFGToB3::compilePutByIdWithThis): (JSC::FTL::DFG::LowerDFGToB3::compilePutByValWithThis): (JSC::FTL::DFG::LowerDFGToB3::compilePutById): (JSC::FTL::DFG::LowerDFGToB3::compilePutByVal): (JSC::FTL::DFG::LowerDFGToB3::compileDelBy): (JSC::FTL::DFG::LowerDFGToB3::compileDeleteById): (JSC::FTL::DFG::LowerDFGToB3::compileDeleteByVal): (JSC::FTL::DFG::LowerDFGToB3::compileCallEval): (JSC::FTL::DFG::LowerDFGToB3::compilePutDynamicVar): * inspector/JSInjectedScriptHost.cpp: (Inspector::JSInjectedScriptHost::internalConstructorName): * interpreter/Interpreter.cpp: (JSC::eval): (JSC::Interpreter::execute): * interpreter/Interpreter.h: * jit/AssemblyHelpers.h: * jit/JITCall.cpp: (JSC::JIT::compileCallEval): * jit/JITInlineCacheGenerator.cpp: (JSC::JITPutByIdGenerator::slowPathFunction): * jit/JITInlineCacheGenerator.h: (JSC::JITPutByIdGenerator::JITPutByIdGenerator): * jit/JITInlines.h: (JSC::JIT::linkSlowCaseIfNotJSCell): (JSC::JIT::emitJumpSlowCaseIfNotJSCell): * jit/JITOperations.cpp: * jit/JITOperations.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::emitPutByValWithCachedId): (JSC::JIT::emitSlow_op_put_by_val): (JSC::JIT::emitSlow_op_del_by_id): (JSC::JIT::emitSlow_op_del_by_val): (JSC::JIT::emit_op_put_by_id): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emitSlow_op_put_by_val): * jit/Repatch.cpp: (JSC::tryCacheDeleteBy): (JSC::repatchDeleteBy): * jit/Repatch.h: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::commonCallEval): * runtime/ArrayPrototype.cpp: (JSC::arrayProtoFuncToString): (JSC::arrayProtoFuncToLocaleString): (JSC::arrayProtoFuncJoin): (JSC::arrayProtoFuncPop): (JSC::arrayProtoFuncPush): (JSC::arrayProtoFuncReverse): (JSC::arrayProtoFuncShift): (JSC::arrayProtoFuncSlice): (JSC::arrayProtoFuncSplice): (JSC::arrayProtoFuncUnShift): (JSC::arrayProtoFuncIndexOf): (JSC::arrayProtoFuncLastIndexOf): * runtime/CachedTypes.cpp: (JSC::CachedCodeBlock::usesEval const): (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): (JSC::CachedCodeBlock<CodeBlockType>::encode): * runtime/ClonedArguments.cpp: (JSC::ClonedArguments::getOwnPropertySlot): (JSC::ClonedArguments::materializeSpecials): * runtime/CodeCache.cpp: (JSC::generateUnlinkedCodeBlockImpl): * runtime/CommonSlowPaths.cpp: (JSC::SLOW_PATH_DECL): * runtime/CommonSlowPathsInlines.h: (JSC::CommonSlowPaths::tryCachePutToScopeGlobal): (JSC::CommonSlowPaths::tryCacheGetFromScopeGlobal): * runtime/Completion.cpp: (JSC::evaluate): * runtime/DirectEvalExecutable.cpp: (JSC::DirectEvalExecutable::create): * runtime/DirectEvalExecutable.h: * runtime/ECMAMode.cpp: Copied from Source/JavaScriptCore/bytecode/PutByIdFlags.cpp. (JSC::ECMAMode::dump const): * runtime/ECMAMode.h: Copied from Source/JavaScriptCore/bytecode/PutByIdFlags.h. (JSC::ECMAMode::fromByte): (JSC::ECMAMode::strict): (JSC::ECMAMode::sloppy): (JSC::ECMAMode::isStrict const): (JSC::ECMAMode::value const): (JSC::ECMAMode::ECMAMode): * runtime/EvalExecutable.h: (JSC::EvalExecutable::executableInfo const): * runtime/FunctionExecutable.h: * runtime/GetPutInfo.cpp: (JSC::GetPutInfo::dump const): * runtime/GetPutInfo.h: (JSC::GetPutInfo::GetPutInfo): (JSC::GetPutInfo::ecmaMode const): * runtime/GetterSetter.cpp: (JSC::callSetter): * runtime/IndirectEvalExecutable.cpp: (JSC::IndirectEvalExecutable::create): (JSC::IndirectEvalExecutable::IndirectEvalExecutable): * runtime/IndirectEvalExecutable.h: * runtime/JSCJSValue.cpp: (JSC::JSValue::toThisSlowCase const): (JSC::JSValue::putToPrimitive): * runtime/JSCJSValue.h: * runtime/JSCell.cpp: (JSC::JSCell::toThis): * runtime/JSFunction.cpp: (JSC::JSFunction::selectStructureForNewFuncExp): (JSC::JSFunction::callerGetter): * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncEval): (JSC::globalFuncProtoGetter): (JSC::globalFuncProtoSetter): * runtime/JSObject.cpp: (JSC::JSObject::putInlineSlow): (JSC::JSObject::setPrototypeWithCycleCheck): * runtime/JSScope.cpp: (JSC::JSScope::toThis): * runtime/JSString.cpp: (JSC::JSString::toThis): * runtime/LiteralParser.cpp: (JSC::LiteralParser<CharType>::parse): * runtime/ModuleProgramExecutable.h: * runtime/NullSetterFunction.cpp: (JSC::GetCallerStrictnessFunctor::operator() const): (JSC::NullSetterFunctionInternal::callReturnUndefined): * runtime/ObjectPrototype.cpp: (JSC::objectProtoFuncValueOf): (JSC::objectProtoFuncHasOwnProperty): (JSC::objectProtoFuncIsPrototypeOf): (JSC::objectProtoFuncDefineGetter): (JSC::objectProtoFuncDefineSetter): (JSC::objectProtoFuncLookupGetter): (JSC::objectProtoFuncLookupSetter): (JSC::objectProtoFuncPropertyIsEnumerable): (JSC::objectProtoFuncToLocaleString): (JSC::objectProtoFuncToString): * runtime/ProgramExecutable.cpp: (JSC::ProgramExecutable::initializeGlobalProperties): * runtime/ProgramExecutable.h: * runtime/ProxyObject.cpp: (JSC::performProxyCall): * runtime/ScriptExecutable.h: (JSC::ScriptExecutable::isArrowFunctionContext const): (JSC::ScriptExecutable::isInStrictContext const): * runtime/SparseArrayValueMap.cpp: (JSC::SparseArrayEntry::put): Source/WebCore: Test: JSTests/ stress/superclass-expression-strictness.js * bindings/js/JSDOMWindowCustom.cpp: (WebCore::IDLOperation<JSDOMWindow>::cast): * bindings/js/JSEventTargetCustom.h: (WebCore::IDLOperation<JSEventTarget>::call): * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): LayoutTests: Fix the test since it contained incorrect code. * js/class-syntax-method-names-expected.txt: * js/script-tests/class-syntax-method-names.js: Canonical link: https://commits.webkit.org/223048@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259676 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-07 22:32:21 +00:00
runtime/ECMAMode.cpp
Add some structureID integrity checks to various runtime functions. https://bugs.webkit.org/show_bug.cgi?id=210015 <rdar://problem/58116514> Reviewed by Keith Miller. Specifically, implementations of toString(), toValue(), and a few others. I also moved the HeapCell version of ensureStillAliveHere() into the new EnsureStillAliveHere.h/cpp since it's useful for any pointers, not just HeapCells. This change is performance neutral on JetStream 2.0, Speedometer-2, and PLT5. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * heap/HeapCell.cpp: (JSC::ensureStillAliveHere): Deleted. * heap/HeapCell.h: (JSC::ensureStillAliveHere): Deleted. * heap/SlotVisitor.cpp: (JSC::SlotVisitor::appendJSCellOrAuxiliary): * runtime/ArrayPrototype.cpp: (JSC::arrayProtoFuncToString): * runtime/BigIntPrototype.cpp: (JSC::bigIntProtoFuncToStringImpl): (JSC::bigIntProtoFuncValueOf): * runtime/BooleanPrototype.cpp: (JSC::booleanProtoFuncToString): (JSC::booleanProtoFuncValueOf): * runtime/DatePrototype.cpp: (JSC::formatLocaleDate): (JSC::formateDateInstance): (JSC::dateProtoFuncToISOString): (JSC::dateProtoFuncToPrimitiveSymbol): * runtime/EnsureStillAliveHere.cpp: Added. (JSC::ensureStillAliveHere): * runtime/EnsureStillAliveHere.h: Added. (JSC::ensureStillAliveHere): * runtime/ErrorInstance.cpp: (JSC::ErrorInstance::sanitizedToString): * runtime/ErrorPrototype.cpp: (JSC::errorProtoFuncToString): * runtime/FunctionPrototype.cpp: (JSC::functionProtoFuncToString): * runtime/JSCell.cpp: (JSC::JSCell::toObjectSlow const): * runtime/NumberPrototype.cpp: (JSC::toThisNumber): * runtime/ObjectPrototype.cpp: (JSC::objectProtoFuncValueOf): (JSC::objectProtoFuncToString): * runtime/RegExpPrototype.cpp: (JSC::regExpProtoFuncToString): * runtime/StringPrototype.cpp: (JSC::stringProtoFuncToString): * runtime/StructureIDTable.h: (JSC::StructureIDTable::validate): (JSC::StructureIDTable::isValid): Deleted. * runtime/SymbolPrototype.cpp: (JSC::symbolProtoGetterDescription): (JSC::symbolProtoFuncToString): (JSC::symbolProtoFuncValueOf): * tools/Integrity.h: * tools/IntegrityInlines.h: (JSC::Integrity::auditStructureID): * wasm/js/WebAssemblyGlobalPrototype.cpp: (JSC::getGlobal): Canonical link: https://commits.webkit.org/222938@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-05 08:34:43 +00:00
runtime/EnsureStillAliveHere.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/Error.cpp
runtime/ErrorConstructor.cpp
runtime/ErrorHandlingScope.cpp
runtime/ErrorInstance.cpp
runtime/ErrorPrototype.cpp
[JSC] NativeErrorConstructor should not have own IsoSubspace https://bugs.webkit.org/show_bug.cgi?id=193713 Reviewed by Saam Barati. JSTests: Remove @Error use. * stress/try-get-by-id-should-spill-registers-dfg.js: (let.f.createBuiltin): Source/JavaScriptCore: This removes an additional member in NativeErrorConstructor, and make sizeof(NativeErrorConstructor) == sizeof(InternalFunction). We also make error constructors lazily allocated by using LazyClassStructure. Since error structures are not accessed from DFG / FTL threads, this is OK. While TypeError constructor is eagerly allocated because it is touched from our builtin JS as @TypeError, we should offer some function instead of exposing TypeError constructor in the future, and remove this @TypeError reference. This change removes IsoSubspace for NativeErrorConstructor in VM. We also remove @Error and @RangeError references for builtins since they are no longer referenced. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/BuiltinNames.h: * interpreter/Interpreter.h: * runtime/Error.cpp: (JSC::createEvalError): (JSC::createRangeError): (JSC::createReferenceError): (JSC::createSyntaxError): (JSC::createTypeError): (JSC::createURIError): (WTF::printInternal): Deleted. * runtime/Error.h: * runtime/ErrorPrototype.cpp: (JSC::ErrorPrototype::create): (JSC::ErrorPrototype::finishCreation): * runtime/ErrorPrototype.h: (JSC::ErrorPrototype::create): Deleted. * runtime/ErrorType.cpp: Added. (JSC::errorTypeName): (WTF::printInternal): * runtime/ErrorType.h: Added. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::initializeErrorConstructor): (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::internalPromiseConstructor const): (JSC::JSGlobalObject::errorStructure const): (JSC::JSGlobalObject::evalErrorConstructor const): Deleted. (JSC::JSGlobalObject::rangeErrorConstructor const): Deleted. (JSC::JSGlobalObject::referenceErrorConstructor const): Deleted. (JSC::JSGlobalObject::syntaxErrorConstructor const): Deleted. (JSC::JSGlobalObject::typeErrorConstructor const): Deleted. (JSC::JSGlobalObject::URIErrorConstructor const): Deleted. * runtime/NativeErrorConstructor.cpp: (JSC::NativeErrorConstructor<errorType>::NativeErrorConstructor): (JSC::NativeErrorConstructorBase::finishCreation): (JSC::NativeErrorConstructor<errorType>::constructNativeErrorConstructor): (JSC::NativeErrorConstructor<errorType>::callNativeErrorConstructor): (JSC::NativeErrorConstructor::NativeErrorConstructor): Deleted. (JSC::NativeErrorConstructor::finishCreation): Deleted. (JSC::NativeErrorConstructor::visitChildren): Deleted. (JSC::Interpreter::constructWithNativeErrorConstructor): Deleted. (JSC::Interpreter::callNativeErrorConstructor): Deleted. * runtime/NativeErrorConstructor.h: (JSC::NativeErrorConstructorBase::createStructure): (JSC::NativeErrorConstructorBase::NativeErrorConstructorBase): * runtime/NativeErrorPrototype.cpp: (JSC::NativeErrorPrototype::finishCreation): Deleted. * runtime/NativeErrorPrototype.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: * wasm/js/WasmToJS.cpp: (JSC::Wasm::handleBadI64Use): Canonical link: https://commits.webkit.org/208374@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240543 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-26 09:07:25 +00:00
runtime/ErrorType.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/EvalExecutable.cpp
runtime/Exception.cpp
runtime/ExceptionEventLocation.cpp
runtime/ExceptionFuzz.cpp
runtime/ExceptionHelpers.cpp
runtime/ExceptionScope.cpp
runtime/ExecutableBase.cpp
Add FuzzerAgent that reads predictions from a file https://bugs.webkit.org/show_bug.cgi?id=203898 Patch by Tuomas Karkkainen <tuomas.webkit@apple.com> on 2019-12-01 Reviewed by Mark Lam. This patch adds a FuzzerAgent that reads predictions from a file. The predictions in the file are correlated with the prediction sites using the name of the JavaScript source file, the opcode, and start and end offsets in the source. There is also a separate FuzzerAgent that can be used to create the prediction files. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * runtime/FileBasedFuzzerAgent.cpp: Added. * runtime/FileBasedFuzzerAgent.h: Copied from Source/JavaScriptCore/runtime/RandomizingFuzzerAgent.cpp. * runtime/FileBasedFuzzerAgentBase.cpp: Added. * runtime/FileBasedFuzzerAgentBase.h: Copied from Source/JavaScriptCore/runtime/RandomizingFuzzerAgent.cpp. * runtime/FuzzerPredictions.cpp: Added. * runtime/FuzzerPredictions.h: Copied from Source/JavaScriptCore/runtime/RandomizingFuzzerAgent.cpp. * runtime/Options.cpp: * runtime/OptionsList.h: * runtime/PredictionFileCreatingFuzzerAgent.cpp: Copied from Source/JavaScriptCore/runtime/RandomizingFuzzerAgent.cpp. * runtime/PredictionFileCreatingFuzzerAgent.h: Copied from Source/JavaScriptCore/runtime/RandomizingFuzzerAgent.cpp. * runtime/RandomizingFuzzerAgent.cpp: * runtime/VM.cpp: Canonical link: https://commits.webkit.org/217951@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252978 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-12-02 06:44:16 +00:00
runtime/FileBasedFuzzerAgent.cpp
runtime/FileBasedFuzzerAgentBase.cpp
Add support for FinalizationRegistries https://bugs.webkit.org/show_bug.cgi?id=199888 Reviewed by Yusuke Suzuki. JSTests: Shamelessly copy v8's tests and refactor them to work with conservative GC. * stress/resources/v8-mjsunit.js: Added. (MjsUnitAssertionError): (MjsUnitAssertionError.prototype.toString): (catch): (classOf): (ValueOf): (prettyPrinted): (prettyPrintedArrayElement): (failWithMessage): (formatFailureText): (fail): (deepObjectEquals): (deepEquals): (assertSame): (assertNotSame): (assertEquals): (assertNotEquals): (assertEqualsDelta): (assertArrayEquals): (assertPropertiesEqual): (assertToStringEquals): (assertTrue): (assertFalse): (assertNull): (assertNotNull): (executeCode): (checkException): (assertThrows): (assertThrowsEquals): (assertThrowsAsync): (assertInstanceof): (assertDoesNotThrow): (assertUnreachable): (assertContains): (assertMatches): (concatenateErrors): (assertPromiseResult): (OptimizationStatus): (assertUnoptimized): (assertOptimized): (isNeverOptimizeLiteMode): (isNeverOptimize): (isAlwaysOptimize): (isInterpreted): (isOptimized): (isTurboFanned): (MjsUnitAssertionError.prepareStackTrace): * stress/v8-cleanup-from-different-realm.js: Added. (let.timeout_func): * stress/v8-cleanup-proxy-from-different-realm.js: Added. (let.timeout_func): * stress/v8-finalization-registry-basics.js: Added. (TestConstructFinalizationRegistry): (TestFinalizationRegistryConstructorCallAsFunction): (TestConstructFinalizationRegistryCleanupNotCallable): (TestConstructFinalizationRegistryWithNonCallableProxyAsCleanup): (TestRegisterTargetAndHoldingsSameValue): (TestRegisterWithoutFinalizationRegistry): (TestUnregisterWithNonExistentKey): (TestUnregisterWithNonFinalizationRegistry): (TestWeakRefConstructorWithNonObject): (TestWeakRefWithProxy): * stress/v8-finalizationregistry-and-weakref.js: Added. (let.cleanup): (setTimeout): * stress/v8-finalizationregistry-keeps-holdings-alive.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-finalizationregistry-scheduled-for-cleanup-multiple-times.js: Added. (let.cleanup0): (let.cleanup1): (let.timeout_func): * stress/v8-multiple-dirty-finalization-registries.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-reentrant-gc-from-cleanup.js: Added. (let.reentrant_gc): (setTimeout): * stress/v8-stress-finalizationregistry-dirty-enqueue.js: Added. (i.registries.push.new.FinalizationRegistry): (registries.forEach): * stress/v8-undefined-holdings.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-unregister-after-cleanup.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-unregister-before-cleanup.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-unregister-called-twice.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-unregister-inside-cleanup2.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-unregister-inside-cleanup3.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-unregister-many.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-weak-unregistertoken.js: Added. (FR.new.FinalizationRegistry): (tryAgain): Source/JavaScriptCore: This patch adds support for FinalizationRegistries. There are two main parts to this patch, the first is refactoring PromiseTimer a more general into DeferredWorkTimer. This allows us to finally have a "real" setTimeout on the jsc command line. The second part is adding all the new classes needed for FinalizationRegistries. The refactoring is mostly a rename but does two main new things. The first is that it now notifies the VM we have finished a synchronuous JS execution, so that WeakRefs can be collected. The second is that it now catches any exceptions and forwards the to a new method on the global object method table. For WebCore, this reports the exception to the console. For API users, this calls their exceptionHandler block. For the CLI, it exits with exit status 3 (our general exception exit status). Unfortunately, there's not currently an ergonomic way to pass the expected exception from the CLI arguments to this handler so that's not supported here. In order to support FinalizationRegistry this patch adds a "new" class JSDestructibleInternalFieldObjectImpl, which allows us to have a destructible object with internal fields. Since the order of collection doesn't matter we currently use C++ HashTables on the FinalizationRegistry. Since users can unregister objects while the callback is pending we have a hash table for the live entries and a second hash table for the dead ones. Lastly, because users are not requred to provide a token for unregistration we have two extra Vectors containing the live/dead objects that are not unregisterible. * API/JSAPIGlobalObject.cpp: * API/JSAPIGlobalObject.mm: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * heap/Heap.cpp: (JSC::Heap::finalizeUnconditionalFinalizers): * jsc.cpp: (functionSetTimeout): (functionFinalizationRegistryLiveCount): (functionFinalizationRegistryDeadCount): (main): (checkUncaughtException): (checkException): (GlobalObject::reportUncaughtExceptionAtEventLoop): (runJSC): * runtime/ArrayIteratorPrototype.cpp: * runtime/CommonIdentifiers.h: * runtime/DeferredWorkTimer.cpp: Renamed from Source/JavaScriptCore/runtime/PromiseTimer.cpp. (JSC::DeferredWorkTimer::DeferredWorkTimer): (JSC::DeferredWorkTimer::doWork): (JSC::DeferredWorkTimer::runRunLoop): (JSC::DeferredWorkTimer::addPendingWork): (JSC::DeferredWorkTimer::hasPendingWork): (JSC::DeferredWorkTimer::hasDependancyInPendingWork): (JSC::DeferredWorkTimer::cancelPendingWork): (JSC::DeferredWorkTimer::scheduleWorkSoon): * runtime/DeferredWorkTimer.h: Renamed from Source/JavaScriptCore/runtime/PromiseTimer.h. * runtime/FinalizationRegistryConstructor.cpp: Added. (JSC::FinalizationRegistryConstructor::finishCreation): (JSC::FinalizationRegistryConstructor::FinalizationRegistryConstructor): (JSC::callFinalizationRegistry): (JSC::constructFinalizationRegistry): * runtime/FinalizationRegistryConstructor.h: Copied from Source/JavaScriptCore/API/JSAPIGlobalObject.cpp. * runtime/FinalizationRegistryPrototype.cpp: Added. (JSC::FinalizationRegistryPrototype::finishCreation): (JSC::getFinalizationRegistry): (JSC::protoFuncFinalizationRegistryRegister): (JSC::protoFuncFinalizationRegistryUnregister): * runtime/FinalizationRegistryPrototype.h: Copied from Source/JavaScriptCore/API/JSAPIGlobalObject.cpp. * runtime/IdentifierInlines.h: (JSC::Identifier::Identifier): * runtime/JSFinalizationRegistry.cpp: Added. (JSC::JSFinalizationRegistry::createStructure): (JSC::JSFinalizationRegistry::create): (JSC::JSFinalizationRegistry::finishCreation): (JSC::JSFinalizationRegistry::visitChildren): (JSC::JSFinalizationRegistry::destroy): (JSC::JSFinalizationRegistry::finalizeUnconditionally): (JSC::JSFinalizationRegistry::runFinalizationCleanup): (JSC::JSFinalizationRegistry::takeDeadHoldingsValue): (JSC::JSFinalizationRegistry::registerTarget): (JSC::JSFinalizationRegistry::unregister): (JSC::JSFinalizationRegistry::liveCount): (JSC::JSFinalizationRegistry::deadCount): (JSC::JSFinalizationRegistry::toStringName): * runtime/JSFinalizationRegistry.h: Added. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::reportUncaughtExceptionAtEventLoop): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::stackOverflowFrameCallee const): (JSC::JSGlobalObject::arrayIteratorProtocolWatchpointSet): (JSC::JSGlobalObject::mapIteratorProtocolWatchpointSet): (JSC::JSGlobalObject::setIteratorProtocolWatchpointSet): (JSC::JSGlobalObject::stringIteratorProtocolWatchpointSet): (JSC::JSGlobalObject::mapSetWatchpointSet): (JSC::JSGlobalObject::setAddWatchpointSet): (JSC::JSGlobalObject::arraySpeciesWatchpointSet): (JSC::JSGlobalObject::arrayJoinWatchpointSet): (JSC::JSGlobalObject::numberToStringWatchpointSet): * runtime/JSInternalFieldObjectImpl.h: * runtime/JSInternalFieldObjectImplInlines.h: (JSC::Base>::visitChildren): (JSC::JSInternalFieldObjectImpl<passedNumberOfInternalFields>::visitChildren): Deleted. * runtime/JSPromise.cpp: (JSC::JSPromise::resolve): (JSC::JSPromise::reject): * runtime/StructureIDTable.cpp: (JSC::StructureIDTable::allocateID): (JSC::StructureIDTable::deallocateID): * runtime/VM.cpp: (JSC::VM::VM): (JSC::VM::~VM): * runtime/VM.h: * wasm/js/JSWebAssembly.cpp: (JSC::webAssemblyModuleValidateAsyncInternal): (JSC::instantiate): (JSC::compileAndInstantiate): (JSC::webAssemblyModuleInstantinateAsyncInternal): (JSC::webAssemblyCompileStreamingInternal): (JSC::webAssemblyInstantiateStreamingInternal): * wasm/js/JSWebAssemblyCodeBlock.h: Source/WebCore: Refactor things for changing PromiseDeferredTimer to DeferredWorkTimer. Also, add globalObject hook for reporting uncaught exceptions from JSC's runloop callbacks. * bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::reportUncaughtExceptionAtEventLoop): * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::compileStreaming): (WebCore::JSDOMWindowBase::instantiateStreaming): * bindings/js/JSWorkerGlobalScopeBase.cpp: * bindings/js/JSWorkletGlobalScopeBase.cpp: * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::addTimerSetNotification): (WebCore::WorkerScriptController::removeTimerSetNotification): * workers/WorkerRunLoop.cpp: * worklets/WorkletScriptController.cpp: LayoutTests: * js/script-tests/weakref-finalizationregistry.js: Added. (makeWeakRef): (turnEventLoop): (async test): * js/weakref-finalizationregistry-expected.txt: Added. * js/weakref-finalizationregistry.html: Added. Canonical link: https://commits.webkit.org/227365@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@264617 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-07-20 21:03:16 +00:00
runtime/FinalizationRegistryConstructor.cpp
runtime/FinalizationRegistryPrototype.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/FunctionConstructor.cpp
runtime/FunctionExecutable.cpp
runtime/FunctionExecutableDump.cpp
runtime/FunctionHasExecutedCache.cpp
runtime/FunctionPrototype.cpp
runtime/FunctionRareData.cpp
runtime/FuzzerAgent.cpp
Add FuzzerAgent that reads predictions from a file https://bugs.webkit.org/show_bug.cgi?id=203898 Patch by Tuomas Karkkainen <tuomas.webkit@apple.com> on 2019-12-01 Reviewed by Mark Lam. This patch adds a FuzzerAgent that reads predictions from a file. The predictions in the file are correlated with the prediction sites using the name of the JavaScript source file, the opcode, and start and end offsets in the source. There is also a separate FuzzerAgent that can be used to create the prediction files. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * runtime/FileBasedFuzzerAgent.cpp: Added. * runtime/FileBasedFuzzerAgent.h: Copied from Source/JavaScriptCore/runtime/RandomizingFuzzerAgent.cpp. * runtime/FileBasedFuzzerAgentBase.cpp: Added. * runtime/FileBasedFuzzerAgentBase.h: Copied from Source/JavaScriptCore/runtime/RandomizingFuzzerAgent.cpp. * runtime/FuzzerPredictions.cpp: Added. * runtime/FuzzerPredictions.h: Copied from Source/JavaScriptCore/runtime/RandomizingFuzzerAgent.cpp. * runtime/Options.cpp: * runtime/OptionsList.h: * runtime/PredictionFileCreatingFuzzerAgent.cpp: Copied from Source/JavaScriptCore/runtime/RandomizingFuzzerAgent.cpp. * runtime/PredictionFileCreatingFuzzerAgent.h: Copied from Source/JavaScriptCore/runtime/RandomizingFuzzerAgent.cpp. * runtime/RandomizingFuzzerAgent.cpp: * runtime/VM.cpp: Canonical link: https://commits.webkit.org/217951@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252978 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-12-02 06:44:16 +00:00
runtime/FuzzerPredictions.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/GeneratorFunctionConstructor.cpp
runtime/GeneratorFunctionPrototype.cpp
runtime/GeneratorPrototype.cpp
New bytecode format for JSC https://bugs.webkit.org/show_bug.cgi?id=187373 <rdar://problem/44186758> Reviewed by Filip Pizlo. .: Disable JIT by default on 32-bit platforms * Source/cmake/WebKitFeatures.cmake: JSTests: Add tests to ensure that the inferred inline capacity for a narrow op_new_object will be capped at 255. * stress/maximum-inline-capacity.js: Added. (test1): (test3.Foo): (test3): Source/JavaScriptCore: Replace unlinked and linked bytecode with a new immutable bytecode that does not embed any addresses. Instructions can be encoded as narrow (1-byte operands) or wide (4-byte operands) and might contain an extra operand, the metadataID. The metadataID is used to access the instruction's mutable data in a side table in the CodeBlock (the MetadataTable). Bytecodes now must be structs declared in the new BytecodeList.rb. All bytecodes give names and types to all its operands. Additionally, reading a bytecode from the instruction stream requires decoding the whole bytecode, i.e. it's no longer possible to access arbitrary operands directly from the stream. * CMakeLists.txt: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/MacroAssemblerCodeRef.h: (JSC::ReturnAddressPtr::ReturnAddressPtr): (JSC::ReturnAddressPtr::value const): (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): (JSC::MacroAssemblerCodePtr::createFromExecutableAddress): * bytecode/ArithProfile.h: (JSC::ArithProfile::ArithProfile): * bytecode/ArrayAllocationProfile.h: (JSC::ArrayAllocationProfile::ArrayAllocationProfile): * bytecode/ArrayProfile.h: * bytecode/BytecodeBasicBlock.cpp: (JSC::isJumpTarget): (JSC::BytecodeBasicBlock::computeImpl): (JSC::BytecodeBasicBlock::compute): * bytecode/BytecodeBasicBlock.h: (JSC::BytecodeBasicBlock::leaderOffset const): (JSC::BytecodeBasicBlock::totalLength const): (JSC::BytecodeBasicBlock::offsets const): (JSC::BytecodeBasicBlock::BytecodeBasicBlock): (JSC::BytecodeBasicBlock::addLength): * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::printLocationAndOp): (JSC::BytecodeDumper<Block>::dumpBytecode): (JSC::BytecodeDumper<Block>::dumpIdentifiers): (JSC::BytecodeDumper<Block>::dumpConstants): (JSC::BytecodeDumper<Block>::dumpExceptionHandlers): (JSC::BytecodeDumper<Block>::dumpSwitchJumpTables): (JSC::BytecodeDumper<Block>::dumpStringSwitchJumpTables): (JSC::BytecodeDumper<Block>::dumpBlock): * bytecode/BytecodeDumper.h: (JSC::BytecodeDumper::dumpOperand): (JSC::BytecodeDumper::dumpValue): (JSC::BytecodeDumper::BytecodeDumper): (JSC::BytecodeDumper::block const): * bytecode/BytecodeGeneratorification.cpp: (JSC::BytecodeGeneratorification::BytecodeGeneratorification): (JSC::BytecodeGeneratorification::enterPoint const): (JSC::BytecodeGeneratorification::instructions const): (JSC::GeneratorLivenessAnalysis::run): (JSC::BytecodeGeneratorification::run): (JSC::performGeneratorification): * bytecode/BytecodeGeneratorification.h: * bytecode/BytecodeGraph.h: (JSC::BytecodeGraph::blockContainsBytecodeOffset): (JSC::BytecodeGraph::findBasicBlockForBytecodeOffset): (JSC::BytecodeGraph::findBasicBlockWithLeaderOffset): (JSC::BytecodeGraph::BytecodeGraph): * bytecode/BytecodeKills.h: * bytecode/BytecodeList.json: Removed. * bytecode/BytecodeList.rb: Added. * bytecode/BytecodeLivenessAnalysis.cpp: (JSC::BytecodeLivenessAnalysis::dumpResults): * bytecode/BytecodeLivenessAnalysis.h: * bytecode/BytecodeLivenessAnalysisInlines.h: (JSC::isValidRegisterForLiveness): (JSC::BytecodeLivenessPropagation::stepOverInstruction): * bytecode/BytecodeRewriter.cpp: (JSC::BytecodeRewriter::applyModification): (JSC::BytecodeRewriter::execute): (JSC::BytecodeRewriter::adjustJumpTargetsInFragment): (JSC::BytecodeRewriter::insertImpl): (JSC::BytecodeRewriter::adjustJumpTarget): (JSC::BytecodeRewriter::adjustJumpTargets): * bytecode/BytecodeRewriter.h: (JSC::BytecodeRewriter::InsertionPoint::InsertionPoint): (JSC::BytecodeRewriter::Fragment::Fragment): (JSC::BytecodeRewriter::Fragment::appendInstruction): (JSC::BytecodeRewriter::BytecodeRewriter): (JSC::BytecodeRewriter::insertFragmentBefore): (JSC::BytecodeRewriter::insertFragmentAfter): (JSC::BytecodeRewriter::removeBytecode): (JSC::BytecodeRewriter::adjustAbsoluteOffset): (JSC::BytecodeRewriter::adjustJumpTarget): * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): (JSC::computeDefsForBytecodeOffset): * bytecode/CallLinkStatus.cpp: (JSC::CallLinkStatus::computeFromLLInt): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): (JSC::CodeBlock::CodeBlock): (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::estimatedSize): (JSC::CodeBlock::visitChildren): (JSC::CodeBlock::propagateTransitions): (JSC::CodeBlock::finalizeLLIntInlineCaches): (JSC::CodeBlock::addJITAddIC): (JSC::CodeBlock::addJITMulIC): (JSC::CodeBlock::addJITSubIC): (JSC::CodeBlock::addJITNegIC): (JSC::CodeBlock::stronglyVisitStrongReferences): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffset): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffsetSlow): (JSC::CodeBlock::hasOpDebugForLineAndColumn): (JSC::CodeBlock::getArrayProfile): (JSC::CodeBlock::updateAllArrayPredictions): (JSC::CodeBlock::predictedMachineCodeSize): (JSC::CodeBlock::tryGetValueProfileForBytecodeOffset): (JSC::CodeBlock::valueProfilePredictionForBytecodeOffset): (JSC::CodeBlock::valueProfileForBytecodeOffset): (JSC::CodeBlock::validate): (JSC::CodeBlock::outOfLineJumpOffset): (JSC::CodeBlock::outOfLineJumpTarget): (JSC::CodeBlock::arithProfileForBytecodeOffset): (JSC::CodeBlock::arithProfileForPC): (JSC::CodeBlock::couldTakeSpecialFastCase): (JSC::CodeBlock::insertBasicBlockBoundariesForControlFlowProfiler): * bytecode/CodeBlock.h: (JSC::CodeBlock::addMathIC): (JSC::CodeBlock::outOfLineJumpOffset): (JSC::CodeBlock::bytecodeOffset): (JSC::CodeBlock::instructions const): (JSC::CodeBlock::instructionCount const): (JSC::CodeBlock::llintBaselineCalleeSaveSpaceAsVirtualRegisters): (JSC::CodeBlock::metadata): (JSC::CodeBlock::metadataSizeInBytes): (JSC::CodeBlock::numberOfNonArgumentValueProfiles): (JSC::CodeBlock::totalNumberOfValueProfiles): * bytecode/CodeBlockInlines.h: Added. (JSC::CodeBlock::forEachValueProfile): (JSC::CodeBlock::forEachArrayProfile): (JSC::CodeBlock::forEachArrayAllocationProfile): (JSC::CodeBlock::forEachObjectAllocationProfile): (JSC::CodeBlock::forEachLLIntCallLinkInfo): * bytecode/Fits.h: Added. * bytecode/GetByIdMetadata.h: Copied from Source/JavaScriptCore/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h. * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::computeFromLLInt): * bytecode/Instruction.h: (JSC::Instruction::Instruction): (JSC::Instruction::Impl::opcodeID const): (JSC::Instruction::opcodeID const): (JSC::Instruction::name const): (JSC::Instruction::isWide const): (JSC::Instruction::size const): (JSC::Instruction::is const): (JSC::Instruction::as const): (JSC::Instruction::cast): (JSC::Instruction::cast const): (JSC::Instruction::narrow const): (JSC::Instruction::wide const): * bytecode/InstructionStream.cpp: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. (JSC::InstructionStream::InstructionStream): (JSC::InstructionStream::sizeInBytes const): * bytecode/InstructionStream.h: Added. (JSC::InstructionStream::BaseRef::BaseRef): (JSC::InstructionStream::BaseRef::operator=): (JSC::InstructionStream::BaseRef::operator-> const): (JSC::InstructionStream::BaseRef::ptr const): (JSC::InstructionStream::BaseRef::operator!= const): (JSC::InstructionStream::BaseRef::next const): (JSC::InstructionStream::BaseRef::offset const): (JSC::InstructionStream::BaseRef::isValid const): (JSC::InstructionStream::BaseRef::unwrap const): (JSC::InstructionStream::MutableRef::freeze const): (JSC::InstructionStream::MutableRef::operator->): (JSC::InstructionStream::MutableRef::ptr): (JSC::InstructionStream::MutableRef::operator Ref): (JSC::InstructionStream::MutableRef::unwrap): (JSC::InstructionStream::iterator::operator*): (JSC::InstructionStream::iterator::operator++): (JSC::InstructionStream::begin const): (JSC::InstructionStream::end const): (JSC::InstructionStream::at const): (JSC::InstructionStream::size const): (JSC::InstructionStreamWriter::InstructionStreamWriter): (JSC::InstructionStreamWriter::ref): (JSC::InstructionStreamWriter::seek): (JSC::InstructionStreamWriter::position): (JSC::InstructionStreamWriter::write): (JSC::InstructionStreamWriter::rewind): (JSC::InstructionStreamWriter::finalize): (JSC::InstructionStreamWriter::swap): (JSC::InstructionStreamWriter::iterator::operator*): (JSC::InstructionStreamWriter::iterator::operator++): (JSC::InstructionStreamWriter::begin): (JSC::InstructionStreamWriter::end): * bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp: (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::LLIntPrototypeLoadAdaptiveStructureWatchpoint): (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::fireInternal): (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::clearLLIntGetByIdCache): * bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h: * bytecode/MetadataTable.cpp: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. (JSC::MetadataTable::MetadataTable): (JSC::DeallocTable::withOpcodeType): (JSC::MetadataTable::~MetadataTable): (JSC::MetadataTable::sizeInBytes): * bytecode/MetadataTable.h: Copied from Source/JavaScriptCore/runtime/Watchdog.h. (JSC::MetadataTable::get): (JSC::MetadataTable::forEach): (JSC::MetadataTable::getImpl): * bytecode/Opcode.cpp: (JSC::metadataSize): * bytecode/Opcode.h: (JSC::padOpcodeName): * bytecode/OpcodeInlines.h: (JSC::isOpcodeShape): (JSC::getOpcodeType): * bytecode/OpcodeSize.h: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. * bytecode/PreciseJumpTargets.cpp: (JSC::getJumpTargetsForInstruction): (JSC::computePreciseJumpTargetsInternal): (JSC::computePreciseJumpTargets): (JSC::recomputePreciseJumpTargets): (JSC::findJumpTargetsForInstruction): * bytecode/PreciseJumpTargets.h: * bytecode/PreciseJumpTargetsInlines.h: (JSC::jumpTargetForInstruction): (JSC::extractStoredJumpTargetsForInstruction): (JSC::updateStoredJumpTargetsForInstruction): * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::computeFromLLInt): * bytecode/SpecialPointer.cpp: (WTF::printInternal): * bytecode/SpecialPointer.h: * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): (JSC::UnlinkedCodeBlock::visitChildren): (JSC::UnlinkedCodeBlock::estimatedSize): (JSC::UnlinkedCodeBlock::lineNumberForBytecodeOffset): (JSC::dumpLineColumnEntry): (JSC::UnlinkedCodeBlock::expressionRangeForBytecodeOffset const): (JSC::UnlinkedCodeBlock::setInstructions): (JSC::UnlinkedCodeBlock::instructions const): (JSC::UnlinkedCodeBlock::applyModification): (JSC::UnlinkedCodeBlock::addOutOfLineJumpTarget): (JSC::UnlinkedCodeBlock::outOfLineJumpOffset): * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::addPropertyAccessInstruction): (JSC::UnlinkedCodeBlock::propertyAccessInstructions const): (JSC::UnlinkedCodeBlock::addOpProfileControlFlowBytecodeOffset): (JSC::UnlinkedCodeBlock::opProfileControlFlowBytecodeOffsets const): (JSC::UnlinkedCodeBlock::metadata): (JSC::UnlinkedCodeBlock::metadataSizeInBytes): (JSC::UnlinkedCodeBlock::outOfLineJumpOffset): (JSC::UnlinkedCodeBlock::replaceOutOfLineJumpTargets): * bytecode/UnlinkedInstructionStream.cpp: Removed. * bytecode/UnlinkedInstructionStream.h: Removed. * bytecode/UnlinkedMetadataTable.h: Copied from Source/JavaScriptCore/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h. * bytecode/UnlinkedMetadataTableInlines.h: Added. (JSC::UnlinkedMetadataTable::UnlinkedMetadataTable): (JSC::UnlinkedMetadataTable::~UnlinkedMetadataTable): (JSC::UnlinkedMetadataTable::addEntry): (JSC::UnlinkedMetadataTable::sizeInBytes): (JSC::UnlinkedMetadataTable::finalize): (JSC::UnlinkedMetadataTable::link): (JSC::UnlinkedMetadataTable::unlink): * bytecode/VirtualRegister.cpp: (JSC::VirtualRegister::VirtualRegister): * bytecode/VirtualRegister.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::Label::setLocation): (JSC::Label::bind): (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::initializeVarLexicalEnvironment): (JSC::BytecodeGenerator::emitEnter): (JSC::BytecodeGenerator::emitLoopHint): (JSC::BytecodeGenerator::emitJump): (JSC::BytecodeGenerator::emitCheckTraps): (JSC::BytecodeGenerator::rewind): (JSC::BytecodeGenerator::fuseCompareAndJump): (JSC::BytecodeGenerator::fuseTestAndJmp): (JSC::BytecodeGenerator::emitJumpIfTrue): (JSC::BytecodeGenerator::emitJumpIfFalse): (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall): (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply): (JSC::BytecodeGenerator::moveLinkTimeConstant): (JSC::BytecodeGenerator::moveEmptyValue): (JSC::BytecodeGenerator::emitMove): (JSC::BytecodeGenerator::emitUnaryOp): (JSC::BytecodeGenerator::emitBinaryOp): (JSC::BytecodeGenerator::emitToObject): (JSC::BytecodeGenerator::emitToNumber): (JSC::BytecodeGenerator::emitToString): (JSC::BytecodeGenerator::emitTypeOf): (JSC::BytecodeGenerator::emitInc): (JSC::BytecodeGenerator::emitDec): (JSC::BytecodeGenerator::emitEqualityOp): (JSC::BytecodeGenerator::emitProfileType): (JSC::BytecodeGenerator::emitProfileControlFlow): (JSC::BytecodeGenerator::pushLexicalScopeInternal): (JSC::BytecodeGenerator::emitResolveScopeForHoistingFuncDeclInEval): (JSC::BytecodeGenerator::prepareLexicalScopeForNextForLoopIteration): (JSC::BytecodeGenerator::emitOverridesHasInstance): (JSC::BytecodeGenerator::emitResolveScope): (JSC::BytecodeGenerator::emitGetFromScope): (JSC::BytecodeGenerator::emitPutToScope): (JSC::BytecodeGenerator::emitInstanceOf): (JSC::BytecodeGenerator::emitInstanceOfCustom): (JSC::BytecodeGenerator::emitInByVal): (JSC::BytecodeGenerator::emitInById): (JSC::BytecodeGenerator::emitTryGetById): (JSC::BytecodeGenerator::emitGetById): (JSC::BytecodeGenerator::emitDirectGetById): (JSC::BytecodeGenerator::emitPutById): (JSC::BytecodeGenerator::emitDirectPutById): (JSC::BytecodeGenerator::emitPutGetterById): (JSC::BytecodeGenerator::emitPutSetterById): (JSC::BytecodeGenerator::emitPutGetterSetter): (JSC::BytecodeGenerator::emitPutGetterByVal): (JSC::BytecodeGenerator::emitPutSetterByVal): (JSC::BytecodeGenerator::emitDeleteById): (JSC::BytecodeGenerator::emitGetByVal): (JSC::BytecodeGenerator::emitPutByVal): (JSC::BytecodeGenerator::emitDirectPutByVal): (JSC::BytecodeGenerator::emitDeleteByVal): (JSC::BytecodeGenerator::emitSuperSamplerBegin): (JSC::BytecodeGenerator::emitSuperSamplerEnd): (JSC::BytecodeGenerator::emitIdWithProfile): (JSC::BytecodeGenerator::emitUnreachable): (JSC::BytecodeGenerator::emitGetArgument): (JSC::BytecodeGenerator::emitCreateThis): (JSC::BytecodeGenerator::emitTDZCheck): (JSC::BytecodeGenerator::emitNewObject): (JSC::BytecodeGenerator::emitNewArrayBuffer): (JSC::BytecodeGenerator::emitNewArray): (JSC::BytecodeGenerator::emitNewArrayWithSpread): (JSC::BytecodeGenerator::emitNewArrayWithSize): (JSC::BytecodeGenerator::emitNewRegExp): (JSC::BytecodeGenerator::emitNewFunctionExpressionCommon): (JSC::BytecodeGenerator::emitNewDefaultConstructor): (JSC::BytecodeGenerator::emitNewFunction): (JSC::BytecodeGenerator::emitSetFunctionNameIfNeeded): (JSC::BytecodeGenerator::emitCall): (JSC::BytecodeGenerator::emitCallInTailPosition): (JSC::BytecodeGenerator::emitCallEval): (JSC::BytecodeGenerator::emitExpectedFunctionSnippet): (JSC::BytecodeGenerator::emitCallVarargs): (JSC::BytecodeGenerator::emitCallVarargsInTailPosition): (JSC::BytecodeGenerator::emitConstructVarargs): (JSC::BytecodeGenerator::emitCallForwardArgumentsInTailPosition): (JSC::BytecodeGenerator::emitLogShadowChickenPrologueIfNecessary): (JSC::BytecodeGenerator::emitLogShadowChickenTailIfNecessary): (JSC::BytecodeGenerator::emitCallDefineProperty): (JSC::BytecodeGenerator::emitReturn): (JSC::BytecodeGenerator::emitEnd): (JSC::BytecodeGenerator::emitConstruct): (JSC::BytecodeGenerator::emitStrcat): (JSC::BytecodeGenerator::emitToPrimitive): (JSC::BytecodeGenerator::emitGetScope): (JSC::BytecodeGenerator::emitPushWithScope): (JSC::BytecodeGenerator::emitGetParentScope): (JSC::BytecodeGenerator::emitDebugHook): (JSC::BytecodeGenerator::emitCatch): (JSC::BytecodeGenerator::emitThrow): (JSC::BytecodeGenerator::emitArgumentCount): (JSC::BytecodeGenerator::emitThrowStaticError): (JSC::BytecodeGenerator::beginSwitch): (JSC::prepareJumpTableForSwitch): (JSC::prepareJumpTableForStringSwitch): (JSC::BytecodeGenerator::endSwitch): (JSC::BytecodeGenerator::emitGetEnumerableLength): (JSC::BytecodeGenerator::emitHasGenericProperty): (JSC::BytecodeGenerator::emitHasIndexedProperty): (JSC::BytecodeGenerator::emitHasStructureProperty): (JSC::BytecodeGenerator::emitGetPropertyEnumerator): (JSC::BytecodeGenerator::emitEnumeratorStructurePropertyName): (JSC::BytecodeGenerator::emitEnumeratorGenericPropertyName): (JSC::BytecodeGenerator::emitToIndexString): (JSC::BytecodeGenerator::emitIsCellWithType): (JSC::BytecodeGenerator::emitIsObject): (JSC::BytecodeGenerator::emitIsNumber): (JSC::BytecodeGenerator::emitIsUndefined): (JSC::BytecodeGenerator::emitIsEmpty): (JSC::BytecodeGenerator::emitRestParameter): (JSC::BytecodeGenerator::emitRequireObjectCoercible): (JSC::BytecodeGenerator::emitYieldPoint): (JSC::BytecodeGenerator::emitYield): (JSC::BytecodeGenerator::emitGetAsyncIterator): (JSC::BytecodeGenerator::emitDelegateYield): (JSC::BytecodeGenerator::emitFinallyCompletion): (JSC::BytecodeGenerator::emitJumpIf): (JSC::ForInContext::finalize): (JSC::StructureForInContext::finalize): (JSC::IndexedForInContext::finalize): (JSC::StaticPropertyAnalysis::record): (JSC::BytecodeGenerator::emitToThis): * bytecompiler/BytecodeGenerator.h: (JSC::StructureForInContext::addGetInst): (JSC::BytecodeGenerator::recordOpcode): (JSC::BytecodeGenerator::addMetadataFor): (JSC::BytecodeGenerator::emitUnaryOp): (JSC::BytecodeGenerator::kill): (JSC::BytecodeGenerator::instructions const): (JSC::BytecodeGenerator::write): (JSC::BytecodeGenerator::withWriter): * bytecompiler/Label.h: (JSC::Label::Label): (JSC::Label::bind): * bytecompiler/NodesCodegen.cpp: (JSC::ArrayNode::emitBytecode): (JSC::BytecodeIntrinsicNode::emit_intrinsic_argumentCount): (JSC::ApplyFunctionCallDotNode::emitBytecode): (JSC::BitwiseNotNode::emitBytecode): (JSC::BinaryOpNode::emitBytecode): (JSC::EqualNode::emitBytecode): (JSC::StrictEqualNode::emitBytecode): (JSC::emitReadModifyAssignment): (JSC::ForInNode::emitBytecode): (JSC::CaseBlockNode::emitBytecodeForBlock): (JSC::FunctionNode::emitBytecode): (JSC::ClassExprNode::emitBytecode): * bytecompiler/ProfileTypeBytecodeFlag.cpp: Copied from Source/JavaScriptCore/bytecode/VirtualRegister.cpp. (WTF::printInternal): * bytecompiler/ProfileTypeBytecodeFlag.h: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. * bytecompiler/RegisterID.h: * bytecompiler/StaticPropertyAnalysis.h: (JSC::StaticPropertyAnalysis::create): (JSC::StaticPropertyAnalysis::StaticPropertyAnalysis): * bytecompiler/StaticPropertyAnalyzer.h: (JSC::StaticPropertyAnalyzer::createThis): (JSC::StaticPropertyAnalyzer::newObject): (JSC::StaticPropertyAnalyzer::putById): (JSC::StaticPropertyAnalyzer::mov): (JSC::StaticPropertyAnalyzer::kill): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::addCall): (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::getArrayMode): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleVarargsCall): (JSC::DFG::ByteCodeParser::handleRecursiveTailCall): (JSC::DFG::ByteCodeParser::inlineCall): (JSC::DFG::ByteCodeParser::handleCallVariant): (JSC::DFG::ByteCodeParser::handleVarargsInlining): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::handleMinMax): (JSC::DFG::ByteCodeParser::handleIntrinsicCall): (JSC::DFG::ByteCodeParser::handleDOMJITCall): (JSC::DFG::ByteCodeParser::handleIntrinsicGetter): (JSC::DFG::ByteCodeParser::handleDOMJITGetter): (JSC::DFG::ByteCodeParser::handleModuleNamespaceLoad): (JSC::DFG::ByteCodeParser::handleTypedArrayConstructor): (JSC::DFG::ByteCodeParser::handleConstantInternalFunction): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::handlePutById): (JSC::DFG::ByteCodeParser::parseGetById): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::handlePutByVal): (JSC::DFG::ByteCodeParser::handlePutAccessorById): (JSC::DFG::ByteCodeParser::handlePutAccessorByVal): (JSC::DFG::ByteCodeParser::handleNewFunc): (JSC::DFG::ByteCodeParser::handleNewFuncExp): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCapabilities.cpp: (JSC::DFG::capabilityLevel): * dfg/DFGCapabilities.h: (JSC::DFG::capabilityLevel): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareCatchOSREntry): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileValueAdd): (JSC::DFG::SpeculativeJIT::compileValueSub): (JSC::DFG::SpeculativeJIT::compileValueNegate): (JSC::DFG::SpeculativeJIT::compileArithMul): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileValueAdd): (JSC::FTL::DFG::LowerDFGToB3::compileValueSub): (JSC::FTL::DFG::LowerDFGToB3::compileUnaryMathIC): (JSC::FTL::DFG::LowerDFGToB3::compileBinaryMathIC): (JSC::FTL::DFG::LowerDFGToB3::compileArithAddOrSub): (JSC::FTL::DFG::LowerDFGToB3::compileArithMul): (JSC::FTL::DFG::LowerDFGToB3::compileValueNegate): * ftl/FTLOperations.cpp: (JSC::FTL::operationMaterializeObjectInOSR): * generate-bytecode-files: Removed. * generator/Argument.rb: Added. * generator/Assertion.rb: Added. * generator/DSL.rb: Added. * generator/Fits.rb: Added. * generator/GeneratedFile.rb: Added. * generator/Metadata.rb: Added. * generator/Opcode.rb: Added. * generator/OpcodeGroup.rb: Added. * generator/Options.rb: Added. * generator/Section.rb: Added. * generator/Template.rb: Added. * generator/Type.rb: Added. * generator/main.rb: Added. * interpreter/AbstractPC.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::currentVPC const): (JSC::CallFrame::setCurrentVPC): * interpreter/CallFrame.h: (JSC::CallSiteIndex::CallSiteIndex): (JSC::ExecState::setReturnPC): * interpreter/Interpreter.cpp: (WTF::printInternal): * interpreter/Interpreter.h: * interpreter/InterpreterInlines.h: * interpreter/StackVisitor.cpp: (JSC::StackVisitor::Frame::dump const): * interpreter/VMEntryRecord.h: * jit/JIT.cpp: (JSC::JIT::JIT): (JSC::JIT::emitSlowCaseCall): (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::compileWithoutLinking): (JSC::JIT::link): * jit/JIT.h: * jit/JITArithmetic.cpp: (JSC::JIT::emit_op_jless): (JSC::JIT::emit_op_jlesseq): (JSC::JIT::emit_op_jgreater): (JSC::JIT::emit_op_jgreatereq): (JSC::JIT::emit_op_jnless): (JSC::JIT::emit_op_jnlesseq): (JSC::JIT::emit_op_jngreater): (JSC::JIT::emit_op_jngreatereq): (JSC::JIT::emitSlow_op_jless): (JSC::JIT::emitSlow_op_jlesseq): (JSC::JIT::emitSlow_op_jgreater): (JSC::JIT::emitSlow_op_jgreatereq): (JSC::JIT::emitSlow_op_jnless): (JSC::JIT::emitSlow_op_jnlesseq): (JSC::JIT::emitSlow_op_jngreater): (JSC::JIT::emitSlow_op_jngreatereq): (JSC::JIT::emit_op_below): (JSC::JIT::emit_op_beloweq): (JSC::JIT::emit_op_jbelow): (JSC::JIT::emit_op_jbeloweq): (JSC::JIT::emit_op_unsigned): (JSC::JIT::emit_compareAndJump): (JSC::JIT::emit_compareUnsignedAndJump): (JSC::JIT::emit_compareUnsigned): (JSC::JIT::emit_compareAndJumpSlow): (JSC::JIT::emit_op_inc): (JSC::JIT::emit_op_dec): (JSC::JIT::emit_op_mod): (JSC::JIT::emitSlow_op_mod): (JSC::JIT::emit_op_negate): (JSC::JIT::emitSlow_op_negate): (JSC::JIT::emitBitBinaryOpFastPath): (JSC::JIT::emit_op_bitand): (JSC::JIT::emit_op_bitor): (JSC::JIT::emit_op_bitxor): (JSC::JIT::emit_op_lshift): (JSC::JIT::emitRightShiftFastPath): (JSC::JIT::emit_op_rshift): (JSC::JIT::emit_op_urshift): (JSC::getOperandTypes): (JSC::JIT::emit_op_add): (JSC::JIT::emitSlow_op_add): (JSC::JIT::emitMathICFast): (JSC::JIT::emitMathICSlow): (JSC::JIT::emit_op_div): (JSC::JIT::emit_op_mul): (JSC::JIT::emitSlow_op_mul): (JSC::JIT::emit_op_sub): (JSC::JIT::emitSlow_op_sub): * jit/JITCall.cpp: (JSC::JIT::emitPutCallResult): (JSC::JIT::compileSetupFrame): (JSC::JIT::compileCallEval): (JSC::JIT::compileCallEvalSlowCase): (JSC::JIT::compileTailCall): (JSC::JIT::compileOpCall): (JSC::JIT::compileOpCallSlowCase): (JSC::JIT::emit_op_call): (JSC::JIT::emit_op_tail_call): (JSC::JIT::emit_op_call_eval): (JSC::JIT::emit_op_call_varargs): (JSC::JIT::emit_op_tail_call_varargs): (JSC::JIT::emit_op_tail_call_forward_arguments): (JSC::JIT::emit_op_construct_varargs): (JSC::JIT::emit_op_construct): (JSC::JIT::emitSlow_op_call): (JSC::JIT::emitSlow_op_tail_call): (JSC::JIT::emitSlow_op_call_eval): (JSC::JIT::emitSlow_op_call_varargs): (JSC::JIT::emitSlow_op_tail_call_varargs): (JSC::JIT::emitSlow_op_tail_call_forward_arguments): (JSC::JIT::emitSlow_op_construct_varargs): (JSC::JIT::emitSlow_op_construct): * jit/JITDisassembler.cpp: (JSC::JITDisassembler::JITDisassembler): * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITInlines.h: (JSC::JIT::emitDoubleGetByVal): (JSC::JIT::emitLoadForArrayMode): (JSC::JIT::emitContiguousGetByVal): (JSC::JIT::emitArrayStorageGetByVal): (JSC::JIT::appendCallWithExceptionCheckSetJSValueResultWithProfile): (JSC::JIT::sampleInstruction): (JSC::JIT::emitValueProfilingSiteIfProfiledOpcode): (JSC::JIT::emitValueProfilingSite): (JSC::JIT::jumpTarget): (JSC::JIT::copiedGetPutInfo): (JSC::JIT::copiedArithProfile): * jit/JITMathIC.h: (JSC::isProfileEmpty): (JSC::JITBinaryMathIC::JITBinaryMathIC): (JSC::JITUnaryMathIC::JITUnaryMathIC): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_mov): (JSC::JIT::emit_op_end): (JSC::JIT::emit_op_jmp): (JSC::JIT::emit_op_new_object): (JSC::JIT::emitSlow_op_new_object): (JSC::JIT::emit_op_overrides_has_instance): (JSC::JIT::emit_op_instanceof): (JSC::JIT::emitSlow_op_instanceof): (JSC::JIT::emit_op_instanceof_custom): (JSC::JIT::emit_op_is_empty): (JSC::JIT::emit_op_is_undefined): (JSC::JIT::emit_op_is_boolean): (JSC::JIT::emit_op_is_number): (JSC::JIT::emit_op_is_cell_with_type): (JSC::JIT::emit_op_is_object): (JSC::JIT::emit_op_ret): (JSC::JIT::emit_op_to_primitive): (JSC::JIT::emit_op_set_function_name): (JSC::JIT::emit_op_not): (JSC::JIT::emit_op_jfalse): (JSC::JIT::emit_op_jeq_null): (JSC::JIT::emit_op_jneq_null): (JSC::JIT::emit_op_jneq_ptr): (JSC::JIT::emit_op_eq): (JSC::JIT::emit_op_jeq): (JSC::JIT::emit_op_jtrue): (JSC::JIT::emit_op_neq): (JSC::JIT::emit_op_jneq): (JSC::JIT::emit_op_throw): (JSC::JIT::compileOpStrictEq): (JSC::JIT::emit_op_stricteq): (JSC::JIT::emit_op_nstricteq): (JSC::JIT::compileOpStrictEqJump): (JSC::JIT::emit_op_jstricteq): (JSC::JIT::emit_op_jnstricteq): (JSC::JIT::emitSlow_op_jstricteq): (JSC::JIT::emitSlow_op_jnstricteq): (JSC::JIT::emit_op_to_number): (JSC::JIT::emit_op_to_string): (JSC::JIT::emit_op_to_object): (JSC::JIT::emit_op_catch): (JSC::JIT::emit_op_identity_with_profile): (JSC::JIT::emit_op_get_parent_scope): (JSC::JIT::emit_op_switch_imm): (JSC::JIT::emit_op_switch_char): (JSC::JIT::emit_op_switch_string): (JSC::JIT::emit_op_debug): (JSC::JIT::emit_op_eq_null): (JSC::JIT::emit_op_neq_null): (JSC::JIT::emit_op_enter): (JSC::JIT::emit_op_get_scope): (JSC::JIT::emit_op_to_this): (JSC::JIT::emit_op_create_this): (JSC::JIT::emit_op_check_tdz): (JSC::JIT::emitSlow_op_eq): (JSC::JIT::emitSlow_op_neq): (JSC::JIT::emitSlow_op_jeq): (JSC::JIT::emitSlow_op_jneq): (JSC::JIT::emitSlow_op_instanceof_custom): (JSC::JIT::emit_op_loop_hint): (JSC::JIT::emitSlow_op_loop_hint): (JSC::JIT::emit_op_check_traps): (JSC::JIT::emit_op_nop): (JSC::JIT::emit_op_super_sampler_begin): (JSC::JIT::emit_op_super_sampler_end): (JSC::JIT::emitSlow_op_check_traps): (JSC::JIT::emit_op_new_regexp): (JSC::JIT::emitNewFuncCommon): (JSC::JIT::emit_op_new_func): (JSC::JIT::emit_op_new_generator_func): (JSC::JIT::emit_op_new_async_generator_func): (JSC::JIT::emit_op_new_async_func): (JSC::JIT::emitNewFuncExprCommon): (JSC::JIT::emit_op_new_func_exp): (JSC::JIT::emit_op_new_generator_func_exp): (JSC::JIT::emit_op_new_async_func_exp): (JSC::JIT::emit_op_new_async_generator_func_exp): (JSC::JIT::emit_op_new_array): (JSC::JIT::emit_op_new_array_with_size): (JSC::JIT::emit_op_has_structure_property): (JSC::JIT::privateCompileHasIndexedProperty): (JSC::JIT::emit_op_has_indexed_property): (JSC::JIT::emitSlow_op_has_indexed_property): (JSC::JIT::emit_op_get_direct_pname): (JSC::JIT::emit_op_enumerator_structure_pname): (JSC::JIT::emit_op_enumerator_generic_pname): (JSC::JIT::emit_op_profile_type): (JSC::JIT::emit_op_log_shadow_chicken_prologue): (JSC::JIT::emit_op_log_shadow_chicken_tail): (JSC::JIT::emit_op_profile_control_flow): (JSC::JIT::emit_op_argument_count): (JSC::JIT::emit_op_get_rest_length): (JSC::JIT::emit_op_get_argument): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_to_this): * jit/JITOperations.cpp: * jit/JITOperations.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_get_by_val): (JSC::JIT::emitGetByValWithCachedId): (JSC::JIT::emitSlow_op_get_by_val): (JSC::JIT::emit_op_put_by_val_direct): (JSC::JIT::emit_op_put_by_val): (JSC::JIT::emitGenericContiguousPutByVal): (JSC::JIT::emitArrayStoragePutByVal): (JSC::JIT::emitPutByValWithCachedId): (JSC::JIT::emitSlow_op_put_by_val): (JSC::JIT::emit_op_put_getter_by_id): (JSC::JIT::emit_op_put_setter_by_id): (JSC::JIT::emit_op_put_getter_setter_by_id): (JSC::JIT::emit_op_put_getter_by_val): (JSC::JIT::emit_op_put_setter_by_val): (JSC::JIT::emit_op_del_by_id): (JSC::JIT::emit_op_del_by_val): (JSC::JIT::emit_op_try_get_by_id): (JSC::JIT::emitSlow_op_try_get_by_id): (JSC::JIT::emit_op_get_by_id_direct): (JSC::JIT::emitSlow_op_get_by_id_direct): (JSC::JIT::emit_op_get_by_id): (JSC::JIT::emit_op_get_by_id_with_this): (JSC::JIT::emitSlow_op_get_by_id): (JSC::JIT::emitSlow_op_get_by_id_with_this): (JSC::JIT::emit_op_put_by_id): (JSC::JIT::emitSlow_op_put_by_id): (JSC::JIT::emit_op_in_by_id): (JSC::JIT::emitSlow_op_in_by_id): (JSC::JIT::emit_op_resolve_scope): (JSC::JIT::emit_op_get_from_scope): (JSC::JIT::emitSlow_op_get_from_scope): (JSC::JIT::emit_op_put_to_scope): (JSC::JIT::emitSlow_op_put_to_scope): (JSC::JIT::emit_op_get_from_arguments): (JSC::JIT::emit_op_put_to_arguments): (JSC::JIT::privateCompileGetByVal): (JSC::JIT::privateCompileGetByValWithCachedId): (JSC::JIT::privateCompilePutByVal): (JSC::JIT::privateCompilePutByValWithCachedId): (JSC::JIT::emitDoubleLoad): (JSC::JIT::emitContiguousLoad): (JSC::JIT::emitArrayStorageLoad): (JSC::JIT::emitDirectArgumentsGetByVal): (JSC::JIT::emitScopedArgumentsGetByVal): (JSC::JIT::emitIntTypedArrayGetByVal): (JSC::JIT::emitFloatTypedArrayGetByVal): (JSC::JIT::emitIntTypedArrayPutByVal): (JSC::JIT::emitFloatTypedArrayPutByVal): * jit/RegisterSet.cpp: (JSC::RegisterSet::llintBaselineCalleeSaveRegisters): * jit/SlowPathCall.h: (JSC::JITSlowPathCall::JITSlowPathCall): * llint/LLIntData.cpp: (JSC::LLInt::initialize): (JSC::LLInt::Data::performAssertions): * llint/LLIntData.h: (JSC::LLInt::exceptionInstructions): (JSC::LLInt::opcodeMap): (JSC::LLInt::opcodeMapWide): (JSC::LLInt::getOpcode): (JSC::LLInt::getOpcodeWide): (JSC::LLInt::getWideCodePtr): * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::llint_trace_operand): (JSC::LLInt::llint_trace_value): (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::entryOSR): (JSC::LLInt::setupGetByIdPrototypeCache): (JSC::LLInt::getByVal): (JSC::LLInt::handleHostCall): (JSC::LLInt::setUpCall): (JSC::LLInt::genericCall): (JSC::LLInt::varargsSetup): (JSC::LLInt::commonCallEval): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter.cpp: (JSC::CLoopRegister::operator const Instruction*): (JSC::CLoop::execute): * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * offlineasm/arm64.rb: * offlineasm/asm.rb: * offlineasm/ast.rb: * offlineasm/cloop.rb: * offlineasm/generate_offset_extractor.rb: * offlineasm/instructions.rb: * offlineasm/offsets.rb: * offlineasm/parser.rb: * offlineasm/transform.rb: * offlineasm/x86.rb: * parser/ResultType.h: (JSC::ResultType::dump const): (JSC::OperandTypes::first const): (JSC::OperandTypes::second const): (JSC::OperandTypes::dump const): * profiler/ProfilerBytecodeSequence.cpp: (JSC::Profiler::BytecodeSequence::BytecodeSequence): * runtime/CommonSlowPaths.cpp: (JSC::SLOW_PATH_DECL): (JSC::updateArithProfileForUnaryArithOp): (JSC::updateArithProfileForBinaryArithOp): * runtime/CommonSlowPaths.h: (JSC::CommonSlowPaths::tryCachePutToScopeGlobal): (JSC::CommonSlowPaths::tryCacheGetFromScopeGlobal): * runtime/ExceptionFuzz.cpp: (JSC::doExceptionFuzzing): * runtime/ExceptionFuzz.h: (JSC::doExceptionFuzzingIfEnabled): * runtime/GetPutInfo.cpp: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. (JSC::GetPutInfo::dump const): (WTF::printInternal): * runtime/GetPutInfo.h: (JSC::GetPutInfo::operand const): * runtime/JSCPoison.h: * runtime/JSType.cpp: Added. (WTF::printInternal): * runtime/JSType.h: * runtime/SamplingProfiler.cpp: (JSC::SamplingProfiler::StackFrame::displayName): * runtime/SamplingProfiler.h: (JSC::SamplingProfiler::UnprocessedStackFrame::UnprocessedStackFrame): * runtime/SlowPathReturnType.h: (JSC::encodeResult): (JSC::decodeResult): * runtime/VM.h: * runtime/Watchdog.h: * tools/HeapVerifier.cpp: Source/WTF: * wtf/Forward.h: Fix WTF_LAZY_FOR_EACH_TERM on MSVC and add WTF_LAZY_HAS_REST to check whether a macro was passed multiple arguments * wtf/Platform.h: Force ENABLE_JIT=false on all 32-bit platforms * wtf/Vector.h: (WTF::minCapacity>::insertVector): Allow vectors with different overflow handlers to be passed to insertVector Tools: Do not force ENABLE_JIT=true when $forceCLoop is false. * Scripts/build-jsc: LayoutTests: Don't use recursion on `equal` to avoid premature stack overflows when testing deep arrays. * fast/dom/Window/resources/postmessage-test.js: Canonical link: https://commits.webkit.org/205839@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-29 13:16:03 +00:00
runtime/GetPutInfo.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/GetterSetter.cpp
[JSC] Shrink sizeof(FunctionExecutable) by 16bytes https://bugs.webkit.org/show_bug.cgi?id=196122 Reviewed by Saam Barati. This patch reduces sizeof(FunctionExecutable) by 16 bytes. 1. ScriptExecutable::m_numParametersForCall and ScriptExecutable::m_numParametersForConstruct are not used in a meaningful way. Removed them. 2. ScriptExecutable::m_lastLine and ScriptExecutable::m_endColumn can be calculated from UnlinkedFunctionExecutable. So FunctionExecutable does not need to hold it. This patch adds GlobalExecutable, which are non-function ScriptExecutables, and move m_lastLine and m_endColumn to this class. 3. FunctionExecutable still needs to have the feature overriding m_lastLine and m_endColumn. We move overridden data in FunctionExecutable::RareData. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/UnlinkedFunctionExecutable.cpp: (JSC::UnlinkedFunctionExecutable::link): * runtime/EvalExecutable.cpp: (JSC::EvalExecutable::EvalExecutable): * runtime/EvalExecutable.h: * runtime/FunctionExecutable.cpp: (JSC::FunctionExecutable::FunctionExecutable): (JSC::FunctionExecutable::ensureRareDataSlow): (JSC::FunctionExecutable::overrideInfo): * runtime/FunctionExecutable.h: * runtime/GlobalExecutable.cpp: Copied from Source/JavaScriptCore/tools/FunctionOverrides.h. * runtime/GlobalExecutable.h: Copied from Source/JavaScriptCore/tools/FunctionOverrides.h. (JSC::GlobalExecutable::lastLine const): (JSC::GlobalExecutable::endColumn const): (JSC::GlobalExecutable::recordParse): (JSC::GlobalExecutable::GlobalExecutable): * runtime/ModuleProgramExecutable.cpp: (JSC::ModuleProgramExecutable::ModuleProgramExecutable): * runtime/ModuleProgramExecutable.h: * runtime/ProgramExecutable.cpp: (JSC::ProgramExecutable::ProgramExecutable): * runtime/ProgramExecutable.h: * runtime/ScriptExecutable.cpp: (JSC::ScriptExecutable::clearCode): (JSC::ScriptExecutable::installCode): (JSC::ScriptExecutable::hasClearableCode const): (JSC::ScriptExecutable::newCodeBlockFor): (JSC::ScriptExecutable::typeProfilingEndOffset const): (JSC::ScriptExecutable::recordParse): (JSC::ScriptExecutable::lastLine const): (JSC::ScriptExecutable::endColumn const): * runtime/ScriptExecutable.h: (JSC::ScriptExecutable::hasJITCodeForCall const): (JSC::ScriptExecutable::hasJITCodeForConstruct const): (JSC::ScriptExecutable::recordParse): (JSC::ScriptExecutable::lastLine const): Deleted. (JSC::ScriptExecutable::endColumn const): Deleted. * tools/FunctionOverrides.h: Canonical link: https://commits.webkit.org/210428@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243365 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-22 07:14:43 +00:00
runtime/GlobalExecutable.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/HashMapImpl.cpp
runtime/Identifier.cpp
runtime/IndexingType.cpp
runtime/IndirectEvalExecutable.cpp
runtime/InitializeThreading.cpp
runtime/InternalFunction.cpp
runtime/Intrinsic.cpp
[JSC] Cache UDateTimePatternGenerator https://bugs.webkit.org/show_bug.cgi?id=213454 Reviewed by Ross Kirsling. JSTests: * microbenchmarks/date-to-locale-date-string.js: Added. * microbenchmarks/date-to-locale-string.js: Added. * microbenchmarks/date-to-locale-time-string.js: Added. Source/JavaScriptCore: ICU udatpg_open function is particularly slow. As a result, 80~% of time is used by this function when calling Date#toLocaleString. We should have last-used cache in VM, which covers major cases like, "One locale (possibly default locale) is used and continuously use toLocaleString with that locale". This significantly improves toLocaleString / toLocaleDateString / toLocaleTimeString performance. ToT Patched date-to-locale-string 392.0092+-0.6811 ^ 87.3196+-3.1598 ^ definitely 4.4894x faster date-to-locale-date-string 377.9117+-7.8701 ^ 70.4155+-3.6661 ^ definitely 5.3669x faster date-to-locale-time-string 373.1970+-3.0142 ^ 67.3790+-2.8952 ^ definitely 5.5388x faster * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * runtime/IntlCache.cpp: Added. (JSC::IntlCache::cacheSharedPatternGenerator): (JSC::IntlCache::getBestDateTimePattern): * runtime/IntlCache.h: Added. (JSC::IntlCache::getSharedPatternGenerator): * runtime/IntlDateTimeFormat.cpp: (JSC::IntlDateTimeFormat::initializeDateTimeFormat): * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: (JSC::VM::intlCache): Canonical link: https://commits.webkit.org/229408@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267132 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-16 04:23:41 +00:00
runtime/IntlCache.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/IntlCollator.cpp
runtime/IntlCollatorConstructor.cpp
runtime/IntlCollatorPrototype.cpp
[JSC] Implement Intl.DateTimeFormat.formatRangeToParts https://bugs.webkit.org/show_bug.cgi?id=213822 <rdar://problem/69328711> Reviewed by Ross Kirsling. JSTests: * stress/intl-datetimeformat-formatrange-relevant-extensions.js: * stress/intl-datetimeformat-formatrange-should-not-handle-gregorian-change-date.js: Added. (shouldBe): (vm.icuHeaderVersion): * stress/intl-datetimeformat-formatrange.js: (shouldThrow): (test): * stress/intl-datetimeformat-formatrangetoparts-relevant-extensions-ja.js: Added. (shouldBe): (compareParts): (shouldThrow): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt1.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt2.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt3.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt4.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt5.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.vm.icuVersion): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt6.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt7.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt8.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt9.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt10.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt11.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt12.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt13.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt14.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt15.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt16.formatRangeToParts): * stress/intl-datetimeformat-formatrangetoparts-relevant-extensions.js: Added. (shouldBe): (compareParts): (shouldThrow): * stress/intl-datetimeformat-formatrangetoparts-should-not-handle-gregorian-change-date.js: Added. (shouldBe): (compareParts): (vm.icuHeaderVersion): * stress/intl-datetimeformat-formatrangetoparts.js: Added. (shouldBe): (compareParts): (shouldThrow): * test262/config.yaml: * test262/expectations.yaml: This failure is because of CLDR data inside ICU. ICU 67 will fix them. Source/JavaScriptCore: This patch implements Intl.DateTimeFormat.formatRangeToParts. It is already stage-4 (included in the spec). The inputs are date interval, and this function generates array of parts of formatted string of date interval. Currently, required ICU APIs are draft status. So, for now, we track ABI changes, and use APIs with careful version checks. However, currently, OpenSource macOS WebKit is built with specific ICU header (ICU 62 headers). So for now, we disable it in OpenSource macOS WebKit build. But we enable it for Apple Internal SDK WebKit build. We can enable it if we include multiple ICU header sets and select appropriate one against the linked ICU version. In the other platforms, they are using corresponding ICU headers so that we can just enable it. There are two interesting implementation topics. 1. From ICU 67, the signature of udtitvfmt_formatToResult is changed. We need to switch the implementation with fine grained ICU version checks. 2. udtitvfmt_formatToResult does not have an ability to configure gregorian calendar change date: before that date, the calendar is julian. In ECMAScript spec, we need to ignore this gregorian calendar change date, and we should handle all gregorian calendar dates as is even if the dates are older than gregorian calendar change date. However, since udtitvfmt_formatToResult does not offer the above ability, ICU automatically switches the calendar between gregorian and julian. To fix this issue, ICU 67 introduced udtitvfmt_formatCalendarToResult, which can take an explicit calendar for each input date so that we configure gregorian calendar change date. But this only exists after ICU 67. In the implementations using ICU 64-66, we just use udtitvfmt_formatToResult. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * runtime/IntlDateTimeFormat.cpp: (JSC::UDateIntervalFormatDeleter::operator()): (JSC::IntlDateTimeFormat::formatToParts const): (JSC::definitelyAfterGregorianCalendarChangeDate): (JSC::formattedValueFromDateRange): (JSC::IntlDateTimeFormat::formatRange): (JSC::IntlDateTimeFormat::formatRangeToParts): * runtime/IntlDateTimeFormat.h: * runtime/IntlDateTimeFormatPrototype.cpp: (JSC::IntlDateTimeFormatPrototype::create): (JSC::IntlDateTimeFormatPrototype::finishCreation): (JSC::JSC_DEFINE_HOST_FUNCTION): * runtime/IntlDateTimeFormatPrototype.h: * runtime/OptionsList.h: Canonical link: https://commits.webkit.org/231485@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269706 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-12 00:25:17 +00:00
runtime/IntlDateTimeFormat.cpp @no-unify // Confine U_HIDE_DRAFT_API's effect to this file.
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/IntlDateTimeFormatConstructor.cpp
runtime/IntlDateTimeFormatPrototype.cpp
[ECMA-402] Implement Intl.DisplayNames https://bugs.webkit.org/show_bug.cgi?id=209779 Reviewed by Ross Kirsling. JSTests: * stress/intl-displaynames.js: Added. (shouldBe): (shouldThrow): (vm.icuVersion): * stress/intl-parse-unicode-subtags.js: Added. (shouldBe): (shouldThrow): (vm.icuVersion): * test262/config.yaml: Source/JavaScriptCore: This patch implements Intl.DisplayNames behind useIntlDisplayNames=1 flag. Intl.DisplayNames can offer readable "display-name" for ICU language, script, region, currency codes. For example, it can offer "United States" string for "US" region code. We use ICU ULocaleDisplayNames to implement it, except for currency since ULocaleDisplayNames is not supporting currency correctly: it ignores "long", "short", and "narrow" style configurations. We need to call ucurr_getName directly. This patch appropriately adds unicode-language-id parsing in IntlLocale.cpp so that we can validate language id when it is passed to `Intl.DisplayNames#of` as defined in the spec. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * runtime/CommonIdentifiers.h: * runtime/IntlDisplayNames.cpp: Added. (JSC::IntlDisplayNames::create): (JSC::IntlDisplayNames::createStructure): (JSC::IntlDisplayNames::IntlDisplayNames): (JSC::IntlDisplayNames::finishCreation): (JSC::IntlDisplayNames::initializeDisplayNames): (JSC::IntlDisplayNames::of const): (JSC::IntlDisplayNames::resolvedOptions const): (JSC::IntlDisplayNames::styleString): (JSC::IntlDisplayNames::typeString): (JSC::IntlDisplayNames::fallbackString): * runtime/IntlDisplayNames.h: Copied from Source/JavaScriptCore/runtime/IntlRelativeTimeFormat.h. * runtime/IntlDisplayNamesConstructor.cpp: Added. (JSC::IntlDisplayNamesConstructor::create): (JSC::IntlDisplayNamesConstructor::createStructure): (JSC::IntlDisplayNamesConstructor::IntlDisplayNamesConstructor): (JSC::IntlDisplayNamesConstructor::finishCreation): (JSC::constructIntlDisplayNames): (JSC::callIntlDisplayNames): (JSC::IntlDisplayNamesConstructorSupportedLocalesOf): * runtime/IntlDisplayNamesConstructor.h: Added. * runtime/IntlDisplayNamesPrototype.cpp: Added. (JSC::IntlDisplayNamesPrototype::create): (JSC::IntlDisplayNamesPrototype::createStructure): (JSC::IntlDisplayNamesPrototype::IntlDisplayNamesPrototype): (JSC::IntlDisplayNamesPrototype::finishCreation): (JSC::IntlDisplayNamesPrototypeFuncOf): (JSC::IntlDisplayNamesPrototypeFuncResolvedOptions): * runtime/IntlDisplayNamesPrototype.h: Added. * runtime/IntlLocale.cpp: (JSC::isUnicodeLanguageSubtag): Deleted. (JSC::isUnicodeScriptSubtag): Deleted. (JSC::isUnicodeRegionSubtag): Deleted. * runtime/IntlNumberFormat.cpp: (JSC::IntlNumberFormat::initializeNumberFormat): * runtime/IntlObject.cpp: (JSC::createDisplayNamesConstructor): (JSC::IntlObject::finishCreation): (JSC::isUnicodeLanguageSubtag): (JSC::isUnicodeScriptSubtag): (JSC::isUnicodeRegionSubtag): (JSC::isUnicodeVariantSubtag): (JSC::isUnicodeLanguageId): (JSC::isWellFormedCurrencyCode): * runtime/IntlObject.h: (JSC::intlDisplayNamesAvailableLocales): * runtime/IntlRelativeTimeFormat.h: * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::displayNamesStructure): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Source/WTF: * wtf/text/StringView.h: Canonical link: https://commits.webkit.org/227385@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@264639 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-07-21 00:04:06 +00:00
runtime/IntlDisplayNames.cpp
runtime/IntlDisplayNamesConstructor.cpp
runtime/IntlDisplayNamesPrototype.cpp
[JSC] Implement Intl.DateTimeFormat.formatRangeToParts https://bugs.webkit.org/show_bug.cgi?id=213822 <rdar://problem/69328711> Reviewed by Ross Kirsling. JSTests: * stress/intl-datetimeformat-formatrange-relevant-extensions.js: * stress/intl-datetimeformat-formatrange-should-not-handle-gregorian-change-date.js: Added. (shouldBe): (vm.icuHeaderVersion): * stress/intl-datetimeformat-formatrange.js: (shouldThrow): (test): * stress/intl-datetimeformat-formatrangetoparts-relevant-extensions-ja.js: Added. (shouldBe): (compareParts): (shouldThrow): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt1.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt2.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt3.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt4.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt5.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.vm.icuVersion): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt6.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt7.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt8.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt9.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt10.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt11.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt12.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt13.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt14.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt15.formatRangeToParts): (Intl.DateTimeFormat.formatRangeToParts.compareParts.fmt16.formatRangeToParts): * stress/intl-datetimeformat-formatrangetoparts-relevant-extensions.js: Added. (shouldBe): (compareParts): (shouldThrow): * stress/intl-datetimeformat-formatrangetoparts-should-not-handle-gregorian-change-date.js: Added. (shouldBe): (compareParts): (vm.icuHeaderVersion): * stress/intl-datetimeformat-formatrangetoparts.js: Added. (shouldBe): (compareParts): (shouldThrow): * test262/config.yaml: * test262/expectations.yaml: This failure is because of CLDR data inside ICU. ICU 67 will fix them. Source/JavaScriptCore: This patch implements Intl.DateTimeFormat.formatRangeToParts. It is already stage-4 (included in the spec). The inputs are date interval, and this function generates array of parts of formatted string of date interval. Currently, required ICU APIs are draft status. So, for now, we track ABI changes, and use APIs with careful version checks. However, currently, OpenSource macOS WebKit is built with specific ICU header (ICU 62 headers). So for now, we disable it in OpenSource macOS WebKit build. But we enable it for Apple Internal SDK WebKit build. We can enable it if we include multiple ICU header sets and select appropriate one against the linked ICU version. In the other platforms, they are using corresponding ICU headers so that we can just enable it. There are two interesting implementation topics. 1. From ICU 67, the signature of udtitvfmt_formatToResult is changed. We need to switch the implementation with fine grained ICU version checks. 2. udtitvfmt_formatToResult does not have an ability to configure gregorian calendar change date: before that date, the calendar is julian. In ECMAScript spec, we need to ignore this gregorian calendar change date, and we should handle all gregorian calendar dates as is even if the dates are older than gregorian calendar change date. However, since udtitvfmt_formatToResult does not offer the above ability, ICU automatically switches the calendar between gregorian and julian. To fix this issue, ICU 67 introduced udtitvfmt_formatCalendarToResult, which can take an explicit calendar for each input date so that we configure gregorian calendar change date. But this only exists after ICU 67. In the implementations using ICU 64-66, we just use udtitvfmt_formatToResult. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * runtime/IntlDateTimeFormat.cpp: (JSC::UDateIntervalFormatDeleter::operator()): (JSC::IntlDateTimeFormat::formatToParts const): (JSC::definitelyAfterGregorianCalendarChangeDate): (JSC::formattedValueFromDateRange): (JSC::IntlDateTimeFormat::formatRange): (JSC::IntlDateTimeFormat::formatRangeToParts): * runtime/IntlDateTimeFormat.h: * runtime/IntlDateTimeFormatPrototype.cpp: (JSC::IntlDateTimeFormatPrototype::create): (JSC::IntlDateTimeFormatPrototype::finishCreation): (JSC::JSC_DEFINE_HOST_FUNCTION): * runtime/IntlDateTimeFormatPrototype.h: * runtime/OptionsList.h: Canonical link: https://commits.webkit.org/231485@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269706 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-12 00:25:17 +00:00
runtime/IntlListFormat.cpp @no-unify // Confine U_HIDE_DRAFT_API's effect in this file.
[ECMA-402] Implement Intl.ListFormat https://bugs.webkit.org/show_bug.cgi?id=209775 Reviewed by Ross Kirsling. JSTests: * stress/intl-listformat.js: Added. (shouldBe): (shouldNotThrow): (shouldThrow): (test.DerivedListFormat): (test.get shouldThrow): (test): Source/JavaScriptCore: This patch implements Intl.ListFormat. Intl.ListFormat requires ulistfmt_openForType. But it is available after ICU 67, and it is draft (unstable) API in ICU 67. But now, this function is stable in ICU 68 without signature change and no major change happened to this API. Thus, we can assume that this API signature won't be changed. We specially undef U_HIDE_DRAFT_API for unicode/ulistformatter.h to use this draft (but stable) APIs. While macOS / iOS shipping ICU (AppleICU) is ICU 66, AppleICU has ulistfmt_openForType and related APIs even in ICU 66. We use these APIs in AppleICU 66 to implement Intl.ListFormat. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * runtime/CommonIdentifiers.h: * runtime/IntlDisplayNames.cpp: (JSC::IntlDisplayNames::initializeDisplayNames): * runtime/IntlListFormat.cpp: Added. (JSC::UListFormatterDeleter::operator()): (JSC::IntlListFormat::create): (JSC::IntlListFormat::createStructure): (JSC::IntlListFormat::IntlListFormat): (JSC::IntlListFormat::finishCreation): (JSC::IntlListFormat::initializeListFormat): (JSC::stringListFromIterable): (JSC::ListFormatInput::ListFormatInput): (JSC::ListFormatInput::size const): (JSC::ListFormatInput::stringPointers const): (JSC::ListFormatInput::stringLengths const): (JSC::IntlListFormat::format const): (JSC::IntlListFormat::formatToParts const): (JSC::IntlListFormat::resolvedOptions const): (JSC::IntlListFormat::styleString): (JSC::IntlListFormat::typeString): * runtime/IntlListFormat.h: Added. * runtime/IntlListFormatConstructor.cpp: Added. (JSC::IntlListFormatConstructor::create): (JSC::IntlListFormatConstructor::createStructure): (JSC::IntlListFormatConstructor::IntlListFormatConstructor): (JSC::IntlListFormatConstructor::finishCreation): (JSC::JSC_DEFINE_HOST_FUNCTION): * runtime/IntlListFormatConstructor.h: Added. * runtime/IntlListFormatPrototype.cpp: Added. (JSC::IntlListFormatPrototype::create): (JSC::IntlListFormatPrototype::createStructure): (JSC::IntlListFormatPrototype::IntlListFormatPrototype): (JSC::IntlListFormatPrototype::finishCreation): (JSC::JSC_DEFINE_HOST_FUNCTION): * runtime/IntlListFormatPrototype.h: Added. * runtime/IntlObject.cpp: (JSC::createListFormatConstructor): (JSC::IntlObject::finishCreation): * runtime/IntlObject.h: (JSC::intlListFormatAvailableLocales): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::listFormatStructure): * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Canonical link: https://commits.webkit.org/230860@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268956 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-25 06:20:47 +00:00
runtime/IntlListFormatConstructor.cpp
runtime/IntlListFormatPrototype.cpp
[ECMA-402] Implement Intl.Locale https://bugs.webkit.org/show_bug.cgi?id=209772 Reviewed by Darin Adler and Saam Barati. JSTests: * stress/intl-locale.js: Added. * stress/intl-locale-as-intl-param.js: Added. * test262/config.yaml: Enable Intl.Locale feature with flag. * test262/expectations.yaml: Mark known failures. None of these should be specific to Intl.Locale. Source/JavaScriptCore: This patch implements the recent ECMA-402 feature Intl.Locale. This is effectively a wrapper class for all the pieces of uloc.h that ECMA-402 cares about. (If we used the C++ API, there's a LocaleBuilder that would make this much easier, but in sticking to the C API, it's basically an object that has an ICU localeID as data and uloc_* functions as methods / getters. Furthermore, there's no way to modify said data, so every method / getter can be lazy and cache its result.) Usage example: >>> locale = new Intl.Locale('ja', { region: 'JP', calendar: 'japanese', numeric: false }) "ja-JP-u-ca-japanese-kn-false" >>> locale.baseName "ja-JP" Intl.Locale can be used anywhere that Intl APIs accept locale strings as input parameters, and is moreover hoped to be the class by which future Web APIs will handle the current locale. This feature is runtime-guarded by the `useIntlLocale` option. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * runtime/CommonIdentifiers.h: * runtime/IntlLocale.cpp: Added. * runtime/IntlLocale.h: Added. * runtime/IntlLocaleConstructor.cpp: Added. * runtime/IntlLocaleConstructor.h: Added. * runtime/IntlLocalePrototype.cpp: Added. * runtime/IntlLocalePrototype.h: Added. * runtime/IntlObject.cpp: (JSC::IntlObject::finishCreation): (JSC::localeIDBufferForLanguageTag): Added. (JSC::languageTagForLocaleID): Renamed from JSC::convertICULocaleToBCP47LanguageTag. (JSC::intlAvailableLocales): (JSC::intlCollatorAvailableLocales): (JSC::canonicalizeLanguageTag): (JSC::canonicalizeLocaleList): (JSC::defaultLocale): * runtime/IntlObject.h: * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::collatorStructure): (JSC::JSGlobalObject::numberFormatStructure): (JSC::JSGlobalObject::localeStructure): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Tools: * Scripts/run-jsc-stress-tests: Add runIntlLocaleEnabled. Canonical link: https://commits.webkit.org/224388@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261215 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-06 06:01:07 +00:00
runtime/IntlLocale.cpp
runtime/IntlLocaleConstructor.cpp
runtime/IntlLocalePrototype.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/IntlNumberFormat.cpp
runtime/IntlNumberFormatConstructor.cpp
runtime/IntlNumberFormatPrototype.cpp
runtime/IntlObject.cpp
[INTL] Implement Intl.PluralRules https://bugs.webkit.org/show_bug.cgi?id=184312 Patch by Andy VanWagoner <thetalecrafter@gmail.com> on 2018-04-26 Reviewed by JF Bastien. .: Added Intl.PluralRules feature flag. * Source/cmake/WebKitFeatures.cmake: Source/JavaScriptCore: Use UNumberFormat to enforce formatting, and then UPluralRules to find the correct plural rule for the given number. Relies on ICU v59+ for resolvedOptions().pluralCategories and trailing 0 detection. Behind the useIntlPluralRules option and INTL_PLURAL_RULES flag. * CMakeLists.txt: * Configurations/FeatureDefines.xcconfig: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/BuiltinNames.h: * runtime/BigIntObject.cpp: (JSC::BigIntObject::create): Moved to ensure complete JSGlobalObject definition. * runtime/BigIntObject.h: * runtime/CommonIdentifiers.h: * runtime/IntlObject.cpp: (JSC::IntlObject::finishCreation): * runtime/IntlObject.h: * runtime/IntlPluralRules.cpp: Added. (JSC::IntlPluralRules::UPluralRulesDeleter::operator() const): (JSC::IntlPluralRules::UNumberFormatDeleter::operator() const): (JSC::UEnumerationDeleter::operator() const): (JSC::IntlPluralRules::create): (JSC::IntlPluralRules::createStructure): (JSC::IntlPluralRules::IntlPluralRules): (JSC::IntlPluralRules::finishCreation): (JSC::IntlPluralRules::destroy): (JSC::IntlPluralRules::visitChildren): (JSC::IntlPRInternal::localeData): (JSC::IntlPluralRules::initializePluralRules): (JSC::IntlPluralRules::resolvedOptions): (JSC::IntlPluralRules::select): * runtime/IntlPluralRules.h: Added. * runtime/IntlPluralRulesConstructor.cpp: Added. (JSC::IntlPluralRulesConstructor::create): (JSC::IntlPluralRulesConstructor::createStructure): (JSC::IntlPluralRulesConstructor::IntlPluralRulesConstructor): (JSC::IntlPluralRulesConstructor::finishCreation): (JSC::constructIntlPluralRules): (JSC::callIntlPluralRules): (JSC::IntlPluralRulesConstructorFuncSupportedLocalesOf): (JSC::IntlPluralRulesConstructor::visitChildren): * runtime/IntlPluralRulesConstructor.h: Added. * runtime/IntlPluralRulesPrototype.cpp: Added. (JSC::IntlPluralRulesPrototype::create): (JSC::IntlPluralRulesPrototype::createStructure): (JSC::IntlPluralRulesPrototype::IntlPluralRulesPrototype): (JSC::IntlPluralRulesPrototype::finishCreation): (JSC::IntlPluralRulesPrototypeFuncSelect): (JSC::IntlPluralRulesPrototypeFuncResolvedOptions): * runtime/IntlPluralRulesPrototype.h: Added. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::intlPluralRulesAvailableLocales): * runtime/JSGlobalObject.h: * runtime/Options.h: * runtime/RegExpPrototype.cpp: Added inlines header. * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Source/WebCore: Added Intl.PluralRules feature flag. Test: js/intl-pluralrules.html * Configurations/FeatureDefines.xcconfig: Source/WebCore/PAL: Added Intl.PluralRules feature flag. * Configurations/FeatureDefines.xcconfig: Source/WebKit: Added Intl.PluralRules feature flag. * Configurations/FeatureDefines.xcconfig: Source/WebKitLegacy/mac: Added Intl.PluralRules feature flag. * Configurations/FeatureDefines.xcconfig: Source/WTF: Added Intl.PluralRules feature flag. * wtf/FeatureDefines.h: Tools: Added Intl.PluralRules feature flag. * Scripts/webkitperl/FeatureList.pm: * TestWebKitAPI/Configurations/FeatureDefines.xcconfig: LayoutTests: * js/intl-pluralrules-expected.txt: Added. * js/intl-pluralrules.html: Added. * js/script-tests/intl-pluralrules.js: Added. * platform/win/TestExpectations: Disabled Intl.PluralRules tests on win. Canonical link: https://commits.webkit.org/200516@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231047 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-04-26 16:37:26 +00:00
runtime/IntlPluralRules.cpp
runtime/IntlPluralRulesConstructor.cpp
runtime/IntlPluralRulesPrototype.cpp
[ECMA-402] Intl.RelativeTimeFormat missing in WebKit https://bugs.webkit.org/show_bug.cgi?id=209770 Reviewed by Darin Adler. JSTests: * stress/intl-relativetimeformat.js: Added. * test262/config.yaml: Enable Intl.RelativeTimeFormat feature with flag. * test262/expectations.yaml: Mark known failures. Test for locale validation is not specific to RelativeTimeFormat and should be investigated separately. Tests for Polish appear to be wrong and should be corrected in test262. Source/JavaScriptCore: This patch implements the recent ECMA-402 feature Intl.RelativeTimeFormat. RelativeTimeFormat has format / formatToParts functions like NumberFormat / DateTimeFormat and is used to turn a number and unit into a formatted relative time string, e.g.: new Intl.RelativeTimeFormat('en').format(10, 'day') > 'in 10 days' new Intl.RelativeTimeFormat('en', { numeric: 'auto' }).format(0, 'day') > 'today' Implementation of RelativeTimeFormat#formatToParts makes direct use of NumberFormat#formatToParts, as the relative time string consists of at most one formatted number with optional literal text on either side. This feature is runtime-guarded by the `useIntlRelativeTimeFormat` option. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * runtime/CommonIdentifiers.h: * runtime/IntlRelativeTimeFormat.cpp: Added. * runtime/IntlRelativeTimeFormat.h: Added. * runtime/IntlRelativeTimeFormatConstructor.cpp: Added. * runtime/IntlRelativeTimeFormatConstructor.h: Added. * runtime/IntlRelativeTimeFormatPrototype.cpp: Added. * runtime/IntlRelativeTimeFormatPrototype.h: Added. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::relativeTimeFormatStructure): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Add feature and runtime option. * runtime/IntlDateTimeFormat.cpp: (JSC::IntlDateTimeFormat::formatToParts): * runtime/IntlPluralRules.cpp: (JSC::IntlPluralRules::initializePluralRules): (JSC::IntlPluralRules::resolvedOptions): Make "type" a property name. * runtime/IntlNumberFormat.cpp: (JSC::IntlNumberFormat::initializeNumberFormat): (JSC::IntlNumberFormat::resolvedOptions): (JSC::IntlNumberFormat::formatToPartsInternal): (JSC::IntlNumberFormat::formatToParts): * runtime/IntlNumberFormat.h: Factor out formatToPartsInternal so that RelativeTimeFormat can use it with its own UNumberFormat. (This logic is too complicated to duplicate; it's because ICU won't split, e.g., "10,000" into parts for us.) * runtime/IntlObject.cpp: (JSC::IntlObject::IntlObject): (JSC::IntlObject::create): (JSC::IntlObject::finishCreation): (JSC::intlAvailableLocales): (JSC::intlCollatorAvailableLocales): (JSC::isUnicodeLocaleIdentifierType): (JSC::supportedLocales): (JSC::intlDateTimeFormatAvailableLocales): Deleted. (JSC::intlNumberFormatAvailableLocales): Deleted. * runtime/IntlObject.h: (JSC::intlDateTimeFormatAvailableLocales): (JSC::intlNumberFormatAvailableLocales): (JSC::intlPluralRulesAvailableLocales): (JSC::intlRelativeTimeFormatAvailableLocales): Perform three corrections for Intl classes: 1. Collator should be the only class with unique "available locales". [unum|udat]_getAvailable exist but they've deferred to uloc_getAvailable for 20 years. 2. isUnicodeLocaleIdentifierType isn't just `alphanum{3,8}` but rather `alphanum{3,8} (sep alphanum{3,8})*`. This is my own mistake from r239941. 3. supportedLocalesOf entries should not be frozen. Changed in https://github.com/tc39/ecma402/pull/278. * tools/JSDollarVM.cpp: (JSC::functionICUVersion): (JSC::JSDollarVM::finishCreation): Add $vm.icuVersion so that we can add per-line skips to stress tests. Tools: * Scripts/run-jsc-stress-tests: Add runIntlRelativeTimeFormatEnabled. Canonical link: https://commits.webkit.org/223609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260349 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-20 05:15:35 +00:00
runtime/IntlRelativeTimeFormat.cpp
runtime/IntlRelativeTimeFormatConstructor.cpp
runtime/IntlRelativeTimeFormatPrototype.cpp
[JSC] Add Intl.Segmenter https://bugs.webkit.org/show_bug.cgi?id=213638 Reviewed by Ross Kirsling. JSTests: * stress/intl-segmenter.js: Added. (shouldBe): (shouldNotThrow): (func): * test262/config.yaml: * test262/expectations.yaml: Source/JavaScriptCore: This patch implements Intl.Segmenter[1]. Intl.Segmenter offers access to ICU break iterator feature, which can break strings into grapheme cluster / words / sentences. [1]: https://github.com/tc39/proposal-intl-segmenter * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * runtime/CommonIdentifiers.h: * runtime/IntlObject.cpp: (JSC::createSegmenterConstructor): (JSC::IntlObject::finishCreation): (JSC::intlSegmenterAvailableLocales): * runtime/IntlObject.h: * runtime/IntlSegmentIterator.cpp: Added. (JSC::IntlSegmentIterator::create): (JSC::IntlSegmentIterator::createStructure): (JSC::IntlSegmentIterator::IntlSegmentIterator): (JSC::IntlSegmentIterator::finishCreation): (JSC::IntlSegmentIterator::visitChildren): (JSC::IntlSegmentIterator::next): * runtime/IntlSegmentIterator.h: Added. * runtime/IntlSegmentIteratorPrototype.cpp: Added. (JSC::IntlSegmentIteratorPrototype::create): (JSC::IntlSegmentIteratorPrototype::createStructure): (JSC::IntlSegmentIteratorPrototype::IntlSegmentIteratorPrototype): (JSC::IntlSegmentIteratorPrototype::finishCreation): (JSC::IntlSegmentIteratorPrototypeFuncNext): * runtime/IntlSegmentIteratorPrototype.h: Added. * runtime/IntlSegmenter.cpp: Added. (JSC::IntlSegmenter::create): (JSC::IntlSegmenter::createStructure): (JSC::IntlSegmenter::IntlSegmenter): (JSC::IntlSegmenter::finishCreation): (JSC::IntlSegmenter::initializeSegmenter): (JSC::IntlSegmenter::segment const): (JSC::IntlSegmenter::resolvedOptions const): (JSC::IntlSegmenter::granularityString): (JSC::IntlSegmenter::createSegmentDataObject): * runtime/IntlSegmenter.h: Added. * runtime/IntlSegmenterConstructor.cpp: Added. (JSC::IntlSegmenterConstructor::create): (JSC::IntlSegmenterConstructor::createStructure): (JSC::IntlSegmenterConstructor::IntlSegmenterConstructor): (JSC::IntlSegmenterConstructor::finishCreation): (JSC::constructIntlSegmenter): (JSC::callIntlSegmenter): (JSC::IntlSegmenterConstructorSupportedLocalesOf): * runtime/IntlSegmenterConstructor.h: Added. * runtime/IntlSegmenterPrototype.cpp: Added. (JSC::IntlSegmenterPrototype::create): (JSC::IntlSegmenterPrototype::createStructure): (JSC::IntlSegmenterPrototype::IntlSegmenterPrototype): (JSC::IntlSegmenterPrototype::finishCreation): (JSC::IntlSegmenterPrototypeFuncSegment): (JSC::IntlSegmenterPrototypeFuncResolvedOptions): * runtime/IntlSegmenterPrototype.h: Added. * runtime/IntlSegments.cpp: Added. (JSC::IntlSegments::create): (JSC::IntlSegments::createStructure): (JSC::IntlSegments::IntlSegments): (JSC::IntlSegments::finishCreation): (JSC::IntlSegments::containing): (JSC::IntlSegments::createSegmentIterator): (JSC::IntlSegments::visitChildren): * runtime/IntlSegments.h: Added. * runtime/IntlSegmentsPrototype.cpp: Added. (JSC::IntlSegmentsPrototype::create): (JSC::IntlSegmentsPrototype::createStructure): (JSC::IntlSegmentsPrototype::IntlSegmentsPrototype): (JSC::IntlSegmentsPrototype::finishCreation): (JSC::IntlSegmentsPrototypeFuncContaining): (JSC::IntlSegmentsPrototypeFuncIterator): * runtime/IntlSegmentsPrototype.h: Added. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::segmentIteratorStructure): (JSC::JSGlobalObject::segmenterStructure): (JSC::JSGlobalObject::segmentsStructure): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Source/WTF: * wtf/text/WTFString.cpp: (WTF::String::charactersWithoutNullTermination const): (WTF::String::charactersWithNullTermination const): * wtf/text/WTFString.h: Canonical link: https://commits.webkit.org/228509@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266032 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-22 19:22:24 +00:00
runtime/IntlSegmentIterator.cpp
runtime/IntlSegmentIteratorPrototype.cpp
runtime/IntlSegmenter.cpp
runtime/IntlSegmenterConstructor.cpp
runtime/IntlSegmenterPrototype.cpp
runtime/IntlSegments.cpp
runtime/IntlSegmentsPrototype.cpp
runtime/IntlWorkaround.cpp @no-unify // Confine U_HIDE_DRAFT_API's effect to this file.
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/IteratorOperations.cpp
runtime/IteratorPrototype.cpp
runtime/JSArray.cpp
runtime/JSArrayBuffer.cpp
runtime/JSArrayBufferConstructor.cpp
runtime/JSArrayBufferPrototype.cpp
runtime/JSArrayBufferView.cpp
runtime/JSAsyncFunction.cpp
[JSC] AsyncGenerator should have internal fields https://bugs.webkit.org/show_bug.cgi?id=201498 Reviewed by Saam Barati. JSTests: * stress/async-generator-construct-failure.js: Added. (shouldThrow): (async.gen): (TypeError): * stress/async-generator-prototype-change.js: Added. (shouldBe): (async.gen): * stress/async-generator-prototype-closure.js: Added. (shouldBe): (test.async.gen): (test): * stress/create-async-generator.js: Added. (shouldBe): (test.async.generator): (test): Source/JavaScriptCore: This patch introduces JSAsyncGenerator. We did this already for JSGenerator. This patch does the same thing for JSAsyncGenerator This patch cleans up JSGenerator's code to share it with JSAsyncGenerator, e.g. JSGenerator::initialValues etc. It improves JetStream2/async-fs by ~10%. We also fixed the pre-existing bug. We are using OpcodeID for the key of hashmap. And using op_add code as a part of key. By adding a new bytecode, it suddenly becomes 0. And 0 is not valid key in WTF::HashMap. This patch adds 1 to opcodeID when using for HashMap's key to fix this issue. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/AsyncGeneratorPrototype.js: (globalPrivate.asyncGeneratorQueueIsEmpty): (globalPrivate.asyncGeneratorQueueEnqueue): (globalPrivate.asyncGeneratorQueueDequeue): (globalPrivate.isExecutionState): (globalPrivate.isSuspendYieldState): (globalPrivate.asyncGeneratorReject): (globalPrivate.asyncGeneratorResolve): (asyncGeneratorYieldAwaited): (globalPrivate.asyncGeneratorYield): (globalPrivate.doAsyncGeneratorBodyCall): (globalPrivate.asyncGeneratorResumeNext): (globalPrivate.asyncGeneratorEnqueue): * builtins/BuiltinNames.h: * bytecode/BytecodeIntrinsicRegistry.cpp: (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): * bytecode/BytecodeIntrinsicRegistry.h: * bytecode/BytecodeList.rb: * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): (JSC::computeDefsForBytecodeOffset): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finalizeLLIntInlineCaches): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitPutAsyncGeneratorFields): (JSC::BytecodeGenerator::emitCreateAsyncGenerator): (JSC::BytecodeGenerator::emitYieldPoint): (JSC::BytecodeGenerator::emitYield): (JSC::BytecodeGenerator::emitAwait): (JSC::BytecodeGenerator::emitDelegateYield): (JSC::BytecodeGenerator::emitGeneratorStateChange): * bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::emitIsAsyncGenerator): * bytecompiler/NodesCodegen.cpp: (JSC::asyncGeneratorInternalFieldIndex): (JSC::BytecodeIntrinsicNode::emit_intrinsic_getAsyncGeneratorInternalField): (JSC::BytecodeIntrinsicNode::emit_intrinsic_putAsyncGeneratorInternalField): (JSC::BytecodeIntrinsicNode::emit_intrinsic_isAsyncGenerator): (JSC::YieldExprNode::emitBytecode): (JSC::AwaitExprNode::emitBytecode): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::handleCreateInternalFieldObject): * dfg/DFGCapabilities.cpp: (JSC::DFG::capabilityLevel): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGClobbersExitState.cpp: (JSC::DFG::clobbersExitState): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGNode.h: (JSC::DFG::Node::convertToNewInternalFieldObject): (JSC::DFG::Node::hasStructure): (JSC::DFG::Node::convertToNewGenerator): Deleted. * dfg/DFGNodeType.h: * dfg/DFGOperations.cpp: * dfg/DFGOperations.h: * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCreateInternalFieldObject): (JSC::DFG::SpeculativeJIT::compileCreateGenerator): (JSC::DFG::SpeculativeJIT::compileCreateAsyncGenerator): (JSC::DFG::SpeculativeJIT::compileNewInternalFieldObject): (JSC::DFG::SpeculativeJIT::compileNewGenerator): (JSC::DFG::SpeculativeJIT::compileNewAsyncGenerator): * dfg/DFGSpeculativeJIT.h: * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStoreBarrierInsertionPhase.cpp: * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compileNewInternalFieldObject): (JSC::FTL::DFG::LowerDFGToB3::compileNewGenerator): (JSC::FTL::DFG::LowerDFGToB3::compileNewAsyncGenerator): (JSC::FTL::DFG::LowerDFGToB3::compileCreateInternalFieldObject): (JSC::FTL::DFG::LowerDFGToB3::compileCreateGenerator): (JSC::FTL::DFG::LowerDFGToB3::compileCreateAsyncGenerator): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): * jit/JITInlines.h: (JSC::JIT::copiedArithProfile): * jit/JITOperations.cpp: * jit/JITOperations.h: * llint/LowLevelInterpreter.asm: * runtime/CommonSlowPaths.cpp: (JSC::createInternalFieldObject): (JSC::SLOW_PATH_DECL): * runtime/CommonSlowPaths.h: * runtime/JSAsyncGenerator.cpp: Copied from Source/JavaScriptCore/runtime/JSGenerator.cpp. (JSC::JSAsyncGenerator::create): (JSC::JSAsyncGenerator::createStructure): (JSC::JSAsyncGenerator::JSAsyncGenerator): (JSC::JSAsyncGenerator::finishCreation): (JSC::JSAsyncGenerator::visitChildren): * runtime/JSAsyncGenerator.h: Copied from Source/JavaScriptCore/runtime/JSGenerator.h. * runtime/JSAsyncGeneratorFunction.h: * runtime/JSGenerator.cpp: (JSC::JSGenerator::finishCreation): * runtime/JSGenerator.h: * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::asyncGeneratorStructure const): * runtime/JSType.cpp: (WTF::printInternal): * runtime/JSType.h: Canonical link: https://commits.webkit.org/215995@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250630 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-02 21:23:09 +00:00
runtime/JSAsyncGenerator.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/JSAsyncGeneratorFunction.cpp
[JSC] Introduce JSArrayIterator https://bugs.webkit.org/show_bug.cgi?id=204043 Reviewed by Yusuke Suzuki. JSTests: * stress/array-iterator-materialize-at-osr-exit.js: Added. (shouldBe): (test): * stress/array-iterator-materialize-one-path.js: Added. (shouldBe): (test): * stress/array-iterator-materialize.js: Added. (shouldBe): (test): * stress/array-iterator-sinking.js: Added. (shouldBe): (test): * stress/array-iterators-next-error-messages.js: (catch): * stress/array-iterators-next-with-call.js: * stress/for-of-iteration.js: Added. (shouldBe): (test1): (test2): (test3): * stress/typedarray-functions-with-neutered.js: (checkProtoFunc): Source/JavaScriptCore: This patch introduces JSArrayIterator that changes the iterator object from a JSFinalObject to an InternalFieldsObject. This makes accessing it much easier from C++ code and makes the iterator object smaller. It also means that the JS code for the next function is much simpler and can *almost* be inlined without shenanigans. As part of this patch the keys/values/entries functions have been converted to C++ with intrinsics since that's slightly more efficient in the LLInt/Baseline. Lastly, this patch also add a custom ISOSubspace for JSArrayIterator objects. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/ArrayIteratorPrototype.js: (next): (globalPrivate.arrayIteratorNextHelper): (globalPrivate.arrayIteratorValueNext): Deleted. (globalPrivate.arrayIteratorKeyNext): Deleted. (globalPrivate.arrayIteratorKeyValueNext): Deleted. * builtins/ArrayPrototype.js: (globalPrivate.ArrayIterator): Deleted. (values): Deleted. (keys): Deleted. (entries): Deleted. * builtins/TypedArrayPrototype.js: (values): Deleted. (keys): Deleted. (entries): Deleted. * bytecode/BytecodeIntrinsicRegistry.cpp: (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): * bytecode/BytecodeIntrinsicRegistry.h: * bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::emitIsArrayIterator): * bytecompiler/NodesCodegen.cpp: (JSC::arrayIteratorInternalFieldIndex): (JSC::BytecodeIntrinsicNode::emit_intrinsic_getArrayIteratorInternalField): (JSC::BytecodeIntrinsicNode::emit_intrinsic_putArrayIteratorInternalField): (JSC::BytecodeIntrinsicNode::emit_intrinsic_isGenerator): Deleted. (JSC::BytecodeIntrinsicNode::emit_intrinsic_isAsyncGenerator): Deleted. (JSC::BytecodeIntrinsicNode::emit_intrinsic_isJSArray): Deleted. (JSC::BytecodeIntrinsicNode::emit_intrinsic_isPromise): Deleted. (JSC::BytecodeIntrinsicNode::emit_intrinsic_isProxyObject): Deleted. (JSC::BytecodeIntrinsicNode::emit_intrinsic_isRegExpObject): Deleted. (JSC::BytecodeIntrinsicNode::emit_intrinsic_isObject): Deleted. (JSC::BytecodeIntrinsicNode::emit_intrinsic_isDerivedArray): Deleted. (JSC::BytecodeIntrinsicNode::emit_intrinsic_isMap): Deleted. (JSC::BytecodeIntrinsicNode::emit_intrinsic_isSet): Deleted. (JSC::BytecodeIntrinsicNode::emit_intrinsic_isUndefinedOrNull): Deleted. * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleIntrinsicCall): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGClobbersExitState.cpp: (JSC::DFG::clobbersExitState): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): * dfg/DFGHeapLocation.cpp: (WTF::printInternal): * dfg/DFGHeapLocation.h: * dfg/DFGMayExit.cpp: * dfg/DFGNode.h: (JSC::DFG::Node::convertToPhantomNewObject): (JSC::DFG::Node::convertToPhantomNewArrayIterator): (JSC::DFG::Node::convertToPhantomCreateActivation): (JSC::DFG::Node::hasStructure): (JSC::DFG::Node::hasObjectMaterializationData): (JSC::DFG::Node::isPhantomAllocation): * dfg/DFGNodeType.h: * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGOperations.cpp: * dfg/DFGOperations.h: * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGPromotedHeapLocation.cpp: (WTF::printInternal): * dfg/DFGPromotedHeapLocation.h: (JSC::DFG::PromotedLocationDescriptor::neededForMaterialization const): * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCheckNeutered): (JSC::DFG::SpeculativeJIT::compileToObjectOrCallObjectConstructor): (JSC::DFG::SpeculativeJIT::compileNewInternalFieldObject): (JSC::DFG::SpeculativeJIT::compileNewArrayIterator): * dfg/DFGSpeculativeJIT.h: * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStoreBarrierInsertionPhase.cpp: * dfg/DFGTypeCheckHoistingPhase.cpp: (JSC::DFG::TypeCheckHoistingPhase::identifyRedundantStructureChecks): (JSC::DFG::TypeCheckHoistingPhase::identifyRedundantArrayChecks): * dfg/DFGValidate.cpp: * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compileToObjectOrCallObjectConstructor): (JSC::FTL::DFG::LowerDFGToB3::compileCheckArray): (JSC::FTL::DFG::LowerDFGToB3::compileCheckNeutered): (JSC::FTL::DFG::LowerDFGToB3::compileNewInternalFieldObject): (JSC::FTL::DFG::LowerDFGToB3::compileNewArrayIterator): (JSC::FTL::DFG::LowerDFGToB3::compileCreateInternalFieldObject): (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewInternalFieldObjectImpl): (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewInternalFieldObject): * ftl/FTLOperations.cpp: (JSC::FTL::operationPopulateObjectInOSR): (JSC::FTL::operationMaterializeObjectInOSR): * inspector/JSInjectedScriptHost.cpp: (Inspector::JSInjectedScriptHost::subtype): (Inspector::JSInjectedScriptHost::getInternalProperties): (Inspector::cloneArrayIteratorObject): (Inspector::JSInjectedScriptHost::iteratorEntries): * runtime/ArrayPrototype.cpp: (JSC::ArrayPrototype::finishCreation): (JSC::createArrayIteratorObject): (JSC::arrayProtoFuncValues): (JSC::arrayProtoFuncEntries): (JSC::arrayProtoFuncKeys): * runtime/CommonIdentifiers.h: * runtime/Intrinsic.cpp: (JSC::intrinsicName): * runtime/Intrinsic.h: * runtime/IterationKind.h: (): Deleted. * runtime/JSArrayIterator.cpp: Added. (JSC::JSArrayIterator::create): (JSC::JSArrayIterator::createWithInitialValues): (JSC::JSArrayIterator::createStructure): (JSC::JSArrayIterator::JSArrayIterator): (JSC::JSArrayIterator::finishCreation): (JSC::JSArrayIterator::visitChildren): * runtime/JSArrayIterator.h: Added. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::arrayIteratorPrototype const): (JSC::JSGlobalObject::arrayIteratorStructure const): * runtime/JSMapIterator.h: * runtime/JSSetIterator.h: * runtime/JSType.cpp: (WTF::printInternal): * runtime/JSType.h: * runtime/JSTypedArrayViewPrototype.cpp: (JSC::createTypedArrayIteratorObject): (JSC::typedArrayViewProtoFuncValues): (JSC::typedArrayProtoViewFuncEntries): (JSC::typedArrayViewProtoFuncKeys): (JSC::JSTypedArrayViewPrototype::finishCreation): * runtime/VM.cpp: * runtime/VM.h: Source/WebCore: JSDOMIterator should just use the JSC IterationKind enum. Also, update other files for the enum member name changes. * bindings/js/JSDOMIterator.h: (WebCore::IteratorTraits>::asJS): * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::serialize): * bindings/scripts/CodeGeneratorJS.pm: (GenerateIterableDefinition): * bindings/scripts/test/JS/JSTestInterface.cpp: (WebCore::jsTestInterfacePrototypeFunctionEntriesCaller): (WebCore::jsTestInterfacePrototypeFunctionKeysCaller): (WebCore::jsTestInterfacePrototypeFunctionValuesCaller): * bindings/scripts/test/JS/JSTestIterable.cpp: (WebCore::jsTestIterablePrototypeFunctionEntriesCaller): (WebCore::jsTestIterablePrototypeFunctionKeysCaller): (WebCore::jsTestIterablePrototypeFunctionValuesCaller): * bindings/scripts/test/JS/JSTestNode.cpp: (WebCore::jsTestNodePrototypeFunctionEntriesCaller): (WebCore::jsTestNodePrototypeFunctionKeysCaller): (WebCore::jsTestNodePrototypeFunctionValuesCaller): LayoutTests: Change the labels of iteration kinds to match what JS refers to them as. * inspector/model/remote-object/iterator-expected.txt: * inspector/model/remote-object/iterator-large-expected.txt: * inspector/model/remote-object/iterators-mutated-expected.txt: Canonical link: https://commits.webkit.org/219108@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254252 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-01-09 06:07:29 +00:00
runtime/JSArrayIterator.cpp
[ESNext][BigInt] Implement BigInt literals and JSBigInt https://bugs.webkit.org/show_bug.cgi?id=179000 Reviewed by Darin Adler and Yusuke Suzuki. JSTests: * bigIntTests.yaml: Added. * stress/big-int-literal-line-terminator.js: Added. * stress/big-int-literals.js: Added. * stress/big-int-operations-error.js: Added. * stress/big-int-type-of.js: Added. * stress/big-int-white-space-trailing-leading.js: Added. * stress/big-int-function-apply.js: Added. Source/JavaScriptCore: This patch starts the implementation of BigInt primitive on JavaScriptCore. We are introducing BigInt primitive and implementing it on JSBigInt as a subclass of JSCell with [[BigIntData]] field implemented contiguosly on memory as inline storage of JSBigInt to take advantages on performance due to cache locality. The implementation allows 64 or 32 bitwise arithmetic operations. JSBigInt also has m_sign to store the sign of [[BigIntData]] and m_length that keeps track of BigInt length. The implementation is following the V8 one. [[BigIntData]] is manipulated by JSBigInt::setDigit(index, value) and JSBigInt::digit(index) operations. We also have some operations to support arithmetics over digits. It is important to notice that on our representation, JSBigInt::dataStorage()[0] represents the least significant digit and JSBigInt::dataStorage()[m_length - 1] represents the most siginificant digit. We are also introducing into this Patch the BigInt literals lexer and syntax parsing support. The operation Strict Equals on BigInts is also being implemented to enable tests. These features are being implemented behind a runtime flage "--useBigInt" and are disabled by default. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitEqualityOp): (JSC::BytecodeGenerator::addBigIntConstant): * bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::BigIntEntryHash::hash): (JSC::BytecodeGenerator::BigIntEntryHash::equal): * bytecompiler/NodesCodegen.cpp: (JSC::BigIntNode::jsValue const): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::isToThisAnIdentity): * interpreter/Interpreter.cpp: (JSC::sizeOfVarargs): * llint/LLIntData.cpp: (JSC::LLInt::Data::performAssertions): * llint/LowLevelInterpreter.asm: * parser/ASTBuilder.h: (JSC::ASTBuilder::createBigInt): * parser/Lexer.cpp: (JSC::Lexer<T>::parseBinary): (JSC::Lexer<T>::parseOctal): (JSC::Lexer<T>::parseDecimal): (JSC::Lexer<T>::lex): (JSC::Lexer<T>::parseHex): Deleted. * parser/Lexer.h: * parser/NodeConstructors.h: (JSC::BigIntNode::BigIntNode): * parser/Nodes.h: (JSC::ExpressionNode::isBigInt const): (JSC::BigIntNode::value): * parser/Parser.cpp: (JSC::Parser<LexerType>::parsePrimaryExpression): * parser/ParserTokens.h: * parser/ResultType.h: (JSC::ResultType::definitelyIsBigInt const): (JSC::ResultType::mightBeBigInt const): (JSC::ResultType::isNotBigInt const): (JSC::ResultType::addResultType): (JSC::ResultType::bigIntType): (JSC::ResultType::forAdd): (JSC::ResultType::forLogicalOp): * parser/SyntaxChecker.h: (JSC::SyntaxChecker::createBigInt): * runtime/CommonIdentifiers.h: * runtime/JSBigInt.cpp: Added. (JSC::JSBigInt::visitChildren): (JSC::JSBigInt::JSBigInt): (JSC::JSBigInt::initialize): (JSC::JSBigInt::createStructure): (JSC::JSBigInt::createZero): (JSC::JSBigInt::allocationSize): (JSC::JSBigInt::createWithLength): (JSC::JSBigInt::finishCreation): (JSC::JSBigInt::toPrimitive const): (JSC::JSBigInt::singleDigitValueForString): (JSC::JSBigInt::parseInt): (JSC::JSBigInt::toString): (JSC::JSBigInt::isZero): (JSC::JSBigInt::inplaceMultiplyAdd): (JSC::JSBigInt::digitAdd): (JSC::JSBigInt::digitSub): (JSC::JSBigInt::digitMul): (JSC::JSBigInt::digitPow): (JSC::JSBigInt::digitDiv): (JSC::JSBigInt::internalMultiplyAdd): (JSC::JSBigInt::equalToBigInt): (JSC::JSBigInt::absoluteDivSmall): (JSC::JSBigInt::calculateMaximumCharactersRequired): (JSC::JSBigInt::toStringGeneric): (JSC::JSBigInt::rightTrim): (JSC::JSBigInt::allocateFor): (JSC::JSBigInt::estimatedSize): (JSC::JSBigInt::toNumber const): (JSC::JSBigInt::getPrimitiveNumber const): * runtime/JSBigInt.h: Added. (JSC::JSBigInt::setSign): (JSC::JSBigInt::sign const): (JSC::JSBigInt::setLength): (JSC::JSBigInt::length const): (JSC::JSBigInt::parseInt): (JSC::JSBigInt::offsetOfData): (JSC::JSBigInt::dataStorage): (JSC::JSBigInt::digit): (JSC::JSBigInt::setDigit): (JSC::asBigInt): * runtime/JSCJSValue.cpp: (JSC::JSValue::synthesizePrototype const): (JSC::JSValue::toStringSlowCase const): * runtime/JSCJSValue.h: * runtime/JSCJSValueInlines.h: (JSC::JSValue::isBigInt const): (JSC::JSValue::strictEqualSlowCaseInline): * runtime/JSCell.cpp: (JSC::JSCell::put): (JSC::JSCell::putByIndex): (JSC::JSCell::toPrimitive const): (JSC::JSCell::getPrimitiveNumber const): (JSC::JSCell::toNumber const): (JSC::JSCell::toObjectSlow const): * runtime/JSCell.h: * runtime/JSCellInlines.h: (JSC::JSCell::isBigInt const): * runtime/JSType.h: * runtime/MathCommon.h: (JSC::clz64): * runtime/NumberPrototype.cpp: * runtime/Operations.cpp: (JSC::jsTypeStringForValue): (JSC::jsIsObjectTypeOrNull): * runtime/Options.h: * runtime/ParseInt.h: * runtime/SmallStrings.h: (JSC::SmallStrings::typeString const): * runtime/StructureInlines.h: (JSC::prototypeForLookupPrimitiveImpl): * runtime/TypeofType.cpp: (WTF::printInternal): * runtime/TypeofType.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Source/WTF: * wtf/HashFunctions.h: Tools: * Scripts/run-jsc-stress-tests: Canonical link: https://commits.webkit.org/196613@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225799 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-12 21:01:57 +00:00
runtime/JSBigInt.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/JSBoundFunction.cpp
Harden JSC against the abuse of runtime options. https://bugs.webkit.org/show_bug.cgi?id=201597 <rdar://problem/55167068> Reviewed by Filip Pizlo. JSTests: Remove the call to forceGCSlowPaths(). This utility function will be removed. The modern way to set the required option is to use //@ requireOptions. * stress/ftl-try-catch-oom-error-lazy-slow-path.js: Source/JavaScriptCore: Linux parts contributed by Carlos Garcia Campos <cgarcia@igalia.com>. 1. Introduce a JSC::Config struct that will be protected as ReadOnly once the first VM instance is constructed. The end of the VM constructor calls Config::permanentlyFreeze() which will make the Config ReadOnly. Note: this is currently only supported for OS(DARWIN) and OS(LINUX). OS(WINDOWS) will need to implement some missing pieces before it can enable this hardening (see FIXME in JSCConfig.cpp). The hardening strategy here is to put immutable global values into the Config. Any modifications that need to be made to these values must be done before the first VM instance is done instantiating. This ensures that no script will ever run while the Config is still writable. Also, the policy for this hardening is that a process is opted in by default. If there's a valid need to disable this hardening (e.g. for some test environments), the relevant process will need to opt itself out by calling Config::configureForTesting(). The jsc shell, WK2 UI and WebContent processes are opted in by default. Only test processes may be opt out. 2. Put all JSC::Options in the Config. This enforces the invariant that options can only be changed before we instantiate a VM. Once a VM is instantiated, the options are immutable. 3. Remove functionForceGCSlowPaths() from the jsc shell. Setting Options::forceGCSlowPaths this way is no longer allowed. 4. Re-factored the Options code (Options.h) into: - OptionEntry.h: the data structure that stores the option values. - OptionsList.h: the list of options. - Options.h: the Options singleton object which is the interface for accessing options. Renamed the JSC_OPTIONS macro to FOR_EACH_JSC_OPTION, because "FOR_EACH_JSC_OPTION(SET_OPTION_VALUE)" reads a lot better than "JSC_OPTIONS(FOR_EACH_OPTION)". 5. Change testapi to call Config::configureForTesting(). Parts of testapi makes use of setting options in its tests. Hence, this hardening is disabled for testapi. Note: the jsc shell does enable this hardening. 6. Put ExecutableAllocator's immutable globals in the Config. 7. RELEASE_ASSERT that restrictedOptionsEnabled in order to use the FunctionOverrides test utility. 8. RELEASE_ASSERT that Options::useDollarVM() is enabled in order to use the $vm. We must RELEASE_ASSERT(Options::useDollarVM()) in all JSDollarVM functions that are non-trivial at an eye's glance. This includes (but is not limited to): constructors create() factory createStructure() factory finishCreation() HOST_CALL or operation functions Constructors and methods of utility and test classes The only exception are some constexpr constructors used for instantiating globals (since these must have trivial constructors) e.g. DOMJITAttribute. Instead, these constructors should always be ALWAYS_INLINE. * API/glib/JSCOptions.cpp: (jscOptionsSetValue): (jscOptionsGetValue): (jsc_options_foreach): (jsc_options_get_option_group): * API/tests/testapi.c: (main): * API/tests/testapi.cpp: (configureJSCForTesting): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * jit/ExecutableAllocator.cpp: (JSC::isJITEnabled): (JSC::ExecutableAllocator::setJITEnabled): (JSC::ExecutableAllocator::initializeUnderlyingAllocator): (JSC::ExecutableAllocator::isValid const): (JSC::ExecutableAllocator::underMemoryPressure): (JSC::ExecutableAllocator::memoryPressureMultiplier): (JSC::ExecutableAllocator::allocate): (JSC::ExecutableAllocator::isValidExecutableMemory): (JSC::ExecutableAllocator::getLock const): (JSC::ExecutableAllocator::committedByteCount): (JSC::ExecutableAllocator::dumpProfile): (JSC::startOfFixedExecutableMemoryPoolImpl): (JSC::endOfFixedExecutableMemoryPoolImpl): (JSC::isJITPC): (JSC::dumpJITMemory): (JSC::ExecutableAllocator::initialize): (JSC::ExecutableAllocator::singleton): * jit/ExecutableAllocator.h: (JSC::performJITMemcpy): * jsc.cpp: (GlobalObject::finishCreation): (functionJSCOptions): (jscmain): (functionForceGCSlowPaths): Deleted. * runtime/ConfigFile.cpp: (JSC::ConfigFile::parse): * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCConfig.cpp: Added. (JSC::Config::disableFreezingForTesting): (JSC::Config::enableRestrictedOptions): (JSC::Config::permanentlyFreeze): * runtime/JSCConfig.h: Added. (JSC::Config::configureForTesting): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::exposeDollarVM): * runtime/OptionEntry.h: Added. (JSC::OptionRange::operator= ): (JSC::OptionRange::rangeString const): * runtime/Options.cpp: (JSC::Options::isAvailable): (JSC::scaleJITPolicy): (JSC::Options::initialize): (JSC::Options::setOptions): (JSC::Options::setOptionWithoutAlias): (JSC::Options::setAliasedOption): (JSC::Option::dump const): (JSC::Option::operator== const): (): Deleted. (JSC::Options::enableRestrictedOptions): Deleted. * runtime/Options.h: (JSC::Option::Option): (JSC::Option::defaultOption const): (JSC::Option::boolVal): (JSC::Option::unsignedVal): (JSC::Option::doubleVal): (JSC::Option::int32Val): (JSC::Option::optionRangeVal): (JSC::Option::optionStringVal): (JSC::Option::gcLogLevelVal): (JSC::OptionRange::operator= ): Deleted. (JSC::OptionRange::rangeString const): Deleted. * runtime/OptionsList.h: Added. (JSC::countNumberOfJSCOptions): * runtime/VM.cpp: (JSC::VM::VM): * tools/FunctionOverrides.cpp: (JSC::FunctionOverrides::FunctionOverrides): (JSC::FunctionOverrides::reinstallOverrides): (JSC::FunctionOverrides::initializeOverrideFor): (JSC::FunctionOverrides::parseOverridesInFile): * tools/JSDollarVM.cpp: (JSC::JSDollarVMCallFrame::JSDollarVMCallFrame): (JSC::JSDollarVMCallFrame::createStructure): (JSC::JSDollarVMCallFrame::create): (JSC::JSDollarVMCallFrame::finishCreation): (JSC::JSDollarVMCallFrame::addProperty): (JSC::Element::Element): (JSC::Element::create): (JSC::Element::createStructure): (JSC::Root::Root): (JSC::Root::create): (JSC::Root::createStructure): (JSC::SimpleObject::SimpleObject): (JSC::SimpleObject::create): (JSC::SimpleObject::createStructure): (JSC::ImpureGetter::ImpureGetter): (JSC::ImpureGetter::createStructure): (JSC::ImpureGetter::create): (JSC::ImpureGetter::finishCreation): (JSC::ImpureGetter::getOwnPropertySlot): (JSC::CustomGetter::CustomGetter): (JSC::CustomGetter::createStructure): (JSC::CustomGetter::create): (JSC::CustomGetter::getOwnPropertySlot): (JSC::CustomGetter::customGetter): (JSC::CustomGetter::customGetterAcessor): (JSC::RuntimeArray::create): (JSC::RuntimeArray::destroy): (JSC::RuntimeArray::getOwnPropertySlot): (JSC::RuntimeArray::getOwnPropertySlotByIndex): (JSC::RuntimeArray::createPrototype): (JSC::RuntimeArray::createStructure): (JSC::RuntimeArray::finishCreation): (JSC::RuntimeArray::RuntimeArray): (JSC::RuntimeArray::lengthGetter): (JSC::DOMJITNode::DOMJITNode): (JSC::DOMJITNode::createStructure): (JSC::DOMJITNode::checkSubClassSnippet): (JSC::DOMJITNode::create): (JSC::DOMJITGetter::DOMJITGetter): (JSC::DOMJITGetter::createStructure): (JSC::DOMJITGetter::create): (JSC::DOMJITGetter::DOMJITAttribute::DOMJITAttribute): (JSC::DOMJITGetter::DOMJITAttribute::slowCall): (JSC::DOMJITGetter::DOMJITAttribute::callDOMGetter): (JSC::DOMJITGetter::customGetter): (JSC::DOMJITGetter::finishCreation): (JSC::DOMJITGetterComplex::DOMJITGetterComplex): (JSC::DOMJITGetterComplex::createStructure): (JSC::DOMJITGetterComplex::create): (JSC::DOMJITGetterComplex::DOMJITAttribute::DOMJITAttribute): (JSC::DOMJITGetterComplex::DOMJITAttribute::slowCall): (JSC::DOMJITGetterComplex::DOMJITAttribute::callDOMGetter): (JSC::DOMJITGetterComplex::functionEnableException): (JSC::DOMJITGetterComplex::customGetter): (JSC::DOMJITGetterComplex::finishCreation): (JSC::DOMJITFunctionObject::DOMJITFunctionObject): (JSC::DOMJITFunctionObject::createStructure): (JSC::DOMJITFunctionObject::create): (JSC::DOMJITFunctionObject::functionWithTypeCheck): (JSC::DOMJITFunctionObject::functionWithoutTypeCheck): (JSC::DOMJITFunctionObject::checkSubClassSnippet): (JSC::DOMJITFunctionObject::finishCreation): (JSC::DOMJITCheckSubClassObject::DOMJITCheckSubClassObject): (JSC::DOMJITCheckSubClassObject::createStructure): (JSC::DOMJITCheckSubClassObject::create): (JSC::DOMJITCheckSubClassObject::functionWithTypeCheck): (JSC::DOMJITCheckSubClassObject::functionWithoutTypeCheck): (JSC::DOMJITCheckSubClassObject::finishCreation): (JSC::DOMJITGetterBaseJSObject::DOMJITGetterBaseJSObject): (JSC::DOMJITGetterBaseJSObject::createStructure): (JSC::DOMJITGetterBaseJSObject::create): (JSC::DOMJITGetterBaseJSObject::DOMJITAttribute::DOMJITAttribute): (JSC::DOMJITGetterBaseJSObject::DOMJITAttribute::slowCall): (JSC::DOMJITGetterBaseJSObject::DOMJITAttribute::callDOMGetter): (JSC::DOMJITGetterBaseJSObject::customGetter): (JSC::DOMJITGetterBaseJSObject::finishCreation): (JSC::JSTestCustomGetterSetter::JSTestCustomGetterSetter): (JSC::JSTestCustomGetterSetter::create): (JSC::JSTestCustomGetterSetter::createStructure): (JSC::customSetAccessor): (JSC::customSetValue): (JSC::JSTestCustomGetterSetter::finishCreation): (JSC::Element::handleOwner): (JSC::Element::finishCreation): (JSC::WasmStreamingParser::WasmStreamingParser): (JSC::WasmStreamingParser::create): (JSC::WasmStreamingParser::createStructure): (JSC::WasmStreamingParser::finishCreation): (JSC::functionWasmStreamingParserAddBytes): (JSC::functionWasmStreamingParserFinalize): (JSC::functionCrash): (JSC::functionBreakpoint): (JSC::functionDFGTrue): (JSC::functionFTLTrue): (JSC::functionCpuMfence): (JSC::functionCpuRdtsc): (JSC::functionCpuCpuid): (JSC::functionCpuPause): (JSC::functionCpuClflush): (JSC::CallerFrameJITTypeFunctor::CallerFrameJITTypeFunctor): (JSC::getExecutableForFunction): (JSC::functionLLintTrue): (JSC::functionJITTrue): (JSC::functionNoInline): (JSC::functionGC): (JSC::functionEdenGC): (JSC::functionDumpSubspaceHashes): (JSC::functionCallFrame): (JSC::functionCodeBlockForFrame): (JSC::codeBlockFromArg): (JSC::functionCodeBlockFor): (JSC::functionDumpSourceFor): (JSC::functionDumpBytecodeFor): (JSC::doPrint): (JSC::functionDataLog): (JSC::functionPrint): (JSC::functionDumpCallFrame): (JSC::functionDumpStack): (JSC::functionDumpRegisters): (JSC::functionDumpCell): (JSC::functionIndexingMode): (JSC::functionInlineCapacity): (JSC::functionValue): (JSC::functionGetPID): (JSC::functionHaveABadTime): (JSC::functionIsHavingABadTime): (JSC::functionCreateGlobalObject): (JSC::functionCreateProxy): (JSC::functionCreateRuntimeArray): (JSC::functionCreateNullRopeString): (JSC::functionCreateImpureGetter): (JSC::functionCreateCustomGetterObject): (JSC::functionCreateDOMJITNodeObject): (JSC::functionCreateDOMJITGetterObject): (JSC::functionCreateDOMJITGetterComplexObject): (JSC::functionCreateDOMJITFunctionObject): (JSC::functionCreateDOMJITCheckSubClassObject): (JSC::functionCreateDOMJITGetterBaseJSObject): (JSC::functionCreateWasmStreamingParser): (JSC::functionSetImpureGetterDelegate): (JSC::functionCreateBuiltin): (JSC::functionGetPrivateProperty): (JSC::functionCreateRoot): (JSC::functionCreateElement): (JSC::functionGetElement): (JSC::functionCreateSimpleObject): (JSC::functionGetHiddenValue): (JSC::functionSetHiddenValue): (JSC::functionShadowChickenFunctionsOnStack): (JSC::functionSetGlobalConstRedeclarationShouldNotThrow): (JSC::functionFindTypeForExpression): (JSC::functionReturnTypeFor): (JSC::functionFlattenDictionaryObject): (JSC::functionDumpBasicBlockExecutionRanges): (JSC::functionHasBasicBlockExecuted): (JSC::functionBasicBlockExecutionCount): (JSC::functionEnableExceptionFuzz): (JSC::changeDebuggerModeWhenIdle): (JSC::functionEnableDebuggerModeWhenIdle): (JSC::functionDisableDebuggerModeWhenIdle): (JSC::functionDeleteAllCodeWhenIdle): (JSC::functionGlobalObjectCount): (JSC::functionGlobalObjectForObject): (JSC::functionGetGetterSetter): (JSC::functionLoadGetterFromGetterSetter): (JSC::functionCreateCustomTestGetterSetter): (JSC::functionDeltaBetweenButterflies): (JSC::functionTotalGCTime): (JSC::functionParseCount): (JSC::functionIsWasmSupported): (JSC::JSDollarVM::finishCreation): (JSC::JSDollarVM::addFunction): (JSC::JSDollarVM::addConstructibleFunction): * tools/JSDollarVM.h: Source/WebCore: No new tests. Covered by existing tests. Enable Options::useDollarVM before we tell the JSGlobalObject to exposeDollarVM(). The $vm utility is now hardened to require that Options::useDollarVM be enabled in order for it to be used. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::injectInternalsObject): Source/WebKit: Linux parts contributed by Carlos Garcia Campos <cgarcia@igalia.com>. 1. Add plumbing to allow WK2 tests to configureJSCForTesting(). 2. Removed the call enable Options::useBigInt in WebInspectorUI. WebInspectorUI doesn't really need it for now. * PluginProcess/unix/PluginProcessMainUnix.cpp: * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h: (WebKit::XPCServiceInitializer): * Shared/unix/AuxiliaryProcessMain.cpp: (WebKit::AuxiliaryProcessMainBase::parseCommandLine): * Shared/unix/AuxiliaryProcessMain.h: (WebKit::AuxiliaryProcessMain): * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/API/C/WKContextConfigurationRef.cpp: (WKContextConfigurationSetShouldConfigureJSCForTesting): * UIProcess/API/C/WKContextConfigurationRef.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: (-[_WKProcessPoolConfiguration configureJSCForTesting]): (-[_WKProcessPoolConfiguration setConfigureJSCForTesting:]): * UIProcess/Launcher/ProcessLauncher.h: (WebKit::ProcessLauncher::Client::shouldConfigureJSCForTesting const): * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp: (WebKit::ProcessLauncher::launchProcess): * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::ProcessLauncher::launchProcess): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::shouldConfigureJSCForTesting const): * UIProcess/WebProcessProxy.h: * WebProcess/WebPage/WebInspectorUI.cpp: (WebKit::WebInspectorUI::WebInspectorUI): Source/WTF: Add a source file that was missing so that Xcode can search its contents too. * WTF.xcodeproj/project.pbxproj: Tools: Linux parts contributed by Carlos Garcia Campos <cgarcia@igalia.com>. Windows parts contributed by Fujii Hironori <Hironori.Fujii@sony.com>. Call JSC::Config::configureForTesting() in test harnesses or at the top of tests to disable the hardening on test runs. Tests rely on setting options to enable test features. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (initialize): * TestWebKitAPI/PlatformUtilities.cpp: (TestWebKitAPI::Util::createContextWithInjectedBundle): * TestWebKitAPI/Tests/JavaScriptCore/glib/TestJSC.cpp: (main): * TestWebKitAPI/Tests/WebKitCocoa/ApplePay.mm: (TestWebKitAPI::TEST): (TestWebKitAPI::runActiveSessionTest): * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewDiagnosticLogging.mm: (TEST): * TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm: (TEST): * TestWebKitAPI/Tests/mac/MediaPlaybackSleepAssertion.mm: (TestWebKitAPI::TEST): * TestWebKitAPI/WKWebViewConfigurationExtras.h: * TestWebKitAPI/WKWebViewConfigurationExtras.mm: (+[WKWebViewConfiguration _test_configurationWithTestPlugInClassName:]): (+[WKWebViewConfiguration _test_configurationWithTestPlugInClassName:configureJSCForTesting:]): * WebKitTestRunner/TestController.cpp: (WTR::TestController::generateContextConfiguration const): Canonical link: https://commits.webkit.org/215364@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249808 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-09-12 15:04:29 +00:00
runtime/JSCConfig.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/JSCJSValue.cpp
Open source arm64e code. https://bugs.webkit.org/show_bug.cgi?id=196012 <rdar://problem/49066237> Reviewed by Keith Miller. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/ARM64EAssembler.h: Added. (JSC::ARM64EAssembler::encodeGroup1): (JSC::ARM64EAssembler::encodeGroup2): (JSC::ARM64EAssembler::encodeGroup4): (JSC::ARM64EAssembler::pacia1716): (JSC::ARM64EAssembler::pacib1716): (JSC::ARM64EAssembler::autia1716): (JSC::ARM64EAssembler::autib1716): (JSC::ARM64EAssembler::paciaz): (JSC::ARM64EAssembler::paciasp): (JSC::ARM64EAssembler::pacibz): (JSC::ARM64EAssembler::pacibsp): (JSC::ARM64EAssembler::autiaz): (JSC::ARM64EAssembler::autiasp): (JSC::ARM64EAssembler::autibz): (JSC::ARM64EAssembler::autibsp): (JSC::ARM64EAssembler::xpaclri): (JSC::ARM64EAssembler::pacia): (JSC::ARM64EAssembler::pacib): (JSC::ARM64EAssembler::pacda): (JSC::ARM64EAssembler::pacdb): (JSC::ARM64EAssembler::autia): (JSC::ARM64EAssembler::autib): (JSC::ARM64EAssembler::autda): (JSC::ARM64EAssembler::autdb): (JSC::ARM64EAssembler::paciza): (JSC::ARM64EAssembler::pacizb): (JSC::ARM64EAssembler::pacdza): (JSC::ARM64EAssembler::pacdzb): (JSC::ARM64EAssembler::autiza): (JSC::ARM64EAssembler::autizb): (JSC::ARM64EAssembler::autdza): (JSC::ARM64EAssembler::autdzb): (JSC::ARM64EAssembler::xpaci): (JSC::ARM64EAssembler::xpacd): (JSC::ARM64EAssembler::pacga): (JSC::ARM64EAssembler::braa): (JSC::ARM64EAssembler::brab): (JSC::ARM64EAssembler::blraa): (JSC::ARM64EAssembler::blrab): (JSC::ARM64EAssembler::braaz): (JSC::ARM64EAssembler::brabz): (JSC::ARM64EAssembler::blraaz): (JSC::ARM64EAssembler::blrabz): (JSC::ARM64EAssembler::retaa): (JSC::ARM64EAssembler::retab): (JSC::ARM64EAssembler::eretaa): (JSC::ARM64EAssembler::eretab): (JSC::ARM64EAssembler::linkPointer): (JSC::ARM64EAssembler::repatchPointer): (JSC::ARM64EAssembler::setPointer): (JSC::ARM64EAssembler::readPointer): (JSC::ARM64EAssembler::readCallTarget): (JSC::ARM64EAssembler::ret): * assembler/MacroAssembler.cpp: * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARM64E.h: Added. (JSC::MacroAssemblerARM64E::tagReturnAddress): (JSC::MacroAssemblerARM64E::untagReturnAddress): (JSC::MacroAssemblerARM64E::tagPtr): (JSC::MacroAssemblerARM64E::untagPtr): (JSC::MacroAssemblerARM64E::removePtrTag): (JSC::MacroAssemblerARM64E::callTrustedPtr): (JSC::MacroAssemblerARM64E::call): (JSC::MacroAssemblerARM64E::callRegister): (JSC::MacroAssemblerARM64E::jump): * dfg/DFGOSRExit.cpp: (JSC::DFG::reifyInlinedCallFrames): * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::reifyInlinedCallFrames): * ftl/FTLThunks.cpp: (JSC::FTL::genericGenerationThunkGenerator): * jit/CCallHelpers.h: (JSC::CCallHelpers::prepareForTailCallSlow): * jit/CallFrameShuffler.cpp: (JSC::CallFrameShuffler::prepareForTailCall): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::allocate): * jit/ThunkGenerators.cpp: (JSC::arityFixupGenerator): * llint/LLIntOfflineAsmConfig.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter64.asm: * runtime/ClassInfo.h: * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCPtrTag.cpp: Added. (JSC::tagForPtr): (JSC::ptrTagName): (JSC::initializePtrTagLookup): * runtime/JSCPtrTag.h: (JSC::initializePtrTagLookup): * runtime/Options.cpp: (JSC::recomputeDependentOptions): Source/WTF: * WTF.xcodeproj/project.pbxproj: * wtf/BlockPtr.h: * wtf/Platform.h: * wtf/PlatformRegisters.cpp: Added. (WTF::threadStateLRInternal): (WTF::threadStatePCInternal): * wtf/PlatformRegisters.h: * wtf/PointerPreparations.h: * wtf/PtrTag.cpp: Added. (WTF::tagForPtr): (WTF::ptrTagName): (WTF::registerPtrTagLookup): (WTF::reportBadTag): * wtf/PtrTag.h: (WTF::removeCodePtrTag): (WTF::tagCodePtrImpl): (WTF::tagCodePtr): (WTF::untagCodePtrImplHelper): (WTF::untagCodePtrImpl): (WTF::untagCodePtr): (WTF::retagCodePtrImplHelper): (WTF::retagCodePtrImpl): (WTF::retagCodePtr): (WTF::tagCFunctionPtrImpl): (WTF::tagCFunctionPtr): (WTF::untagCFunctionPtrImpl): (WTF::untagCFunctionPtr): (WTF::tagInt): (WTF::assertIsCFunctionPtr): (WTF::assertIsNullOrCFunctionPtr): (WTF::assertIsNotTagged): (WTF::assertIsTagged): (WTF::assertIsNullOrTagged): (WTF::isTaggedWith): (WTF::assertIsTaggedWith): (WTF::assertIsNullOrTaggedWith): (WTF::usesPointerTagging): (WTF::registerPtrTagLookup): (WTF::reportBadTag): (WTF::tagForPtr): Deleted. Canonical link: https://commits.webkit.org/210319@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-20 23:32:26 +00:00
runtime/JSCPtrTag.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/JSCallee.cpp
runtime/JSCell.cpp
[JSC] PropertySlot should allow passing custom setters https://bugs.webkit.org/show_bug.cgi?id=221872 Reviewed by Yusuke Suzuki. LayoutTests/imported/w3c: * web-platform-tests/WebIDL/ecmascript-binding/attributes-accessors-unique-function-objects-expected.txt: Added. * web-platform-tests/WebIDL/ecmascript-binding/attributes-accessors-unique-function-objects.html: Added. * web-platform-tests/dom/events/Event-isTrusted.any-expected.txt: * web-platform-tests/dom/events/Event-isTrusted.any.worker-expected.txt: * web-platform-tests/html/browsers/history/the-location-interface/document_location-expected.txt: * web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-setter.window-expected.txt: * web-platform-tests/html/browsers/windows/embedded-opener-expected.txt: Source/JavaScriptCore: This patch: 1. Merges PropertySlot::TypeCustomAccessor into TypeCustom, allowing to pass a setter for CustomAccessor / CustomValue. Raw C++ function pointers are used to avoid creating CustomGetterSetter instances for non-reified static properties. 2. Reworks JSObject::getOwnPropertyDescriptor() for custom accessors, making it simpler, more robust, and no longer required to reify all static properties. 3. Hoists GetValueFunc / PutValueFunc declarations to JSC namespace so they can be used in header files. 4. Moves CustomAccessor's wrapper maps to JSGlobalObject (because VM outlives it) and simplifies their keys to C++ function pointers. 5. Splits JSCustomGetterSetterFunction into JSCustomGetterFunction / JSCustomSetterFunction since their signatures and [[Call]] logic are quite different. This is a nice refactor that also simplifies garbage collection and reduces memory needed for setter wrappers. 6. Removes PropertyDescriptor::setCustomDescriptor(), making PropertyDescriptor unaware of custom accessors. Also, drops CustomAccessor check from validateAndApplyPropertyDescriptor() that was incorrect (no error should be thrown if accessors are unchanged) yet unreachable because PropertyDescriptor::equalTo() ignores CustomAccessor. This change fixes a) accessor functions of unforgeable properties [1] to be persistent (in terms of referential equality) and b) cross-realm accessor functions to be of correct global object (instead of lexical). [1]: https://heycam.github.io/webidl/#dfn-unforgeable-on-an-interface * API/JSCallbackObject.h: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * runtime/JSCustomGetterFunction.cpp: Added. (JSC::JSC_DEFINE_HOST_FUNCTION): (JSC::JSCustomGetterFunction::JSCustomGetterFunction): (JSC::JSCustomGetterFunction::create): * runtime/JSCustomGetterFunction.h: Added. * runtime/JSCustomGetterSetterFunction.cpp: Removed. * runtime/JSCustomGetterSetterFunction.h: Removed. * runtime/JSCustomSetterFunction.cpp: Added. (JSC::JSC_DEFINE_HOST_FUNCTION): (JSC::JSCustomSetterFunction::JSCustomSetterFunction): (JSC::JSCustomSetterFunction::create): * runtime/JSCustomSetterFunction.h: Added. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::JSGlobalObject): (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::customGetterFunctionMap): (JSC::JSGlobalObject::customSetterFunctionMap): (JSC::JSGlobalObject::customGetterFunctionStructure const): (JSC::JSGlobalObject::customSetterFunctionStructure const): (JSC::JSGlobalObject::customGetterSetterFunctionStructure const): Deleted. * runtime/JSObject.cpp: (JSC::getCustomGetterFunction): (JSC::getCustomSetterFunction): (JSC::JSObject::getOwnPropertyDescriptor): (JSC::validateAndApplyPropertyDescriptor): (JSC::getCustomGetterSetterFunctionForGetterSetter): Deleted. * runtime/JSObject.h: (JSC::JSObject::fillCustomGetterPropertySlot): * runtime/Lookup.h: (JSC::getStaticPropertySlotFromTable): * runtime/PropertyDescriptor.cpp: (JSC::PropertyDescriptor::setAccessorDescriptor): (JSC::PropertyDescriptor::setCustomDescriptor): Deleted. * runtime/PropertyDescriptor.h: * runtime/PropertySlot.cpp: (JSC::PropertySlot::customAccessorGetter const): Deleted. * runtime/PropertySlot.h: (JSC::PropertySlot::isCustom const): (JSC::PropertySlot::customGetter const): (JSC::PropertySlot::customSetter const): (JSC::PropertySlot::setCustom): (JSC::PropertySlot::setCacheableCustom): (JSC::PropertySlot::getValue const): (JSC::PropertySlot::isCustomAccessor const): Deleted. (JSC::PropertySlot::customGetterSetter const): Deleted. (JSC::PropertySlot::setCustomGetterSetter): Deleted. * runtime/PutPropertySlot.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Source/WebCore: To prevent cross-origin accessor functions from different realms to have the same wrapper, return PropertySlot::TypeGetter instead. Tests: fast/dom/Window/getOwnPropertyDescriptor-other-window.html js/instance-property-getter-other-instance.html imported/w3c/web-platform-tests/dom/events/Event-isTrusted.any.js imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/document_location.html * bindings/js/JSDOMWindowCustom.cpp: (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess): * bindings/js/JSLocationCustom.cpp: (WebCore::getOwnPropertySlotCommon): LayoutTests: * fast/dom/Window/getOwnPropertyDescriptor-other-window-expected.txt: * fast/dom/Window/getOwnPropertyDescriptor-other-window.html: * js/instance-property-getter-other-instance-expected.txt: * js/instance-property-getter-other-instance.html: Canonical link: https://commits.webkit.org/234118@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-15 23:08:52 +00:00
runtime/JSCustomGetterFunction.cpp
runtime/JSCustomSetterFunction.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/JSDataView.cpp
runtime/JSDataViewPrototype.cpp
runtime/JSDateMath.cpp @no-unify // Confine U_SHOW_CPLUSPLUS_API's effect to this file.
GC should support isoheaps https://bugs.webkit.org/show_bug.cgi?id=179288 Reviewed by Saam Barati. Source/JavaScriptCore: This expands the power of the Subspace API in JSC: - Everything associated with describing the types of objects is now part of the HeapCellType class. We have different HeapCellTypes for different destruction strategies. Any Subspace can use any HeapCellType; these are orthogonal things. - There are now two variants of Subspace: CompleteSubspace, which can allocate any size objects using any AlignedMemoryAllocator; and IsoSubspace, which can allocate just one size of object and uses a special virtual memory pool for that purpose. Like bmalloc's IsoHeap, IsoSubspace hoards virtual pages but releases the physical pages as part of the respective allocator's scavenging policy (the Scavenger in bmalloc for IsoHeap and the incremental sweep and full sweep in Riptide for IsoSubspace). So far, this patch just puts subtypes of ExecutableBase in IsoSubspaces. If it works, we can use it for more things. This does not have any effect on JetStream (0.18% faster with p = 0.69). * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/AccessCase.cpp: (JSC::AccessCase::generateImpl): * bytecode/ObjectAllocationProfileInlines.h: (JSC::ObjectAllocationProfile::initializeProfile): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::emitAllocateRawObject): (JSC::DFG::SpeculativeJIT::compileMakeRope): (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage): (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * ftl/FTLAbstractHeapRepository.h: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileMakeRope): (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewObject): (JSC::FTL::DFG::LowerDFGToB3::allocatePropertyStorageWithSizeImpl): (JSC::FTL::DFG::LowerDFGToB3::allocateObject): (JSC::FTL::DFG::LowerDFGToB3::allocatorForSize): * heap/AlignedMemoryAllocator.cpp: (JSC::AlignedMemoryAllocator::registerAllocator): (JSC::AlignedMemoryAllocator::registerSubspace): * heap/AlignedMemoryAllocator.h: (JSC::AlignedMemoryAllocator::firstAllocator const): * heap/AllocationFailureMode.h: Added. * heap/CompleteSubspace.cpp: Added. (JSC::CompleteSubspace::CompleteSubspace): (JSC::CompleteSubspace::~CompleteSubspace): (JSC::CompleteSubspace::allocatorFor): (JSC::CompleteSubspace::allocate): (JSC::CompleteSubspace::allocateNonVirtual): (JSC::CompleteSubspace::allocatorForSlow): (JSC::CompleteSubspace::allocateSlow): (JSC::CompleteSubspace::tryAllocateSlow): * heap/CompleteSubspace.h: Added. (JSC::CompleteSubspace::offsetOfAllocatorForSizeStep): (JSC::CompleteSubspace::allocatorForSizeStep): (JSC::CompleteSubspace::allocatorForNonVirtual): * heap/HeapCellType.cpp: Added. (JSC::HeapCellType::HeapCellType): (JSC::HeapCellType::~HeapCellType): (JSC::HeapCellType::finishSweep): (JSC::HeapCellType::destroy): * heap/HeapCellType.h: Added. (JSC::HeapCellType::attributes const): * heap/IsoAlignedMemoryAllocator.cpp: Added. (JSC::IsoAlignedMemoryAllocator::IsoAlignedMemoryAllocator): (JSC::IsoAlignedMemoryAllocator::~IsoAlignedMemoryAllocator): (JSC::IsoAlignedMemoryAllocator::tryAllocateAlignedMemory): (JSC::IsoAlignedMemoryAllocator::freeAlignedMemory): (JSC::IsoAlignedMemoryAllocator::dump const): * heap/IsoAlignedMemoryAllocator.h: Added. * heap/IsoSubspace.cpp: Added. (JSC::IsoSubspace::IsoSubspace): (JSC::IsoSubspace::~IsoSubspace): (JSC::IsoSubspace::allocatorFor): (JSC::IsoSubspace::allocatorForNonVirtual): (JSC::IsoSubspace::allocate): (JSC::IsoSubspace::allocateNonVirtual): * heap/IsoSubspace.h: Added. (JSC::IsoSubspace::size const): * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::MarkedAllocator): (JSC::MarkedAllocator::setSubspace): (JSC::MarkedAllocator::allocateSlowCase): (JSC::MarkedAllocator::tryAllocateSlowCase): Deleted. (JSC::MarkedAllocator::allocateSlowCaseImpl): Deleted. * heap/MarkedAllocator.h: (JSC::MarkedAllocator::nextAllocatorInAlignedMemoryAllocator const): (JSC::MarkedAllocator::setNextAllocatorInAlignedMemoryAllocator): * heap/MarkedAllocatorInlines.h: (JSC::MarkedAllocator::allocate): (JSC::MarkedAllocator::tryAllocate): Deleted. * heap/MarkedBlock.h: * heap/MarkedBlockInlines.h: (JSC::MarkedBlock::Handle::finishSweepKnowingHeapCellType): (JSC::MarkedBlock::Handle::finishSweepKnowingSubspace): Deleted. * heap/MarkedSpace.cpp: (JSC::MarkedSpace::addMarkedAllocator): * heap/MarkedSpace.h: * heap/Subspace.cpp: (JSC::Subspace::Subspace): (JSC::Subspace::initialize): (JSC::Subspace::finishSweep): (JSC::Subspace::destroy): (JSC::Subspace::prepareForAllocation): (JSC::Subspace::findEmptyBlockToSteal): (): Deleted. (JSC::Subspace::allocate): Deleted. (JSC::Subspace::tryAllocate): Deleted. (JSC::Subspace::allocatorForSlow): Deleted. (JSC::Subspace::allocateSlow): Deleted. (JSC::Subspace::tryAllocateSlow): Deleted. (JSC::Subspace::didAllocate): Deleted. * heap/Subspace.h: (JSC::Subspace::heapCellType const): (JSC::Subspace::nextSubspaceInAlignedMemoryAllocator const): (JSC::Subspace::setNextSubspaceInAlignedMemoryAllocator): (JSC::Subspace::offsetOfAllocatorForSizeStep): Deleted. (JSC::Subspace::allocatorForSizeStep): Deleted. (JSC::Subspace::tryAllocatorFor): Deleted. (JSC::Subspace::allocatorFor): Deleted. * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::emitAllocateJSObjectWithKnownSize): (JSC::AssemblyHelpers::emitAllocateVariableSized): (JSC::AssemblyHelpers::emitAllocateVariableSizedCell): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_new_object): * runtime/ButterflyInlines.h: (JSC::Butterfly::createUninitialized): (JSC::Butterfly::tryCreate): (JSC::Butterfly::growArrayRight): * runtime/DirectArguments.cpp: (JSC::DirectArguments::overrideThings): * runtime/DirectArguments.h: (JSC::DirectArguments::subspaceFor): * runtime/DirectEvalExecutable.h: * runtime/EvalExecutable.h: * runtime/ExecutableBase.h: (JSC::ExecutableBase::subspaceFor): * runtime/FunctionExecutable.h: * runtime/GenericArgumentsInlines.h: (JSC::GenericArguments<Type>::initModifiedArgumentsDescriptor): * runtime/HashMapImpl.h: (JSC::HashMapBuffer::create): * runtime/IndirectEvalExecutable.h: * runtime/JSArray.cpp: (JSC::JSArray::tryCreateUninitializedRestricted): (JSC::JSArray::unshiftCountSlowCase): * runtime/JSArray.h: (JSC::JSArray::tryCreate): * runtime/JSArrayBufferView.cpp: (JSC::JSArrayBufferView::ConstructionContext::ConstructionContext): * runtime/JSCell.h: (JSC::subspaceFor): * runtime/JSCellInlines.h: (JSC::JSCell::subspaceFor): (JSC::tryAllocateCellHelper): (JSC::allocateCell): (JSC::tryAllocateCell): * runtime/JSDestructibleObject.h: (JSC::JSDestructibleObject::subspaceFor): * runtime/JSDestructibleObjectHeapCellType.cpp: Copied from Source/JavaScriptCore/runtime/JSDestructibleObjectSubspace.cpp. (JSC::JSDestructibleObjectHeapCellType::JSDestructibleObjectHeapCellType): (JSC::JSDestructibleObjectHeapCellType::~JSDestructibleObjectHeapCellType): (JSC::JSDestructibleObjectHeapCellType::finishSweep): (JSC::JSDestructibleObjectHeapCellType::destroy): (JSC::JSDestructibleObjectSubspace::JSDestructibleObjectSubspace): Deleted. (JSC::JSDestructibleObjectSubspace::~JSDestructibleObjectSubspace): Deleted. (JSC::JSDestructibleObjectSubspace::finishSweep): Deleted. (JSC::JSDestructibleObjectSubspace::destroy): Deleted. * runtime/JSDestructibleObjectHeapCellType.h: Copied from Source/JavaScriptCore/runtime/JSDestructibleObjectSubspace.h. * runtime/JSDestructibleObjectSubspace.cpp: Removed. * runtime/JSDestructibleObjectSubspace.h: Removed. * runtime/JSLexicalEnvironment.h: (JSC::JSLexicalEnvironment::subspaceFor): * runtime/JSSegmentedVariableObject.h: (JSC::JSSegmentedVariableObject::subspaceFor): * runtime/JSSegmentedVariableObjectHeapCellType.cpp: Copied from Source/JavaScriptCore/runtime/JSSegmentedVariableObjectSubspace.cpp. (JSC::JSSegmentedVariableObjectHeapCellType::JSSegmentedVariableObjectHeapCellType): (JSC::JSSegmentedVariableObjectHeapCellType::~JSSegmentedVariableObjectHeapCellType): (JSC::JSSegmentedVariableObjectHeapCellType::finishSweep): (JSC::JSSegmentedVariableObjectHeapCellType::destroy): (JSC::JSSegmentedVariableObjectSubspace::JSSegmentedVariableObjectSubspace): Deleted. (JSC::JSSegmentedVariableObjectSubspace::~JSSegmentedVariableObjectSubspace): Deleted. (JSC::JSSegmentedVariableObjectSubspace::finishSweep): Deleted. (JSC::JSSegmentedVariableObjectSubspace::destroy): Deleted. * runtime/JSSegmentedVariableObjectHeapCellType.h: Copied from Source/JavaScriptCore/runtime/JSSegmentedVariableObjectSubspace.h. * runtime/JSSegmentedVariableObjectSubspace.cpp: Removed. * runtime/JSSegmentedVariableObjectSubspace.h: Removed. * runtime/JSString.h: (JSC::JSString::subspaceFor): * runtime/JSStringHeapCellType.cpp: Copied from Source/JavaScriptCore/runtime/JSStringSubspace.cpp. (JSC::JSStringHeapCellType::JSStringHeapCellType): (JSC::JSStringHeapCellType::~JSStringHeapCellType): (JSC::JSStringHeapCellType::finishSweep): (JSC::JSStringHeapCellType::destroy): (JSC::JSStringSubspace::JSStringSubspace): Deleted. (JSC::JSStringSubspace::~JSStringSubspace): Deleted. (JSC::JSStringSubspace::finishSweep): Deleted. (JSC::JSStringSubspace::destroy): Deleted. * runtime/JSStringHeapCellType.h: Copied from Source/JavaScriptCore/runtime/JSStringSubspace.h. * runtime/JSStringSubspace.cpp: Removed. * runtime/JSStringSubspace.h: Removed. * runtime/ModuleProgramExecutable.h: * runtime/NativeExecutable.h: * runtime/ProgramExecutable.h: * runtime/RegExpMatchesArray.h: (JSC::tryCreateUninitializedRegExpMatchesArray): * runtime/ScopedArguments.h: (JSC::ScopedArguments::subspaceFor): * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: (JSC::VM::gigacageAuxiliarySpace): * wasm/js/JSWebAssemblyCodeBlock.h: * wasm/js/JSWebAssemblyCodeBlockHeapCellType.cpp: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyCodeBlockSubspace.cpp. (JSC::JSWebAssemblyCodeBlockHeapCellType::JSWebAssemblyCodeBlockHeapCellType): (JSC::JSWebAssemblyCodeBlockHeapCellType::~JSWebAssemblyCodeBlockHeapCellType): (JSC::JSWebAssemblyCodeBlockHeapCellType::finishSweep): (JSC::JSWebAssemblyCodeBlockHeapCellType::destroy): (JSC::JSWebAssemblyCodeBlockSubspace::JSWebAssemblyCodeBlockSubspace): Deleted. (JSC::JSWebAssemblyCodeBlockSubspace::~JSWebAssemblyCodeBlockSubspace): Deleted. (JSC::JSWebAssemblyCodeBlockSubspace::finishSweep): Deleted. (JSC::JSWebAssemblyCodeBlockSubspace::destroy): Deleted. * wasm/js/JSWebAssemblyCodeBlockHeapCellType.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyCodeBlockSubspace.h. * wasm/js/JSWebAssemblyCodeBlockSubspace.cpp: Removed. * wasm/js/JSWebAssemblyCodeBlockSubspace.h: Removed. * wasm/js/JSWebAssemblyMemory.h: (JSC::JSWebAssemblyMemory::subspaceFor): Source/WebCore: No new tests because no new behavior. Adopting changes in JSC Subspace API. * ForwardingHeaders/runtime/JSDestructibleObjectHeapCellType.h: Added. * ForwardingHeaders/runtime/JSSegmentedVariableObjectHeapCellType.h: Added. * bindings/js/JSDOMWrapper.cpp: (WebCore::outputConstraintSubspaceFor): (WebCore::globalObjectOutputConstraintSubspaceFor): * bindings/js/JSDOMWrapper.h: * bindings/js/WebCoreJSClientData.cpp: (WebCore::JSVMClientData::JSVMClientData): * bindings/js/WebCoreJSClientData.h: (WebCore::JSVMClientData::outputConstraintSpace): (WebCore::JSVMClientData::globalObjectOutputConstraintSpace): * bindings/scripts/CodeGeneratorJS.pm: (GenerateHeader): Source/WTF: One of my favorite data structures in the GC is a singly-linked list that knows its tail, so that things get added to it at the end rather that at the beginning. In this patch, I use this to put the same node on multiple lists, which our existing linked list templates also don't support. This adds a new linked list that does those things: - It supports append(). It could also support prepend(), but currently there is no need for it. - It supports nodes that are on multiple lists. The GC uses std::mem_fn() to create a lambda that the list uses to set next. * WTF.xcodeproj/project.pbxproj: * wtf/SinglyLinkedListWithTail.h: Added. (WTF::SinglyLinkedListWithTail::isEmpty const): (WTF::SinglyLinkedListWithTail::append): (WTF::SinglyLinkedListWithTail::first const): (WTF::SinglyLinkedListWithTail::last const): Canonical link: https://commits.webkit.org/196172@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225314 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-11-30 04:39:50 +00:00
runtime/JSDestructibleObjectHeapCellType.cpp
Add support for FinalizationRegistries https://bugs.webkit.org/show_bug.cgi?id=199888 Reviewed by Yusuke Suzuki. JSTests: Shamelessly copy v8's tests and refactor them to work with conservative GC. * stress/resources/v8-mjsunit.js: Added. (MjsUnitAssertionError): (MjsUnitAssertionError.prototype.toString): (catch): (classOf): (ValueOf): (prettyPrinted): (prettyPrintedArrayElement): (failWithMessage): (formatFailureText): (fail): (deepObjectEquals): (deepEquals): (assertSame): (assertNotSame): (assertEquals): (assertNotEquals): (assertEqualsDelta): (assertArrayEquals): (assertPropertiesEqual): (assertToStringEquals): (assertTrue): (assertFalse): (assertNull): (assertNotNull): (executeCode): (checkException): (assertThrows): (assertThrowsEquals): (assertThrowsAsync): (assertInstanceof): (assertDoesNotThrow): (assertUnreachable): (assertContains): (assertMatches): (concatenateErrors): (assertPromiseResult): (OptimizationStatus): (assertUnoptimized): (assertOptimized): (isNeverOptimizeLiteMode): (isNeverOptimize): (isAlwaysOptimize): (isInterpreted): (isOptimized): (isTurboFanned): (MjsUnitAssertionError.prepareStackTrace): * stress/v8-cleanup-from-different-realm.js: Added. (let.timeout_func): * stress/v8-cleanup-proxy-from-different-realm.js: Added. (let.timeout_func): * stress/v8-finalization-registry-basics.js: Added. (TestConstructFinalizationRegistry): (TestFinalizationRegistryConstructorCallAsFunction): (TestConstructFinalizationRegistryCleanupNotCallable): (TestConstructFinalizationRegistryWithNonCallableProxyAsCleanup): (TestRegisterTargetAndHoldingsSameValue): (TestRegisterWithoutFinalizationRegistry): (TestUnregisterWithNonExistentKey): (TestUnregisterWithNonFinalizationRegistry): (TestWeakRefConstructorWithNonObject): (TestWeakRefWithProxy): * stress/v8-finalizationregistry-and-weakref.js: Added. (let.cleanup): (setTimeout): * stress/v8-finalizationregistry-keeps-holdings-alive.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-finalizationregistry-scheduled-for-cleanup-multiple-times.js: Added. (let.cleanup0): (let.cleanup1): (let.timeout_func): * stress/v8-multiple-dirty-finalization-registries.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-reentrant-gc-from-cleanup.js: Added. (let.reentrant_gc): (setTimeout): * stress/v8-stress-finalizationregistry-dirty-enqueue.js: Added. (i.registries.push.new.FinalizationRegistry): (registries.forEach): * stress/v8-undefined-holdings.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-unregister-after-cleanup.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-unregister-before-cleanup.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-unregister-called-twice.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-unregister-inside-cleanup2.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-unregister-inside-cleanup3.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-unregister-many.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-weak-unregistertoken.js: Added. (FR.new.FinalizationRegistry): (tryAgain): Source/JavaScriptCore: This patch adds support for FinalizationRegistries. There are two main parts to this patch, the first is refactoring PromiseTimer a more general into DeferredWorkTimer. This allows us to finally have a "real" setTimeout on the jsc command line. The second part is adding all the new classes needed for FinalizationRegistries. The refactoring is mostly a rename but does two main new things. The first is that it now notifies the VM we have finished a synchronuous JS execution, so that WeakRefs can be collected. The second is that it now catches any exceptions and forwards the to a new method on the global object method table. For WebCore, this reports the exception to the console. For API users, this calls their exceptionHandler block. For the CLI, it exits with exit status 3 (our general exception exit status). Unfortunately, there's not currently an ergonomic way to pass the expected exception from the CLI arguments to this handler so that's not supported here. In order to support FinalizationRegistry this patch adds a "new" class JSDestructibleInternalFieldObjectImpl, which allows us to have a destructible object with internal fields. Since the order of collection doesn't matter we currently use C++ HashTables on the FinalizationRegistry. Since users can unregister objects while the callback is pending we have a hash table for the live entries and a second hash table for the dead ones. Lastly, because users are not requred to provide a token for unregistration we have two extra Vectors containing the live/dead objects that are not unregisterible. * API/JSAPIGlobalObject.cpp: * API/JSAPIGlobalObject.mm: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * heap/Heap.cpp: (JSC::Heap::finalizeUnconditionalFinalizers): * jsc.cpp: (functionSetTimeout): (functionFinalizationRegistryLiveCount): (functionFinalizationRegistryDeadCount): (main): (checkUncaughtException): (checkException): (GlobalObject::reportUncaughtExceptionAtEventLoop): (runJSC): * runtime/ArrayIteratorPrototype.cpp: * runtime/CommonIdentifiers.h: * runtime/DeferredWorkTimer.cpp: Renamed from Source/JavaScriptCore/runtime/PromiseTimer.cpp. (JSC::DeferredWorkTimer::DeferredWorkTimer): (JSC::DeferredWorkTimer::doWork): (JSC::DeferredWorkTimer::runRunLoop): (JSC::DeferredWorkTimer::addPendingWork): (JSC::DeferredWorkTimer::hasPendingWork): (JSC::DeferredWorkTimer::hasDependancyInPendingWork): (JSC::DeferredWorkTimer::cancelPendingWork): (JSC::DeferredWorkTimer::scheduleWorkSoon): * runtime/DeferredWorkTimer.h: Renamed from Source/JavaScriptCore/runtime/PromiseTimer.h. * runtime/FinalizationRegistryConstructor.cpp: Added. (JSC::FinalizationRegistryConstructor::finishCreation): (JSC::FinalizationRegistryConstructor::FinalizationRegistryConstructor): (JSC::callFinalizationRegistry): (JSC::constructFinalizationRegistry): * runtime/FinalizationRegistryConstructor.h: Copied from Source/JavaScriptCore/API/JSAPIGlobalObject.cpp. * runtime/FinalizationRegistryPrototype.cpp: Added. (JSC::FinalizationRegistryPrototype::finishCreation): (JSC::getFinalizationRegistry): (JSC::protoFuncFinalizationRegistryRegister): (JSC::protoFuncFinalizationRegistryUnregister): * runtime/FinalizationRegistryPrototype.h: Copied from Source/JavaScriptCore/API/JSAPIGlobalObject.cpp. * runtime/IdentifierInlines.h: (JSC::Identifier::Identifier): * runtime/JSFinalizationRegistry.cpp: Added. (JSC::JSFinalizationRegistry::createStructure): (JSC::JSFinalizationRegistry::create): (JSC::JSFinalizationRegistry::finishCreation): (JSC::JSFinalizationRegistry::visitChildren): (JSC::JSFinalizationRegistry::destroy): (JSC::JSFinalizationRegistry::finalizeUnconditionally): (JSC::JSFinalizationRegistry::runFinalizationCleanup): (JSC::JSFinalizationRegistry::takeDeadHoldingsValue): (JSC::JSFinalizationRegistry::registerTarget): (JSC::JSFinalizationRegistry::unregister): (JSC::JSFinalizationRegistry::liveCount): (JSC::JSFinalizationRegistry::deadCount): (JSC::JSFinalizationRegistry::toStringName): * runtime/JSFinalizationRegistry.h: Added. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::reportUncaughtExceptionAtEventLoop): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::stackOverflowFrameCallee const): (JSC::JSGlobalObject::arrayIteratorProtocolWatchpointSet): (JSC::JSGlobalObject::mapIteratorProtocolWatchpointSet): (JSC::JSGlobalObject::setIteratorProtocolWatchpointSet): (JSC::JSGlobalObject::stringIteratorProtocolWatchpointSet): (JSC::JSGlobalObject::mapSetWatchpointSet): (JSC::JSGlobalObject::setAddWatchpointSet): (JSC::JSGlobalObject::arraySpeciesWatchpointSet): (JSC::JSGlobalObject::arrayJoinWatchpointSet): (JSC::JSGlobalObject::numberToStringWatchpointSet): * runtime/JSInternalFieldObjectImpl.h: * runtime/JSInternalFieldObjectImplInlines.h: (JSC::Base>::visitChildren): (JSC::JSInternalFieldObjectImpl<passedNumberOfInternalFields>::visitChildren): Deleted. * runtime/JSPromise.cpp: (JSC::JSPromise::resolve): (JSC::JSPromise::reject): * runtime/StructureIDTable.cpp: (JSC::StructureIDTable::allocateID): (JSC::StructureIDTable::deallocateID): * runtime/VM.cpp: (JSC::VM::VM): (JSC::VM::~VM): * runtime/VM.h: * wasm/js/JSWebAssembly.cpp: (JSC::webAssemblyModuleValidateAsyncInternal): (JSC::instantiate): (JSC::compileAndInstantiate): (JSC::webAssemblyModuleInstantinateAsyncInternal): (JSC::webAssemblyCompileStreamingInternal): (JSC::webAssemblyInstantiateStreamingInternal): * wasm/js/JSWebAssemblyCodeBlock.h: Source/WebCore: Refactor things for changing PromiseDeferredTimer to DeferredWorkTimer. Also, add globalObject hook for reporting uncaught exceptions from JSC's runloop callbacks. * bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::reportUncaughtExceptionAtEventLoop): * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::compileStreaming): (WebCore::JSDOMWindowBase::instantiateStreaming): * bindings/js/JSWorkerGlobalScopeBase.cpp: * bindings/js/JSWorkletGlobalScopeBase.cpp: * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::addTimerSetNotification): (WebCore::WorkerScriptController::removeTimerSetNotification): * workers/WorkerRunLoop.cpp: * worklets/WorkletScriptController.cpp: LayoutTests: * js/script-tests/weakref-finalizationregistry.js: Added. (makeWeakRef): (turnEventLoop): (async test): * js/weakref-finalizationregistry-expected.txt: Added. * js/weakref-finalizationregistry.html: Added. Canonical link: https://commits.webkit.org/227365@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@264617 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-07-20 21:03:16 +00:00
runtime/JSFinalizationRegistry.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/JSFunction.cpp
[JSC] Generator should have internal fields https://bugs.webkit.org/show_bug.cgi?id=201159 Reviewed by Keith Miller. JSTests: * stress/create-generator.js: Added. (shouldBe): (test.generator): (test): * stress/generator-construct-failure.js: Added. (shouldThrow): (TypeError): * stress/generator-prototype-change.js: Added. (shouldBe): (gen): * stress/generator-prototype-closure.js: Added. (shouldBe): (test.gen): (test): * stress/object-assign-fast-path.js: Source/JavaScriptCore: This patch makes generator's internal states InternalField instead of private properties. Each generator function produces a generator with different [[Prototype]], which makes generators have different Structures. As a result, Generator.prototype.next etc.'s implementation becomes megamorphic even if it is not necessary. If we make these structures adaptively poly-proto, some generators get poly-proto structures while others are not, resulting in megamorphic lookup in Generator.prototype.next. If we make all the generator's structure poly-proto, it makes Generator.prototype.next lookup suboptimal for now. In this patch, we start with a relatively simple solution. This patch introduces JSGenerator class, and it has internal fields for generator's internal states. We extend promise-internal-field access bytecodes to access to these fields from bytecode so that Generator.prototype.next can access these fields without using megamorphic get_by_id_direct. And we attach JSGeneratorType to JSGenerator so that we can efficiently implement `@isGenerator()` check in bytecode. We reserve the offset = 0 slot for the future poly-proto extension for JSGenerator. By reserving this slot, non-poly-proto JSGenerator and poly-proto JSGenerator still can offer the way to access to the same Generator internal fields with the same offset while poly-proto JSGenerator can get offset = 0 inline-storage slot for PolyProto implementation. This patch adds op_create_generator since it is distinct from op_create_promise once we add PolyProto support. In the future when we introduce some kind of op_create_async_generator we will probably share only one bytecode for both generator and async generator. This patch offers around 10% improvement in JetStream2/Basic. And this patch is the basis of optimization of JetStream2/async-fs which leverages async generators significantly. This patch includes several design decisions. 1. We add a new JSGenerator instead of leveraging JSFinalObject. The main reason is that we would like to have JSGeneratorType to quickly query `@isGenerator`. 2. This patch currently does not include object-allocation-sinking support for JSGenerator, but it is trivial, and will be added. And this patch also does not include poly-proto support for JSGenerator. The main reason is simply because this patch is already large enough, and I do not want to make this patch larger and larger. 3. We can support arbitrary sized inline-storage: Reserving 0-5 offsets for internal fields, and start putting all the other things to the subsequent internal fields. But for now, we are not taking this approach just because I'm not sure this is necessary. If we found such a pattern, we can easily extend the current one but for now, I would like to keep this patch simple. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/AsyncFunctionPrototype.js: (globalPrivate.asyncFunctionResume): * builtins/GeneratorPrototype.js: (globalPrivate.generatorResume): (next): (return): (throw): * bytecode/BytecodeGeneratorification.cpp: (JSC::BytecodeGeneratorification::run): * bytecode/BytecodeIntrinsicRegistry.cpp: (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): * bytecode/BytecodeIntrinsicRegistry.h: * bytecode/BytecodeList.rb: * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): (JSC::computeDefsForBytecodeOffset): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::finalizeLLIntInlineCaches): * bytecode/SpeculatedType.cpp: (JSC::speculationFromJSType): * bytecode/SpeculatedType.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitPutGeneratorFields): (JSC::BytecodeGenerator::emitCreateGenerator): (JSC::BytecodeGenerator::emitNewGenerator): (JSC::BytecodeGenerator::emitYield): (JSC::BytecodeGenerator::emitDelegateYield): (JSC::BytecodeGenerator::emitGeneratorStateChange): * bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::emitIsGenerator): (JSC::BytecodeGenerator::generatorStateRegister): (JSC::BytecodeGenerator::generatorValueRegister): (JSC::BytecodeGenerator::generatorResumeModeRegister): (JSC::BytecodeGenerator::generatorFrameRegister): * bytecompiler/NodesCodegen.cpp: (JSC::generatorInternalFieldIndex): (JSC::BytecodeIntrinsicNode::emit_intrinsic_getGeneratorInternalField): (JSC::BytecodeIntrinsicNode::emit_intrinsic_putGeneratorInternalField): (JSC::BytecodeIntrinsicNode::emit_intrinsic_isGenerator): (JSC::FunctionNode::emitBytecode): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCapabilities.cpp: (JSC::DFG::capabilityLevel): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGClobbersExitState.cpp: (JSC::DFG::clobbersExitState): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): (JSC::DFG::FixupPhase::fixupIsCellWithType): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): * dfg/DFGNode.h: (JSC::DFG::Node::convertToNewGenerator): (JSC::DFG::Node::speculatedTypeForQuery): (JSC::DFG::Node::hasStructure): * dfg/DFGNodeType.h: * dfg/DFGOperations.cpp: * dfg/DFGOperations.h: * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCreatePromise): (JSC::DFG::SpeculativeJIT::compileCreateGenerator): (JSC::DFG::SpeculativeJIT::compileNewGenerator): * dfg/DFGSpeculativeJIT.h: * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStoreBarrierInsertionPhase.cpp: * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compileNewGenerator): (JSC::FTL::DFG::LowerDFGToB3::compileCreatePromise): (JSC::FTL::DFG::LowerDFGToB3::compileCreateGenerator): (JSC::FTL::DFG::LowerDFGToB3::isCellWithType): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): * jit/JITOperations.cpp: * jit/JITOperations.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_get_internal_field): (JSC::JIT::emit_op_put_internal_field): * llint/LowLevelInterpreter.asm: * runtime/CommonSlowPaths.cpp: (JSC::SLOW_PATH_DECL): * runtime/CommonSlowPaths.h: * runtime/InternalFunction.cpp: (JSC::InternalFunction::createSubclassStructureSlow): * runtime/InternalFunction.h: (JSC::InternalFunction::createSubclassStructure): * runtime/JSGenerator.cpp: Added. (JSC::JSGenerator::create): (JSC::JSGenerator::createStructure): (JSC::JSGenerator::JSGenerator): (JSC::JSGenerator::finishCreation): (JSC::JSGenerator::visitChildren): * runtime/JSGenerator.h: Copied from Source/JavaScriptCore/runtime/JSGeneratorFunction.h. * runtime/JSGeneratorFunction.h: * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::generatorStructure const): * runtime/JSType.cpp: (WTF::printInternal): * runtime/JSType.h: Canonical link: https://commits.webkit.org/215550@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250025 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-09-18 05:02:45 +00:00
runtime/JSGenerator.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/JSGeneratorFunction.cpp
runtime/JSGlobalLexicalEnvironment.cpp
runtime/JSGlobalObject.cpp
runtime/JSGlobalObjectDebuggable.cpp
runtime/JSGlobalObjectFunctions.cpp
We should have a CoW storage for NewArrayBuffer arrays. https://bugs.webkit.org/show_bug.cgi?id=185003 Reviewed by Filip Pizlo. JSTests: * stress/cow-convert-contiguous-to-array-storage.js: Added. (createBuffer): (shouldBe): (test): * stress/cow-convert-double-to-array-storage.js: Added. (createBuffer): (shouldBe): (test): * stress/cow-convert-double-to-contiguous.js: Added. (createBuffer): (shouldBe): (test): * stress/cow-convert-int32-to-array-storage.js: Added. (createBuffer): (shouldBe): (test): * stress/cow-convert-int32-to-contiguous.js: Added. (createBuffer): (shouldBe): (test): * stress/cow-convert-int32-to-double.js: Added. (createBuffer): (shouldBe): (test): * stress/put-on-cow-prototype.js: Added. (putByVal): (putById): Source/JavaScriptCore: This patch adds copy on write storage for new array buffers. In order to do this there needed to be significant changes to the layout of IndexingType. The new indexing type has the following shape: struct IndexingTypeAndMisc { struct IndexingModeIncludingHistory { struct IndexingMode { struct IndexingType { uint8_t isArray:1; // bit 0 uint8_t shape:3; // bit 1 - 3 }; uint8_t copyOnWrite:1; // bit 4 }; uint8_t mayHaveIndexedAccessors:1; // bit 5 }; uint8_t cellLockBits:2; // bit 6 - 7 }; For simplicity ArrayStorage shapes cannot be CoW. So the only valid CoW indexing shapes are ArrayWithInt32, ArrayWithDouble, and ArrayWithContiguous. The backing store for a CoW array is a new class JSImmutableButterfly, which looks exactly the same as a normal butterfly except that it has a JSCell header. Like other butterflies, JSImmutableButterfies are allocated out of the Auxiliary Gigacage and are pointed to by JSCells in the same way. However, when marking JSImmutableButterflies they are marked as if they were a property. With CoW arrays, the new_array_buffer bytecode will reallocate the shared JSImmutableButterfly if it sees from the allocation profile that the last array it allocated has transitioned to a different indexing type. From then on, all arrays created by that new_array_buffer bytecode will have the promoted indexing type. This is more or less the same as what we used to do. The only difference is that we don't promote all the way to array storage even if we have seen it before. Transitioning from a CoW indexing mode occurs whenever someone tries to store to an element, grow the array, or add properties. Storing or growing the array will call into code that does the stupid thing of copying the butterfly then continue into the old code. This doesn't end up costing us as future allocations will use any upgraded indexing shape. We get adding properties for free by just changing the indexing mode on transition (our C++ code always updates the indexing mode). * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/ArrayAllocationProfile.cpp: (JSC::ArrayAllocationProfile::updateProfile): * bytecode/ArrayAllocationProfile.h: (JSC::ArrayAllocationProfile::initializeIndexingMode): * bytecode/ArrayProfile.cpp: (JSC::dumpArrayModes): (JSC::ArrayProfile::briefDescriptionWithoutUpdating): * bytecode/ArrayProfile.h: (JSC::asArrayModes): (JSC::arrayModeFromStructure): (JSC::arrayModesInclude): (JSC::hasSeenCopyOnWriteArray): * bytecode/BytecodeList.json: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finishCreation): * bytecode/InlineAccess.cpp: (JSC::InlineAccess::generateArrayLength): * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::addArrayAllocationProfile): (JSC::UnlinkedCodeBlock::decompressArrayAllocationProfile): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::newArrayAllocationProfile): (JSC::BytecodeGenerator::emitNewArrayBuffer): (JSC::BytecodeGenerator::emitNewArray): (JSC::BytecodeGenerator::emitNewArrayWithSize): (JSC::BytecodeGenerator::emitExpectedFunctionSnippet): * bytecompiler/BytecodeGenerator.h: * bytecompiler/NodesCodegen.cpp: (JSC::ArrayNode::emitBytecode): (JSC::ArrayPatternNode::bindValue const): (JSC::ArrayPatternNode::emitDirectBinding): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGArgumentsEliminationPhase.cpp: * dfg/DFGArgumentsUtilities.cpp: (JSC::DFG::emitCodeToGetArgumentsArrayLength): * dfg/DFGArrayMode.cpp: (JSC::DFG::ArrayMode::fromObserved): (JSC::DFG::ArrayMode::refine const): (JSC::DFG::ArrayMode::alreadyChecked const): * dfg/DFGArrayMode.h: (JSC::DFG::ArrayMode::ArrayMode): (JSC::DFG::ArrayMode::action const): (JSC::DFG::ArrayMode::withSpeculation const): (JSC::DFG::ArrayMode::withArrayClass const): (JSC::DFG::ArrayMode::withType const): (JSC::DFG::ArrayMode::withConversion const): (JSC::DFG::ArrayMode::withTypeAndConversion const): (JSC::DFG::ArrayMode::arrayModesThatPassFiltering const): (JSC::DFG::ArrayMode::arrayModesWithIndexingShape const): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleIntrinsicCall): (JSC::DFG::ByteCodeParser::handleIntrinsicGetter): (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): (JSC::DFG::FixupPhase::attemptToForceStringArrayModeByToStringConversion): (JSC::DFG::FixupPhase::attemptToMakeGetArrayLength): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dump): * dfg/DFGNode.h: (JSC::DFG::Node::indexingType): (JSC::DFG::Node::indexingMode): * dfg/DFGOSRExit.cpp: (JSC::DFG::OSRExit::compileExit): * dfg/DFGOperations.cpp: * dfg/DFGOperations.h: * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::emitAllocateRawObject): (JSC::DFG::SpeculativeJIT::jumpSlowForUnwantedArrayMode): (JSC::DFG::SpeculativeJIT::arrayify): (JSC::DFG::SpeculativeJIT::compileGetByValOnString): (JSC::DFG::SpeculativeJIT::compileGetByValOnDirectArguments): (JSC::DFG::SpeculativeJIT::compileGetByValOnScopedArguments): (JSC::DFG::SpeculativeJIT::compileGetArrayLength): (JSC::DFG::SpeculativeJIT::compileCreateRest): (JSC::DFG::SpeculativeJIT::compileArraySlice): (JSC::DFG::SpeculativeJIT::compileNewArrayBuffer): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGValidate.cpp: * ftl/FTLAbstractHeapRepository.h: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compilePutStructure): (JSC::FTL::DFG::LowerDFGToB3::compileArraySlice): (JSC::FTL::DFG::LowerDFGToB3::compileNewArrayWithSpread): (JSC::FTL::DFG::LowerDFGToB3::compileNewArrayBuffer): (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread): (JSC::FTL::DFG::LowerDFGToB3::compileForwardVarargsWithSpread): (JSC::FTL::DFG::LowerDFGToB3::storeStructure): (JSC::FTL::DFG::LowerDFGToB3::isArrayTypeForArrayify): * ftl/FTLOperations.cpp: (JSC::FTL::operationMaterializeObjectInOSR): * generate-bytecode-files: * interpreter/Interpreter.cpp: (JSC::sizeOfVarargs): (JSC::loadVarargs): * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::emitStoreStructureWithTypeInfo): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::emitStoreStructureWithTypeInfo): * jit/JITOperations.cpp: * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_put_by_val): (JSC::JIT::emitSlow_op_put_by_val): * jit/Repatch.cpp: (JSC::tryCachePutByID): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * runtime/Butterfly.h: (JSC::ContiguousData::Data::Data): (JSC::ContiguousData::Data::operator bool const): (JSC::ContiguousData::Data::operator=): (JSC::ContiguousData::Data::operator const T& const): (JSC::ContiguousData::Data::set): (JSC::ContiguousData::Data::setWithoutWriteBarrier): (JSC::ContiguousData::Data::clear): (JSC::ContiguousData::Data::get const): (JSC::ContiguousData::atUnsafe): (JSC::ContiguousData::at const): Deleted. (JSC::ContiguousData::at): Deleted. * runtime/ButterflyInlines.h: (JSC::ContiguousData<T>::at const): (JSC::ContiguousData<T>::at): * runtime/ClonedArguments.cpp: (JSC::ClonedArguments::createEmpty): * runtime/CommonSlowPaths.cpp: (JSC::SLOW_PATH_DECL): * runtime/CommonSlowPaths.h: (JSC::CommonSlowPaths::allocateNewArrayBuffer): * runtime/IndexingType.cpp: (JSC::leastUpperBoundOfIndexingTypeAndType): (JSC::leastUpperBoundOfIndexingTypeAndValue): (JSC::dumpIndexingType): * runtime/IndexingType.h: (JSC::hasIndexedProperties): (JSC::hasUndecided): (JSC::hasInt32): (JSC::hasDouble): (JSC::hasContiguous): (JSC::hasArrayStorage): (JSC::hasAnyArrayStorage): (JSC::hasSlowPutArrayStorage): (JSC::shouldUseSlowPut): (JSC::isCopyOnWrite): (JSC::arrayIndexFromIndexingType): * runtime/JSArray.cpp: (JSC::JSArray::tryCreateUninitializedRestricted): (JSC::JSArray::put): (JSC::JSArray::appendMemcpy): (JSC::JSArray::setLength): (JSC::JSArray::pop): (JSC::JSArray::fastSlice): (JSC::JSArray::shiftCountWithAnyIndexingType): (JSC::JSArray::unshiftCountWithAnyIndexingType): (JSC::JSArray::fillArgList): (JSC::JSArray::copyToArguments): * runtime/JSArrayInlines.h: (JSC::JSArray::pushInline): * runtime/JSCell.h: * runtime/JSCellInlines.h: (JSC::JSCell::JSCell): (JSC::JSCell::finishCreation): (JSC::JSCell::indexingType const): (JSC::JSCell::indexingMode const): (JSC::JSCell::setStructure): * runtime/JSFixedArray.h: * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::haveABadTime): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::originalArrayStructureForIndexingType const): (JSC::JSGlobalObject::arrayStructureForIndexingTypeDuringAllocation const): (JSC::JSGlobalObject::isOriginalArrayStructure): * runtime/JSImmutableButterfly.cpp: Added. (JSC::JSImmutableButterfly::visitChildren): (JSC::JSImmutableButterfly::copyToArguments): * runtime/JSImmutableButterfly.h: Added. (JSC::JSImmutableButterfly::createStructure): (JSC::JSImmutableButterfly::tryCreate): (JSC::JSImmutableButterfly::create): (JSC::JSImmutableButterfly::publicLength const): (JSC::JSImmutableButterfly::vectorLength const): (JSC::JSImmutableButterfly::length const): (JSC::JSImmutableButterfly::toButterfly const): (JSC::JSImmutableButterfly::fromButterfly): (JSC::JSImmutableButterfly::get const): (JSC::JSImmutableButterfly::subspaceFor): (JSC::JSImmutableButterfly::setIndex): (JSC::JSImmutableButterfly::allocationSize): (JSC::JSImmutableButterfly::JSImmutableButterfly): * runtime/JSObject.cpp: (JSC::JSObject::markAuxiliaryAndVisitOutOfLineProperties): (JSC::JSObject::visitButterflyImpl): (JSC::JSObject::getOwnPropertySlotByIndex): (JSC::JSObject::putByIndex): (JSC::JSObject::createInitialInt32): (JSC::JSObject::createInitialDouble): (JSC::JSObject::createInitialContiguous): (JSC::JSObject::convertUndecidedToInt32): (JSC::JSObject::convertUndecidedToDouble): (JSC::JSObject::convertUndecidedToContiguous): (JSC::JSObject::convertInt32ToDouble): (JSC::JSObject::convertInt32ToArrayStorage): (JSC::JSObject::convertDoubleToContiguous): (JSC::JSObject::convertDoubleToArrayStorage): (JSC::JSObject::convertContiguousToArrayStorage): (JSC::JSObject::createInitialForValueAndSet): (JSC::JSObject::convertInt32ForValue): (JSC::JSObject::convertFromCopyOnWrite): (JSC::JSObject::ensureWritableInt32Slow): (JSC::JSObject::ensureWritableDoubleSlow): (JSC::JSObject::ensureWritableContiguousSlow): (JSC::JSObject::ensureArrayStorageSlow): (JSC::JSObject::ensureArrayStorageExistsAndEnterDictionaryIndexingMode): (JSC::JSObject::switchToSlowPutArrayStorage): (JSC::JSObject::deletePropertyByIndex): (JSC::JSObject::getOwnPropertyNames): (JSC::canDoFastPutDirectIndex): (JSC::JSObject::defineOwnIndexedProperty): (JSC::JSObject::putByIndexBeyondVectorLengthWithoutAttributes): (JSC::JSObject::putByIndexBeyondVectorLengthWithArrayStorage): (JSC::JSObject::putByIndexBeyondVectorLength): (JSC::JSObject::countElements): (JSC::JSObject::ensureLengthSlow): (JSC::JSObject::getEnumerableLength): (JSC::JSObject::ensureInt32Slow): Deleted. (JSC::JSObject::ensureDoubleSlow): Deleted. (JSC::JSObject::ensureContiguousSlow): Deleted. * runtime/JSObject.h: (JSC::JSObject::putDirectIndex): (JSC::JSObject::canGetIndexQuickly): (JSC::JSObject::getIndexQuickly): (JSC::JSObject::tryGetIndexQuickly const): (JSC::JSObject::canSetIndexQuickly): (JSC::JSObject::setIndexQuickly): (JSC::JSObject::initializeIndex): (JSC::JSObject::initializeIndexWithoutBarrier): (JSC::JSObject::ensureWritableInt32): (JSC::JSObject::ensureWritableDouble): (JSC::JSObject::ensureWritableContiguous): (JSC::JSObject::ensureLength): (JSC::JSObject::ensureInt32): Deleted. (JSC::JSObject::ensureDouble): Deleted. (JSC::JSObject::ensureContiguous): Deleted. * runtime/JSObjectInlines.h: (JSC::JSObject::putDirectInternal): * runtime/JSType.h: * runtime/RegExpMatchesArray.h: (JSC::tryCreateUninitializedRegExpMatchesArray): * runtime/Structure.cpp: (JSC::Structure::Structure): (JSC::Structure::addNewPropertyTransition): (JSC::Structure::nonPropertyTransition): * runtime/Structure.h: * runtime/StructureIDBlob.h: (JSC::StructureIDBlob::StructureIDBlob): (JSC::StructureIDBlob::indexingModeIncludingHistory const): (JSC::StructureIDBlob::setIndexingModeIncludingHistory): (JSC::StructureIDBlob::indexingModeIncludingHistoryOffset): (JSC::StructureIDBlob::indexingTypeIncludingHistory const): Deleted. (JSC::StructureIDBlob::setIndexingTypeIncludingHistory): Deleted. (JSC::StructureIDBlob::indexingTypeIncludingHistoryOffset): Deleted. * runtime/StructureTransitionTable.h: (JSC::newIndexingType): * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Source/WebCore: * bindings/js/JSDOMConvertSequences.h: (WebCore::Detail::NumericSequenceConverter::convertArray): (WebCore::Detail::SequenceConverter::convertArray): LayoutTests: Test should have a real error that gives you the stack. * js/slow-stress/script-tests/variadic-closure-call.js: Canonical link: https://commits.webkit.org/201321@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232070 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-22 18:04:31 +00:00
runtime/JSImmutableButterfly.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/JSInternalPromise.cpp
runtime/JSInternalPromiseConstructor.cpp
runtime/JSInternalPromisePrototype.cpp
runtime/JSLexicalEnvironment.cpp
runtime/JSLock.cpp
runtime/JSMap.cpp
runtime/JSMapIterator.cpp
runtime/JSMicrotask.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/JSModuleEnvironment.cpp
runtime/JSModuleLoader.cpp
runtime/JSModuleNamespaceObject.cpp
runtime/JSModuleRecord.cpp
runtime/JSNativeStdFunction.cpp
runtime/JSONObject.cpp
runtime/JSObject.cpp
runtime/JSPromise.cpp
runtime/JSPromiseConstructor.cpp
runtime/JSPromisePrototype.cpp
runtime/JSPropertyNameEnumerator.cpp
runtime/JSProxy.cpp
runtime/JSRunLoopTimer.cpp
runtime/JSScope.cpp
runtime/JSScriptFetcher.cpp
Support integrity="" on module scripts https://bugs.webkit.org/show_bug.cgi?id=177959 Reviewed by Sam Weinig. Source/JavaScriptCore: This patch adds Subresource Integrity check for module scripts. Currently, only top-level module can be verified with integrity parameter since there is no way to perform integrity check onto the imported modules. In JSC side, we add `parameters` to the entry point of the module loader pipeline. This is fetching parameters and used when fetching modules. We separately pass this parameters to the pipeline along with the script fetcher. The script fetcher is only one for module graph since this is the initiator of this module graph loading. On the other hand, this parameters is for each module fetching. While setting "integrity" parameters to this script fetcher is sufficient to pass parameters to top-level-module's fetching, it is not enough for the future extension. In the future, we will investigate a way to pass parameters to each non-top-level module. At that time, this `parameters` should be per-module. This is because "integrity" value should be different for each module. For example, we will accept some form of syntax to add parameters to `import`. Some proposed syntax is like https://discourse.wicg.io/t/specifying-nonce-or-integrity-when-importing-modules/1861 import "./xxx.js" integrity "xxxxxxx" In this case, this `parameters` will be passed to "./xxx.js" module fetching. This `parameters` should be different from the one of top-level-module's one. That's why we need per-module `parameters` and why this patch adds `parameters` to the module pipeline. On the other hand, we also want to keep script fetcher. This `per-module-graph` thing is important to offer module-graph-wide information. For example, import.meta would have `import.meta.scriptElement`, which is the script element fetching the module graph including this. So, we keep the both, script fetcher and parameters. https://github.com/tc39/proposal-import-meta This parameters will be finally used by pipeline's fetch hook, and WebCore side can use this parameters to fetch modules. We also further clean up the module pipeline by dropping unnecessary features. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/ModuleLoaderPrototype.js: (requestFetch): (requestInstantiate): (requestSatisfy): (loadModule): (loadAndEvaluateModule): This loadAndEvaluateModule should be implemented by just calling loadModule and linkAndEvaluateModule. We can drop requestReady and requestLink. (requestLink): Deleted. (requestImportModule): Deleted. * jsc.cpp: (GlobalObject::moduleLoaderImportModule): (GlobalObject::moduleLoaderFetch): import and fetch hook takes parameters. Currently, we always pass `undefined` for import hook. When dynamic `import()` is extended to accept additional parameters like integrity, this parameters will be replaced with the actual value. (functionLoadModule): (runWithOptions): * runtime/Completion.cpp: (JSC::loadAndEvaluateModule): (JSC::loadModule): (JSC::importModule): * runtime/Completion.h: * runtime/JSGlobalObject.h: * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncImportModule): * runtime/JSModuleLoader.cpp: (JSC::JSModuleLoader::loadAndEvaluateModule): (JSC::JSModuleLoader::loadModule): (JSC::JSModuleLoader::requestImportModule): (JSC::JSModuleLoader::importModule): (JSC::JSModuleLoader::fetch): * runtime/JSModuleLoader.h: * runtime/JSScriptFetchParameters.cpp: Added. (JSC::JSScriptFetchParameters::destroy): * runtime/JSScriptFetchParameters.h: Added. (JSC::JSScriptFetchParameters::createStructure): (JSC::JSScriptFetchParameters::create): (JSC::JSScriptFetchParameters::parameters const): (JSC::JSScriptFetchParameters::JSScriptFetchParameters): Add ScriptFetchParameters' JSCell wrapper, JSScriptFetchParameters. It is used in the module pipeline. * runtime/JSType.h: * runtime/ModuleLoaderPrototype.cpp: (JSC::moduleLoaderPrototypeFetch): * runtime/ScriptFetchParameters.h: Added. (JSC::ScriptFetchParameters::~ScriptFetchParameters): Add ScriptFetchParameters. We can define our own custom ScriptFetchParameters by inheriting this class. WebCore creates ModuleFetchParameters by inheriting this. * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Source/WebCore: This patch extends module hooks to accept fetching parameters. When starting fetching modules, WebCore creates ModuleFetchParameters. And this parameters is propagated to the fetch hook. Then, fetch hook can use this parameters to fetch modules. This parameters only contains `integrity` field. This "integrity" is used to perform subresource integrity check in module loader pipeline. And this error is just proparaged as errors in module pipeline, which is the same to the other types of errors in module pipeline. Test: http/tests/subresource-integrity/sri-module.html * ForwardingHeaders/runtime/JSScriptFetchParameters.h: Added. * ForwardingHeaders/runtime/ScriptFetchParameters.h: Added. * WebCore.xcodeproj/project.pbxproj: * bindings/js/CachedModuleScriptLoader.cpp: (WebCore::CachedModuleScriptLoader::create): (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader): Take parameters, which includes "integrity". * bindings/js/CachedModuleScriptLoader.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::moduleLoaderFetch): (WebCore::JSDOMWindowBase::moduleLoaderImportModule): import and fetch hooks take parameters. * bindings/js/JSDOMWindowBase.h: * bindings/js/JSMainThreadExecState.h: (WebCore::JSMainThreadExecState::loadModule): * bindings/js/ScriptController.cpp: (WebCore::ScriptController::loadModuleScriptInWorld): (WebCore::ScriptController::loadModuleScript): Pass parameters to the entry point of the module pipeline. * bindings/js/ScriptController.h: * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::fetch): If parameters are passed, we set them to CachedModuleScriptLoader. (WebCore::ScriptModuleLoader::importModule): Pass parameters to the entry point of dynamic import. (WebCore::ScriptModuleLoader::notifyFinished): If script loader has parameters, we perform subresource integrity check here. * bindings/js/ScriptModuleLoader.h: * dom/LoadableModuleScript.cpp: (WebCore::LoadableModuleScript::create): (WebCore::LoadableModuleScript::LoadableModuleScript): (WebCore::LoadableModuleScript::load): Create ModuleFetchParameters with "integrity" value. * dom/LoadableModuleScript.h: * dom/ModuleFetchParameters.h: Copied from Source/WebCore/bindings/js/CachedModuleScriptLoader.h. (WebCore::ModuleFetchParameters::create): (WebCore::ModuleFetchParameters::integrity const): (WebCore::ModuleFetchParameters::ModuleFetchParameters): * dom/ScriptElement.cpp: (WebCore::ScriptElement::requestModuleScript): Pass "integrity" value to the module script. LayoutTests: * http/tests/subresource-integrity/resources/crossorigin-anon-script-module.js: Added. * http/tests/subresource-integrity/resources/crossorigin-creds-script-module.js: Added. * http/tests/subresource-integrity/resources/crossorigin-ineligible-script-module.js: Added. * http/tests/subresource-integrity/resources/matching-digest-module.js: Added. * http/tests/subresource-integrity/resources/non-matching-digest-module.js: Added. * http/tests/subresource-integrity/resources/sri-utilities.js: (add_result_callback): (SRIModuleTest): (SRIModuleTest.prototype.execute): * http/tests/subresource-integrity/sri-module-expected.txt: Added. * http/tests/subresource-integrity/sri-module.html: Added. * js/dom/modules/module-inline-ignore-integrity-expected.txt: Added. * js/dom/modules/module-inline-ignore-integrity.html: Added. * js/dom/modules/module-integrity-non-top-level-expected.txt: Added. * js/dom/modules/module-integrity-non-top-level.html: Added. * js/dom/modules/script-tests/module-integrity-non-top-level-2.js: Added. * js/dom/modules/script-tests/module-integrity-non-top-level.js: Added. Canonical link: https://commits.webkit.org/194461@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223237 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-12 13:12:48 +00:00
runtime/JSScriptFetchParameters.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/JSSegmentedVariableObject.cpp
runtime/JSSet.cpp
runtime/JSSetIterator.cpp
runtime/JSSourceCode.cpp
runtime/JSString.cpp
runtime/JSStringIterator.cpp
runtime/JSStringJoiner.cpp
runtime/JSSymbolTableObject.cpp
[JSC] cache TaggedTemplate arrays by callsite rather than by contents https://bugs.webkit.org/show_bug.cgi?id=182717 Reviewed by Yusuke Suzuki. https://github.com/tc39/ecma262/pull/890 imposes a change to template literals, to allow template callsite arrays to be collected when the code containing the tagged template call is collected. This spec change has received concensus and been ratified. This change eliminates the eternal map associating template contents with arrays. JSTests: * stress/tagged-template-object-collect.js: Renamed from JSTests/stress/tagged-template-registry-key-collect.js. * stress/tagged-template-object.js: Renamed from JSTests/stress/tagged-template-registry-key.js. * stress/tagged-templates-identity.js: * stress/template-string-tags-eval.js: * test262.yaml: Source/JavaScriptCore: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::setConstantRegisters): * bytecode/DirectEvalCodeCache.cpp: (JSC::DirectEvalCodeCache::setSlow): * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::allowDirectEvalCache const): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::addTemplateObjectConstant): (JSC::BytecodeGenerator::emitGetTemplateObject): (JSC::BytecodeGenerator::addTemplateRegistryKeyConstant): Deleted. * bytecompiler/BytecodeGenerator.h: * parser/Parser.cpp: (JSC::Parser<LexerType>::parseInner): (JSC::Parser<LexerType>::parseMemberExpression): * parser/Parser.h: * parser/ParserModes.h: * runtime/EvalExecutable.h: (JSC::EvalExecutable::allowDirectEvalCache const): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::JSGlobalObject): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::templateRegistry): Deleted. * runtime/JSTemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistry.cpp. (JSC::JSTemplateObjectDescriptor::JSTemplateObjectDescriptor): (JSC::JSTemplateObjectDescriptor::create): (JSC::JSTemplateObjectDescriptor::destroy): (JSC::JSTemplateObjectDescriptor::createTemplateObject): * runtime/JSTemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/JSTemplateRegistryKey.h. (JSC::isTemplateObjectDescriptor): * runtime/JSTemplateRegistryKey.cpp: Removed. * runtime/TemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.cpp. (JSC::TemplateObjectDescriptor::~TemplateObjectDescriptor): * runtime/TemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.h. (JSC::TemplateObjectDescriptor::operator== const): (JSC::TemplateObjectDescriptor::operator!= const): (JSC::TemplateObjectDescriptor::Hasher::hash): (JSC::TemplateObjectDescriptor::Hasher::equal): (JSC::TemplateObjectDescriptor::create): (JSC::TemplateObjectDescriptor::TemplateObjectDescriptor): (JSC::TemplateObjectDescriptor::calculateHash): * runtime/TemplateRegistry.h: Removed. * runtime/TemplateRegistryKeyTable.cpp: Removed. * runtime/TemplateRegistryKeyTable.h: Removed. * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: (JSC::VM::templateRegistryKeyTable): Deleted. * runtime/VMEntryScope.cpp: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::setConstantRegisters): * bytecode/DirectEvalCodeCache.cpp: (JSC::DirectEvalCodeCache::setSlow): * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::allowDirectEvalCache const): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::addTemplateObjectConstant): (JSC::BytecodeGenerator::emitGetTemplateObject): (JSC::BytecodeGenerator::addTemplateRegistryKeyConstant): Deleted. * bytecompiler/BytecodeGenerator.h: * parser/Parser.cpp: (JSC::Parser<LexerType>::parseInner): (JSC::Parser<LexerType>::parseMemberExpression): * parser/Parser.h: * parser/ParserModes.h: * runtime/EvalExecutable.h: (JSC::EvalExecutable::allowDirectEvalCache const): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::JSGlobalObject): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::templateRegistry): Deleted. * runtime/JSTemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistry.cpp. (JSC::JSTemplateObjectDescriptor::JSTemplateObjectDescriptor): (JSC::JSTemplateObjectDescriptor::create): (JSC::JSTemplateObjectDescriptor::destroy): (JSC::JSTemplateObjectDescriptor::createTemplateObject): * runtime/JSTemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/JSTemplateRegistryKey.h. (JSC::isTemplateObjectDescriptor): * runtime/JSTemplateRegistryKey.cpp: Removed. * runtime/TemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.cpp. (JSC::TemplateObjectDescriptor::~TemplateObjectDescriptor): * runtime/TemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.h. (JSC::TemplateObjectDescriptor::operator== const): (JSC::TemplateObjectDescriptor::operator!= const): (JSC::TemplateObjectDescriptor::Hasher::hash): (JSC::TemplateObjectDescriptor::Hasher::equal): (JSC::TemplateObjectDescriptor::create): (JSC::TemplateObjectDescriptor::TemplateObjectDescriptor): (JSC::TemplateObjectDescriptor::calculateHash): * runtime/TemplateRegistry.h: Removed. * runtime/TemplateRegistryKeyTable.cpp: Removed. * runtime/TemplateRegistryKeyTable.h: Removed. * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: (JSC::VM::templateRegistryKeyTable): Deleted. * runtime/VMEntryScope.cpp: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::setConstantRegisters): * bytecode/DirectEvalCodeCache.cpp: (JSC::DirectEvalCodeCache::setSlow): * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::allowDirectEvalCache const): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::addTemplateObjectConstant): (JSC::BytecodeGenerator::emitGetTemplateObject): (JSC::BytecodeGenerator::addTemplateRegistryKeyConstant): Deleted. * bytecompiler/BytecodeGenerator.h: * parser/Parser.cpp: (JSC::Parser<LexerType>::parseInner): (JSC::Parser<LexerType>::parseMemberExpression): * parser/Parser.h: * parser/ParserModes.h: * runtime/EvalExecutable.h: (JSC::EvalExecutable::allowDirectEvalCache const): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::JSGlobalObject): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::templateRegistry): Deleted. * runtime/JSTemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistry.cpp. (JSC::JSTemplateObjectDescriptor::JSTemplateObjectDescriptor): (JSC::JSTemplateObjectDescriptor::create): (JSC::JSTemplateObjectDescriptor::destroy): (JSC::JSTemplateObjectDescriptor::createTemplateObject): * runtime/JSTemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/JSTemplateRegistryKey.h. (JSC::isTemplateObjectDescriptor): * runtime/JSTemplateRegistryKey.cpp: Removed. * runtime/TemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.cpp. (JSC::TemplateObjectDescriptor::~TemplateObjectDescriptor): * runtime/TemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.h. (JSC::TemplateObjectDescriptor::operator== const): (JSC::TemplateObjectDescriptor::operator!= const): (JSC::TemplateObjectDescriptor::Hasher::hash): (JSC::TemplateObjectDescriptor::Hasher::equal): (JSC::TemplateObjectDescriptor::create): (JSC::TemplateObjectDescriptor::TemplateObjectDescriptor): (JSC::TemplateObjectDescriptor::calculateHash): * runtime/TemplateRegistry.h: Removed. * runtime/TemplateRegistryKeyTable.cpp: Removed. * runtime/TemplateRegistryKeyTable.h: Removed. * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: (JSC::VM::templateRegistryKeyTable): Deleted. * runtime/VMEntryScope.cpp: Canonical link: https://commits.webkit.org/198521@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228422 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-02-13 18:10:30 +00:00
runtime/JSTemplateObjectDescriptor.cpp
New bytecode format for JSC https://bugs.webkit.org/show_bug.cgi?id=187373 <rdar://problem/44186758> Reviewed by Filip Pizlo. .: Disable JIT by default on 32-bit platforms * Source/cmake/WebKitFeatures.cmake: JSTests: Add tests to ensure that the inferred inline capacity for a narrow op_new_object will be capped at 255. * stress/maximum-inline-capacity.js: Added. (test1): (test3.Foo): (test3): Source/JavaScriptCore: Replace unlinked and linked bytecode with a new immutable bytecode that does not embed any addresses. Instructions can be encoded as narrow (1-byte operands) or wide (4-byte operands) and might contain an extra operand, the metadataID. The metadataID is used to access the instruction's mutable data in a side table in the CodeBlock (the MetadataTable). Bytecodes now must be structs declared in the new BytecodeList.rb. All bytecodes give names and types to all its operands. Additionally, reading a bytecode from the instruction stream requires decoding the whole bytecode, i.e. it's no longer possible to access arbitrary operands directly from the stream. * CMakeLists.txt: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/MacroAssemblerCodeRef.h: (JSC::ReturnAddressPtr::ReturnAddressPtr): (JSC::ReturnAddressPtr::value const): (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): (JSC::MacroAssemblerCodePtr::createFromExecutableAddress): * bytecode/ArithProfile.h: (JSC::ArithProfile::ArithProfile): * bytecode/ArrayAllocationProfile.h: (JSC::ArrayAllocationProfile::ArrayAllocationProfile): * bytecode/ArrayProfile.h: * bytecode/BytecodeBasicBlock.cpp: (JSC::isJumpTarget): (JSC::BytecodeBasicBlock::computeImpl): (JSC::BytecodeBasicBlock::compute): * bytecode/BytecodeBasicBlock.h: (JSC::BytecodeBasicBlock::leaderOffset const): (JSC::BytecodeBasicBlock::totalLength const): (JSC::BytecodeBasicBlock::offsets const): (JSC::BytecodeBasicBlock::BytecodeBasicBlock): (JSC::BytecodeBasicBlock::addLength): * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::printLocationAndOp): (JSC::BytecodeDumper<Block>::dumpBytecode): (JSC::BytecodeDumper<Block>::dumpIdentifiers): (JSC::BytecodeDumper<Block>::dumpConstants): (JSC::BytecodeDumper<Block>::dumpExceptionHandlers): (JSC::BytecodeDumper<Block>::dumpSwitchJumpTables): (JSC::BytecodeDumper<Block>::dumpStringSwitchJumpTables): (JSC::BytecodeDumper<Block>::dumpBlock): * bytecode/BytecodeDumper.h: (JSC::BytecodeDumper::dumpOperand): (JSC::BytecodeDumper::dumpValue): (JSC::BytecodeDumper::BytecodeDumper): (JSC::BytecodeDumper::block const): * bytecode/BytecodeGeneratorification.cpp: (JSC::BytecodeGeneratorification::BytecodeGeneratorification): (JSC::BytecodeGeneratorification::enterPoint const): (JSC::BytecodeGeneratorification::instructions const): (JSC::GeneratorLivenessAnalysis::run): (JSC::BytecodeGeneratorification::run): (JSC::performGeneratorification): * bytecode/BytecodeGeneratorification.h: * bytecode/BytecodeGraph.h: (JSC::BytecodeGraph::blockContainsBytecodeOffset): (JSC::BytecodeGraph::findBasicBlockForBytecodeOffset): (JSC::BytecodeGraph::findBasicBlockWithLeaderOffset): (JSC::BytecodeGraph::BytecodeGraph): * bytecode/BytecodeKills.h: * bytecode/BytecodeList.json: Removed. * bytecode/BytecodeList.rb: Added. * bytecode/BytecodeLivenessAnalysis.cpp: (JSC::BytecodeLivenessAnalysis::dumpResults): * bytecode/BytecodeLivenessAnalysis.h: * bytecode/BytecodeLivenessAnalysisInlines.h: (JSC::isValidRegisterForLiveness): (JSC::BytecodeLivenessPropagation::stepOverInstruction): * bytecode/BytecodeRewriter.cpp: (JSC::BytecodeRewriter::applyModification): (JSC::BytecodeRewriter::execute): (JSC::BytecodeRewriter::adjustJumpTargetsInFragment): (JSC::BytecodeRewriter::insertImpl): (JSC::BytecodeRewriter::adjustJumpTarget): (JSC::BytecodeRewriter::adjustJumpTargets): * bytecode/BytecodeRewriter.h: (JSC::BytecodeRewriter::InsertionPoint::InsertionPoint): (JSC::BytecodeRewriter::Fragment::Fragment): (JSC::BytecodeRewriter::Fragment::appendInstruction): (JSC::BytecodeRewriter::BytecodeRewriter): (JSC::BytecodeRewriter::insertFragmentBefore): (JSC::BytecodeRewriter::insertFragmentAfter): (JSC::BytecodeRewriter::removeBytecode): (JSC::BytecodeRewriter::adjustAbsoluteOffset): (JSC::BytecodeRewriter::adjustJumpTarget): * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): (JSC::computeDefsForBytecodeOffset): * bytecode/CallLinkStatus.cpp: (JSC::CallLinkStatus::computeFromLLInt): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): (JSC::CodeBlock::CodeBlock): (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::estimatedSize): (JSC::CodeBlock::visitChildren): (JSC::CodeBlock::propagateTransitions): (JSC::CodeBlock::finalizeLLIntInlineCaches): (JSC::CodeBlock::addJITAddIC): (JSC::CodeBlock::addJITMulIC): (JSC::CodeBlock::addJITSubIC): (JSC::CodeBlock::addJITNegIC): (JSC::CodeBlock::stronglyVisitStrongReferences): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffset): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffsetSlow): (JSC::CodeBlock::hasOpDebugForLineAndColumn): (JSC::CodeBlock::getArrayProfile): (JSC::CodeBlock::updateAllArrayPredictions): (JSC::CodeBlock::predictedMachineCodeSize): (JSC::CodeBlock::tryGetValueProfileForBytecodeOffset): (JSC::CodeBlock::valueProfilePredictionForBytecodeOffset): (JSC::CodeBlock::valueProfileForBytecodeOffset): (JSC::CodeBlock::validate): (JSC::CodeBlock::outOfLineJumpOffset): (JSC::CodeBlock::outOfLineJumpTarget): (JSC::CodeBlock::arithProfileForBytecodeOffset): (JSC::CodeBlock::arithProfileForPC): (JSC::CodeBlock::couldTakeSpecialFastCase): (JSC::CodeBlock::insertBasicBlockBoundariesForControlFlowProfiler): * bytecode/CodeBlock.h: (JSC::CodeBlock::addMathIC): (JSC::CodeBlock::outOfLineJumpOffset): (JSC::CodeBlock::bytecodeOffset): (JSC::CodeBlock::instructions const): (JSC::CodeBlock::instructionCount const): (JSC::CodeBlock::llintBaselineCalleeSaveSpaceAsVirtualRegisters): (JSC::CodeBlock::metadata): (JSC::CodeBlock::metadataSizeInBytes): (JSC::CodeBlock::numberOfNonArgumentValueProfiles): (JSC::CodeBlock::totalNumberOfValueProfiles): * bytecode/CodeBlockInlines.h: Added. (JSC::CodeBlock::forEachValueProfile): (JSC::CodeBlock::forEachArrayProfile): (JSC::CodeBlock::forEachArrayAllocationProfile): (JSC::CodeBlock::forEachObjectAllocationProfile): (JSC::CodeBlock::forEachLLIntCallLinkInfo): * bytecode/Fits.h: Added. * bytecode/GetByIdMetadata.h: Copied from Source/JavaScriptCore/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h. * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::computeFromLLInt): * bytecode/Instruction.h: (JSC::Instruction::Instruction): (JSC::Instruction::Impl::opcodeID const): (JSC::Instruction::opcodeID const): (JSC::Instruction::name const): (JSC::Instruction::isWide const): (JSC::Instruction::size const): (JSC::Instruction::is const): (JSC::Instruction::as const): (JSC::Instruction::cast): (JSC::Instruction::cast const): (JSC::Instruction::narrow const): (JSC::Instruction::wide const): * bytecode/InstructionStream.cpp: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. (JSC::InstructionStream::InstructionStream): (JSC::InstructionStream::sizeInBytes const): * bytecode/InstructionStream.h: Added. (JSC::InstructionStream::BaseRef::BaseRef): (JSC::InstructionStream::BaseRef::operator=): (JSC::InstructionStream::BaseRef::operator-> const): (JSC::InstructionStream::BaseRef::ptr const): (JSC::InstructionStream::BaseRef::operator!= const): (JSC::InstructionStream::BaseRef::next const): (JSC::InstructionStream::BaseRef::offset const): (JSC::InstructionStream::BaseRef::isValid const): (JSC::InstructionStream::BaseRef::unwrap const): (JSC::InstructionStream::MutableRef::freeze const): (JSC::InstructionStream::MutableRef::operator->): (JSC::InstructionStream::MutableRef::ptr): (JSC::InstructionStream::MutableRef::operator Ref): (JSC::InstructionStream::MutableRef::unwrap): (JSC::InstructionStream::iterator::operator*): (JSC::InstructionStream::iterator::operator++): (JSC::InstructionStream::begin const): (JSC::InstructionStream::end const): (JSC::InstructionStream::at const): (JSC::InstructionStream::size const): (JSC::InstructionStreamWriter::InstructionStreamWriter): (JSC::InstructionStreamWriter::ref): (JSC::InstructionStreamWriter::seek): (JSC::InstructionStreamWriter::position): (JSC::InstructionStreamWriter::write): (JSC::InstructionStreamWriter::rewind): (JSC::InstructionStreamWriter::finalize): (JSC::InstructionStreamWriter::swap): (JSC::InstructionStreamWriter::iterator::operator*): (JSC::InstructionStreamWriter::iterator::operator++): (JSC::InstructionStreamWriter::begin): (JSC::InstructionStreamWriter::end): * bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp: (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::LLIntPrototypeLoadAdaptiveStructureWatchpoint): (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::fireInternal): (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::clearLLIntGetByIdCache): * bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h: * bytecode/MetadataTable.cpp: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. (JSC::MetadataTable::MetadataTable): (JSC::DeallocTable::withOpcodeType): (JSC::MetadataTable::~MetadataTable): (JSC::MetadataTable::sizeInBytes): * bytecode/MetadataTable.h: Copied from Source/JavaScriptCore/runtime/Watchdog.h. (JSC::MetadataTable::get): (JSC::MetadataTable::forEach): (JSC::MetadataTable::getImpl): * bytecode/Opcode.cpp: (JSC::metadataSize): * bytecode/Opcode.h: (JSC::padOpcodeName): * bytecode/OpcodeInlines.h: (JSC::isOpcodeShape): (JSC::getOpcodeType): * bytecode/OpcodeSize.h: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. * bytecode/PreciseJumpTargets.cpp: (JSC::getJumpTargetsForInstruction): (JSC::computePreciseJumpTargetsInternal): (JSC::computePreciseJumpTargets): (JSC::recomputePreciseJumpTargets): (JSC::findJumpTargetsForInstruction): * bytecode/PreciseJumpTargets.h: * bytecode/PreciseJumpTargetsInlines.h: (JSC::jumpTargetForInstruction): (JSC::extractStoredJumpTargetsForInstruction): (JSC::updateStoredJumpTargetsForInstruction): * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::computeFromLLInt): * bytecode/SpecialPointer.cpp: (WTF::printInternal): * bytecode/SpecialPointer.h: * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): (JSC::UnlinkedCodeBlock::visitChildren): (JSC::UnlinkedCodeBlock::estimatedSize): (JSC::UnlinkedCodeBlock::lineNumberForBytecodeOffset): (JSC::dumpLineColumnEntry): (JSC::UnlinkedCodeBlock::expressionRangeForBytecodeOffset const): (JSC::UnlinkedCodeBlock::setInstructions): (JSC::UnlinkedCodeBlock::instructions const): (JSC::UnlinkedCodeBlock::applyModification): (JSC::UnlinkedCodeBlock::addOutOfLineJumpTarget): (JSC::UnlinkedCodeBlock::outOfLineJumpOffset): * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::addPropertyAccessInstruction): (JSC::UnlinkedCodeBlock::propertyAccessInstructions const): (JSC::UnlinkedCodeBlock::addOpProfileControlFlowBytecodeOffset): (JSC::UnlinkedCodeBlock::opProfileControlFlowBytecodeOffsets const): (JSC::UnlinkedCodeBlock::metadata): (JSC::UnlinkedCodeBlock::metadataSizeInBytes): (JSC::UnlinkedCodeBlock::outOfLineJumpOffset): (JSC::UnlinkedCodeBlock::replaceOutOfLineJumpTargets): * bytecode/UnlinkedInstructionStream.cpp: Removed. * bytecode/UnlinkedInstructionStream.h: Removed. * bytecode/UnlinkedMetadataTable.h: Copied from Source/JavaScriptCore/bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h. * bytecode/UnlinkedMetadataTableInlines.h: Added. (JSC::UnlinkedMetadataTable::UnlinkedMetadataTable): (JSC::UnlinkedMetadataTable::~UnlinkedMetadataTable): (JSC::UnlinkedMetadataTable::addEntry): (JSC::UnlinkedMetadataTable::sizeInBytes): (JSC::UnlinkedMetadataTable::finalize): (JSC::UnlinkedMetadataTable::link): (JSC::UnlinkedMetadataTable::unlink): * bytecode/VirtualRegister.cpp: (JSC::VirtualRegister::VirtualRegister): * bytecode/VirtualRegister.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::Label::setLocation): (JSC::Label::bind): (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::initializeVarLexicalEnvironment): (JSC::BytecodeGenerator::emitEnter): (JSC::BytecodeGenerator::emitLoopHint): (JSC::BytecodeGenerator::emitJump): (JSC::BytecodeGenerator::emitCheckTraps): (JSC::BytecodeGenerator::rewind): (JSC::BytecodeGenerator::fuseCompareAndJump): (JSC::BytecodeGenerator::fuseTestAndJmp): (JSC::BytecodeGenerator::emitJumpIfTrue): (JSC::BytecodeGenerator::emitJumpIfFalse): (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall): (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply): (JSC::BytecodeGenerator::moveLinkTimeConstant): (JSC::BytecodeGenerator::moveEmptyValue): (JSC::BytecodeGenerator::emitMove): (JSC::BytecodeGenerator::emitUnaryOp): (JSC::BytecodeGenerator::emitBinaryOp): (JSC::BytecodeGenerator::emitToObject): (JSC::BytecodeGenerator::emitToNumber): (JSC::BytecodeGenerator::emitToString): (JSC::BytecodeGenerator::emitTypeOf): (JSC::BytecodeGenerator::emitInc): (JSC::BytecodeGenerator::emitDec): (JSC::BytecodeGenerator::emitEqualityOp): (JSC::BytecodeGenerator::emitProfileType): (JSC::BytecodeGenerator::emitProfileControlFlow): (JSC::BytecodeGenerator::pushLexicalScopeInternal): (JSC::BytecodeGenerator::emitResolveScopeForHoistingFuncDeclInEval): (JSC::BytecodeGenerator::prepareLexicalScopeForNextForLoopIteration): (JSC::BytecodeGenerator::emitOverridesHasInstance): (JSC::BytecodeGenerator::emitResolveScope): (JSC::BytecodeGenerator::emitGetFromScope): (JSC::BytecodeGenerator::emitPutToScope): (JSC::BytecodeGenerator::emitInstanceOf): (JSC::BytecodeGenerator::emitInstanceOfCustom): (JSC::BytecodeGenerator::emitInByVal): (JSC::BytecodeGenerator::emitInById): (JSC::BytecodeGenerator::emitTryGetById): (JSC::BytecodeGenerator::emitGetById): (JSC::BytecodeGenerator::emitDirectGetById): (JSC::BytecodeGenerator::emitPutById): (JSC::BytecodeGenerator::emitDirectPutById): (JSC::BytecodeGenerator::emitPutGetterById): (JSC::BytecodeGenerator::emitPutSetterById): (JSC::BytecodeGenerator::emitPutGetterSetter): (JSC::BytecodeGenerator::emitPutGetterByVal): (JSC::BytecodeGenerator::emitPutSetterByVal): (JSC::BytecodeGenerator::emitDeleteById): (JSC::BytecodeGenerator::emitGetByVal): (JSC::BytecodeGenerator::emitPutByVal): (JSC::BytecodeGenerator::emitDirectPutByVal): (JSC::BytecodeGenerator::emitDeleteByVal): (JSC::BytecodeGenerator::emitSuperSamplerBegin): (JSC::BytecodeGenerator::emitSuperSamplerEnd): (JSC::BytecodeGenerator::emitIdWithProfile): (JSC::BytecodeGenerator::emitUnreachable): (JSC::BytecodeGenerator::emitGetArgument): (JSC::BytecodeGenerator::emitCreateThis): (JSC::BytecodeGenerator::emitTDZCheck): (JSC::BytecodeGenerator::emitNewObject): (JSC::BytecodeGenerator::emitNewArrayBuffer): (JSC::BytecodeGenerator::emitNewArray): (JSC::BytecodeGenerator::emitNewArrayWithSpread): (JSC::BytecodeGenerator::emitNewArrayWithSize): (JSC::BytecodeGenerator::emitNewRegExp): (JSC::BytecodeGenerator::emitNewFunctionExpressionCommon): (JSC::BytecodeGenerator::emitNewDefaultConstructor): (JSC::BytecodeGenerator::emitNewFunction): (JSC::BytecodeGenerator::emitSetFunctionNameIfNeeded): (JSC::BytecodeGenerator::emitCall): (JSC::BytecodeGenerator::emitCallInTailPosition): (JSC::BytecodeGenerator::emitCallEval): (JSC::BytecodeGenerator::emitExpectedFunctionSnippet): (JSC::BytecodeGenerator::emitCallVarargs): (JSC::BytecodeGenerator::emitCallVarargsInTailPosition): (JSC::BytecodeGenerator::emitConstructVarargs): (JSC::BytecodeGenerator::emitCallForwardArgumentsInTailPosition): (JSC::BytecodeGenerator::emitLogShadowChickenPrologueIfNecessary): (JSC::BytecodeGenerator::emitLogShadowChickenTailIfNecessary): (JSC::BytecodeGenerator::emitCallDefineProperty): (JSC::BytecodeGenerator::emitReturn): (JSC::BytecodeGenerator::emitEnd): (JSC::BytecodeGenerator::emitConstruct): (JSC::BytecodeGenerator::emitStrcat): (JSC::BytecodeGenerator::emitToPrimitive): (JSC::BytecodeGenerator::emitGetScope): (JSC::BytecodeGenerator::emitPushWithScope): (JSC::BytecodeGenerator::emitGetParentScope): (JSC::BytecodeGenerator::emitDebugHook): (JSC::BytecodeGenerator::emitCatch): (JSC::BytecodeGenerator::emitThrow): (JSC::BytecodeGenerator::emitArgumentCount): (JSC::BytecodeGenerator::emitThrowStaticError): (JSC::BytecodeGenerator::beginSwitch): (JSC::prepareJumpTableForSwitch): (JSC::prepareJumpTableForStringSwitch): (JSC::BytecodeGenerator::endSwitch): (JSC::BytecodeGenerator::emitGetEnumerableLength): (JSC::BytecodeGenerator::emitHasGenericProperty): (JSC::BytecodeGenerator::emitHasIndexedProperty): (JSC::BytecodeGenerator::emitHasStructureProperty): (JSC::BytecodeGenerator::emitGetPropertyEnumerator): (JSC::BytecodeGenerator::emitEnumeratorStructurePropertyName): (JSC::BytecodeGenerator::emitEnumeratorGenericPropertyName): (JSC::BytecodeGenerator::emitToIndexString): (JSC::BytecodeGenerator::emitIsCellWithType): (JSC::BytecodeGenerator::emitIsObject): (JSC::BytecodeGenerator::emitIsNumber): (JSC::BytecodeGenerator::emitIsUndefined): (JSC::BytecodeGenerator::emitIsEmpty): (JSC::BytecodeGenerator::emitRestParameter): (JSC::BytecodeGenerator::emitRequireObjectCoercible): (JSC::BytecodeGenerator::emitYieldPoint): (JSC::BytecodeGenerator::emitYield): (JSC::BytecodeGenerator::emitGetAsyncIterator): (JSC::BytecodeGenerator::emitDelegateYield): (JSC::BytecodeGenerator::emitFinallyCompletion): (JSC::BytecodeGenerator::emitJumpIf): (JSC::ForInContext::finalize): (JSC::StructureForInContext::finalize): (JSC::IndexedForInContext::finalize): (JSC::StaticPropertyAnalysis::record): (JSC::BytecodeGenerator::emitToThis): * bytecompiler/BytecodeGenerator.h: (JSC::StructureForInContext::addGetInst): (JSC::BytecodeGenerator::recordOpcode): (JSC::BytecodeGenerator::addMetadataFor): (JSC::BytecodeGenerator::emitUnaryOp): (JSC::BytecodeGenerator::kill): (JSC::BytecodeGenerator::instructions const): (JSC::BytecodeGenerator::write): (JSC::BytecodeGenerator::withWriter): * bytecompiler/Label.h: (JSC::Label::Label): (JSC::Label::bind): * bytecompiler/NodesCodegen.cpp: (JSC::ArrayNode::emitBytecode): (JSC::BytecodeIntrinsicNode::emit_intrinsic_argumentCount): (JSC::ApplyFunctionCallDotNode::emitBytecode): (JSC::BitwiseNotNode::emitBytecode): (JSC::BinaryOpNode::emitBytecode): (JSC::EqualNode::emitBytecode): (JSC::StrictEqualNode::emitBytecode): (JSC::emitReadModifyAssignment): (JSC::ForInNode::emitBytecode): (JSC::CaseBlockNode::emitBytecodeForBlock): (JSC::FunctionNode::emitBytecode): (JSC::ClassExprNode::emitBytecode): * bytecompiler/ProfileTypeBytecodeFlag.cpp: Copied from Source/JavaScriptCore/bytecode/VirtualRegister.cpp. (WTF::printInternal): * bytecompiler/ProfileTypeBytecodeFlag.h: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. * bytecompiler/RegisterID.h: * bytecompiler/StaticPropertyAnalysis.h: (JSC::StaticPropertyAnalysis::create): (JSC::StaticPropertyAnalysis::StaticPropertyAnalysis): * bytecompiler/StaticPropertyAnalyzer.h: (JSC::StaticPropertyAnalyzer::createThis): (JSC::StaticPropertyAnalyzer::newObject): (JSC::StaticPropertyAnalyzer::putById): (JSC::StaticPropertyAnalyzer::mov): (JSC::StaticPropertyAnalyzer::kill): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::addCall): (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit): (JSC::DFG::ByteCodeParser::getArrayMode): (JSC::DFG::ByteCodeParser::handleCall): (JSC::DFG::ByteCodeParser::handleVarargsCall): (JSC::DFG::ByteCodeParser::handleRecursiveTailCall): (JSC::DFG::ByteCodeParser::inlineCall): (JSC::DFG::ByteCodeParser::handleCallVariant): (JSC::DFG::ByteCodeParser::handleVarargsInlining): (JSC::DFG::ByteCodeParser::handleInlining): (JSC::DFG::ByteCodeParser::handleMinMax): (JSC::DFG::ByteCodeParser::handleIntrinsicCall): (JSC::DFG::ByteCodeParser::handleDOMJITCall): (JSC::DFG::ByteCodeParser::handleIntrinsicGetter): (JSC::DFG::ByteCodeParser::handleDOMJITGetter): (JSC::DFG::ByteCodeParser::handleModuleNamespaceLoad): (JSC::DFG::ByteCodeParser::handleTypedArrayConstructor): (JSC::DFG::ByteCodeParser::handleConstantInternalFunction): (JSC::DFG::ByteCodeParser::handleGetById): (JSC::DFG::ByteCodeParser::handlePutById): (JSC::DFG::ByteCodeParser::parseGetById): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::parseCodeBlock): (JSC::DFG::ByteCodeParser::handlePutByVal): (JSC::DFG::ByteCodeParser::handlePutAccessorById): (JSC::DFG::ByteCodeParser::handlePutAccessorByVal): (JSC::DFG::ByteCodeParser::handleNewFunc): (JSC::DFG::ByteCodeParser::handleNewFuncExp): (JSC::DFG::ByteCodeParser::parse): * dfg/DFGCapabilities.cpp: (JSC::DFG::capabilityLevel): * dfg/DFGCapabilities.h: (JSC::DFG::capabilityLevel): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareCatchOSREntry): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileValueAdd): (JSC::DFG::SpeculativeJIT::compileValueSub): (JSC::DFG::SpeculativeJIT::compileValueNegate): (JSC::DFG::SpeculativeJIT::compileArithMul): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileValueAdd): (JSC::FTL::DFG::LowerDFGToB3::compileValueSub): (JSC::FTL::DFG::LowerDFGToB3::compileUnaryMathIC): (JSC::FTL::DFG::LowerDFGToB3::compileBinaryMathIC): (JSC::FTL::DFG::LowerDFGToB3::compileArithAddOrSub): (JSC::FTL::DFG::LowerDFGToB3::compileArithMul): (JSC::FTL::DFG::LowerDFGToB3::compileValueNegate): * ftl/FTLOperations.cpp: (JSC::FTL::operationMaterializeObjectInOSR): * generate-bytecode-files: Removed. * generator/Argument.rb: Added. * generator/Assertion.rb: Added. * generator/DSL.rb: Added. * generator/Fits.rb: Added. * generator/GeneratedFile.rb: Added. * generator/Metadata.rb: Added. * generator/Opcode.rb: Added. * generator/OpcodeGroup.rb: Added. * generator/Options.rb: Added. * generator/Section.rb: Added. * generator/Template.rb: Added. * generator/Type.rb: Added. * generator/main.rb: Added. * interpreter/AbstractPC.h: * interpreter/CallFrame.cpp: (JSC::CallFrame::currentVPC const): (JSC::CallFrame::setCurrentVPC): * interpreter/CallFrame.h: (JSC::CallSiteIndex::CallSiteIndex): (JSC::ExecState::setReturnPC): * interpreter/Interpreter.cpp: (WTF::printInternal): * interpreter/Interpreter.h: * interpreter/InterpreterInlines.h: * interpreter/StackVisitor.cpp: (JSC::StackVisitor::Frame::dump const): * interpreter/VMEntryRecord.h: * jit/JIT.cpp: (JSC::JIT::JIT): (JSC::JIT::emitSlowCaseCall): (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::compileWithoutLinking): (JSC::JIT::link): * jit/JIT.h: * jit/JITArithmetic.cpp: (JSC::JIT::emit_op_jless): (JSC::JIT::emit_op_jlesseq): (JSC::JIT::emit_op_jgreater): (JSC::JIT::emit_op_jgreatereq): (JSC::JIT::emit_op_jnless): (JSC::JIT::emit_op_jnlesseq): (JSC::JIT::emit_op_jngreater): (JSC::JIT::emit_op_jngreatereq): (JSC::JIT::emitSlow_op_jless): (JSC::JIT::emitSlow_op_jlesseq): (JSC::JIT::emitSlow_op_jgreater): (JSC::JIT::emitSlow_op_jgreatereq): (JSC::JIT::emitSlow_op_jnless): (JSC::JIT::emitSlow_op_jnlesseq): (JSC::JIT::emitSlow_op_jngreater): (JSC::JIT::emitSlow_op_jngreatereq): (JSC::JIT::emit_op_below): (JSC::JIT::emit_op_beloweq): (JSC::JIT::emit_op_jbelow): (JSC::JIT::emit_op_jbeloweq): (JSC::JIT::emit_op_unsigned): (JSC::JIT::emit_compareAndJump): (JSC::JIT::emit_compareUnsignedAndJump): (JSC::JIT::emit_compareUnsigned): (JSC::JIT::emit_compareAndJumpSlow): (JSC::JIT::emit_op_inc): (JSC::JIT::emit_op_dec): (JSC::JIT::emit_op_mod): (JSC::JIT::emitSlow_op_mod): (JSC::JIT::emit_op_negate): (JSC::JIT::emitSlow_op_negate): (JSC::JIT::emitBitBinaryOpFastPath): (JSC::JIT::emit_op_bitand): (JSC::JIT::emit_op_bitor): (JSC::JIT::emit_op_bitxor): (JSC::JIT::emit_op_lshift): (JSC::JIT::emitRightShiftFastPath): (JSC::JIT::emit_op_rshift): (JSC::JIT::emit_op_urshift): (JSC::getOperandTypes): (JSC::JIT::emit_op_add): (JSC::JIT::emitSlow_op_add): (JSC::JIT::emitMathICFast): (JSC::JIT::emitMathICSlow): (JSC::JIT::emit_op_div): (JSC::JIT::emit_op_mul): (JSC::JIT::emitSlow_op_mul): (JSC::JIT::emit_op_sub): (JSC::JIT::emitSlow_op_sub): * jit/JITCall.cpp: (JSC::JIT::emitPutCallResult): (JSC::JIT::compileSetupFrame): (JSC::JIT::compileCallEval): (JSC::JIT::compileCallEvalSlowCase): (JSC::JIT::compileTailCall): (JSC::JIT::compileOpCall): (JSC::JIT::compileOpCallSlowCase): (JSC::JIT::emit_op_call): (JSC::JIT::emit_op_tail_call): (JSC::JIT::emit_op_call_eval): (JSC::JIT::emit_op_call_varargs): (JSC::JIT::emit_op_tail_call_varargs): (JSC::JIT::emit_op_tail_call_forward_arguments): (JSC::JIT::emit_op_construct_varargs): (JSC::JIT::emit_op_construct): (JSC::JIT::emitSlow_op_call): (JSC::JIT::emitSlow_op_tail_call): (JSC::JIT::emitSlow_op_call_eval): (JSC::JIT::emitSlow_op_call_varargs): (JSC::JIT::emitSlow_op_tail_call_varargs): (JSC::JIT::emitSlow_op_tail_call_forward_arguments): (JSC::JIT::emitSlow_op_construct_varargs): (JSC::JIT::emitSlow_op_construct): * jit/JITDisassembler.cpp: (JSC::JITDisassembler::JITDisassembler): * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITInlines.h: (JSC::JIT::emitDoubleGetByVal): (JSC::JIT::emitLoadForArrayMode): (JSC::JIT::emitContiguousGetByVal): (JSC::JIT::emitArrayStorageGetByVal): (JSC::JIT::appendCallWithExceptionCheckSetJSValueResultWithProfile): (JSC::JIT::sampleInstruction): (JSC::JIT::emitValueProfilingSiteIfProfiledOpcode): (JSC::JIT::emitValueProfilingSite): (JSC::JIT::jumpTarget): (JSC::JIT::copiedGetPutInfo): (JSC::JIT::copiedArithProfile): * jit/JITMathIC.h: (JSC::isProfileEmpty): (JSC::JITBinaryMathIC::JITBinaryMathIC): (JSC::JITUnaryMathIC::JITUnaryMathIC): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_mov): (JSC::JIT::emit_op_end): (JSC::JIT::emit_op_jmp): (JSC::JIT::emit_op_new_object): (JSC::JIT::emitSlow_op_new_object): (JSC::JIT::emit_op_overrides_has_instance): (JSC::JIT::emit_op_instanceof): (JSC::JIT::emitSlow_op_instanceof): (JSC::JIT::emit_op_instanceof_custom): (JSC::JIT::emit_op_is_empty): (JSC::JIT::emit_op_is_undefined): (JSC::JIT::emit_op_is_boolean): (JSC::JIT::emit_op_is_number): (JSC::JIT::emit_op_is_cell_with_type): (JSC::JIT::emit_op_is_object): (JSC::JIT::emit_op_ret): (JSC::JIT::emit_op_to_primitive): (JSC::JIT::emit_op_set_function_name): (JSC::JIT::emit_op_not): (JSC::JIT::emit_op_jfalse): (JSC::JIT::emit_op_jeq_null): (JSC::JIT::emit_op_jneq_null): (JSC::JIT::emit_op_jneq_ptr): (JSC::JIT::emit_op_eq): (JSC::JIT::emit_op_jeq): (JSC::JIT::emit_op_jtrue): (JSC::JIT::emit_op_neq): (JSC::JIT::emit_op_jneq): (JSC::JIT::emit_op_throw): (JSC::JIT::compileOpStrictEq): (JSC::JIT::emit_op_stricteq): (JSC::JIT::emit_op_nstricteq): (JSC::JIT::compileOpStrictEqJump): (JSC::JIT::emit_op_jstricteq): (JSC::JIT::emit_op_jnstricteq): (JSC::JIT::emitSlow_op_jstricteq): (JSC::JIT::emitSlow_op_jnstricteq): (JSC::JIT::emit_op_to_number): (JSC::JIT::emit_op_to_string): (JSC::JIT::emit_op_to_object): (JSC::JIT::emit_op_catch): (JSC::JIT::emit_op_identity_with_profile): (JSC::JIT::emit_op_get_parent_scope): (JSC::JIT::emit_op_switch_imm): (JSC::JIT::emit_op_switch_char): (JSC::JIT::emit_op_switch_string): (JSC::JIT::emit_op_debug): (JSC::JIT::emit_op_eq_null): (JSC::JIT::emit_op_neq_null): (JSC::JIT::emit_op_enter): (JSC::JIT::emit_op_get_scope): (JSC::JIT::emit_op_to_this): (JSC::JIT::emit_op_create_this): (JSC::JIT::emit_op_check_tdz): (JSC::JIT::emitSlow_op_eq): (JSC::JIT::emitSlow_op_neq): (JSC::JIT::emitSlow_op_jeq): (JSC::JIT::emitSlow_op_jneq): (JSC::JIT::emitSlow_op_instanceof_custom): (JSC::JIT::emit_op_loop_hint): (JSC::JIT::emitSlow_op_loop_hint): (JSC::JIT::emit_op_check_traps): (JSC::JIT::emit_op_nop): (JSC::JIT::emit_op_super_sampler_begin): (JSC::JIT::emit_op_super_sampler_end): (JSC::JIT::emitSlow_op_check_traps): (JSC::JIT::emit_op_new_regexp): (JSC::JIT::emitNewFuncCommon): (JSC::JIT::emit_op_new_func): (JSC::JIT::emit_op_new_generator_func): (JSC::JIT::emit_op_new_async_generator_func): (JSC::JIT::emit_op_new_async_func): (JSC::JIT::emitNewFuncExprCommon): (JSC::JIT::emit_op_new_func_exp): (JSC::JIT::emit_op_new_generator_func_exp): (JSC::JIT::emit_op_new_async_func_exp): (JSC::JIT::emit_op_new_async_generator_func_exp): (JSC::JIT::emit_op_new_array): (JSC::JIT::emit_op_new_array_with_size): (JSC::JIT::emit_op_has_structure_property): (JSC::JIT::privateCompileHasIndexedProperty): (JSC::JIT::emit_op_has_indexed_property): (JSC::JIT::emitSlow_op_has_indexed_property): (JSC::JIT::emit_op_get_direct_pname): (JSC::JIT::emit_op_enumerator_structure_pname): (JSC::JIT::emit_op_enumerator_generic_pname): (JSC::JIT::emit_op_profile_type): (JSC::JIT::emit_op_log_shadow_chicken_prologue): (JSC::JIT::emit_op_log_shadow_chicken_tail): (JSC::JIT::emit_op_profile_control_flow): (JSC::JIT::emit_op_argument_count): (JSC::JIT::emit_op_get_rest_length): (JSC::JIT::emit_op_get_argument): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_to_this): * jit/JITOperations.cpp: * jit/JITOperations.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_get_by_val): (JSC::JIT::emitGetByValWithCachedId): (JSC::JIT::emitSlow_op_get_by_val): (JSC::JIT::emit_op_put_by_val_direct): (JSC::JIT::emit_op_put_by_val): (JSC::JIT::emitGenericContiguousPutByVal): (JSC::JIT::emitArrayStoragePutByVal): (JSC::JIT::emitPutByValWithCachedId): (JSC::JIT::emitSlow_op_put_by_val): (JSC::JIT::emit_op_put_getter_by_id): (JSC::JIT::emit_op_put_setter_by_id): (JSC::JIT::emit_op_put_getter_setter_by_id): (JSC::JIT::emit_op_put_getter_by_val): (JSC::JIT::emit_op_put_setter_by_val): (JSC::JIT::emit_op_del_by_id): (JSC::JIT::emit_op_del_by_val): (JSC::JIT::emit_op_try_get_by_id): (JSC::JIT::emitSlow_op_try_get_by_id): (JSC::JIT::emit_op_get_by_id_direct): (JSC::JIT::emitSlow_op_get_by_id_direct): (JSC::JIT::emit_op_get_by_id): (JSC::JIT::emit_op_get_by_id_with_this): (JSC::JIT::emitSlow_op_get_by_id): (JSC::JIT::emitSlow_op_get_by_id_with_this): (JSC::JIT::emit_op_put_by_id): (JSC::JIT::emitSlow_op_put_by_id): (JSC::JIT::emit_op_in_by_id): (JSC::JIT::emitSlow_op_in_by_id): (JSC::JIT::emit_op_resolve_scope): (JSC::JIT::emit_op_get_from_scope): (JSC::JIT::emitSlow_op_get_from_scope): (JSC::JIT::emit_op_put_to_scope): (JSC::JIT::emitSlow_op_put_to_scope): (JSC::JIT::emit_op_get_from_arguments): (JSC::JIT::emit_op_put_to_arguments): (JSC::JIT::privateCompileGetByVal): (JSC::JIT::privateCompileGetByValWithCachedId): (JSC::JIT::privateCompilePutByVal): (JSC::JIT::privateCompilePutByValWithCachedId): (JSC::JIT::emitDoubleLoad): (JSC::JIT::emitContiguousLoad): (JSC::JIT::emitArrayStorageLoad): (JSC::JIT::emitDirectArgumentsGetByVal): (JSC::JIT::emitScopedArgumentsGetByVal): (JSC::JIT::emitIntTypedArrayGetByVal): (JSC::JIT::emitFloatTypedArrayGetByVal): (JSC::JIT::emitIntTypedArrayPutByVal): (JSC::JIT::emitFloatTypedArrayPutByVal): * jit/RegisterSet.cpp: (JSC::RegisterSet::llintBaselineCalleeSaveRegisters): * jit/SlowPathCall.h: (JSC::JITSlowPathCall::JITSlowPathCall): * llint/LLIntData.cpp: (JSC::LLInt::initialize): (JSC::LLInt::Data::performAssertions): * llint/LLIntData.h: (JSC::LLInt::exceptionInstructions): (JSC::LLInt::opcodeMap): (JSC::LLInt::opcodeMapWide): (JSC::LLInt::getOpcode): (JSC::LLInt::getOpcodeWide): (JSC::LLInt::getWideCodePtr): * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::llint_trace_operand): (JSC::LLInt::llint_trace_value): (JSC::LLInt::LLINT_SLOW_PATH_DECL): (JSC::LLInt::entryOSR): (JSC::LLInt::setupGetByIdPrototypeCache): (JSC::LLInt::getByVal): (JSC::LLInt::handleHostCall): (JSC::LLInt::setUpCall): (JSC::LLInt::genericCall): (JSC::LLInt::varargsSetup): (JSC::LLInt::commonCallEval): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter.cpp: (JSC::CLoopRegister::operator const Instruction*): (JSC::CLoop::execute): * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * offlineasm/arm64.rb: * offlineasm/asm.rb: * offlineasm/ast.rb: * offlineasm/cloop.rb: * offlineasm/generate_offset_extractor.rb: * offlineasm/instructions.rb: * offlineasm/offsets.rb: * offlineasm/parser.rb: * offlineasm/transform.rb: * offlineasm/x86.rb: * parser/ResultType.h: (JSC::ResultType::dump const): (JSC::OperandTypes::first const): (JSC::OperandTypes::second const): (JSC::OperandTypes::dump const): * profiler/ProfilerBytecodeSequence.cpp: (JSC::Profiler::BytecodeSequence::BytecodeSequence): * runtime/CommonSlowPaths.cpp: (JSC::SLOW_PATH_DECL): (JSC::updateArithProfileForUnaryArithOp): (JSC::updateArithProfileForBinaryArithOp): * runtime/CommonSlowPaths.h: (JSC::CommonSlowPaths::tryCachePutToScopeGlobal): (JSC::CommonSlowPaths::tryCacheGetFromScopeGlobal): * runtime/ExceptionFuzz.cpp: (JSC::doExceptionFuzzing): * runtime/ExceptionFuzz.h: (JSC::doExceptionFuzzingIfEnabled): * runtime/GetPutInfo.cpp: Copied from Source/JavaScriptCore/bytecode/SpecialPointer.cpp. (JSC::GetPutInfo::dump const): (WTF::printInternal): * runtime/GetPutInfo.h: (JSC::GetPutInfo::operand const): * runtime/JSCPoison.h: * runtime/JSType.cpp: Added. (WTF::printInternal): * runtime/JSType.h: * runtime/SamplingProfiler.cpp: (JSC::SamplingProfiler::StackFrame::displayName): * runtime/SamplingProfiler.h: (JSC::SamplingProfiler::UnprocessedStackFrame::UnprocessedStackFrame): * runtime/SlowPathReturnType.h: (JSC::encodeResult): (JSC::decodeResult): * runtime/VM.h: * runtime/Watchdog.h: * tools/HeapVerifier.cpp: Source/WTF: * wtf/Forward.h: Fix WTF_LAZY_FOR_EACH_TERM on MSVC and add WTF_LAZY_HAS_REST to check whether a macro was passed multiple arguments * wtf/Platform.h: Force ENABLE_JIT=false on all 32-bit platforms * wtf/Vector.h: (WTF::minCapacity>::insertVector): Allow vectors with different overflow handlers to be passed to insertVector Tools: Do not force ENABLE_JIT=true when $forceCLoop is false. * Scripts/build-jsc: LayoutTests: Don't use recursion on `equal` to avoid premature stack overflows when testing deep arrays. * fast/dom/Window/resources/postmessage-test.js: Canonical link: https://commits.webkit.org/205839@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-29 13:16:03 +00:00
runtime/JSType.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/JSTypedArrayConstructors.cpp
runtime/JSTypedArrayPrototypes.cpp
runtime/JSTypedArrayViewConstructor.cpp
runtime/JSTypedArrayViewPrototype.cpp
runtime/JSTypedArrays.cpp
runtime/JSWeakMap.cpp
Add support for WeakRef https://bugs.webkit.org/show_bug.cgi?id=198710 Reviewed by Yusuke Suzuki. Source/JavaScriptCore: Add support for WeakRefs which are now at stage 3 (https://tc39.es/proposal-weakrefs). This patch doesn't add support for FinalizationGroups, which I'll add in another patch. Some other things of interest. Per the spec, we cannot collect a weak refs target unless it has not been dereffed (or created) in the current microtask turn. i.e. WeakRefs are only allowed to be collected at the end of a drain of the Microtask queue. My understanding for this behavior is to reduce implementation dependence on specific GC behavior in a given browser. We track if a WeakRef is retaining its target by using a version number on each WeakRef as well as on the VM. Whenever a WeakRef is derefed we update its version number to match the VM's then WriteBarrier ourselves. During marking if the VM and the WeakRef have the same version number, the target is visited. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * heap/Heap.cpp: (JSC::Heap::finalizeUnconditionalFinalizers): * jsc.cpp: (GlobalObject::finishCreation): (functionReleaseWeakRefs): * runtime/CommonIdentifiers.h: * runtime/JSGlobalObject.cpp: * runtime/JSGlobalObject.h: * runtime/JSWeakObjectRef.cpp: Added. (JSC::JSWeakObjectRef::finishCreation): (JSC::JSWeakObjectRef::visitChildren): (JSC::JSWeakObjectRef::finalizeUnconditionally): (JSC::JSWeakObjectRef::toStringName): * runtime/JSWeakObjectRef.h: Added. * runtime/VM.cpp: (JSC::VM::drainMicrotasks): * runtime/VM.h: (JSC::VM::setOnEachMicrotaskTick): (JSC::VM::finalizeSynchronousJSExecution): (JSC::VM::currentWeakRefVersion const): * runtime/WeakObjectRefConstructor.cpp: Added. (JSC::WeakObjectRefConstructor::finishCreation): (JSC::WeakObjectRefConstructor::WeakObjectRefConstructor): (JSC::callWeakRef): (JSC::constructWeakRef): * runtime/WeakObjectRefConstructor.h: Added. (JSC::WeakObjectRefConstructor::create): (JSC::WeakObjectRefConstructor::createStructure): * runtime/WeakObjectRefPrototype.cpp: Added. (JSC::WeakObjectRefPrototype::finishCreation): (JSC::getWeakRef): (JSC::protoFuncWeakRefDeref): * runtime/WeakObjectRefPrototype.h: Added. Source/WebCore: We need to make sure the Web MicrotaskQueue notifies the JSC VM that it has finished performing a microtask checkpoint. This lets the JSC VM know it is safe to collect referenced WeakRefs. Since there was no way to get the VM from the MicrotaskQueue I have added a RefPtr to the queue's VM. For the main thread the VM lives forever so is fine. For workers the queue and the VM share an owner so this shouldn't matter either. Tests: js/weakref-async-is-collected.html js/weakref-eventually-collects-values.html js/weakref-microtasks-dont-collect.html js/weakref-weakset-consistency.html * dom/Microtasks.cpp: (WebCore::MicrotaskQueue::MicrotaskQueue): (WebCore::MicrotaskQueue::mainThreadQueue): (WebCore::MicrotaskQueue::performMicrotaskCheckpoint): * dom/Microtasks.h: (WebCore::MicrotaskQueue::vm const): * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): LayoutTests: Add an asyncTestStart that mirrors the asyncTestStart behavior in the JSC cli. * http/tests/resources/js-test-pre.js: (asyncTestStart): * js/script-tests/weakref-async-is-collected.js: Added. (makeWeakRef): (turnEventLoop): (async.foo): (async.test): * js/script-tests/weakref-eventually-collects-values.js: Added. (makeWeakRef): (turnEventLoop): (let.weakRefs.async.test): * js/script-tests/weakref-microtasks-dont-collect.js: Added. (asyncTestStart.1.makeWeakRef): (turnEventLoop): (async.foo): (async.test): * js/script-tests/weakref-weakset-consistency.js: Added. (makeWeakRef): (turnEventLoop): (async.foo): (async.test): * js/weakref-async-is-collected-expected.txt: Added. * js/weakref-async-is-collected.html: Added. * js/weakref-eventually-collects-values-expected.txt: Added. * js/weakref-eventually-collects-values.html: Added. * js/weakref-microtasks-dont-collect-expected.txt: Added. * js/weakref-microtasks-dont-collect.html: Added. * js/weakref-weakset-consistency-expected.txt: Added. * js/weakref-weakset-consistency.html: Added. * resources/js-test-pre.js: (asyncTestStart): Canonical link: https://commits.webkit.org/212957@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-06-18 21:02:19 +00:00
runtime/JSWeakObjectRef.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/JSWeakSet.cpp
runtime/JSWithScope.cpp
runtime/JSWrapperObject.cpp
runtime/LazyClassStructure.cpp
Add support for incremental bytecode cache updates https://bugs.webkit.org/show_bug.cgi?id=195000 Reviewed by Filip Pizlo. Source/JavaScriptCore: Add support for incremental updates to the bytecode cache. The cache is constructed as follows: - When the cache is empty, the initial payload can be added to the BytecodeCache by calling BytecodeCache::addGlobalUpdate. This represents the encoded top-level UnlinkedCodeBlock. - Afterwards, updates can be added by calling BytecodeCache::addFunctionUpdate. The update is applied by appending the encoded UnlinkedFunctionCodeBlock to the existing cache and updating the CachedFunctionExecutableMetadata and the offset of the new CachedFunctionCodeBlock in the owner CachedFunctionExecutable. * API/JSScript.mm: (-[JSScript readCache]): (-[JSScript isUsingBytecodeCache]): (-[JSScript init]): (-[JSScript cachedBytecode]): (-[JSScript writeCache:]): * API/JSScriptInternal.h: * API/JSScriptSourceProvider.h: * API/JSScriptSourceProvider.mm: (JSScriptSourceProvider::cachedBytecode const): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/UnlinkedFunctionExecutable.cpp: (JSC::generateUnlinkedFunctionCodeBlock): * jsc.cpp: (ShellSourceProvider::~ShellSourceProvider): (ShellSourceProvider::cachePath const): (ShellSourceProvider::loadBytecode const): (ShellSourceProvider::ShellSourceProvider): (ShellSourceProvider::cacheEnabled): * parser/SourceProvider.h: (JSC::SourceProvider::cachedBytecode const): (JSC::SourceProvider::updateCache const): (JSC::SourceProvider::commitCachedBytecode const): * runtime/CachePayload.cpp: Copied from Source/JavaScriptCore/API/JSScriptInternal.h. (JSC::CachePayload::makeMappedPayload): (JSC::CachePayload::makeMallocPayload): (JSC::CachePayload::makeEmptyPayload): (JSC::CachePayload::CachePayload): (JSC::CachePayload::~CachePayload): (JSC::CachePayload::operator=): (JSC::CachePayload::freeData): * runtime/CachePayload.h: Copied from Source/JavaScriptCore/API/JSScriptInternal.h. (JSC::CachePayload::data const): (JSC::CachePayload::size const): (JSC::CachePayload::CachePayload): * runtime/CacheUpdate.cpp: Copied from Source/JavaScriptCore/API/JSScriptInternal.h. (JSC::CacheUpdate::CacheUpdate): (JSC::CacheUpdate::operator=): (JSC::CacheUpdate::isGlobal const): (JSC::CacheUpdate::asGlobal const): (JSC::CacheUpdate::asFunction const): * runtime/CacheUpdate.h: Copied from Source/JavaScriptCore/API/JSScriptInternal.h. * runtime/CachedBytecode.cpp: Added. (JSC::CachedBytecode::addGlobalUpdate): (JSC::CachedBytecode::addFunctionUpdate): (JSC::CachedBytecode::copyLeafExecutables): (JSC::CachedBytecode::commitUpdates const): * runtime/CachedBytecode.h: Added. (JSC::CachedBytecode::create): (JSC::CachedBytecode::leafExecutables): (JSC::CachedBytecode::data const): (JSC::CachedBytecode::size const): (JSC::CachedBytecode::hasUpdates const): (JSC::CachedBytecode::sizeForUpdate const): (JSC::CachedBytecode::CachedBytecode): * runtime/CachedTypes.cpp: (JSC::Encoder::addLeafExecutable): (JSC::Encoder::release): (JSC::Decoder::Decoder): (JSC::Decoder::create): (JSC::Decoder::size const): (JSC::Decoder::offsetOf): (JSC::Decoder::ptrForOffsetFromBase): (JSC::Decoder::addLeafExecutable): (JSC::VariableLengthObject::VariableLengthObject): (JSC::VariableLengthObject::buffer const): (JSC::CachedPtrOffsets::offsetOffset): (JSC::CachedWriteBarrierOffsets::ptrOffset): (JSC::CachedFunctionExecutable::features const): (JSC::CachedFunctionExecutable::hasCapturedVariables const): (JSC::CachedFunctionExecutableOffsets::codeBlockForCallOffset): (JSC::CachedFunctionExecutableOffsets::codeBlockForConstructOffset): (JSC::CachedFunctionExecutableOffsets::metadataOffset): (JSC::CachedFunctionExecutable::encode): (JSC::CachedFunctionExecutable::decode const): (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable): (JSC::encodeCodeBlock): (JSC::encodeFunctionCodeBlock): (JSC::decodeCodeBlockImpl): (JSC::isCachedBytecodeStillValid): * runtime/CachedTypes.h: (JSC::VariableLengthObjectBase::VariableLengthObjectBase): (JSC::decodeCodeBlock): * runtime/CodeCache.cpp: (JSC::CodeCache::getUnlinkedGlobalCodeBlock): (JSC::CodeCache::updateCache): (JSC::CodeCache::write): (JSC::writeCodeBlock): (JSC::serializeBytecode): * runtime/CodeCache.h: (JSC::SourceCodeValue::SourceCodeValue): (JSC::CodeCacheMap::findCacheAndUpdateAge): (JSC::CodeCacheMap::fetchFromDiskImpl): * runtime/Completion.cpp: (JSC::generateProgramBytecode): (JSC::generateModuleBytecode): * runtime/Completion.h: * runtime/LeafExecutable.cpp: Copied from Source/JavaScriptCore/API/JSScriptSourceProvider.mm. (JSC::LeafExecutable::operator+ const): * runtime/LeafExecutable.h: Copied from Source/JavaScriptCore/API/JSScriptSourceProvider.mm. (JSC::LeafExecutable::LeafExecutable): (JSC::LeafExecutable::base const): Tools: Exit when the initial run to generate bytecode fails. * Scripts/jsc-stress-test-helpers/bytecode-cache-test-helper.sh: Canonical link: https://commits.webkit.org/211061@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244143 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-10 19:18:20 +00:00
runtime/LeafExecutable.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/LiteralParser.cpp
runtime/Lookup.cpp
runtime/MapConstructor.cpp
runtime/MapIteratorPrototype.cpp
runtime/MapPrototype.cpp
runtime/MatchResult.cpp
runtime/MathCommon.cpp
runtime/MathObject.cpp
runtime/MemoryStatistics.cpp
runtime/ModuleProgramExecutable.cpp
runtime/NarrowingNumberPredictionFuzzerAgent.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/NativeErrorConstructor.cpp
runtime/NativeErrorPrototype.cpp
runtime/NativeExecutable.cpp
runtime/NullGetterFunction.cpp
runtime/NullSetterFunction.cpp
runtime/NumberConstructor.cpp
runtime/NumberObject.cpp
runtime/NumberPredictionFuzzerAgent.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/NumberPrototype.cpp
runtime/ObjectConstructor.cpp
runtime/ObjectInitializationScope.cpp
runtime/ObjectPrototype.cpp
runtime/Operations.cpp
Rolling out r251226: Causes a build speed regression. https://bugs.webkit.org/show_bug.cgi?id=203219 Not reviewed. Apparently, compilers aren't very fast at compiling constexpr function invocations. Rolling this out while I rework the patch to not have this build speed regression. * API/glib/JSCOptions.cpp: (jscOptionsSetValue): (jscOptionsGetValue): (jsc_options_foreach): (jsc_options_get_option_group): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * runtime/JSCConfig.h: * runtime/OptionEntry.h: Copied from Source/JavaScriptCore/runtime/OptionEntry.h. * runtime/Options.cpp: (JSC::Options::isAvailable): (JSC::overrideOptionWithHeuristic): (JSC::scaleJITPolicy): (JSC::recomputeDependentOptions): (JSC::Options::initialize): (JSC::Options::setOptionWithoutAlias): (JSC::Options::dumpAllOptions): (JSC::Options::dumpOption): (JSC::Option::dump const): (JSC::Option::operator== const): (JSC::optionTypeSpecificIndex): Deleted. (JSC::Option::Option): Deleted. (JSC::Option::defaultOption const): Deleted. * runtime/Options.h: (JSC::Option::Option): (JSC::Option::id const): (JSC::Option::name const): (JSC::Option::description const): (JSC::Option::type const): (JSC::Option::availability const): (JSC::Option::isOverridden const): (JSC::Option::defaultOption const): (JSC::Option::boolVal): (JSC::Option::unsignedVal): (JSC::Option::doubleVal): (JSC::Option::int32Val): (JSC::Option::optionRangeVal): (JSC::Option::optionStringVal): (JSC::Option::gcLogLevelVal): (JSC::Option::idIndex const): Deleted. (JSC::optionTypeSpecificIndex): Deleted. * runtime/OptionsList.h: (JSC::OptionRange::operator= ): Deleted. (JSC::OptionRange::rangeString const): Deleted. (JSC::countNumberOfJSCOptionsOfType): Deleted. Canonical link: https://commits.webkit.org/216637@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251400 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-22 00:17:50 +00:00
runtime/Options.cpp
Add FuzzerAgent that reads predictions from a file https://bugs.webkit.org/show_bug.cgi?id=203898 Patch by Tuomas Karkkainen <tuomas.webkit@apple.com> on 2019-12-01 Reviewed by Mark Lam. This patch adds a FuzzerAgent that reads predictions from a file. The predictions in the file are correlated with the prediction sites using the name of the JavaScript source file, the opcode, and start and end offsets in the source. There is also a separate FuzzerAgent that can be used to create the prediction files. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * runtime/FileBasedFuzzerAgent.cpp: Added. * runtime/FileBasedFuzzerAgent.h: Copied from Source/JavaScriptCore/runtime/RandomizingFuzzerAgent.cpp. * runtime/FileBasedFuzzerAgentBase.cpp: Added. * runtime/FileBasedFuzzerAgentBase.h: Copied from Source/JavaScriptCore/runtime/RandomizingFuzzerAgent.cpp. * runtime/FuzzerPredictions.cpp: Added. * runtime/FuzzerPredictions.h: Copied from Source/JavaScriptCore/runtime/RandomizingFuzzerAgent.cpp. * runtime/Options.cpp: * runtime/OptionsList.h: * runtime/PredictionFileCreatingFuzzerAgent.cpp: Copied from Source/JavaScriptCore/runtime/RandomizingFuzzerAgent.cpp. * runtime/PredictionFileCreatingFuzzerAgent.h: Copied from Source/JavaScriptCore/runtime/RandomizingFuzzerAgent.cpp. * runtime/RandomizingFuzzerAgent.cpp: * runtime/VM.cpp: Canonical link: https://commits.webkit.org/217951@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252978 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-12-02 06:44:16 +00:00
runtime/PredictionFileCreatingFuzzerAgent.cpp
[JSC][ESNext] Create a new opcode to handle private fields store/define https://bugs.webkit.org/show_bug.cgi?id=213372 Reviewed by Yusuke Suzuki. JSTests: Adjusting tests that emit `get_private_name` to avoid execution in FTL/DFG. * microbenchmarks/class-fields-private/polymorphic-put-private-field.js: Added. * microbenchmarks/class-fields-private/put-private-field.js: Added. * microbenchmarks/polymorphic-put-public-field.js: Added. * microbenchmarks/put-public-field.js: Added. * stress/dfg-put-private-name-check-barrier-insertion.js: Added. * stress/dfg-put-private-name-compiled-as-put-by-id-direct.js: Added. * stress/dfg-put-private-name-compiled-as-put-private-name-by-id.js: Added. * stress/put-private-name-by-id-set-do-not-add-structure-trasition.js: Added. * stress/put-private-name-check-structure-miss.js: Added. * stress/put-private-name-constant-folding-to-mult-put-by-offset.js: Added. * stress/put-private-name-constant-folding-to-put-by-offset.js: Added. * stress/put-private-name-generic.js: Added. * stress/put-private-name-invalid-define.js: Added. * stress/put-private-name-invalid-store.js: Added. * stress/put-private-name-invalidate-compiled-with-constant-symbol.js: Added. * stress/put-private-name-polymorphic-with-constant-symbol.js: Added. * stress/put-private-name-with-constant-symbol.js: Added. * stress/put-private-name-with-different-identifier.js: Added. Source/JavaScriptCore: This patch is adding a new opcode to handle private field storage. Before this change, we were using `put_by_val_direct` and including the information of `PutKind` into `PutByValFlags`. We initially decided to use `put_by_val_direct` to take advantage of all IC mechanism already implemented for this instruction, however the semantics of private field is different enough to complicate the understanding of `put_by_val_direct`. The new instruction is called `put_private_name` and has as its operands `baseObject` where the put is going to be placed, the `property` that's going to be installed (it is always a private symbol of a private field), the `value` we are going to store and the `PrivateFieldPutKind` that can be `Define` or `Set`. The difference of each `PrivateFieldPutKind` is the following: - Define: It defines a new private field. If this field is already present, it throws a `TypeError`. - Set: It sets the value of a private field. If the field is not present at the moment of set, it throws a `TypeError`. This patch includes support of IC for all tiers. For DFG and FTL, we are only emmiting IC when we are able to emit `CheckConstant` for subscript identifier during Bytecode parsing. We are adding a new DFG node called `PutPrivateNameById` that handles such cases when we have constant identifiers. We are also adding a new DFG node `PutPrivateName` that handles generic case of `put_private_name`. The strategy used to compile `put_private_name` is very similar with what we are using with `put_by_val[_direct]`. We first try to compile it as `[Multi]PutByOffset` using profiled information from LLInt and Baseline execution. If it is not possible, we then emit `PutPrivateName[ById]` node. We get another chance to transform `PutPrivateNameById` into `PutByOffset` if we can prove its structure set at constant folding phase. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/BytecodeList.rb: * bytecode/BytecodeUseDef.cpp: (JSC::computeUsesForBytecodeIndexImpl): (JSC::computeDefsForBytecodeIndexImpl): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::propagateTransitions): (JSC::CodeBlock::finalizeLLIntInlineCaches): * bytecode/Fits.h: * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::computeFromLLInt): (JSC::PutByIdStatus::computeFor): * bytecode/PutByIdStatus.h: * bytecode/PutByValFlags.cpp: Removed. * bytecode/PutByValFlags.h: Removed. * bytecode/PutKind.h: (): Deleted. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitDirectPutByVal): (JSC::BytecodeGenerator::emitDefinePrivateField): (JSC::BytecodeGenerator::emitPrivateFieldPut): * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handlePutPrivateNameById): (JSC::DFG::ByteCodeParser::parseBlock): (JSC::DFG::ByteCodeParser::handlePutByVal): (JSC::DFG::ecmaMode): Deleted. (JSC::DFG::ecmaMode<OpPutByValDirect>): Deleted. * dfg/DFGCapabilities.cpp: (JSC::DFG::capabilityLevel): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::foldConstants): (JSC::DFG::ConstantFoldingPhase::tryFoldAsPutByOffset): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGNode.h: (JSC::DFG::Node::convertToPutByOffset): (JSC::DFG::Node::convertToMultiPutByOffset): (JSC::DFG::Node::hasCacheableIdentifier): (JSC::DFG::Node::hasPrivateFieldPutKind): (JSC::DFG::Node::privateFieldPutKind): * dfg/DFGNodeType.h: * dfg/DFGOpInfo.h: (JSC::DFG::OpInfo::OpInfo): * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compilePutPrivateName): (JSC::DFG::SpeculativeJIT::compilePutPrivateNameById): (JSC::DFG::SpeculativeJIT::compilePutByIdFlush): (JSC::DFG::SpeculativeJIT::compilePutById): (JSC::DFG::SpeculativeJIT::compilePutByIdDirect): (JSC::DFG::SpeculativeJIT::cachedPutById): * dfg/DFGSpeculativeJIT.h: * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGStoreBarrierInsertionPhase.cpp: * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compilePutPrivateNameById): (JSC::FTL::DFG::LowerDFGToB3::compilePutPrivateName): (JSC::FTL::DFG::LowerDFGToB3::cachedPutById): (JSC::FTL::DFG::LowerDFGToB3::compilePutById): * generator/DSL.rb: * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::link): * jit/JIT.h: (JSC::ByValCompilationInfo::ByValCompilationInfo): * jit/JITInlineCacheGenerator.cpp: (JSC::JITPutByIdGenerator::JITPutByIdGenerator): (JSC::JITPutByIdGenerator::slowPathFunction): * jit/JITInlineCacheGenerator.h: (JSC::JITPutByIdGenerator::JITPutByIdGenerator): * jit/JITInlines.h: (JSC::JIT::ecmaMode<OpPutPrivateName>): (JSC::JIT::ecmaMode<OpPutByValDirect>): Deleted. (JSC::JIT::privateFieldAccessKind): Deleted. (JSC::JIT::privateFieldAccessKind<OpPutByValDirect>): Deleted. * jit/JITOperations.cpp: (JSC::setPrivateField): (JSC::putPrivateField): Deleted. * jit/JITOperations.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::emitPutByValWithCachedId): (JSC::JIT::emitSlow_op_put_by_val): (JSC::JIT::emit_op_put_private_name): (JSC::JIT::emitSlow_op_put_private_name): (JSC::JIT::emit_op_put_by_id): (JSC::JIT::emitPutPrivateNameWithCachedId): (JSC::JIT::privateCompilePutPrivateNameWithCachedId): (JSC::JIT::privateCompilePutByValWithCachedId): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emit_op_put_private_name): (JSC::JIT::emitSlow_op_put_private_name): (JSC::JIT::emit_op_put_by_id): * jit/Repatch.cpp: (JSC::appropriateGenericPutByIdFunction): (JSC::appropriateOptimizingPutByIdFunction): (JSC::tryCachePutByID): (JSC::resetPutByID): * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSObject.h: * runtime/JSObjectInlines.h: (JSC::JSObject::setPrivateField): (JSC::JSObject::putPrivateField): Deleted. * runtime/PrivateFieldPutKind.cpp: Added. (JSC::PrivateFieldPutKind::dump const): * runtime/PrivateFieldPutKind.h: Added. (JSC::PrivateFieldPutKind::fromByte): (JSC::PrivateFieldPutKind::none): (JSC::PrivateFieldPutKind::set): (JSC::PrivateFieldPutKind::define): (JSC::PrivateFieldPutKind::isNone const): (JSC::PrivateFieldPutKind::isSet const): (JSC::PrivateFieldPutKind::isDefine const): (JSC::PrivateFieldPutKind::value const): (JSC::PrivateFieldPutKind::PrivateFieldPutKind): Canonical link: https://commits.webkit.org/229673@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267489 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-23 17:19:38 +00:00
runtime/PrivateFieldPutKind.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/ProgramExecutable.cpp
Add support for FinalizationRegistries https://bugs.webkit.org/show_bug.cgi?id=199888 Reviewed by Yusuke Suzuki. JSTests: Shamelessly copy v8's tests and refactor them to work with conservative GC. * stress/resources/v8-mjsunit.js: Added. (MjsUnitAssertionError): (MjsUnitAssertionError.prototype.toString): (catch): (classOf): (ValueOf): (prettyPrinted): (prettyPrintedArrayElement): (failWithMessage): (formatFailureText): (fail): (deepObjectEquals): (deepEquals): (assertSame): (assertNotSame): (assertEquals): (assertNotEquals): (assertEqualsDelta): (assertArrayEquals): (assertPropertiesEqual): (assertToStringEquals): (assertTrue): (assertFalse): (assertNull): (assertNotNull): (executeCode): (checkException): (assertThrows): (assertThrowsEquals): (assertThrowsAsync): (assertInstanceof): (assertDoesNotThrow): (assertUnreachable): (assertContains): (assertMatches): (concatenateErrors): (assertPromiseResult): (OptimizationStatus): (assertUnoptimized): (assertOptimized): (isNeverOptimizeLiteMode): (isNeverOptimize): (isAlwaysOptimize): (isInterpreted): (isOptimized): (isTurboFanned): (MjsUnitAssertionError.prepareStackTrace): * stress/v8-cleanup-from-different-realm.js: Added. (let.timeout_func): * stress/v8-cleanup-proxy-from-different-realm.js: Added. (let.timeout_func): * stress/v8-finalization-registry-basics.js: Added. (TestConstructFinalizationRegistry): (TestFinalizationRegistryConstructorCallAsFunction): (TestConstructFinalizationRegistryCleanupNotCallable): (TestConstructFinalizationRegistryWithNonCallableProxyAsCleanup): (TestRegisterTargetAndHoldingsSameValue): (TestRegisterWithoutFinalizationRegistry): (TestUnregisterWithNonExistentKey): (TestUnregisterWithNonFinalizationRegistry): (TestWeakRefConstructorWithNonObject): (TestWeakRefWithProxy): * stress/v8-finalizationregistry-and-weakref.js: Added. (let.cleanup): (setTimeout): * stress/v8-finalizationregistry-keeps-holdings-alive.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-finalizationregistry-scheduled-for-cleanup-multiple-times.js: Added. (let.cleanup0): (let.cleanup1): (let.timeout_func): * stress/v8-multiple-dirty-finalization-registries.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-reentrant-gc-from-cleanup.js: Added. (let.reentrant_gc): (setTimeout): * stress/v8-stress-finalizationregistry-dirty-enqueue.js: Added. (i.registries.push.new.FinalizationRegistry): (registries.forEach): * stress/v8-undefined-holdings.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-unregister-after-cleanup.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-unregister-before-cleanup.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-unregister-called-twice.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-unregister-inside-cleanup2.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-unregister-inside-cleanup3.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-unregister-many.js: Added. (let.cleanup): (let.timeout_func): * stress/v8-weak-unregistertoken.js: Added. (FR.new.FinalizationRegistry): (tryAgain): Source/JavaScriptCore: This patch adds support for FinalizationRegistries. There are two main parts to this patch, the first is refactoring PromiseTimer a more general into DeferredWorkTimer. This allows us to finally have a "real" setTimeout on the jsc command line. The second part is adding all the new classes needed for FinalizationRegistries. The refactoring is mostly a rename but does two main new things. The first is that it now notifies the VM we have finished a synchronuous JS execution, so that WeakRefs can be collected. The second is that it now catches any exceptions and forwards the to a new method on the global object method table. For WebCore, this reports the exception to the console. For API users, this calls their exceptionHandler block. For the CLI, it exits with exit status 3 (our general exception exit status). Unfortunately, there's not currently an ergonomic way to pass the expected exception from the CLI arguments to this handler so that's not supported here. In order to support FinalizationRegistry this patch adds a "new" class JSDestructibleInternalFieldObjectImpl, which allows us to have a destructible object with internal fields. Since the order of collection doesn't matter we currently use C++ HashTables on the FinalizationRegistry. Since users can unregister objects while the callback is pending we have a hash table for the live entries and a second hash table for the dead ones. Lastly, because users are not requred to provide a token for unregistration we have two extra Vectors containing the live/dead objects that are not unregisterible. * API/JSAPIGlobalObject.cpp: * API/JSAPIGlobalObject.mm: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * heap/Heap.cpp: (JSC::Heap::finalizeUnconditionalFinalizers): * jsc.cpp: (functionSetTimeout): (functionFinalizationRegistryLiveCount): (functionFinalizationRegistryDeadCount): (main): (checkUncaughtException): (checkException): (GlobalObject::reportUncaughtExceptionAtEventLoop): (runJSC): * runtime/ArrayIteratorPrototype.cpp: * runtime/CommonIdentifiers.h: * runtime/DeferredWorkTimer.cpp: Renamed from Source/JavaScriptCore/runtime/PromiseTimer.cpp. (JSC::DeferredWorkTimer::DeferredWorkTimer): (JSC::DeferredWorkTimer::doWork): (JSC::DeferredWorkTimer::runRunLoop): (JSC::DeferredWorkTimer::addPendingWork): (JSC::DeferredWorkTimer::hasPendingWork): (JSC::DeferredWorkTimer::hasDependancyInPendingWork): (JSC::DeferredWorkTimer::cancelPendingWork): (JSC::DeferredWorkTimer::scheduleWorkSoon): * runtime/DeferredWorkTimer.h: Renamed from Source/JavaScriptCore/runtime/PromiseTimer.h. * runtime/FinalizationRegistryConstructor.cpp: Added. (JSC::FinalizationRegistryConstructor::finishCreation): (JSC::FinalizationRegistryConstructor::FinalizationRegistryConstructor): (JSC::callFinalizationRegistry): (JSC::constructFinalizationRegistry): * runtime/FinalizationRegistryConstructor.h: Copied from Source/JavaScriptCore/API/JSAPIGlobalObject.cpp. * runtime/FinalizationRegistryPrototype.cpp: Added. (JSC::FinalizationRegistryPrototype::finishCreation): (JSC::getFinalizationRegistry): (JSC::protoFuncFinalizationRegistryRegister): (JSC::protoFuncFinalizationRegistryUnregister): * runtime/FinalizationRegistryPrototype.h: Copied from Source/JavaScriptCore/API/JSAPIGlobalObject.cpp. * runtime/IdentifierInlines.h: (JSC::Identifier::Identifier): * runtime/JSFinalizationRegistry.cpp: Added. (JSC::JSFinalizationRegistry::createStructure): (JSC::JSFinalizationRegistry::create): (JSC::JSFinalizationRegistry::finishCreation): (JSC::JSFinalizationRegistry::visitChildren): (JSC::JSFinalizationRegistry::destroy): (JSC::JSFinalizationRegistry::finalizeUnconditionally): (JSC::JSFinalizationRegistry::runFinalizationCleanup): (JSC::JSFinalizationRegistry::takeDeadHoldingsValue): (JSC::JSFinalizationRegistry::registerTarget): (JSC::JSFinalizationRegistry::unregister): (JSC::JSFinalizationRegistry::liveCount): (JSC::JSFinalizationRegistry::deadCount): (JSC::JSFinalizationRegistry::toStringName): * runtime/JSFinalizationRegistry.h: Added. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::reportUncaughtExceptionAtEventLoop): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::stackOverflowFrameCallee const): (JSC::JSGlobalObject::arrayIteratorProtocolWatchpointSet): (JSC::JSGlobalObject::mapIteratorProtocolWatchpointSet): (JSC::JSGlobalObject::setIteratorProtocolWatchpointSet): (JSC::JSGlobalObject::stringIteratorProtocolWatchpointSet): (JSC::JSGlobalObject::mapSetWatchpointSet): (JSC::JSGlobalObject::setAddWatchpointSet): (JSC::JSGlobalObject::arraySpeciesWatchpointSet): (JSC::JSGlobalObject::arrayJoinWatchpointSet): (JSC::JSGlobalObject::numberToStringWatchpointSet): * runtime/JSInternalFieldObjectImpl.h: * runtime/JSInternalFieldObjectImplInlines.h: (JSC::Base>::visitChildren): (JSC::JSInternalFieldObjectImpl<passedNumberOfInternalFields>::visitChildren): Deleted. * runtime/JSPromise.cpp: (JSC::JSPromise::resolve): (JSC::JSPromise::reject): * runtime/StructureIDTable.cpp: (JSC::StructureIDTable::allocateID): (JSC::StructureIDTable::deallocateID): * runtime/VM.cpp: (JSC::VM::VM): (JSC::VM::~VM): * runtime/VM.h: * wasm/js/JSWebAssembly.cpp: (JSC::webAssemblyModuleValidateAsyncInternal): (JSC::instantiate): (JSC::compileAndInstantiate): (JSC::webAssemblyModuleInstantinateAsyncInternal): (JSC::webAssemblyCompileStreamingInternal): (JSC::webAssemblyInstantiateStreamingInternal): * wasm/js/JSWebAssemblyCodeBlock.h: Source/WebCore: Refactor things for changing PromiseDeferredTimer to DeferredWorkTimer. Also, add globalObject hook for reporting uncaught exceptions from JSC's runloop callbacks. * bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::reportUncaughtExceptionAtEventLoop): * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::compileStreaming): (WebCore::JSDOMWindowBase::instantiateStreaming): * bindings/js/JSWorkerGlobalScopeBase.cpp: * bindings/js/JSWorkletGlobalScopeBase.cpp: * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::addTimerSetNotification): (WebCore::WorkerScriptController::removeTimerSetNotification): * workers/WorkerRunLoop.cpp: * worklets/WorkletScriptController.cpp: LayoutTests: * js/script-tests/weakref-finalizationregistry.js: Added. (makeWeakRef): (turnEventLoop): (async test): * js/weakref-finalizationregistry-expected.txt: Added. * js/weakref-finalizationregistry.html: Added. Canonical link: https://commits.webkit.org/227365@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@264617 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-07-20 21:03:16 +00:00
runtime/DeferredWorkTimer.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/PropertyDescriptor.cpp
runtime/PropertySlot.cpp
runtime/PropertyTable.cpp
runtime/ProxyConstructor.cpp
runtime/ProxyObject.cpp
runtime/ProxyRevoke.cpp
runtime/RandomizingFuzzerAgent.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/ReflectObject.cpp
runtime/RegExp.cpp
runtime/RegExpCache.cpp
runtime/RegExpCachedResult.cpp
runtime/RegExpConstructor.cpp
[JSC] RegExpConstructor should not have own IsoSubspace https://bugs.webkit.org/show_bug.cgi?id=193801 Reviewed by Mark Lam. This patch finally removes RegExpConstructor's cached data to JSGlobalObject and remove IsoSubspace for RegExpConstructor. sizeof(RegExpConstructor) != sizeof(InternalFunction), so that we have 16KB memory just for RegExpConstructor. But cached regexp matching data (e.g. `RegExp.$1`) is per-JSGlobalObject one, and we can move this data to JSGlobalObject and remove it from RegExpConstructor members. We introduce RegExpGlobalData, which holds the per-global RegExp matching data. And we perform `performMatch` etc. with JSGlobalObject instead of RegExpConstructor. This change requires small changes in DFG / FTL's RecordRegExpCachedResult node since its 1st argument is changed from RegExpConstructor to JSGlobalObject. We also move emptyRegExp from RegExpPrototype to VM's RegExpCache because it is more natural place to put it. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * dfg/DFGOperations.cpp: * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileRecordRegExpCachedResult): * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * ftl/FTLAbstractHeapRepository.cpp: * ftl/FTLAbstractHeapRepository.h: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileRecordRegExpCachedResult): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::regExpGlobalData): (JSC::JSGlobalObject::regExpGlobalDataOffset): (JSC::JSGlobalObject::regExpConstructor const): Deleted. * runtime/RegExpCache.cpp: (JSC::RegExpCache::initialize): * runtime/RegExpCache.h: (JSC::RegExpCache::emptyRegExp const): * runtime/RegExpCachedResult.cpp: (JSC::RegExpCachedResult::visitAggregate): (JSC::RegExpCachedResult::visitChildren): Deleted. * runtime/RegExpCachedResult.h: (JSC::RegExpCachedResult::RegExpCachedResult): Deleted. * runtime/RegExpConstructor.cpp: (JSC::RegExpConstructor::RegExpConstructor): (JSC::regExpConstructorDollar): (JSC::regExpConstructorInput): (JSC::regExpConstructorMultiline): (JSC::regExpConstructorLastMatch): (JSC::regExpConstructorLastParen): (JSC::regExpConstructorLeftContext): (JSC::regExpConstructorRightContext): (JSC::setRegExpConstructorInput): (JSC::setRegExpConstructorMultiline): (JSC::RegExpConstructor::destroy): Deleted. (JSC::RegExpConstructor::visitChildren): Deleted. (JSC::RegExpConstructor::getBackref): Deleted. (JSC::RegExpConstructor::getLastParen): Deleted. (JSC::RegExpConstructor::getLeftContext): Deleted. (JSC::RegExpConstructor::getRightContext): Deleted. * runtime/RegExpConstructor.h: (JSC::RegExpConstructor::performMatch): Deleted. (JSC::RegExpConstructor::recordMatch): Deleted. * runtime/RegExpGlobalData.cpp: Added. (JSC::RegExpGlobalData::visitAggregate): (JSC::RegExpGlobalData::getBackref): (JSC::RegExpGlobalData::getLastParen): (JSC::RegExpGlobalData::getLeftContext): (JSC::RegExpGlobalData::getRightContext): * runtime/RegExpGlobalData.h: Added. (JSC::RegExpGlobalData::cachedResult): (JSC::RegExpGlobalData::setMultiline): (JSC::RegExpGlobalData::multiline const): (JSC::RegExpGlobalData::input): (JSC::RegExpGlobalData::offsetOfCachedResult): * runtime/RegExpGlobalDataInlines.h: Added. (JSC::RegExpGlobalData::setInput): (JSC::RegExpGlobalData::performMatch): (JSC::RegExpGlobalData::recordMatch): * runtime/RegExpObject.cpp: (JSC::RegExpObject::matchGlobal): * runtime/RegExpObjectInlines.h: (JSC::RegExpObject::execInline): (JSC::RegExpObject::matchInline): (JSC::collectMatches): * runtime/RegExpPrototype.cpp: (JSC::RegExpPrototype::finishCreation): (JSC::regExpProtoFuncSearchFast): (JSC::RegExpPrototype::visitChildren): Deleted. * runtime/RegExpPrototype.h: * runtime/StringPrototype.cpp: (JSC::removeUsingRegExpSearch): (JSC::replaceUsingRegExpSearch): * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Canonical link: https://commits.webkit.org/208404@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240593 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-28 19:52:17 +00:00
runtime/RegExpGlobalData.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/RegExpMatchesArray.cpp
runtime/RegExpObject.cpp
runtime/RegExpPrototype.cpp
[ESNExt] String.prototype.matchAll https://bugs.webkit.org/show_bug.cgi?id=186694 Patch by Alexey Shvayka <shvaikalesh@gmail.com> on 2019-06-18 Reviewed by Yusuke Suzuki. Implement String.prototype.matchAll. (https://tc39.es/ecma262/#sec-string.prototype.matchall) JSTests: * test262/config.yaml: Source/JavaScriptCore: Also rename @globalPrivate @constructor functions and C++ variables holding them. Shipping in Chrome since version 73. Shipping in Firefox since version 67. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Scripts/wkbuiltins/builtins_generate_combined_header.py: (get_var_name): (generate_section_for_global_private_code_name_macro): * Sources.txt: * builtins/ArrayPrototype.js: (globalPrivate.ArrayIterator): (values): (keys): (entries): (globalPrivate.createArrayIterator): Deleted. * builtins/AsyncFromSyncIteratorPrototype.js: (globalPrivate.createAsyncFromSyncIterator): (globalPrivate.AsyncFromSyncIterator): (globalPrivate.AsyncFromSyncIteratorConstructor): Deleted. * builtins/BuiltinNames.h: * builtins/MapPrototype.js: (globalPrivate.MapIterator): (values): (keys): (entries): (globalPrivate.createMapIterator): Deleted. * builtins/RegExpPrototype.js: (globalPrivate.RegExpStringIterator): (overriddenName.string_appeared_here.matchAll): * builtins/RegExpStringIteratorPrototype.js: Added. (next): * builtins/SetPrototype.js: (globalPrivate.SetIterator): (values): (entries): (globalPrivate.createSetIterator): Deleted. * builtins/StringPrototype.js: (matchAll): * builtins/TypedArrayPrototype.js: (values): (keys): (entries): * runtime/CommonIdentifiers.h: * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * runtime/RegExpPrototype.cpp: (JSC::RegExpPrototype::finishCreation): * runtime/RegExpStringIteratorPrototype.cpp: Added. (JSC::RegExpStringIteratorPrototype::finishCreation): * runtime/RegExpStringIteratorPrototype.h: Added. * runtime/StringPrototype.cpp: LayoutTests: * js/Object-getOwnPropertyNames-expected.txt: * js/script-tests/Object-getOwnPropertyNames.js: Canonical link: https://commits.webkit.org/212959@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246567 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-06-18 21:21:48 +00:00
runtime/RegExpStringIteratorPrototype.cpp
runtime/ResourceExhaustion.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/RuntimeType.cpp
runtime/SamplingCounter.cpp
runtime/SamplingProfiler.cpp
runtime/ScopeOffset.cpp
runtime/ScopedArguments.cpp
runtime/ScopedArgumentsTable.cpp
runtime/ScriptExecutable.cpp
runtime/SetConstructor.cpp
runtime/SetIteratorPrototype.cpp
runtime/SetPrototype.cpp
runtime/SimpleTypedArrayController.cpp
runtime/SmallStrings.cpp
runtime/SparseArrayValueMap.cpp
runtime/StackFrame.cpp
runtime/StrictEvalActivation.cpp
runtime/StringConstructor.cpp
runtime/StringIteratorPrototype.cpp
runtime/StringObject.cpp
runtime/StringPrototype.cpp
runtime/StringRecursionChecker.cpp
runtime/Structure.cpp
The prototype cache should be aware of the Executable it generates a Structure for https://bugs.webkit.org/show_bug.cgi?id=177907 Reviewed by Filip Pizlo. JSTests: * microbenchmarks/dont-confuse-structures-from-different-executable-as-poly-proto.js: Added. (assert): (foo.C): (foo): (bar.C): (bar): (access): (makeLongChain): (accessY): Source/JavaScriptCore: This patch renames PrototypeMap to StructureCache because it is no longer a map of the prototypes in the VM. It's only used to cache Structures during object construction. The main change of this patch is to guarantee that Structures generated by the create_this originating from different two different Executables' bytecode won't hash-cons to the same thing. Previously, we could hash-cons them depending on the JSObject* prototype pointer. This would cause the last thing that hash-consed to overwrite the Structure's poly proto watchpoint. This happened because when we initialize a JSFunction's ObjectAllocationProfile, we set the resulting Structure's poly proto watchpoint. This could cause a Structure generating from some Executable e1 to end up with the poly proto watchpoint for another Executable e2 simply because JSFunctions backed by e1 and e2 shared the same prototype. Then, based on profiling information, we may fire the wrong Executable's poly proto watchpoint. This patch fixes this bug by guaranteeing that Structures generating from create_this for different Executables are unique even if they share the same prototype by adding the FunctionExecutable* as another field in PrototypeKey. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/InternalFunctionAllocationProfile.h: (JSC::InternalFunctionAllocationProfile::createAllocationStructureFromBase): * bytecode/ObjectAllocationProfile.cpp: (JSC::ObjectAllocationProfile::initializeProfile): * dfg/DFGOperations.cpp: * runtime/CommonSlowPaths.cpp: (JSC::SLOW_PATH_DECL): * runtime/InternalFunction.cpp: (JSC::InternalFunction::createSubclassStructureSlow): * runtime/IteratorOperations.cpp: (JSC::createIteratorResultObjectStructure): * runtime/JSBoundFunction.cpp: (JSC::getBoundFunctionStructure): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * runtime/ObjectConstructor.h: (JSC::constructEmptyObject): * runtime/PrototypeKey.h: (JSC::PrototypeKey::PrototypeKey): (JSC::PrototypeKey::executable const): (JSC::PrototypeKey::operator== const): (JSC::PrototypeKey::hash const): * runtime/PrototypeMap.cpp: Removed. * runtime/PrototypeMap.h: Removed. * runtime/StructureCache.cpp: Copied from Source/JavaScriptCore/runtime/PrototypeMap.cpp. (JSC::StructureCache::createEmptyStructure): (JSC::StructureCache::emptyStructureForPrototypeFromBaseStructure): (JSC::StructureCache::emptyObjectStructureForPrototype): (JSC::PrototypeMap::createEmptyStructure): Deleted. (JSC::PrototypeMap::emptyStructureForPrototypeFromBaseStructure): Deleted. (JSC::PrototypeMap::emptyObjectStructureForPrototype): Deleted. * runtime/StructureCache.h: Copied from Source/JavaScriptCore/runtime/PrototypeMap.h. (JSC::StructureCache::StructureCache): (JSC::PrototypeMap::PrototypeMap): Deleted. * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: Canonical link: https://commits.webkit.org/194368@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223125 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-10 07:58:27 +00:00
runtime/StructureCache.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/StructureChain.cpp
runtime/StructureIDTable.cpp
runtime/StructureRareData.cpp
runtime/Symbol.cpp
runtime/SymbolConstructor.cpp
runtime/SymbolObject.cpp
runtime/SymbolPrototype.cpp
runtime/SymbolTable.cpp
[JSC] cache TaggedTemplate arrays by callsite rather than by contents https://bugs.webkit.org/show_bug.cgi?id=182717 Reviewed by Yusuke Suzuki. https://github.com/tc39/ecma262/pull/890 imposes a change to template literals, to allow template callsite arrays to be collected when the code containing the tagged template call is collected. This spec change has received concensus and been ratified. This change eliminates the eternal map associating template contents with arrays. JSTests: * stress/tagged-template-object-collect.js: Renamed from JSTests/stress/tagged-template-registry-key-collect.js. * stress/tagged-template-object.js: Renamed from JSTests/stress/tagged-template-registry-key.js. * stress/tagged-templates-identity.js: * stress/template-string-tags-eval.js: * test262.yaml: Source/JavaScriptCore: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::setConstantRegisters): * bytecode/DirectEvalCodeCache.cpp: (JSC::DirectEvalCodeCache::setSlow): * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::allowDirectEvalCache const): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::addTemplateObjectConstant): (JSC::BytecodeGenerator::emitGetTemplateObject): (JSC::BytecodeGenerator::addTemplateRegistryKeyConstant): Deleted. * bytecompiler/BytecodeGenerator.h: * parser/Parser.cpp: (JSC::Parser<LexerType>::parseInner): (JSC::Parser<LexerType>::parseMemberExpression): * parser/Parser.h: * parser/ParserModes.h: * runtime/EvalExecutable.h: (JSC::EvalExecutable::allowDirectEvalCache const): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::JSGlobalObject): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::templateRegistry): Deleted. * runtime/JSTemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistry.cpp. (JSC::JSTemplateObjectDescriptor::JSTemplateObjectDescriptor): (JSC::JSTemplateObjectDescriptor::create): (JSC::JSTemplateObjectDescriptor::destroy): (JSC::JSTemplateObjectDescriptor::createTemplateObject): * runtime/JSTemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/JSTemplateRegistryKey.h. (JSC::isTemplateObjectDescriptor): * runtime/JSTemplateRegistryKey.cpp: Removed. * runtime/TemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.cpp. (JSC::TemplateObjectDescriptor::~TemplateObjectDescriptor): * runtime/TemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.h. (JSC::TemplateObjectDescriptor::operator== const): (JSC::TemplateObjectDescriptor::operator!= const): (JSC::TemplateObjectDescriptor::Hasher::hash): (JSC::TemplateObjectDescriptor::Hasher::equal): (JSC::TemplateObjectDescriptor::create): (JSC::TemplateObjectDescriptor::TemplateObjectDescriptor): (JSC::TemplateObjectDescriptor::calculateHash): * runtime/TemplateRegistry.h: Removed. * runtime/TemplateRegistryKeyTable.cpp: Removed. * runtime/TemplateRegistryKeyTable.h: Removed. * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: (JSC::VM::templateRegistryKeyTable): Deleted. * runtime/VMEntryScope.cpp: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::setConstantRegisters): * bytecode/DirectEvalCodeCache.cpp: (JSC::DirectEvalCodeCache::setSlow): * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::allowDirectEvalCache const): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::addTemplateObjectConstant): (JSC::BytecodeGenerator::emitGetTemplateObject): (JSC::BytecodeGenerator::addTemplateRegistryKeyConstant): Deleted. * bytecompiler/BytecodeGenerator.h: * parser/Parser.cpp: (JSC::Parser<LexerType>::parseInner): (JSC::Parser<LexerType>::parseMemberExpression): * parser/Parser.h: * parser/ParserModes.h: * runtime/EvalExecutable.h: (JSC::EvalExecutable::allowDirectEvalCache const): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::JSGlobalObject): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::templateRegistry): Deleted. * runtime/JSTemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistry.cpp. (JSC::JSTemplateObjectDescriptor::JSTemplateObjectDescriptor): (JSC::JSTemplateObjectDescriptor::create): (JSC::JSTemplateObjectDescriptor::destroy): (JSC::JSTemplateObjectDescriptor::createTemplateObject): * runtime/JSTemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/JSTemplateRegistryKey.h. (JSC::isTemplateObjectDescriptor): * runtime/JSTemplateRegistryKey.cpp: Removed. * runtime/TemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.cpp. (JSC::TemplateObjectDescriptor::~TemplateObjectDescriptor): * runtime/TemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.h. (JSC::TemplateObjectDescriptor::operator== const): (JSC::TemplateObjectDescriptor::operator!= const): (JSC::TemplateObjectDescriptor::Hasher::hash): (JSC::TemplateObjectDescriptor::Hasher::equal): (JSC::TemplateObjectDescriptor::create): (JSC::TemplateObjectDescriptor::TemplateObjectDescriptor): (JSC::TemplateObjectDescriptor::calculateHash): * runtime/TemplateRegistry.h: Removed. * runtime/TemplateRegistryKeyTable.cpp: Removed. * runtime/TemplateRegistryKeyTable.h: Removed. * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: (JSC::VM::templateRegistryKeyTable): Deleted. * runtime/VMEntryScope.cpp: * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::setConstantRegisters): * bytecode/DirectEvalCodeCache.cpp: (JSC::DirectEvalCodeCache::setSlow): * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::allowDirectEvalCache const): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::addTemplateObjectConstant): (JSC::BytecodeGenerator::emitGetTemplateObject): (JSC::BytecodeGenerator::addTemplateRegistryKeyConstant): Deleted. * bytecompiler/BytecodeGenerator.h: * parser/Parser.cpp: (JSC::Parser<LexerType>::parseInner): (JSC::Parser<LexerType>::parseMemberExpression): * parser/Parser.h: * parser/ParserModes.h: * runtime/EvalExecutable.h: (JSC::EvalExecutable::allowDirectEvalCache const): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::JSGlobalObject): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::templateRegistry): Deleted. * runtime/JSTemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistry.cpp. (JSC::JSTemplateObjectDescriptor::JSTemplateObjectDescriptor): (JSC::JSTemplateObjectDescriptor::create): (JSC::JSTemplateObjectDescriptor::destroy): (JSC::JSTemplateObjectDescriptor::createTemplateObject): * runtime/JSTemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/JSTemplateRegistryKey.h. (JSC::isTemplateObjectDescriptor): * runtime/JSTemplateRegistryKey.cpp: Removed. * runtime/TemplateObjectDescriptor.cpp: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.cpp. (JSC::TemplateObjectDescriptor::~TemplateObjectDescriptor): * runtime/TemplateObjectDescriptor.h: Renamed from Source/JavaScriptCore/runtime/TemplateRegistryKey.h. (JSC::TemplateObjectDescriptor::operator== const): (JSC::TemplateObjectDescriptor::operator!= const): (JSC::TemplateObjectDescriptor::Hasher::hash): (JSC::TemplateObjectDescriptor::Hasher::equal): (JSC::TemplateObjectDescriptor::create): (JSC::TemplateObjectDescriptor::TemplateObjectDescriptor): (JSC::TemplateObjectDescriptor::calculateHash): * runtime/TemplateRegistry.h: Removed. * runtime/TemplateRegistryKeyTable.cpp: Removed. * runtime/TemplateRegistryKeyTable.h: Removed. * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: (JSC::VM::templateRegistryKeyTable): Deleted. * runtime/VMEntryScope.cpp: Canonical link: https://commits.webkit.org/198521@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228422 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-02-13 18:10:30 +00:00
runtime/TemplateObjectDescriptor.cpp
[JSC] Implement Temporal https://bugs.webkit.org/show_bug.cgi?id=223166 Patch by Philip Chimento <pchimento@igalia.com> on 2021-07-06 Reviewed by Yusuke Suzuki. Intended to be the first patch in a stack. Adds boilerplate for Temporal in order to unblock further parallelizable work on this bug. This patch adds a feature flag for Temporal, and a toplevel Temporal global containing only Temporal.now, which is itself an empty object. These objects will be further populated in later patches. * CMakeLists.txt: Add TemporalObject and TemporalNow. Property lookup table in TemporalObject. * DerivedSources.make: Add TemporalObject property lookup table header. * JavaScriptCore.xcodeproj/project.pbxproj: Add new files. * Sources.txt: Add TemporalObject and TemporalNow. * runtime/CommonIdentifiers.h: Add 'Temporal' property key. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): Create the Temporal global if the feature flag is enabled. * runtime/OptionsList.h: Add useTemporal feature flag. * runtime/TemporalNow.cpp: Added. (JSC::TemporalNow::TemporalNow): (JSC::TemporalNow::create): (JSC::TemporalNow::createStructure): (JSC::TemporalNow::finishCreation): * runtime/TemporalNow.h: Added. * runtime/TemporalObject.cpp: Added. (JSC::createNowObject): (JSC::TemporalObject::TemporalObject): (JSC::TemporalObject::create): (JSC::TemporalObject::createStructure): (JSC::TemporalObject::finishCreation): * runtime/TemporalObject.h: Added. Canonical link: https://commits.webkit.org/239448@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279630 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-07-07 00:48:50 +00:00
runtime/TemporalNow.cpp
runtime/TemporalObject.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/TestRunnerUtils.cpp
runtime/ThrowScope.cpp
runtime/TypeLocationCache.cpp
runtime/TypeProfiler.cpp
runtime/TypeProfilerLog.cpp
runtime/TypeSet.cpp
runtime/TypedArrayController.cpp
runtime/TypedArrayType.cpp
runtime/TypeofType.cpp
runtime/VM.cpp
runtime/VMEntryScope.cpp
runtime/VMTraps.cpp
runtime/VarOffset.cpp
runtime/Watchdog.cpp
runtime/WeakMapConstructor.cpp
[JSC] Implement optimized WeakMap and WeakSet https://bugs.webkit.org/show_bug.cgi?id=179929 Reviewed by Saam Barati. JSTests: * microbenchmarks/weak-map-key.js: * microbenchmarks/weak-set-key.js: Copied from JSTests/microbenchmarks/weak-map-key.js. (assert): (objectKey): (let.start.Date.now): * stress/basic-weakmap.js: Added. (shouldBe): (test): * stress/basic-weakset.js: Added. (shouldBe): (test.set new): * stress/weakmap-cse-set-break.js: Added. (shouldBe): (test): * stress/weakmap-cse.js: Added. (shouldBe): (test): * stress/weakmap-gc.js: Added. (test): * stress/weakset-cse-add-break.js: Added. (shouldBe): (test.set new): * stress/weakset-cse.js: Added. (shouldBe): (test.set new): * stress/weakset-gc.js: Added. (test.set add): (test.set new): (test): Source/JavaScriptCore: This patch introduces WeakMapImpl to optimize WeakMap and WeakSet. This is similar to HashMapImpl. But, 1. WeakMapImpl's bucket is not allocated in GC heap since WeakMap do not need to have iterators. 2. WeakMapImpl's buffer is allocated in JSValue Gigacage instead of auxiliary buffer. This is because we would like to allocate buffer when finalizing GC. At that time, WeakMapImpl prunes dead entries and shrink it if necessary. However, allocating from the GC heap during finalization is not allowed. In particular, (2) is important since it ensures any WeakMap operations do not cause GC. Since GC may collect dead keys in WeakMap, rehash WeakMap, and reallocate/change WeakMap's buffer, ensuring that any WeakMap operations do not cause GC makes our implementation simple. To ensure this, we place DisallowGC for each WeakMap's interface. In DFG, we introduce WeakMapGet and ExtractValueFromWeakMapGet nodes. WeakMapGet looks up entry in WeakMapImpl and returns value. If it is WeakMap, it returns value. And it returns key if it is WeakSet. If it does not find a corresponding entry, it returns JSEmpty. ExtractValueFromWeakMapGet converts JSEmpty to JSUndefined. This patch improves WeakMap and WeakSet operations. baseline patched weak-set-key 240.6932+-10.4923 ^ 148.7606+-6.1784 ^ definitely 1.6180x faster weak-map-key 174.3176+-8.2680 ^ 151.7053+-6.8723 ^ definitely 1.1491x faster * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * dfg/DFGAbstractHeap.h: * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleIntrinsicCall): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGNode.h: (JSC::DFG::Node::hasHeapPrediction): * dfg/DFGNodeType.h: * dfg/DFGOperations.cpp: * dfg/DFGOperations.h: * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileExtractValueFromWeakMapGet): (JSC::DFG::SpeculativeJIT::compileWeakMapGet): * dfg/DFGSpeculativeJIT.h: * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * ftl/FTLAbstractHeapRepository.h: * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compileExtractValueFromWeakMapGet): (JSC::FTL::DFG::LowerDFGToB3::compileWeakMapGet): * inspector/JSInjectedScriptHost.cpp: (Inspector::JSInjectedScriptHost::weakMapEntries): (Inspector::JSInjectedScriptHost::weakSetEntries): Existing code is incorrect. They can run GC and break WeakMap's iterator. We introduce takeSnapshot function to WeakMapImpl, which retrieves live entries without causing any GC. * runtime/HashMapImpl.h: (JSC::shouldShrink): (JSC::shouldRehashAfterAdd): (JSC::nextCapacity): (JSC::HashMapImpl::shouldRehashAfterAdd const): (JSC::HashMapImpl::shouldShrink const): (JSC::HashMapImpl::rehash): (JSC::WeakMapHash::hash): Deleted. (JSC::WeakMapHash::equal): Deleted. * runtime/Intrinsic.cpp: (JSC::intrinsicName): * runtime/Intrinsic.h: * runtime/JSWeakMap.cpp: * runtime/JSWeakMap.h: * runtime/JSWeakSet.cpp: * runtime/JSWeakSet.h: * runtime/VM.cpp: * runtime/WeakGCMap.h: (JSC::WeakGCMap::forEach): Deleted. * runtime/WeakMapBase.cpp: Removed. * runtime/WeakMapBase.h: Removed. * runtime/WeakMapConstructor.cpp: (JSC::constructWeakMap): * runtime/WeakMapImpl.cpp: Added. (JSC::WeakMapImpl<WeakMapBucket>::destroy): (JSC::WeakMapImpl<WeakMapBucket>::visitChildren): (JSC::WeakMapImpl<WeakMapBucket>::estimatedSize): (JSC::WeakMapImpl<WeakMapBucket<WeakMapBucketDataKey>>::visitWeakReferences): (JSC::WeakMapImpl<WeakMapBucket<WeakMapBucketDataKeyValue>>::visitWeakReferences): (JSC::WeakMapImpl<WeakMapBucket>::finalizeUnconditionally): (JSC::WeakMapImpl<WeakMapBucket<WeakMapBucketDataKey>>::takeSnapshot): (JSC::WeakMapImpl<WeakMapBucket<WeakMapBucketDataKeyValue>>::takeSnapshot): * runtime/WeakMapImpl.h: Added. (JSC::jsWeakMapHash): (JSC::nextCapacityAfterRemoveBatching): (JSC::WeakMapBucket::setKey): (JSC::WeakMapBucket::setValue): (JSC::WeakMapBucket::key const): (JSC::WeakMapBucket::value const): (JSC::WeakMapBucket::copyFrom): (JSC::WeakMapBucket::offsetOfKey): (JSC::WeakMapBucket::offsetOfValue): (JSC::WeakMapBucket::extractValue): (JSC::WeakMapBucket::isEmpty): (JSC::WeakMapBucket::deletedKey): (JSC::WeakMapBucket::isDeleted): (JSC::WeakMapBucket::makeDeleted): (JSC::WeakMapBucket::visitAggregate): (JSC::WeakMapBucket::clearValue): (JSC::WeakMapBuffer::allocationSize): (JSC::WeakMapBuffer::buffer const): (JSC::WeakMapBuffer::create): (JSC::WeakMapBuffer::reset): (JSC::WeakMapImpl::WeakMapImpl): (JSC::WeakMapImpl::finishCreation): (JSC::WeakMapImpl::get): (JSC::WeakMapImpl::has): (JSC::WeakMapImpl::add): (JSC::WeakMapImpl::remove): (JSC::WeakMapImpl::size const): (JSC::WeakMapImpl::offsetOfBuffer): (JSC::WeakMapImpl::offsetOfCapacity): (JSC::WeakMapImpl::findBucket): (JSC::WeakMapImpl::buffer const): (JSC::WeakMapImpl::forEach): (JSC::WeakMapImpl::shouldRehashAfterAdd const): (JSC::WeakMapImpl::shouldShrink const): (JSC::WeakMapImpl::canUseBucket): (JSC::WeakMapImpl::addInternal): (JSC::WeakMapImpl::findBucketAlreadyHashed): (JSC::WeakMapImpl::rehash): (JSC::WeakMapImpl::checkConsistency const): (JSC::WeakMapImpl::makeAndSetNewBuffer): (JSC::WeakMapImpl::assertBufferIsEmpty const): (JSC::WeakMapImpl::DeadKeyCleaner::target): * runtime/WeakMapPrototype.cpp: (JSC::WeakMapPrototype::finishCreation): (JSC::protoFuncWeakMapGet): (JSC::protoFuncWeakMapHas): * runtime/WeakSetConstructor.cpp: (JSC::constructWeakSet): * runtime/WeakSetPrototype.cpp: (JSC::WeakSetPrototype::finishCreation): (JSC::protoFuncWeakSetHas): (JSC::protoFuncWeakSetAdd): Source/WTF: We introduce JSValueMalloc, which is specialized malloc scheme with Gigacage::JSValue. This is used for WeakMapImpl's buffer. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/JSValueMalloc.cpp: Added. (WTF::tryJSValueMalloc): (WTF::jsValueMalloc): (WTF::jsValueRealloc): (WTF::jsValueFree): * wtf/JSValueMalloc.h: Added. (WTF::JSValueMalloc::malloc): (WTF::JSValueMalloc::tryMalloc): (WTF::JSValueMalloc::realloc): (WTF::JSValueMalloc::free): * wtf/MallocPtr.h: (WTF::MallocPtr::~MallocPtr): (WTF::MallocPtr::malloc): (WTF::MallocPtr::tryMalloc): (WTF::MallocPtr::realloc): We extend MallocPtr to adopt malloc scheme as its template parameter. Canonical link: https://commits.webkit.org/196645@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225832 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-13 02:49:00 +00:00
runtime/WeakMapImpl.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/WeakMapPrototype.cpp
Add support for WeakRef https://bugs.webkit.org/show_bug.cgi?id=198710 Reviewed by Yusuke Suzuki. Source/JavaScriptCore: Add support for WeakRefs which are now at stage 3 (https://tc39.es/proposal-weakrefs). This patch doesn't add support for FinalizationGroups, which I'll add in another patch. Some other things of interest. Per the spec, we cannot collect a weak refs target unless it has not been dereffed (or created) in the current microtask turn. i.e. WeakRefs are only allowed to be collected at the end of a drain of the Microtask queue. My understanding for this behavior is to reduce implementation dependence on specific GC behavior in a given browser. We track if a WeakRef is retaining its target by using a version number on each WeakRef as well as on the VM. Whenever a WeakRef is derefed we update its version number to match the VM's then WriteBarrier ourselves. During marking if the VM and the WeakRef have the same version number, the target is visited. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * heap/Heap.cpp: (JSC::Heap::finalizeUnconditionalFinalizers): * jsc.cpp: (GlobalObject::finishCreation): (functionReleaseWeakRefs): * runtime/CommonIdentifiers.h: * runtime/JSGlobalObject.cpp: * runtime/JSGlobalObject.h: * runtime/JSWeakObjectRef.cpp: Added. (JSC::JSWeakObjectRef::finishCreation): (JSC::JSWeakObjectRef::visitChildren): (JSC::JSWeakObjectRef::finalizeUnconditionally): (JSC::JSWeakObjectRef::toStringName): * runtime/JSWeakObjectRef.h: Added. * runtime/VM.cpp: (JSC::VM::drainMicrotasks): * runtime/VM.h: (JSC::VM::setOnEachMicrotaskTick): (JSC::VM::finalizeSynchronousJSExecution): (JSC::VM::currentWeakRefVersion const): * runtime/WeakObjectRefConstructor.cpp: Added. (JSC::WeakObjectRefConstructor::finishCreation): (JSC::WeakObjectRefConstructor::WeakObjectRefConstructor): (JSC::callWeakRef): (JSC::constructWeakRef): * runtime/WeakObjectRefConstructor.h: Added. (JSC::WeakObjectRefConstructor::create): (JSC::WeakObjectRefConstructor::createStructure): * runtime/WeakObjectRefPrototype.cpp: Added. (JSC::WeakObjectRefPrototype::finishCreation): (JSC::getWeakRef): (JSC::protoFuncWeakRefDeref): * runtime/WeakObjectRefPrototype.h: Added. Source/WebCore: We need to make sure the Web MicrotaskQueue notifies the JSC VM that it has finished performing a microtask checkpoint. This lets the JSC VM know it is safe to collect referenced WeakRefs. Since there was no way to get the VM from the MicrotaskQueue I have added a RefPtr to the queue's VM. For the main thread the VM lives forever so is fine. For workers the queue and the VM share an owner so this shouldn't matter either. Tests: js/weakref-async-is-collected.html js/weakref-eventually-collects-values.html js/weakref-microtasks-dont-collect.html js/weakref-weakset-consistency.html * dom/Microtasks.cpp: (WebCore::MicrotaskQueue::MicrotaskQueue): (WebCore::MicrotaskQueue::mainThreadQueue): (WebCore::MicrotaskQueue::performMicrotaskCheckpoint): * dom/Microtasks.h: (WebCore::MicrotaskQueue::vm const): * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): LayoutTests: Add an asyncTestStart that mirrors the asyncTestStart behavior in the JSC cli. * http/tests/resources/js-test-pre.js: (asyncTestStart): * js/script-tests/weakref-async-is-collected.js: Added. (makeWeakRef): (turnEventLoop): (async.foo): (async.test): * js/script-tests/weakref-eventually-collects-values.js: Added. (makeWeakRef): (turnEventLoop): (let.weakRefs.async.test): * js/script-tests/weakref-microtasks-dont-collect.js: Added. (asyncTestStart.1.makeWeakRef): (turnEventLoop): (async.foo): (async.test): * js/script-tests/weakref-weakset-consistency.js: Added. (makeWeakRef): (turnEventLoop): (async.foo): (async.test): * js/weakref-async-is-collected-expected.txt: Added. * js/weakref-async-is-collected.html: Added. * js/weakref-eventually-collects-values-expected.txt: Added. * js/weakref-eventually-collects-values.html: Added. * js/weakref-microtasks-dont-collect-expected.txt: Added. * js/weakref-microtasks-dont-collect.html: Added. * js/weakref-weakset-consistency-expected.txt: Added. * js/weakref-weakset-consistency.html: Added. * resources/js-test-pre.js: (asyncTestStart): Canonical link: https://commits.webkit.org/212957@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-06-18 21:02:19 +00:00
runtime/WeakObjectRefConstructor.cpp
runtime/WeakObjectRefPrototype.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
runtime/WeakSetConstructor.cpp
runtime/WeakSetPrototype.cpp
runtime/WideningNumberPredictionFuzzerAgent.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
Setup WebCore build to start using unified sources. https://bugs.webkit.org/show_bug.cgi?id=178362 Reviewed by Tim Horton. .: Pass features to the unified source bundler script. * Source/cmake/WebKitCommon.cmake: * Source/cmake/WebKitFeatures.cmake: * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: Change comments in source list files. Also, pass explicit names for build files. * CMakeLists.txt: * PlatformGTK.cmake: * PlatformMac.cmake: * Sources.txt: * SourcesGTK.txt: * SourcesMac.txt: Source/WebCore: This patch adds all the long tooling needed to start adding unified sources to WebCore. Most of the source list files are empty to start but will be filled over the next few days. I started by moving all the non-derived bindings code to unified sources to make sure everything worked correctly. * CMakeLists.txt: * Configurations/GenerateUnifiedSources.xcconfig: Added. * Configurations/WebCore.xcconfig: * PlatformMac.cmake: * Sources.txt: Added. * SourcesCocoa.txt: Added. * SourcesIOS.txt: Added. * SourcesMac.txt: Added. * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSMediaStreamCapabilitiesCustom.cpp: Removed. No one seems to use this... Source/WTF: There are a number of changes to the bundler script. First, it is now possible to enable or disable building files based on if the associated feature flag is enabled or not. The syntax for this is similar to how we do #ifs in C++ code. e.g. #if ENABLE_APPLE_PAY myApplePayFile.cpp #endif would enable myApplePayFile.cpp if and only if the APPLE_PAY feature define is set. I also changed comments from # to // to make it less likely they would be confused with a #if. Finally, this patch enables bundling files in the same relative directory across source list files. Previously, if SourcesCocoa.txt had platform/cf/foo.cpp and SourcesMac.txt had platform/cf/bar.cpp those files would not be put in the same unified source bundle. Now, those files will be put into the same bundle but bar.cpp will always follow foo.cpp. The idea is that by putting more specific files after more general files we can avoid random build failures. * Scripts/generate-unified-source-bundles.rb: Canonical link: https://commits.webkit.org/194673@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223621 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-18 19:14:51 +00:00
// Derived Sources
// FIXME: We should move this to runtime but it kept breaking the Windows build in weird ways... https://bugs.webkit.org/show_bug.cgi?id=177486
JSC build should use unified sources for derived sources https://bugs.webkit.org/show_bug.cgi?id=177421 Reviewed by JF Bastien. .: * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch make a couple of changes: 1) Make derived sources added to relevant bundles. I was going to add JSCBuiltins.cpp to runtime but that kept breaking the windows build. I'll get back to it later 2) Move the derived location of some sources both for clarity and for ease of use. 3) Make auto generator scripts able to create directories if needed. 4) Move some scripts from the top level of the JavaScriptCore directory to a more appropriate directory. 5) Move some CMake generation commands around for clarity. * CMakeLists.txt: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Scripts/lazywriter.py: (LazyFileWriter.close): * Sources.txt: * inspector/scripts/generate-inspector-protocol-bindings.py: (IncrementalFileWriter.close): * yarr/create_regex_tables: Renamed from Source/JavaScriptCore/create_regex_tables. * yarr/generateYarrCanonicalizeUnicode: Renamed from Source/JavaScriptCore/generateYarrCanonicalizeUnicode. Source/WTF: The script now needs to determine if a file is from a derived source. This is only relevant for the CMake build since the script needs to provide a list of the bundled source files. If the script does not provide the full path for derived sources then CMake will be unable to find them and the build will fail. Additionally, I move the error message for the Xcode build outside the main loop. This means that the error message will contain all the files you need to add to Xcode and all those files will now be written in DerivedSources so they should be easier to add. * Scripts/generate-unified-source-bundles.rb: Canonical link: https://commits.webkit.org/193793@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-26 15:34:19 +00:00
JSCBuiltins.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
tools/CellList.cpp
Harden JSC against the abuse of runtime options. https://bugs.webkit.org/show_bug.cgi?id=201597 <rdar://problem/55167068> Reviewed by Filip Pizlo. JSTests: Remove the call to forceGCSlowPaths(). This utility function will be removed. The modern way to set the required option is to use //@ requireOptions. * stress/ftl-try-catch-oom-error-lazy-slow-path.js: Source/JavaScriptCore: Linux parts contributed by Carlos Garcia Campos <cgarcia@igalia.com>. 1. Introduce a JSC::Config struct that will be protected as ReadOnly once the first VM instance is constructed. The end of the VM constructor calls Config::permanentlyFreeze() which will make the Config ReadOnly. Note: this is currently only supported for OS(DARWIN) and OS(LINUX). OS(WINDOWS) will need to implement some missing pieces before it can enable this hardening (see FIXME in JSCConfig.cpp). The hardening strategy here is to put immutable global values into the Config. Any modifications that need to be made to these values must be done before the first VM instance is done instantiating. This ensures that no script will ever run while the Config is still writable. Also, the policy for this hardening is that a process is opted in by default. If there's a valid need to disable this hardening (e.g. for some test environments), the relevant process will need to opt itself out by calling Config::configureForTesting(). The jsc shell, WK2 UI and WebContent processes are opted in by default. Only test processes may be opt out. 2. Put all JSC::Options in the Config. This enforces the invariant that options can only be changed before we instantiate a VM. Once a VM is instantiated, the options are immutable. 3. Remove functionForceGCSlowPaths() from the jsc shell. Setting Options::forceGCSlowPaths this way is no longer allowed. 4. Re-factored the Options code (Options.h) into: - OptionEntry.h: the data structure that stores the option values. - OptionsList.h: the list of options. - Options.h: the Options singleton object which is the interface for accessing options. Renamed the JSC_OPTIONS macro to FOR_EACH_JSC_OPTION, because "FOR_EACH_JSC_OPTION(SET_OPTION_VALUE)" reads a lot better than "JSC_OPTIONS(FOR_EACH_OPTION)". 5. Change testapi to call Config::configureForTesting(). Parts of testapi makes use of setting options in its tests. Hence, this hardening is disabled for testapi. Note: the jsc shell does enable this hardening. 6. Put ExecutableAllocator's immutable globals in the Config. 7. RELEASE_ASSERT that restrictedOptionsEnabled in order to use the FunctionOverrides test utility. 8. RELEASE_ASSERT that Options::useDollarVM() is enabled in order to use the $vm. We must RELEASE_ASSERT(Options::useDollarVM()) in all JSDollarVM functions that are non-trivial at an eye's glance. This includes (but is not limited to): constructors create() factory createStructure() factory finishCreation() HOST_CALL or operation functions Constructors and methods of utility and test classes The only exception are some constexpr constructors used for instantiating globals (since these must have trivial constructors) e.g. DOMJITAttribute. Instead, these constructors should always be ALWAYS_INLINE. * API/glib/JSCOptions.cpp: (jscOptionsSetValue): (jscOptionsGetValue): (jsc_options_foreach): (jsc_options_get_option_group): * API/tests/testapi.c: (main): * API/tests/testapi.cpp: (configureJSCForTesting): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * jit/ExecutableAllocator.cpp: (JSC::isJITEnabled): (JSC::ExecutableAllocator::setJITEnabled): (JSC::ExecutableAllocator::initializeUnderlyingAllocator): (JSC::ExecutableAllocator::isValid const): (JSC::ExecutableAllocator::underMemoryPressure): (JSC::ExecutableAllocator::memoryPressureMultiplier): (JSC::ExecutableAllocator::allocate): (JSC::ExecutableAllocator::isValidExecutableMemory): (JSC::ExecutableAllocator::getLock const): (JSC::ExecutableAllocator::committedByteCount): (JSC::ExecutableAllocator::dumpProfile): (JSC::startOfFixedExecutableMemoryPoolImpl): (JSC::endOfFixedExecutableMemoryPoolImpl): (JSC::isJITPC): (JSC::dumpJITMemory): (JSC::ExecutableAllocator::initialize): (JSC::ExecutableAllocator::singleton): * jit/ExecutableAllocator.h: (JSC::performJITMemcpy): * jsc.cpp: (GlobalObject::finishCreation): (functionJSCOptions): (jscmain): (functionForceGCSlowPaths): Deleted. * runtime/ConfigFile.cpp: (JSC::ConfigFile::parse): * runtime/InitializeThreading.cpp: (JSC::initializeThreading): * runtime/JSCConfig.cpp: Added. (JSC::Config::disableFreezingForTesting): (JSC::Config::enableRestrictedOptions): (JSC::Config::permanentlyFreeze): * runtime/JSCConfig.h: Added. (JSC::Config::configureForTesting): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::exposeDollarVM): * runtime/OptionEntry.h: Added. (JSC::OptionRange::operator= ): (JSC::OptionRange::rangeString const): * runtime/Options.cpp: (JSC::Options::isAvailable): (JSC::scaleJITPolicy): (JSC::Options::initialize): (JSC::Options::setOptions): (JSC::Options::setOptionWithoutAlias): (JSC::Options::setAliasedOption): (JSC::Option::dump const): (JSC::Option::operator== const): (): Deleted. (JSC::Options::enableRestrictedOptions): Deleted. * runtime/Options.h: (JSC::Option::Option): (JSC::Option::defaultOption const): (JSC::Option::boolVal): (JSC::Option::unsignedVal): (JSC::Option::doubleVal): (JSC::Option::int32Val): (JSC::Option::optionRangeVal): (JSC::Option::optionStringVal): (JSC::Option::gcLogLevelVal): (JSC::OptionRange::operator= ): Deleted. (JSC::OptionRange::rangeString const): Deleted. * runtime/OptionsList.h: Added. (JSC::countNumberOfJSCOptions): * runtime/VM.cpp: (JSC::VM::VM): * tools/FunctionOverrides.cpp: (JSC::FunctionOverrides::FunctionOverrides): (JSC::FunctionOverrides::reinstallOverrides): (JSC::FunctionOverrides::initializeOverrideFor): (JSC::FunctionOverrides::parseOverridesInFile): * tools/JSDollarVM.cpp: (JSC::JSDollarVMCallFrame::JSDollarVMCallFrame): (JSC::JSDollarVMCallFrame::createStructure): (JSC::JSDollarVMCallFrame::create): (JSC::JSDollarVMCallFrame::finishCreation): (JSC::JSDollarVMCallFrame::addProperty): (JSC::Element::Element): (JSC::Element::create): (JSC::Element::createStructure): (JSC::Root::Root): (JSC::Root::create): (JSC::Root::createStructure): (JSC::SimpleObject::SimpleObject): (JSC::SimpleObject::create): (JSC::SimpleObject::createStructure): (JSC::ImpureGetter::ImpureGetter): (JSC::ImpureGetter::createStructure): (JSC::ImpureGetter::create): (JSC::ImpureGetter::finishCreation): (JSC::ImpureGetter::getOwnPropertySlot): (JSC::CustomGetter::CustomGetter): (JSC::CustomGetter::createStructure): (JSC::CustomGetter::create): (JSC::CustomGetter::getOwnPropertySlot): (JSC::CustomGetter::customGetter): (JSC::CustomGetter::customGetterAcessor): (JSC::RuntimeArray::create): (JSC::RuntimeArray::destroy): (JSC::RuntimeArray::getOwnPropertySlot): (JSC::RuntimeArray::getOwnPropertySlotByIndex): (JSC::RuntimeArray::createPrototype): (JSC::RuntimeArray::createStructure): (JSC::RuntimeArray::finishCreation): (JSC::RuntimeArray::RuntimeArray): (JSC::RuntimeArray::lengthGetter): (JSC::DOMJITNode::DOMJITNode): (JSC::DOMJITNode::createStructure): (JSC::DOMJITNode::checkSubClassSnippet): (JSC::DOMJITNode::create): (JSC::DOMJITGetter::DOMJITGetter): (JSC::DOMJITGetter::createStructure): (JSC::DOMJITGetter::create): (JSC::DOMJITGetter::DOMJITAttribute::DOMJITAttribute): (JSC::DOMJITGetter::DOMJITAttribute::slowCall): (JSC::DOMJITGetter::DOMJITAttribute::callDOMGetter): (JSC::DOMJITGetter::customGetter): (JSC::DOMJITGetter::finishCreation): (JSC::DOMJITGetterComplex::DOMJITGetterComplex): (JSC::DOMJITGetterComplex::createStructure): (JSC::DOMJITGetterComplex::create): (JSC::DOMJITGetterComplex::DOMJITAttribute::DOMJITAttribute): (JSC::DOMJITGetterComplex::DOMJITAttribute::slowCall): (JSC::DOMJITGetterComplex::DOMJITAttribute::callDOMGetter): (JSC::DOMJITGetterComplex::functionEnableException): (JSC::DOMJITGetterComplex::customGetter): (JSC::DOMJITGetterComplex::finishCreation): (JSC::DOMJITFunctionObject::DOMJITFunctionObject): (JSC::DOMJITFunctionObject::createStructure): (JSC::DOMJITFunctionObject::create): (JSC::DOMJITFunctionObject::functionWithTypeCheck): (JSC::DOMJITFunctionObject::functionWithoutTypeCheck): (JSC::DOMJITFunctionObject::checkSubClassSnippet): (JSC::DOMJITFunctionObject::finishCreation): (JSC::DOMJITCheckSubClassObject::DOMJITCheckSubClassObject): (JSC::DOMJITCheckSubClassObject::createStructure): (JSC::DOMJITCheckSubClassObject::create): (JSC::DOMJITCheckSubClassObject::functionWithTypeCheck): (JSC::DOMJITCheckSubClassObject::functionWithoutTypeCheck): (JSC::DOMJITCheckSubClassObject::finishCreation): (JSC::DOMJITGetterBaseJSObject::DOMJITGetterBaseJSObject): (JSC::DOMJITGetterBaseJSObject::createStructure): (JSC::DOMJITGetterBaseJSObject::create): (JSC::DOMJITGetterBaseJSObject::DOMJITAttribute::DOMJITAttribute): (JSC::DOMJITGetterBaseJSObject::DOMJITAttribute::slowCall): (JSC::DOMJITGetterBaseJSObject::DOMJITAttribute::callDOMGetter): (JSC::DOMJITGetterBaseJSObject::customGetter): (JSC::DOMJITGetterBaseJSObject::finishCreation): (JSC::JSTestCustomGetterSetter::JSTestCustomGetterSetter): (JSC::JSTestCustomGetterSetter::create): (JSC::JSTestCustomGetterSetter::createStructure): (JSC::customSetAccessor): (JSC::customSetValue): (JSC::JSTestCustomGetterSetter::finishCreation): (JSC::Element::handleOwner): (JSC::Element::finishCreation): (JSC::WasmStreamingParser::WasmStreamingParser): (JSC::WasmStreamingParser::create): (JSC::WasmStreamingParser::createStructure): (JSC::WasmStreamingParser::finishCreation): (JSC::functionWasmStreamingParserAddBytes): (JSC::functionWasmStreamingParserFinalize): (JSC::functionCrash): (JSC::functionBreakpoint): (JSC::functionDFGTrue): (JSC::functionFTLTrue): (JSC::functionCpuMfence): (JSC::functionCpuRdtsc): (JSC::functionCpuCpuid): (JSC::functionCpuPause): (JSC::functionCpuClflush): (JSC::CallerFrameJITTypeFunctor::CallerFrameJITTypeFunctor): (JSC::getExecutableForFunction): (JSC::functionLLintTrue): (JSC::functionJITTrue): (JSC::functionNoInline): (JSC::functionGC): (JSC::functionEdenGC): (JSC::functionDumpSubspaceHashes): (JSC::functionCallFrame): (JSC::functionCodeBlockForFrame): (JSC::codeBlockFromArg): (JSC::functionCodeBlockFor): (JSC::functionDumpSourceFor): (JSC::functionDumpBytecodeFor): (JSC::doPrint): (JSC::functionDataLog): (JSC::functionPrint): (JSC::functionDumpCallFrame): (JSC::functionDumpStack): (JSC::functionDumpRegisters): (JSC::functionDumpCell): (JSC::functionIndexingMode): (JSC::functionInlineCapacity): (JSC::functionValue): (JSC::functionGetPID): (JSC::functionHaveABadTime): (JSC::functionIsHavingABadTime): (JSC::functionCreateGlobalObject): (JSC::functionCreateProxy): (JSC::functionCreateRuntimeArray): (JSC::functionCreateNullRopeString): (JSC::functionCreateImpureGetter): (JSC::functionCreateCustomGetterObject): (JSC::functionCreateDOMJITNodeObject): (JSC::functionCreateDOMJITGetterObject): (JSC::functionCreateDOMJITGetterComplexObject): (JSC::functionCreateDOMJITFunctionObject): (JSC::functionCreateDOMJITCheckSubClassObject): (JSC::functionCreateDOMJITGetterBaseJSObject): (JSC::functionCreateWasmStreamingParser): (JSC::functionSetImpureGetterDelegate): (JSC::functionCreateBuiltin): (JSC::functionGetPrivateProperty): (JSC::functionCreateRoot): (JSC::functionCreateElement): (JSC::functionGetElement): (JSC::functionCreateSimpleObject): (JSC::functionGetHiddenValue): (JSC::functionSetHiddenValue): (JSC::functionShadowChickenFunctionsOnStack): (JSC::functionSetGlobalConstRedeclarationShouldNotThrow): (JSC::functionFindTypeForExpression): (JSC::functionReturnTypeFor): (JSC::functionFlattenDictionaryObject): (JSC::functionDumpBasicBlockExecutionRanges): (JSC::functionHasBasicBlockExecuted): (JSC::functionBasicBlockExecutionCount): (JSC::functionEnableExceptionFuzz): (JSC::changeDebuggerModeWhenIdle): (JSC::functionEnableDebuggerModeWhenIdle): (JSC::functionDisableDebuggerModeWhenIdle): (JSC::functionDeleteAllCodeWhenIdle): (JSC::functionGlobalObjectCount): (JSC::functionGlobalObjectForObject): (JSC::functionGetGetterSetter): (JSC::functionLoadGetterFromGetterSetter): (JSC::functionCreateCustomTestGetterSetter): (JSC::functionDeltaBetweenButterflies): (JSC::functionTotalGCTime): (JSC::functionParseCount): (JSC::functionIsWasmSupported): (JSC::JSDollarVM::finishCreation): (JSC::JSDollarVM::addFunction): (JSC::JSDollarVM::addConstructibleFunction): * tools/JSDollarVM.h: Source/WebCore: No new tests. Covered by existing tests. Enable Options::useDollarVM before we tell the JSGlobalObject to exposeDollarVM(). The $vm utility is now hardened to require that Options::useDollarVM be enabled in order for it to be used. * testing/js/WebCoreTestSupport.cpp: (WebCoreTestSupport::injectInternalsObject): Source/WebKit: Linux parts contributed by Carlos Garcia Campos <cgarcia@igalia.com>. 1. Add plumbing to allow WK2 tests to configureJSCForTesting(). 2. Removed the call enable Options::useBigInt in WebInspectorUI. WebInspectorUI doesn't really need it for now. * PluginProcess/unix/PluginProcessMainUnix.cpp: * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h: (WebKit::XPCServiceInitializer): * Shared/unix/AuxiliaryProcessMain.cpp: (WebKit::AuxiliaryProcessMainBase::parseCommandLine): * Shared/unix/AuxiliaryProcessMain.h: (WebKit::AuxiliaryProcessMain): * UIProcess/API/APIProcessPoolConfiguration.cpp: (API::ProcessPoolConfiguration::copy): * UIProcess/API/APIProcessPoolConfiguration.h: * UIProcess/API/C/WKContextConfigurationRef.cpp: (WKContextConfigurationSetShouldConfigureJSCForTesting): * UIProcess/API/C/WKContextConfigurationRef.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm: (-[_WKProcessPoolConfiguration configureJSCForTesting]): (-[_WKProcessPoolConfiguration setConfigureJSCForTesting:]): * UIProcess/Launcher/ProcessLauncher.h: (WebKit::ProcessLauncher::Client::shouldConfigureJSCForTesting const): * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp: (WebKit::ProcessLauncher::launchProcess): * UIProcess/Launcher/mac/ProcessLauncherMac.mm: (WebKit::ProcessLauncher::launchProcess): * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::shouldConfigureJSCForTesting const): * UIProcess/WebProcessProxy.h: * WebProcess/WebPage/WebInspectorUI.cpp: (WebKit::WebInspectorUI::WebInspectorUI): Source/WTF: Add a source file that was missing so that Xcode can search its contents too. * WTF.xcodeproj/project.pbxproj: Tools: Linux parts contributed by Carlos Garcia Campos <cgarcia@igalia.com>. Windows parts contributed by Fujii Hironori <Hironori.Fujii@sony.com>. Call JSC::Config::configureForTesting() in test harnesses or at the top of tests to disable the hardening on test runs. Tests rely on setting options to enable test features. * DumpRenderTree/mac/DumpRenderTree.mm: (dumpRenderTree): * DumpRenderTree/win/DumpRenderTree.cpp: (initialize): * TestWebKitAPI/PlatformUtilities.cpp: (TestWebKitAPI::Util::createContextWithInjectedBundle): * TestWebKitAPI/Tests/JavaScriptCore/glib/TestJSC.cpp: (main): * TestWebKitAPI/Tests/WebKitCocoa/ApplePay.mm: (TestWebKitAPI::TEST): (TestWebKitAPI::runActiveSessionTest): * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewDiagnosticLogging.mm: (TEST): * TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm: (TEST): * TestWebKitAPI/Tests/mac/MediaPlaybackSleepAssertion.mm: (TestWebKitAPI::TEST): * TestWebKitAPI/WKWebViewConfigurationExtras.h: * TestWebKitAPI/WKWebViewConfigurationExtras.mm: (+[WKWebViewConfiguration _test_configurationWithTestPlugInClassName:]): (+[WKWebViewConfiguration _test_configurationWithTestPlugInClassName:configureJSCForTesting:]): * WebKitTestRunner/TestController.cpp: (WTR::TestController::generateContextConfiguration const): Canonical link: https://commits.webkit.org/215364@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249808 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-09-12 15:04:29 +00:00
tools/CompilerTimingScope.cpp
Replace uses of black/white list with block/allow list https://bugs.webkit.org/show_bug.cgi?id=213084 Reviewed by Keith Miller. We should be using racially neutral names in our code. From Chromium style guide: "Terms such as 'blacklist' and 'whitelist' reinforce the notion that black==bad and white==good." * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * b3/air/AirLowerAfterRegAlloc.cpp: (JSC::B3::Air::lowerAfterRegAlloc): * dfg/DFGDriver.cpp: (JSC::DFG::ensureGlobalDFGAllowlist): (JSC::DFG::compileImpl): (JSC::DFG::ensureGlobalDFGWhitelist): Deleted. * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::ensureGlobalFTLAllowlist): (JSC::DFG::TierUpCheckInjectionPhase::run): (JSC::DFG::ensureGlobalFTLWhitelist): Deleted. * heap/MachineStackMarker.cpp: * inspector/scripts/codegen/objc_generator.py: (ObjCGenerator.should_generate_types_for_domain): (ObjCGenerator.should_generate_commands_for_domain): (ObjCGenerator.should_generate_events_for_domain): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::ensureGlobalJITAllowlist): (JSC::LLInt::shouldJIT): (JSC::LLInt::ensureGlobalJITWhitelist): Deleted. * runtime/OptionsList.h: * tools/FunctionAllowlist.cpp: Copied from Source/JavaScriptCore/tools/FunctionWhitelist.cpp. (JSC::FunctionAllowlist::FunctionAllowlist): (JSC::FunctionAllowlist::contains const): (JSC::FunctionWhitelist::FunctionWhitelist): Deleted. (JSC::FunctionWhitelist::contains const): Deleted. * tools/FunctionAllowlist.h: Copied from Source/JavaScriptCore/tools/FunctionWhitelist.h. * tools/FunctionWhitelist.cpp: Removed. * tools/FunctionWhitelist.h: Removed. Canonical link: https://commits.webkit.org/225882@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262928 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-11 22:47:21 +00:00
tools/FunctionAllowlist.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
tools/FunctionOverrides.cpp
tools/HeapVerifier.cpp
Introducing Integrity audit functions. https://bugs.webkit.org/show_bug.cgi?id=202085 Reviewed by Saam Barati. This patch's main goal is to introduce the Integrity audit functions. They can be used wherever we want to audit a cell to probabilistically ensure it is not corrupted. However, to keep this patch small, we will only introduce the audit tool here with one example use in SlotVisitor. We'll follow up later with more patches to deploy this tool throughout the VM. 1. Introduced Integrity audit functions that can be configured at several AuditLevels: None - don't do any audits. Minimal - do a minimal quick audit (minimize perf impact). Full - do a full audit of the many aspects of a cell. Random - randomly do a full audit with a probability dictated by Options::randomIntegrityAuditRate() between 0.0 (never audit) and 1.0 (audit at every chance). The default AuditLevel for Debug builds is Random. The default AuditLevel for Release builds is None. The default Options::randomIntegrityAuditRate() is 0.05. How full audits work? ==================== The full audit uses the VMInspector::verifyCell() template function to do its job. The reason for keeping this separate is to allow the template function to be used later for debug checks that want to take some custom action on verification failure instead of crashing with a RELEASE_ASSERT. Full audit of a cell pointer includes: a. Verify that a cell designated as a LargeAllocation is in the heap's set of LargeAllocations. b. Verify that a cell not designated as a LargeAllocation is actually in its MarkedBlock's bounds. c. Verify that the cell's container (LargeAllocation / MarkedBlock) actually belongs to the current VM. d. Verify that a cell in a MarkedBlock is properly aligned on the block's allocation unit size. e. If the cell is not an ImmutableButterfly, verify that it is not located in the Gigacage. f. Verify that the cell's JSType matches its StructureBlob's JSType. g. Verify that the cell size as dictated by the cell ClassInfo does not exceed the size of the allocation unit size (as expected by the container MarkedBlock or LargeAllocation). Some cells are dynamically size (see isDynamicallySizedType()). For these cells, we compute their sizes and verify that the size does not exceed the allocation unit size. Their sizes should also be greater or equal to the static cell size as dictated by their ClassInfo. h. If a cell has a butterfly, verify that the butterfly is in its the JSValue Gigacage. We can add more verifications later, or make some these more robust, but this is a start for now. How random audits work? ====================== Random audits are triggered by the m_triggerBits bits in VM::m_integrityRandom. m_triggerBits is a 64-bit bitfield. If Options::randomIntegrityAuditRate() is 0, m_triggerBits will always be 0, and no audits will be done. If Options::randomIntegrityAuditRate() is non-zero, m_triggerBits will be initialized as follows: | 1 reload bit | ... 63 trigger bits ... | The reload bit is always set (more details below). Each of the 63 trigger bits are randomly set depending if the following is true for the bit: VM::random() <= Options::randomIntegrityAuditRate() * UINT_MAX When Integrity::auditCell() is called, we take the bottom bit as the trigger bit for the current cell, and shifts the rest down by 1. If m_triggerBits is non-null after the shift, the taken trigger bit will dictate whether we do a full audit on the current cell or not. Once the reload bit reaches the bottom, we call a reload function to re-initialize m_triggerBits. The reload function also returns a bool indicating whether to trigger a full audit of the current cell. With this scheme, we only need to call the reload function once every 64 calls to Integrity::auditCell(), and can efficiently determine whether to trigger the audit the other 63 times with the probability specified in Options::randomIntegrityAuditRate(). 2. Embedded the C++ class size of JSCells into their ClassInfo. This is used in the full audits to verify cell sizes. 3. Added isDynamicallySizedType() to check if a JSType has a dynamic size allocation i.e. the size of instances of this type is not determined by the static C++ size of its class, but rather, depends on some runtime variable. 4. Made the VMInspector a friend of several classes so that it can access their private methods and fields. 5. Moved the inline function JSBigInt::allocationSize() from BigInt.cpp to its header file so that we can use it in VMInspector::verifyCellSize(). 6. Gave the JSModuleNamespaceObject() its own JSType so that we can identify it as a dynamically sized object. 7. Increased the randomness of VM::random() (which is implemented with WeakRandom) by re-seeding it with a cryptographically random number each GC. 8. Called Integrity::auditCell() on SlotVisitor::appendJSCellOrAuxiliary()'s cell as an example use of auditCell(). More uses will be added in later patches to follow. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * heap/Heap.cpp: (JSC::Heap::runBeginPhase): * heap/SlotVisitor.cpp: (JSC::SlotVisitor::appendJSCellOrAuxiliary): * runtime/ClassInfo.h: * runtime/DirectArguments.h: * runtime/JSBigInt.cpp: (JSC::JSBigInt::allocationSize): Deleted. * runtime/JSBigInt.h: (JSC::JSBigInt::allocationSize): * runtime/JSModuleNamespaceObject.h: * runtime/JSType.cpp: (WTF::printInternal): * runtime/JSType.h: (JSC::isDynamicallySizedType): * runtime/Options.cpp: (JSC::recomputeDependentOptions): * runtime/OptionsList.h: * runtime/Structure.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: (JSC::VM::random): (JSC::VM::integrityRandom): * tools/Integrity.cpp: Added. (JSC::Integrity::Random::Random): (JSC::Integrity::Random::reloadAndCheckShouldAuditSlow): (JSC::Integrity::auditCellFully): (JSC::Integrity::auditCellMinimallySlow): * tools/Integrity.h: Added. (JSC::Integrity::auditCell): * tools/IntegrityInlines.h: Added. (JSC::Integrity::Random::shouldAudit): (JSC::Integrity::auditCellMinimally): (JSC::Integrity::auditCellRandomly): * tools/VMInspector.h: (JSC::VMInspector::unusedVerifier): (JSC::VMInspector::verifyCellSize): * tools/VMInspectorInlines.h: Added. (JSC::VMInspector::verifyCellSize): (JSC::VMInspector::verifyCell): Canonical link: https://commits.webkit.org/215737@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250285 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-09-24 06:02:30 +00:00
tools/Integrity.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
tools/JSDollarVM.cpp
tools/SigillCrashAnalyzer.cpp
tools/VMInspector.cpp
[WebAssembly] Change BBQ to generate Air IR https://bugs.webkit.org/show_bug.cgi?id=191802 <rdar://problem/47651718> Reviewed by Keith Miller. This patch adds a new Wasm compiler for the BBQ tier. Instead of compiling using B3-01, we now generate Air code directly. The goal of doing this was to speed up compile times for Wasm programs. This patch provides us with a 20-30% compile time speedup. However, I have ideas on how to improve compile times even further. For example, we should probably implement a faster running register allocator: https://bugs.webkit.org/show_bug.cgi?id=194036 We can also improve on the code we generate. We should emit better code for Switch: https://bugs.webkit.org/show_bug.cgi?id=194053 And we should do better instruction selection in various areas: https://bugs.webkit.org/show_bug.cgi?id=193999 * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * b3/B3LowerToAir.cpp: * b3/B3StackmapSpecial.h: * b3/air/AirCode.cpp: (JSC::B3::Air::Code::emitDefaultPrologue): * b3/air/AirCode.h: * b3/air/AirTmp.h: (JSC::B3::Air::Tmp::Tmp): * runtime/Options.h: * wasm/WasmAirIRGenerator.cpp: Added. (JSC::Wasm::ConstrainedTmp::ConstrainedTmp): (JSC::Wasm::TypedTmp::TypedTmp): (JSC::Wasm::TypedTmp::operator== const): (JSC::Wasm::TypedTmp::operator!= const): (JSC::Wasm::TypedTmp::operator bool const): (JSC::Wasm::TypedTmp::operator Tmp const): (JSC::Wasm::TypedTmp::operator Arg const): (JSC::Wasm::TypedTmp::tmp const): (JSC::Wasm::TypedTmp::type const): (JSC::Wasm::AirIRGenerator::ControlData::ControlData): (JSC::Wasm::AirIRGenerator::ControlData::dump const): (JSC::Wasm::AirIRGenerator::ControlData::type const): (JSC::Wasm::AirIRGenerator::ControlData::signature const): (JSC::Wasm::AirIRGenerator::ControlData::hasNonVoidSignature const): (JSC::Wasm::AirIRGenerator::ControlData::targetBlockForBranch): (JSC::Wasm::AirIRGenerator::ControlData::convertIfToBlock): (JSC::Wasm::AirIRGenerator::ControlData::resultForBranch const): (JSC::Wasm::AirIRGenerator::emptyExpression): (JSC::Wasm::AirIRGenerator::fail const): (JSC::Wasm::AirIRGenerator::setParser): (JSC::Wasm::AirIRGenerator::toTmpVector): (JSC::Wasm::AirIRGenerator::validateInst): (JSC::Wasm::AirIRGenerator::extractArg): (JSC::Wasm::AirIRGenerator::append): (JSC::Wasm::AirIRGenerator::appendEffectful): (JSC::Wasm::AirIRGenerator::newTmp): (JSC::Wasm::AirIRGenerator::g32): (JSC::Wasm::AirIRGenerator::g64): (JSC::Wasm::AirIRGenerator::f32): (JSC::Wasm::AirIRGenerator::f64): (JSC::Wasm::AirIRGenerator::tmpForType): (JSC::Wasm::AirIRGenerator::addPatchpoint): (JSC::Wasm::AirIRGenerator::emitPatchpoint): (JSC::Wasm::AirIRGenerator::emitCheck): (JSC::Wasm::AirIRGenerator::emitCCall): (JSC::Wasm::AirIRGenerator::moveOpForValueType): (JSC::Wasm::AirIRGenerator::instanceValue): (JSC::Wasm::AirIRGenerator::fixupPointerPlusOffset): (JSC::Wasm::AirIRGenerator::restoreWasmContextInstance): (JSC::Wasm::AirIRGenerator::AirIRGenerator): (JSC::Wasm::AirIRGenerator::restoreWebAssemblyGlobalState): (JSC::Wasm::AirIRGenerator::emitThrowException): (JSC::Wasm::AirIRGenerator::addLocal): (JSC::Wasm::AirIRGenerator::addConstant): (JSC::Wasm::AirIRGenerator::addArguments): (JSC::Wasm::AirIRGenerator::getLocal): (JSC::Wasm::AirIRGenerator::addUnreachable): (JSC::Wasm::AirIRGenerator::addGrowMemory): (JSC::Wasm::AirIRGenerator::addCurrentMemory): (JSC::Wasm::AirIRGenerator::setLocal): (JSC::Wasm::AirIRGenerator::getGlobal): (JSC::Wasm::AirIRGenerator::setGlobal): (JSC::Wasm::AirIRGenerator::emitCheckAndPreparePointer): (JSC::Wasm::sizeOfLoadOp): (JSC::Wasm::AirIRGenerator::emitLoadOp): (JSC::Wasm::AirIRGenerator::load): (JSC::Wasm::sizeOfStoreOp): (JSC::Wasm::AirIRGenerator::emitStoreOp): (JSC::Wasm::AirIRGenerator::store): (JSC::Wasm::AirIRGenerator::addSelect): (JSC::Wasm::AirIRGenerator::emitTierUpCheck): (JSC::Wasm::AirIRGenerator::addLoop): (JSC::Wasm::AirIRGenerator::addTopLevel): (JSC::Wasm::AirIRGenerator::addBlock): (JSC::Wasm::AirIRGenerator::addIf): (JSC::Wasm::AirIRGenerator::addElse): (JSC::Wasm::AirIRGenerator::addElseToUnreachable): (JSC::Wasm::AirIRGenerator::addReturn): (JSC::Wasm::AirIRGenerator::addBranch): (JSC::Wasm::AirIRGenerator::addSwitch): (JSC::Wasm::AirIRGenerator::endBlock): (JSC::Wasm::AirIRGenerator::addEndToUnreachable): (JSC::Wasm::AirIRGenerator::addCall): (JSC::Wasm::AirIRGenerator::addCallIndirect): (JSC::Wasm::AirIRGenerator::unify): (JSC::Wasm::AirIRGenerator::unifyValuesWithBlock): (JSC::Wasm::AirIRGenerator::dump): (JSC::Wasm::AirIRGenerator::origin): (JSC::Wasm::parseAndCompileAir): (JSC::Wasm::AirIRGenerator::emitChecksForModOrDiv): (JSC::Wasm::AirIRGenerator::emitModOrDiv): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32DivS>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32RemS>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32DivU>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32RemU>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64DivS>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64RemS>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64DivU>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64RemU>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Ctz>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Ctz>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Popcnt>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Popcnt>): (JSC::Wasm::AirIRGenerator::addOp<F64ConvertUI64>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32ConvertUI64>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Nearest>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Nearest>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Trunc>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Trunc>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32TruncSF64>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32TruncSF32>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32TruncUF64>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32TruncUF32>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64TruncSF64>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64TruncUF64>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64TruncSF32>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64TruncUF32>): (JSC::Wasm::AirIRGenerator::addShift): (JSC::Wasm::AirIRGenerator::addIntegerSub): (JSC::Wasm::AirIRGenerator::addFloatingPointAbs): (JSC::Wasm::AirIRGenerator::addFloatingPointBinOp): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Ceil>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Mul>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Sub>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Le>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32DemoteF64>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Min>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Ne>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Lt>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Max>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Mul>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Div>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Clz>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Copysign>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64ConvertUI32>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32ReinterpretI32>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64And>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Ne>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Gt>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Sqrt>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Ge>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64GtS>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64GtU>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Eqz>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Div>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Add>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Or>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32LeU>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32LeS>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Ne>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Clz>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Neg>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32And>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32LtU>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Rotr>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Abs>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32LtS>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Eq>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Copysign>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32ConvertSI64>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Rotl>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Lt>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64ConvertSI32>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Eq>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Le>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Ge>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32ShrU>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32ConvertUI32>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32ShrS>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32GeU>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Ceil>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32GeS>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Shl>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Floor>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Xor>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Abs>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Min>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Mul>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Sub>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32ReinterpretF32>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Add>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Sub>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Or>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64LtU>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64LtS>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64ConvertSI64>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Xor>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64GeU>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Mul>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Sub>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64PromoteF32>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Add>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64GeS>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64ExtendUI32>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Ne>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64ReinterpretI64>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Eq>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Eq>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Floor>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32ConvertSI32>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Eqz>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64ReinterpretF64>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64ShrS>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64ShrU>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Sqrt>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Shl>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Gt>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32WrapI64>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Rotl>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Rotr>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32GtU>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64ExtendSI32>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I32GtS>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Neg>): (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Max>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64LeU>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64LeS>): (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Add>): * wasm/WasmAirIRGenerator.h: Added. * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::emptyExpression): * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::compileFunctions): * wasm/WasmCallingConvention.cpp: (JSC::Wasm::jscCallingConventionAir): (JSC::Wasm::wasmCallingConventionAir): * wasm/WasmCallingConvention.h: (JSC::Wasm::CallingConvention::CallingConvention): (JSC::Wasm::CallingConvention::marshallArgumentImpl const): (JSC::Wasm::CallingConvention::marshallArgument const): (JSC::Wasm::CallingConventionAir::CallingConventionAir): (JSC::Wasm::CallingConventionAir::prologueScratch const): (JSC::Wasm::CallingConventionAir::marshallArgumentImpl const): (JSC::Wasm::CallingConventionAir::marshallArgument const): (JSC::Wasm::CallingConventionAir::headerSizeInBytes): (JSC::Wasm::CallingConventionAir::loadArguments const): (JSC::Wasm::CallingConventionAir::setupCall const): (JSC::Wasm::nextJSCOffset): * wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser<Context>::parseExpression): * wasm/WasmValidate.cpp: (JSC::Wasm::Validate::emptyExpression): Canonical link: https://commits.webkit.org/208540@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240752 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-31 02:49:36 +00:00
wasm/WasmAirIRGenerator.cpp @no-unify
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
wasm/WasmB3IRGenerator.cpp
wasm/WasmBBQPlan.cpp
wasm/WasmBinding.cpp
wasm/WasmCallee.cpp
[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
wasm/WasmCalleeRegistry.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
wasm/WasmCallingConvention.cpp
wasm/WasmCodeBlock.cpp
[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
wasm/WasmCompilationMode.cpp
[JSC] OSR entry to Wasm OMG https://bugs.webkit.org/show_bug.cgi?id=200362 Reviewed by Michael Saboff. JSTests: * wasm/stress/osr-entry-basic.js: Added. (instance.exports.loop): * wasm/stress/osr-entry-many-locals-f32.js: Added. * wasm/stress/osr-entry-many-locals-f64.js: Added. * wasm/stress/osr-entry-many-locals-i32.js: Added. * wasm/stress/osr-entry-many-locals-i64.js: Added. * wasm/stress/osr-entry-many-stacks-f32.js: Added. * wasm/stress/osr-entry-many-stacks-f64.js: Added. * wasm/stress/osr-entry-many-stacks-i32.js: Added. * wasm/stress/osr-entry-many-stacks-i64.js: Added. Source/JavaScriptCore: This patch implements Wasm OSR entry mechanism from BBQ tier to OMG tier. We found that one of JetStream2 test heavily relies on OSR entry feature. gcc-loops-wasm consumes most of time in BBQ tier since one of the function takes significantly long time. And since we did not have OSR entry feature, we cannot use OMG function until that BBQ function finishes. To implement Wasm OSR feature, we first capture all locals and stacks in the patchpoint to generate the stackmap. Once the threshold is crossed, the patchpoint calls `MacroAssembler::probe` feature to capture whole register context, and C++ runtime function reads stackmap and Probe::Context to perform OSR entry. This patch intentionally makes OSR entry written in C++ runtime side as much as possible to make it easily reusable for the other tiers. For example, we are planning to introduce Wasm interpreter, and it can easily use this tier-up function. Because of this simplicity, this generic implementation can cover both BBQ Air and BBQ B3 tier-up features. So, in the feature, it is possible that we revive BBQ B3, and construct the wasm pipeline like, interpreter->BBQ B3->OMG B3. To generate OMG code for OSR entry, we add a new mode OMGForOSREntry, which mimics the FTLForOSREntry. In FTLForOSREntry, we cut unrelated blocks including the usual entry point in DFG tier and later convert graph to SSA. This is possible because DFG is not SSA. On the other hand, B3 is SSA and we cannot take the same thing without a hack. This patch introduce a hack: making all wasm locals and stack values B3::Variable for OMGForOSREntry mode. Then, we can cut blocks easily and we can generate the B3 graph without doing reachability analysis from the OSR entry point. B3 will remove unreachable blocks later. Tier-up function mimics DFG->FTL OSR entry heuristics and threshold as much as possible. And this patch adjusts the tier-up count threshold to make it close to DFG->FTL ones. Wasm tier-up is now using ExecutionCounter, which is inherited from Wasm::TierUpCount. Since wasm can execute concurrently, the tier-up counter can be racily updated. But this is OK in practice. Even if we see some more tier-up function calls or tier-up function calls are delayed, the critical part is guarded by a lock in tier-up function. In iMac Pro, it shows ~4x runtime improvement for gcc-loops-wasm. On iOS device (iPhone XR), we saw ~2x improvement. ToT: HashSet-wasm:Score: 24.6pt stdev=4.6% :Time:Geometric: 204ms stdev=4.4% Runtime:Time: 689ms stdev=1.0% Startup:Time: 60.3ms stdev=8.4% gcc-loops-wasm:Score: 8.41pt stdev=6.7% :Time:Geometric: 597ms stdev=6.5% Runtime:Time: 8.509s stdev=0.7% Startup:Time: 42ms stdev=12.4% quicksort-wasm:Score: 347pt stdev=20.9% :Time:Geometric: 15ms stdev=18.6% Runtime:Time: 28.2ms stdev=7.9% Startup:Time: 8.2ms stdev=35.0% richards-wasm:Score: 77.6pt stdev=4.5% :Time:Geometric: 64.6ms stdev=4.4% Runtime:Time: 544ms stdev=3.3% Startup:Time: 7.67ms stdev=6.7% tsf-wasm:Score: 47.9pt stdev=4.5% :Time:Geometric: 104ms stdev=4.8% Runtime:Time: 259ms stdev=4.4% Startup:Time: 42.2ms stdev=8.5% Patched: HashSet-wasm:Score: 24.1pt stdev=4.1% :Time:Geometric: 208ms stdev=4.1% Runtime:Time: 684ms stdev=1.1% Startup:Time: 63.2ms stdev=8.1% gcc-loops-wasm:Score: 15.7pt stdev=5.1% :Time:Geometric: 319ms stdev=5.3% Runtime:Time: 2.491s stdev=0.7% Startup:Time: 41ms stdev=11.0% quicksort-wasm:Score: 353pt stdev=13.7% :Time:Geometric: 14ms stdev=12.7% Runtime:Time: 26.2ms stdev=2.9% Startup:Time: 8.0ms stdev=23.7% richards-wasm:Score: 77.4pt stdev=5.3% :Time:Geometric: 64.7ms stdev=5.3% Runtime:Time: 536ms stdev=1.5% Startup:Time: 7.83ms stdev=9.6% tsf-wasm:Score: 47.3pt stdev=5.7% :Time:Geometric: 106ms stdev=6.1% Runtime:Time: 250ms stdev=3.5% Startup:Time: 45ms stdev=13.8% * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/MacroAssemblerARM64.h: (JSC::MacroAssemblerARM64::branchAdd32): * b3/B3ValueRep.h: * bytecode/CodeBlock.h: * bytecode/ExecutionCounter.cpp: (JSC::applyMemoryUsageHeuristics): (JSC::ExecutionCounter<countingVariant>::setThreshold): * bytecode/ExecutionCounter.h: (JSC::ExecutionCounter::clippedThreshold): * dfg/DFGJITCode.h: * dfg/DFGOperations.cpp: * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::prologueStackPointerDelta): * runtime/Options.h: * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::createStack): (JSC::Wasm::AirIRGenerator::emitPatchpoint): (JSC::Wasm::AirIRGenerator::outerLoopIndex const): (JSC::Wasm::AirIRGenerator::AirIRGenerator): (JSC::Wasm::AirIRGenerator::emitEntryTierUpCheck): (JSC::Wasm::AirIRGenerator::emitLoopTierUpCheck): (JSC::Wasm::AirIRGenerator::addLoop): (JSC::Wasm::AirIRGenerator::addElse): (JSC::Wasm::AirIRGenerator::addBranch): (JSC::Wasm::AirIRGenerator::addSwitch): (JSC::Wasm::AirIRGenerator::endBlock): (JSC::Wasm::AirIRGenerator::addEndToUnreachable): (JSC::Wasm::AirIRGenerator::unifyValuesWithBlock): (JSC::Wasm::AirIRGenerator::dump): (JSC::Wasm::AirIRGenerator::emitTierUpCheck): Deleted. * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::Stack::Stack): (JSC::Wasm::B3IRGenerator::Stack::append): (JSC::Wasm::B3IRGenerator::Stack::takeLast): (JSC::Wasm::B3IRGenerator::Stack::last): (JSC::Wasm::B3IRGenerator::Stack::size const): (JSC::Wasm::B3IRGenerator::Stack::isEmpty const): (JSC::Wasm::B3IRGenerator::Stack::convertToExpressionList): (JSC::Wasm::B3IRGenerator::Stack::at const): (JSC::Wasm::B3IRGenerator::Stack::variableAt const): (JSC::Wasm::B3IRGenerator::Stack::shrink): (JSC::Wasm::B3IRGenerator::Stack::swap): (JSC::Wasm::B3IRGenerator::Stack::dump const): (JSC::Wasm::B3IRGenerator::createStack): (JSC::Wasm::B3IRGenerator::outerLoopIndex const): (JSC::Wasm::B3IRGenerator::B3IRGenerator): (JSC::Wasm::B3IRGenerator::emitEntryTierUpCheck): (JSC::Wasm::B3IRGenerator::emitLoopTierUpCheck): (JSC::Wasm::B3IRGenerator::addLoop): (JSC::Wasm::B3IRGenerator::addElse): (JSC::Wasm::B3IRGenerator::addBranch): (JSC::Wasm::B3IRGenerator::addSwitch): (JSC::Wasm::B3IRGenerator::endBlock): (JSC::Wasm::B3IRGenerator::addEndToUnreachable): (JSC::Wasm::B3IRGenerator::unifyValuesWithBlock): (JSC::Wasm::B3IRGenerator::dump): (JSC::Wasm::parseAndCompile): (JSC::Wasm::B3IRGenerator::emitTierUpCheck): Deleted. (JSC::Wasm::dumpExpressionStack): Deleted. * wasm/WasmB3IRGenerator.h: * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::compileFunctions): * wasm/WasmBBQPlan.h: * wasm/WasmBBQPlanInlines.h: (JSC::Wasm::BBQPlan::initializeCallees): * wasm/WasmCallee.h: * wasm/WasmCodeBlock.cpp: (JSC::Wasm::CodeBlock::CodeBlock): * wasm/WasmCodeBlock.h: (JSC::Wasm::CodeBlock::wasmBBQCalleeFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::entrypointLoadLocationFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::tierUpCount): Deleted. * wasm/WasmCompilationMode.cpp: (JSC::Wasm::makeString): * wasm/WasmCompilationMode.h: * wasm/WasmContext.cpp: Copied from Source/JavaScriptCore/wasm/WasmCompilationMode.cpp. (JSC::Wasm::Context::scratchBufferForSize): * wasm/WasmContext.h: * wasm/WasmContextInlines.h: (JSC::Wasm::Context::tryLoadInstanceFromTLS): * wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser<Context>::FunctionParser): (JSC::Wasm::FunctionParser<Context>::parseBody): (JSC::Wasm::FunctionParser<Context>::parseExpression): * wasm/WasmOMGForOSREntryPlan.cpp: Copied from Source/JavaScriptCore/wasm/WasmOMGPlan.cpp. (JSC::Wasm::OMGForOSREntryPlan::OMGForOSREntryPlan): (JSC::Wasm::OMGForOSREntryPlan::work): * wasm/WasmOMGForOSREntryPlan.h: Copied from Source/JavaScriptCore/wasm/WasmOMGPlan.h. * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::work): (JSC::Wasm::OMGPlan::runForIndex): Deleted. * wasm/WasmOMGPlan.h: * wasm/WasmOSREntryData.h: Copied from Source/JavaScriptCore/wasm/WasmContext.h. (JSC::Wasm::OSREntryValue::OSREntryValue): (JSC::Wasm::OSREntryValue::type const): (JSC::Wasm::OSREntryData::OSREntryData): (JSC::Wasm::OSREntryData::functionIndex const): (JSC::Wasm::OSREntryData::loopIndex const): (JSC::Wasm::OSREntryData::values): * wasm/WasmOperations.cpp: Added. (JSC::Wasm::shouldTriggerOMGCompile): (JSC::Wasm::triggerOMGReplacementCompile): (JSC::Wasm::doOSREntry): (JSC::Wasm::triggerOSREntryNow): (JSC::Wasm::triggerTierUpNow): * wasm/WasmOperations.h: Copied from Source/JavaScriptCore/wasm/WasmCompilationMode.h. * wasm/WasmThunks.cpp: (JSC::Wasm::triggerOMGEntryTierUpThunkGenerator): (JSC::Wasm::triggerOMGTierUpThunkGenerator): Deleted. * wasm/WasmThunks.h: * wasm/WasmTierUpCount.cpp: Copied from Source/JavaScriptCore/wasm/WasmCompilationMode.cpp. (JSC::Wasm::TierUpCount::TierUpCount): (JSC::Wasm::TierUpCount::addOSREntryData): * wasm/WasmTierUpCount.h: (JSC::Wasm::TierUpCount::loopIncrement): (JSC::Wasm::TierUpCount::functionEntryIncrement): (JSC::Wasm::TierUpCount::osrEntryTriggers): (JSC::Wasm::TierUpCount::outerLoops): (JSC::Wasm::TierUpCount::getLock): (JSC::Wasm::TierUpCount::optimizeAfterWarmUp): (JSC::Wasm::TierUpCount::checkIfOptimizationThresholdReached): (JSC::Wasm::TierUpCount::dontOptimizeAnytimeSoon): (JSC::Wasm::TierUpCount::optimizeNextInvocation): (JSC::Wasm::TierUpCount::optimizeSoon): (JSC::Wasm::TierUpCount::setOptimizationThresholdBasedOnCompilationResult): (JSC::Wasm::TierUpCount::TierUpCount): Deleted. (JSC::Wasm::TierUpCount::loopDecrement): Deleted. (JSC::Wasm::TierUpCount::functionEntryDecrement): Deleted. (JSC::Wasm::TierUpCount::shouldStartTierUp): Deleted. (JSC::Wasm::TierUpCount::count): Deleted. * wasm/WasmValidate.cpp: (JSC::Wasm::Validate::createStack): (JSC::Wasm::Validate::addLoop): (JSC::Wasm::Validate::addElse): (JSC::Wasm::Validate::checkBranchTarget): (JSC::Wasm::Validate::addBranch): (JSC::Wasm::Validate::addSwitch): (JSC::Wasm::Validate::endBlock): (JSC::Wasm::Validate::unify): (JSC::Wasm::dumpExpressionStack): (JSC::Wasm::Validate::dump): Tools: * Scripts/run-jsc-stress-tests: Canonical link: https://commits.webkit.org/214633@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-20 00:21:29 +00:00
wasm/WasmContext.cpp
WebAssembly: no VM / JS version of everything but Instance https://bugs.webkit.org/show_bug.cgi?id=177473 Reviewed by Filip Pizlo, Saam Barati. JSTests: - Exceeding max on memory growth now returns a range error as per spec. This is a (very minor) breaking change: it used to throw OOM error. Update the corresponding test. * wasm/js-api/memory-grow.js: (assertEq): * wasm/js-api/table.js: (assert.throws): Source/JavaScriptCore: This change entails cleaning up and splitting a bunch of code which we had intertwined between C++ classes which represent JS objects, and pure C++ implementation objects. This specific change goes most of the way towards allowing JSC's WebAssembly to work without VM / JS, up to but excluding JSWebAssemblyInstance (there's Wasm::Instance, but it's not *the* thing yet). Because of this we still have a few FIXME identifying places that need to change. A follow-up change will go the rest of the way. I went about this change in the simplest way possible: grep the JavaScriptCore/wasm directory for "JS[^C_]" as well as "VM" and exclude the /js/ sub-directory (which contains the JS implementation of WebAssembly). None of this change removes the need for a JIT entitlement to be able to use WebAssembly. We don't have an interpreter, the process therefore still needs to be allowed to JIT to use these pure-C++ APIs. Interesting things to note: - Remove VM from Plan and associated places. It can just live as a capture in the callback lambda if it's needed. - Wasm::Memory shouldn't require a VM. It was only used to ask the GC to collect. We now instead pass two lambdas at construction time for this purpose: one to notify of memory pressure, and the other to ask for syncrhonous memory reclamation. This allows whoever creates the memory to dictate how to react to both these cases, and for a JS embedding that's to call the GC (async or sync, respectively). - Move grow logic from JSWebAssemblyMemory to Wasm::Memory::grow. Use Expected there, with an enum class for failure types. - Exceeding max on memory growth now returns a range error as per spec. This is a (very minor) breaking change: it used to throw OOM error. Update the corresponding test. - When generating the grow_memory opcode, no need to get the VM. Instead, reach directly for Wasm::Memory and grow it. - JSWebAssemblyMemory::grow can now always throw on failure, because it's only ever called from JS (not from grow_memory as before). - Wasm::Memory now takes a callback for successful growth. This allows JS wrappers to register themselves when growth succeeds without Wasm::Memory knowning anything about JS. It'll also allow creating a list of callbacks for when we add thread support (we'll want to notify many wrappers, all under a lock). - Wasm::Memory is now back to being the source of truth about address / size, used directly by generated code instead of JSWebAssemblyMemory. - Move wasmToJS from the general WasmBinding header to its own header under wasm/js. It's only used by wasm/js/JSWebAssemblyCodeBlock.cpp, and uses VM, and therefore isn't general WebAssembly. - Make Wasm::Context an actual type (just a struct holding a JSWebAssemlyInstance for now) instead of an alias for that. Notably this doesn't add anything to the Context and doesn't change what actually gets passed around in JIT code (fast TLS or registers) because these changes potentially impact performance. The entire purpose of this change is to allow passing Wasm::Context around without having to know about VM. Since VM contains a Wasm::Context the JS embedding is effectively the same, but with this setup a non-JS embedding is much better off. - Move JSWebAssembly into the JS folder. - OMGPlan: use Wasm::CodeBlock directly instead of JSWebAssemblyCodeBlock. - wasm->JS stubs are now on the instance's tail as raw pointers, instead of being on JSWebAssemblyCodeBlock, and are now called wasm->Embedder stubs. The owned reference is still on JSWebAssemblyCodeBlock, and is still called wasm->JS stub. This move means that the embedder must, after creating a Wasm::CodeBlock, somehow create the stubs to call back into the embedder. This removes an indirection in the generated code because the B3 IR generator now reaches into the instance instead of JSWebAssemblyCodeBlock. - Move more CodeBlock things. Compilation completion is now marked by its own atomic<bool> flag instead of a nullptr plan: that required using a lock, and was causing a deadlock in stack-trace.js because before my changes JSWebAssemblyCodeBlock did its own completion checking separately from Wasm::CodeBlock, without getting the lock. Now that everything points to Wasm::CodeBlock and there's no cached completion marker, the lock was being acquired in a sanity-check assertion. - Embedder -> Wasm wrappers are now generated through a function that's passed in at compilation time, instead of being hard-coded as a JS -> Wasm wrapper. - WasmMemory doens't need to know about fault handling thunks. Only the IR generator should know, and should make sure that the exception throwing thunk is generated if any memory is present (note: with signal handling not all of them generate an exception check). - Make exception throwing pluggable: instead of having a hard-coded JS-specific lambda we now have a regular C++ function being called from JIT code when a WebAssembly exception is thrown. This allows any embedder to get called as they wish. For now a process can only have a single of these functions (i.e. only one embedder per process) because the trap handler is a singleton. That can be fixed in in #177475. - Create WasmEmbedder.h where all embedder plugging will live. - Split up JSWebAssemblyTable into Wasm::Table which is refcounted. JSWebAssemblyTable now only contains the JS functions in the table, and Wasm::Table is what's used by the JIT code to lookup where to call and do the instance check (for context switch). Note that this creates an extra allocation for all the instances in Wasm::Table, and in exchange removes an indirection in JIT code because the instance used to be obtained off of the JS function. Also note that it's the embedder than keeps the instances alive, not Wasm::Table (which holds a dumb pointer to the instance), because doing otherwise would cause reference cycles. - Add WasmInstance. It doesn't do much for now, owns globals. - JSWebAssembly instance now doesn't just contain the imported functions as JSObjects, it also has the corresponding import's instance and wasm entrypoint. This triples the space allocated per instance's imported function, but there shouldn't be that many imports. This has two upsides: it creates smaller and faster code, and makes is easier to disassociate embedder-specific things from embedder-neutral things. The small / faster win is in two places: B3 IR generator only needs offsetOfImportFunction for the call opcode (when the called index is an import) to know whether the import is wasm->wasm or wasm->embedder (this isn't known at compile-time because it's dependent on the import object), this is now done by seeing if that import function has an associated target instance (only wasm->wasm does); the other place is wasmBinding which uses offsetOfImportFunction to figure out the wasm->wasm target instance, and then gets WebAssemblyFunction::offsetOfWasmEntrypointLoadLocation to do a tail call. The disassociation comes because the target instance can be Wasm::Instance once we change what the Context is, and WasmEntrypointLoadLocation is already embedder-independent. As a next step I can move this tail allocation from JSWebAssemblyInstance to Wasm::Instance, and leave importFunction in as an opaque pointer which is embedder-specific, and in JS will remain WriteBarrier<JSObject>. - Rename VMEntryFrame to EntryFrame, and in many places pass a pointer to it around instead of VM. This is a first step in allowing entry frames which aren't stored on VM, but which are instead stored in an embedder-specific location. That change won't really affect JS except through code churn, but will allow WebAssembly to use some machinery in a generic manner without having a VM. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/PolymorphicAccess.cpp: (JSC::AccessGenerationState::emitExplicitExceptionHandler): * debugger/Debugger.cpp: (JSC::Debugger::stepOutOfFunction): (JSC::Debugger::returnEvent): (JSC::Debugger::unwindEvent): (JSC::Debugger::didExecuteProgram): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::compileExceptionHandlers): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExit.cpp: (JSC::DFG::OSRExit::compileOSRExit): (JSC::DFG::OSRExit::compileExit): * dfg/DFGThunks.cpp: (JSC::DFG::osrEntryThunkGenerator): * ftl/FTLCompile.cpp: (JSC::FTL::compile): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileStub): * interpreter/CallFrame.cpp: (JSC::CallFrame::wasmAwareLexicalGlobalObject): (JSC::CallFrame::callerFrame): (JSC::CallFrame::unsafeCallerFrame): * interpreter/CallFrame.h: (JSC::ExecState::callerFrame const): (JSC::ExecState::callerFrameOrEntryFrame const): (JSC::ExecState::unsafeCallerFrameOrEntryFrame const): * interpreter/FrameTracers.h: (JSC::NativeCallFrameTracer::NativeCallFrameTracer): (JSC::NativeCallFrameTracerWithRestore::NativeCallFrameTracerWithRestore): (JSC::NativeCallFrameTracerWithRestore::~NativeCallFrameTracerWithRestore): * interpreter/Interpreter.cpp: (JSC::UnwindFunctor::operator() const): (JSC::UnwindFunctor::copyCalleeSavesToEntryFrameCalleeSavesBuffer const): (JSC::Interpreter::unwind): * interpreter/StackVisitor.cpp: (JSC::StackVisitor::StackVisitor): (JSC::StackVisitor::gotoNextFrame): (JSC::StackVisitor::readNonInlinedFrame): (JSC::StackVisitor::Frame::dump const): * interpreter/StackVisitor.h: (JSC::StackVisitor::Frame::callerIsEntryFrame const): * interpreter/VMEntryRecord.h: (JSC::VMEntryRecord::prevTopEntryFrame): (JSC::VMEntryRecord::unsafePrevTopEntryFrame): (JSC::EntryFrame::vmEntryRecordOffset): * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::restoreCalleeSavesFromEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::loadWasmContextInstance): (JSC::AssemblyHelpers::storeWasmContextInstance): (JSC::AssemblyHelpers::loadWasmContextInstanceNeedsMacroScratchRegister): (JSC::AssemblyHelpers::storeWasmContextInstanceNeedsMacroScratchRegister): (JSC::AssemblyHelpers::copyCalleeSavesToEntryFrameCalleeSavesBufferImpl): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::copyCalleeSavesToVMEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::copyCalleeSavesToEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::copyCalleeSavesFromFrameOrRegisterToEntryFrameCalleeSavesBuffer): * jit/JIT.cpp: (JSC::JIT::emitEnterOptimizationCheck): (JSC::JIT::privateCompileExceptionHandlers): * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_throw): (JSC::JIT::emit_op_catch): (JSC::JIT::emitSlow_op_loop_hint): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_throw): (JSC::JIT::emit_op_catch): * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::throwExceptionFromCallSlowPathGenerator): (JSC::nativeForGenerator): * jsc.cpp: (functionDumpCallFrame): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntThunks.cpp: (JSC::vmEntryRecord): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * runtime/Options.cpp: (JSC::recomputeDependentOptions): * runtime/Options.h: * runtime/SamplingProfiler.cpp: (JSC::FrameWalker::FrameWalker): (JSC::FrameWalker::advanceToParentFrame): (JSC::SamplingProfiler::processUnverifiedStackTraces): * runtime/ThrowScope.cpp: (JSC::ThrowScope::~ThrowScope): * runtime/VM.cpp: (JSC::VM::VM): (JSC::VM::~VM): * runtime/VM.h: (JSC::VM::topEntryFrameOffset): * runtime/VMTraps.cpp: (JSC::isSaneFrame): (JSC::VMTraps::tryInstallTrapBreakpoints): (JSC::VMTraps::invalidateCodeBlocksOnStack): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::restoreWasmContextInstance): (JSC::Wasm::B3IRGenerator::B3IRGenerator): (JSC::Wasm::B3IRGenerator::restoreWebAssemblyGlobalState): (JSC::Wasm::B3IRGenerator::addGrowMemory): (JSC::Wasm::B3IRGenerator::addCurrentMemory): (JSC::Wasm::B3IRGenerator::addCall): (JSC::Wasm::B3IRGenerator::addCallIndirect): (JSC::Wasm::parseAndCompile): * wasm/WasmB3IRGenerator.h: * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::BBQPlan): (JSC::Wasm::BBQPlan::compileFunctions): (JSC::Wasm::BBQPlan::complete): * wasm/WasmBBQPlan.h: * wasm/WasmBBQPlanInlines.h: (JSC::Wasm::BBQPlan::initializeCallees): * wasm/WasmBinding.cpp: (JSC::Wasm::wasmToWasm): * wasm/WasmBinding.h: * wasm/WasmCodeBlock.cpp: (JSC::Wasm::CodeBlock::create): (JSC::Wasm::CodeBlock::CodeBlock): (JSC::Wasm::CodeBlock::compileAsync): (JSC::Wasm::CodeBlock::setCompilationFinished): * wasm/WasmCodeBlock.h: (JSC::Wasm::CodeBlock::offsetOfImportStubs): (JSC::Wasm::CodeBlock::allocationSize): (JSC::Wasm::CodeBlock::importWasmToEmbedderStub): (JSC::Wasm::CodeBlock::offsetOfImportWasmToEmbedderStub): (JSC::Wasm::CodeBlock::wasmToJSCallStubForImport): (JSC::Wasm::CodeBlock::compilationFinished): (JSC::Wasm::CodeBlock::jsEntrypointCalleeFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::wasmEntrypointCalleeFromFunctionIndexSpace): * wasm/WasmContext.cpp: (JSC::Wasm::Context::useFastTLS): (JSC::Wasm::Context::load const): (JSC::Wasm::Context::store): * wasm/WasmContext.h: * wasm/WasmEmbedder.h: Copied from Source/JavaScriptCore/wasm/WasmContext.h. * wasm/WasmFaultSignalHandler.cpp: * wasm/WasmFaultSignalHandler.h: * wasm/WasmFormat.h: * wasm/WasmInstance.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. (JSC::Wasm::Instance::Instance): (JSC::Wasm::Instance::~Instance): (JSC::Wasm::Instance::extraMemoryAllocated const): * wasm/WasmInstance.h: Added. (JSC::Wasm::Instance::create): (JSC::Wasm::Instance::finalizeCreation): (JSC::Wasm::Instance::module): (JSC::Wasm::Instance::codeBlock): (JSC::Wasm::Instance::memory): (JSC::Wasm::Instance::table): (JSC::Wasm::Instance::loadI32Global const): (JSC::Wasm::Instance::loadI64Global const): (JSC::Wasm::Instance::loadF32Global const): (JSC::Wasm::Instance::loadF64Global const): (JSC::Wasm::Instance::setGlobal): (JSC::Wasm::Instance::offsetOfCachedStackLimit): (JSC::Wasm::Instance::cachedStackLimit const): (JSC::Wasm::Instance::setCachedStackLimit): * wasm/WasmMemory.cpp: (JSC::Wasm::Memory::Memory): (JSC::Wasm::Memory::create): (JSC::Wasm::Memory::~Memory): (JSC::Wasm::Memory::grow): * wasm/WasmMemory.h: (JSC::Wasm::Memory::offsetOfMemory): (JSC::Wasm::Memory::offsetOfSize): * wasm/WasmMemoryInformation.cpp: (JSC::Wasm::PinnedRegisterInfo::get): (JSC::Wasm::PinnedRegisterInfo::PinnedRegisterInfo): * wasm/WasmMemoryInformation.h: (JSC::Wasm::PinnedRegisterInfo::toSave const): * wasm/WasmMemoryMode.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. (JSC::Wasm::makeString): * wasm/WasmMemoryMode.h: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. * wasm/WasmModule.cpp: (JSC::Wasm::makeValidationCallback): (JSC::Wasm::Module::validateSync): (JSC::Wasm::Module::validateAsync): (JSC::Wasm::Module::getOrCreateCodeBlock): (JSC::Wasm::Module::compileSync): (JSC::Wasm::Module::compileAsync): * wasm/WasmModule.h: * wasm/WasmModuleParser.cpp: (JSC::Wasm::ModuleParser::parseTableHelper): * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::OMGPlan): (JSC::Wasm::OMGPlan::runForIndex): * wasm/WasmOMGPlan.h: * wasm/WasmPageCount.h: (JSC::Wasm::PageCount::isValid const): * wasm/WasmPlan.cpp: (JSC::Wasm::Plan::Plan): (JSC::Wasm::Plan::runCompletionTasks): (JSC::Wasm::Plan::addCompletionTask): (JSC::Wasm::Plan::tryRemoveContextAndCancelIfLast): * wasm/WasmPlan.h: (JSC::Wasm::Plan::dontFinalize): * wasm/WasmSignature.cpp: * wasm/WasmSignature.h: * wasm/WasmTable.cpp: Added. (JSC::Wasm::Table::create): (JSC::Wasm::Table::~Table): (JSC::Wasm::Table::Table): (JSC::Wasm::Table::grow): (JSC::Wasm::Table::clearFunction): (JSC::Wasm::Table::setFunction): * wasm/WasmTable.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyTable.h. (JSC::Wasm::Table::maximum const): (JSC::Wasm::Table::size const): (JSC::Wasm::Table::offsetOfSize): (JSC::Wasm::Table::offsetOfFunctions): (JSC::Wasm::Table::offsetOfInstances): (JSC::Wasm::Table::isValidSize): * wasm/WasmThunks.cpp: (JSC::Wasm::throwExceptionFromWasmThunkGenerator): (JSC::Wasm::triggerOMGTierUpThunkGenerator): (JSC::Wasm::Thunks::setThrowWasmException): (JSC::Wasm::Thunks::throwWasmException): * wasm/WasmThunks.h: * wasm/WasmWorklist.cpp: (JSC::Wasm::Worklist::stopAllPlansForContext): * wasm/WasmWorklist.h: * wasm/js/JSToWasm.cpp: Added. (JSC::Wasm::createJSToWasmWrapper): * wasm/js/JSToWasm.h: Copied from Source/JavaScriptCore/wasm/WasmBinding.h. * wasm/js/JSWebAssembly.cpp: Renamed from Source/JavaScriptCore/wasm/JSWebAssembly.cpp. * wasm/js/JSWebAssembly.h: Renamed from Source/JavaScriptCore/wasm/JSWebAssembly.h. * wasm/js/JSWebAssemblyCodeBlock.cpp: (JSC::JSWebAssemblyCodeBlock::create): (JSC::JSWebAssemblyCodeBlock::JSWebAssemblyCodeBlock): * wasm/js/JSWebAssemblyCodeBlock.h: * wasm/js/JSWebAssemblyInstance.cpp: (JSC::JSWebAssemblyInstance::JSWebAssemblyInstance): (JSC::JSWebAssemblyInstance::finishCreation): (JSC::JSWebAssemblyInstance::visitChildren): (JSC::JSWebAssemblyInstance::finalizeCreation): (JSC::JSWebAssemblyInstance::create): * wasm/js/JSWebAssemblyInstance.h: (JSC::JSWebAssemblyInstance::instance): (JSC::JSWebAssemblyInstance::context const): (JSC::JSWebAssemblyInstance::table): (JSC::JSWebAssemblyInstance::webAssemblyToJSCallee): (JSC::JSWebAssemblyInstance::setMemory): (JSC::JSWebAssemblyInstance::offsetOfTail): (JSC::JSWebAssemblyInstance::importFunctionInfo): (JSC::JSWebAssemblyInstance::offsetOfTargetInstance): (JSC::JSWebAssemblyInstance::offsetOfWasmEntrypoint): (JSC::JSWebAssemblyInstance::offsetOfImportFunction): (JSC::JSWebAssemblyInstance::importFunction): (JSC::JSWebAssemblyInstance::internalMemory): (JSC::JSWebAssemblyInstance::wasmCodeBlock const): (JSC::JSWebAssemblyInstance::offsetOfWasmTable): (JSC::JSWebAssemblyInstance::offsetOfCallee): (JSC::JSWebAssemblyInstance::offsetOfGlobals): (JSC::JSWebAssemblyInstance::offsetOfWasmCodeBlock): (JSC::JSWebAssemblyInstance::offsetOfWasmMemory): (JSC::JSWebAssemblyInstance::cachedStackLimit const): (JSC::JSWebAssemblyInstance::setCachedStackLimit): (JSC::JSWebAssemblyInstance::wasmMemory): (JSC::JSWebAssemblyInstance::wasmModule): (JSC::JSWebAssemblyInstance::allocationSize): (JSC::JSWebAssemblyInstance::module const): * wasm/js/JSWebAssemblyMemory.cpp: (JSC::JSWebAssemblyMemory::create): (JSC::JSWebAssemblyMemory::adopt): (JSC::JSWebAssemblyMemory::JSWebAssemblyMemory): (JSC::JSWebAssemblyMemory::grow): (JSC::JSWebAssemblyMemory::growSuccessCallback): * wasm/js/JSWebAssemblyMemory.h: * wasm/js/JSWebAssemblyModule.cpp: (JSC::JSWebAssemblyModule::moduleInformation const): (JSC::JSWebAssemblyModule::exportSymbolTable const): (JSC::JSWebAssemblyModule::signatureIndexFromFunctionIndexSpace const): (JSC::JSWebAssemblyModule::callee const): (JSC::JSWebAssemblyModule::codeBlock): (JSC::JSWebAssemblyModule::module): * wasm/js/JSWebAssemblyModule.h: * wasm/js/JSWebAssemblyTable.cpp: (JSC::JSWebAssemblyTable::create): (JSC::JSWebAssemblyTable::JSWebAssemblyTable): (JSC::JSWebAssemblyTable::visitChildren): (JSC::JSWebAssemblyTable::grow): (JSC::JSWebAssemblyTable::getFunction): (JSC::JSWebAssemblyTable::clearFunction): (JSC::JSWebAssemblyTable::setFunction): * wasm/js/JSWebAssemblyTable.h: (JSC::JSWebAssemblyTable::isValidSize): (JSC::JSWebAssemblyTable::maximum const): (JSC::JSWebAssemblyTable::size const): (JSC::JSWebAssemblyTable::table): * wasm/js/WasmToJS.cpp: Copied from Source/JavaScriptCore/wasm/WasmBinding.cpp. (JSC::Wasm::materializeImportJSCell): (JSC::Wasm::wasmToJS): (JSC::Wasm::wasmToJSException): * wasm/js/WasmToJS.h: Copied from Source/JavaScriptCore/wasm/WasmBinding.h. * wasm/js/WebAssemblyFunction.cpp: (JSC::callWebAssemblyFunction): * wasm/js/WebAssemblyInstanceConstructor.cpp: (JSC::constructJSWebAssemblyInstance): * wasm/js/WebAssemblyMemoryConstructor.cpp: (JSC::constructJSWebAssemblyMemory): * wasm/js/WebAssemblyMemoryPrototype.cpp: (JSC::webAssemblyMemoryProtoFuncGrow): * wasm/js/WebAssemblyModuleConstructor.cpp: (JSC::constructJSWebAssemblyModule): (JSC::WebAssemblyModuleConstructor::createModule): * wasm/js/WebAssemblyModuleConstructor.h: * wasm/js/WebAssemblyModuleRecord.cpp: (JSC::WebAssemblyModuleRecord::link): (JSC::WebAssemblyModuleRecord::evaluate): * wasm/js/WebAssemblyPrototype.cpp: (JSC::webAssemblyCompileFunc): (JSC::instantiate): (JSC::compileAndInstantiate): (JSC::webAssemblyValidateFunc): * wasm/js/WebAssemblyTableConstructor.cpp: (JSC::constructJSWebAssemblyTable): * wasm/js/WebAssemblyWrapperFunction.cpp: (JSC::WebAssemblyWrapperFunction::create): Source/WebCore: * ForwardingHeaders/wasm/WasmModule.h: Added. This used to be included in JSWebAssemblyModule.h. * bindings/js/SerializedScriptValue.cpp: Update postMessage code according to C++ API changes. Canonical link: https://commits.webkit.org/194750@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223738 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-20 02:23:29 +00:00
wasm/WasmEmbedder.h
[WebAssembly] Create a Wasm interpreter https://bugs.webkit.org/show_bug.cgi?id=194257 <rdar://problem/44186794> Reviewed by Saam Barati. Source/JavaScriptCore: Add an interpreter tier to WebAssembly which reuses the LLInt infrastructure. The interpreter currently tiers up straight to OMG and can OSR enter at the prologue and from loops. The initial implementation of the interpreter is very naive, but despite the lack of optimizations it still shows a 2x improvement on the WebAssembly subtests in JetStream2 and 2x improvement on the PSPDFKit benchmark. It reduces "compilation" times by ~3x and it's neutral on throughput. The interpreter follows the same calling conventions as the BBQ/OMG, this means that: - We have to allocate locals for all argument registers and write all arguments registers to the stack in the prologue. - Calls have to allocate space for at least as many arguments as the number of argument registers. Before each call, all argument registers must be loaded from the stack, and after we return from the call, all registers must be stored back to the stack, in case they contain return values. We carefully layout the stack so that the arguments that would already have to be passed in the stack end up in the right place. The stack layout for calls is: [ gprs ][ fprs ][ optional stack arguments ][ callee frame ] ^ sp - The return opcode has to load all registers from the stack, since they might need to contain results of the function. - The calling convention requires that the callee should store itself in the callee slot of the call frame, which is impossible in the interpreter, since the code we execute is the same for all callees. In order to work around that, we generate an entry thunk to the wasm interpreter for each function. All this thunk does is store the callee in the call frame and tail call the interpreter. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::constantName const): (JSC::BytecodeDumper<Block>::dumpValue): (JSC::BytecodeDumper<Block>::dumpBytecode): (JSC::CodeBlockBytecodeDumper<Block>::vm const): (JSC::CodeBlockBytecodeDumper<Block>::identifier const): (JSC::CodeBlockBytecodeDumper<Block>::dumpIdentifiers): (JSC::CodeBlockBytecodeDumper<Block>::dumpConstants): (JSC::CodeBlockBytecodeDumper<Block>::dumpExceptionHandlers): (JSC::CodeBlockBytecodeDumper<Block>::dumpSwitchJumpTables): (JSC::CodeBlockBytecodeDumper<Block>::dumpStringSwitchJumpTables): (JSC::CodeBlockBytecodeDumper<Block>::dumpBlock): * bytecode/BytecodeDumper.h: (JSC::BytecodeDumper::dumpValue): (JSC::BytecodeDumper::BytecodeDumper): * bytecode/BytecodeGeneratorification.cpp: (JSC::performGeneratorification): * bytecode/BytecodeList.rb: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): * bytecode/Fits.h: * bytecode/Instruction.h: (JSC::BaseInstruction::BaseInstruction): (JSC::BaseInstruction::Impl::opcodeID const): (JSC::BaseInstruction::opcodeID const): (JSC::BaseInstruction::name const): (JSC::BaseInstruction::isWide16 const): (JSC::BaseInstruction::isWide32 const): (JSC::BaseInstruction::hasMetadata const): (JSC::BaseInstruction::sizeShiftAmount const): (JSC::BaseInstruction::size const): (JSC::BaseInstruction::is const): (JSC::BaseInstruction::as const): (JSC::BaseInstruction::cast): (JSC::BaseInstruction::cast const): (JSC::BaseInstruction::wide16 const): (JSC::BaseInstruction::wide32 const): * bytecode/InstructionStream.h: (JSC::InstructionStream::iterator::operator+=): (JSC::InstructionStream::iterator::operator++): (JSC::InstructionStreamWriter::iterator::operator+=): (JSC::InstructionStreamWriter::iterator::operator++): * bytecode/Opcode.cpp: * bytecode/Opcode.h: * bytecode/PreciseJumpTargetsInlines.h: * bytecode/UnlinkedCodeBlock.h: * bytecode/VirtualRegister.cpp: (JSC::VirtualRegister::VirtualRegister): * bytecode/VirtualRegister.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::GenericLabel<JSGeneratorTraits>::setLocation): (JSC::BytecodeGenerator::BytecodeGenerator): * bytecompiler/BytecodeGenerator.h: * bytecompiler/BytecodeGeneratorBase.h: Added. * bytecompiler/BytecodeGeneratorBaseInlines.h: Added. (JSC::shrinkToFit): (JSC::BytecodeGeneratorBase<Traits>::BytecodeGeneratorBase): (JSC::BytecodeGeneratorBase<Traits>::newLabel): (JSC::BytecodeGeneratorBase<Traits>::newEmittedLabel): (JSC::BytecodeGeneratorBase<Traits>::reclaimFreeRegisters): (JSC::BytecodeGeneratorBase<Traits>::emitLabel): (JSC::BytecodeGeneratorBase<Traits>::recordOpcode): (JSC::BytecodeGeneratorBase<Traits>::alignWideOpcode16): (JSC::BytecodeGeneratorBase<Traits>::alignWideOpcode32): (JSC::BytecodeGeneratorBase<Traits>::write): (JSC::BytecodeGeneratorBase<Traits>::newRegister): (JSC::BytecodeGeneratorBase<Traits>::newTemporary): (JSC::BytecodeGeneratorBase<Traits>::addVar): (JSC::BytecodeGeneratorBase<Traits>::allocateCalleeSaveSpace): * bytecompiler/Label.h: (JSC::GenericBoundLabel::GenericBoundLabel): (JSC::GenericBoundLabel::target): (JSC::GenericBoundLabel::saveTarget): (JSC::GenericBoundLabel::commitTarget): * dfg/DFGByteCodeParser.cpp: * dfg/DFGCapabilities.cpp: (JSC::DFG::capabilityLevel): * dfg/DFGOperations.cpp: * generator/Argument.rb: * generator/DSL.rb: * generator/GeneratedFile.rb: * generator/Opcode.rb: * generator/Options.rb: * generator/Section.rb: * generator/Wasm.rb: Added. * interpreter/Register.h: * interpreter/RegisterInlines.h: (JSC::Register::operator=): * jit/JITArithmetic.cpp: * jit/JITOpcodes.cpp: * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntData.h: (JSC::LLInt::wasmExceptionInstructions): * llint/LLIntOfflineAsmConfig.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntSlowPaths.cpp: * llint/LLIntThunks.cpp: (JSC::LLInt::generateThunkWithJumpTo): (JSC::LLInt::wasmFunctionEntryThunk): * llint/LLIntThunks.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * llint/WebAssembly.asm: Added. * offlineasm/arm64.rb: * offlineasm/instructions.rb: * offlineasm/parser.rb: * offlineasm/registers.rb: * offlineasm/transform.rb: * offlineasm/x86.rb: * parser/Nodes.h: * runtime/Error.cpp: (JSC::FindFirstCallerFrameWithCodeblockFunctor::operator() const): * runtime/ErrorInstance.cpp: (JSC::ErrorInstance::finishCreation): * runtime/Options.cpp: (JSC::overrideDefaults): * runtime/OptionsList.h: * runtime/SamplingProfiler.cpp: (JSC::FrameWalker::recordJITFrame): (JSC::FrameWalker::resetAtMachineFrame): * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::isControlTypeIf): (JSC::Wasm::AirIRGenerator::emitLoopTierUpCheck): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::isControlTypeIf): * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::prepareImpl): (JSC::Wasm::BBQPlan::work): (JSC::Wasm::BBQPlan::compileFunction): (JSC::Wasm::BBQPlan::didCompleteCompilation): (JSC::Wasm::BBQPlan::initializeCallees): * wasm/WasmBBQPlan.h: * wasm/WasmBBQPlanInlines.h: Removed. * wasm/WasmCallee.cpp: (JSC::Wasm::Callee::Callee): (JSC::Wasm::Callee::dump const): (JSC::Wasm::JITCallee::JITCallee): (JSC::Wasm::LLIntCallee::setEntrypoint): (JSC::Wasm::LLIntCallee::entrypoint const): (JSC::Wasm::LLIntCallee::calleeSaveRegisters): (JSC::Wasm:: const): * wasm/WasmCallee.h: (JSC::Wasm::Callee::setOSREntryCallee): (JSC::Wasm::JITCallee::wasmToWasmCallsites): (JSC::Wasm::JITCallee:: const): * wasm/WasmCallingConvention.h: * wasm/WasmCodeBlock.cpp: (JSC::Wasm::CodeBlock::CodeBlock): * wasm/WasmCodeBlock.h: (JSC::Wasm::CodeBlock::wasmEntrypointCalleeFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::wasmBBQCalleeFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::wasmToWasmExitStub): * wasm/WasmCompilationMode.cpp: (JSC::Wasm::makeString): * wasm/WasmCompilationMode.h: * wasm/WasmEmbedder.h: * wasm/WasmEntryPlan.cpp: Added. (JSC::Wasm::EntryPlan::EntryPlan): (JSC::Wasm::EntryPlan::stateString): (JSC::Wasm::EntryPlan::moveToState): (JSC::Wasm::EntryPlan::didReceiveFunctionData): (JSC::Wasm::EntryPlan::parseAndValidateModule): (JSC::Wasm::EntryPlan::prepare): (JSC::Wasm::EntryPlan::ThreadCountHolder::ThreadCountHolder): (JSC::Wasm::EntryPlan::ThreadCountHolder::~ThreadCountHolder): (JSC::Wasm::EntryPlan::complete): (JSC::Wasm::EntryPlan::compileFunctions): (JSC::Wasm::EntryPlan::work): * wasm/WasmEntryPlan.h: Copied from Source/JavaScriptCore/wasm/WasmBBQPlan.h. (JSC::Wasm::EntryPlan::parseAndValidateModule): (JSC::Wasm::EntryPlan::exports const): (JSC::Wasm::EntryPlan::internalFunctionCount const): (JSC::Wasm::EntryPlan::takeModuleInformation): (JSC::Wasm::EntryPlan::takeWasmToWasmExitStubs): (JSC::Wasm::EntryPlan::takeWasmToWasmCallsites): (JSC::Wasm::EntryPlan::hasBeenPrepared const): (JSC::Wasm::EntryPlan::tryReserveCapacity): * wasm/WasmFunctionCodeBlock.cpp: Added. (JSC::Wasm::FunctionCodeBlock::setInstructions): (JSC::Wasm::FunctionCodeBlock::dumpBytecode): (JSC::Wasm::FunctionCodeBlock::addOutOfLineJumpTarget): (JSC::Wasm::FunctionCodeBlock::outOfLineJumpOffset): (JSC::Wasm::FunctionCodeBlock::outOfLineJumpTarget): (JSC::Wasm::FunctionCodeBlock::addSignature): (JSC::Wasm::FunctionCodeBlock::signature const): (JSC::Wasm::FunctionCodeBlock::addJumpTable): (JSC::Wasm::FunctionCodeBlock::jumpTable const const): (JSC::Wasm::FunctionCodeBlock::numberOfJumpTables const): * wasm/WasmFunctionCodeBlock.h: Added. (JSC::Wasm::FunctionCodeBlock::FunctionCodeBlock): (JSC::Wasm::FunctionCodeBlock::getConstant const): (JSC::Wasm::FunctionCodeBlock::functionIndex const): (JSC::Wasm::FunctionCodeBlock::addJumpTarget): (JSC::Wasm::FunctionCodeBlock::numberOfJumpTargets): (JSC::Wasm::FunctionCodeBlock::lastJumpTarget): (JSC::Wasm::FunctionCodeBlock::outOfLineJumpOffset): (JSC::Wasm::FunctionCodeBlock::bytecodeOffset): (JSC::Wasm::FunctionCodeBlock::tierUpCounter): * wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser<Context>::parseExpression): (JSC::Wasm::FunctionParser<Context>::parseUnreachableExpression): * wasm/WasmInstance.h: * wasm/WasmLLIntGenerator.cpp: Added. (JSC::Wasm::LLIntGenerator::ControlType::ControlType): (JSC::Wasm::LLIntGenerator::ControlType::loop): (JSC::Wasm::LLIntGenerator::ControlType::topLevel): (JSC::Wasm::LLIntGenerator::ControlType::block): (JSC::Wasm::LLIntGenerator::ControlType::if_): (JSC::Wasm::LLIntGenerator::ControlType::targetLabelForBranch const): (JSC::Wasm::LLIntGenerator::fail const): (JSC::Wasm::LLIntGenerator::unifyValuesWithBlock): (JSC::Wasm::LLIntGenerator::emptyExpression): (JSC::Wasm::LLIntGenerator::createStack): (JSC::Wasm::LLIntGenerator::isControlTypeIf): (JSC::Wasm::LLIntGenerator::addEndToUnreachable): (JSC::Wasm::LLIntGenerator::setParser): (JSC::Wasm::LLIntGenerator::dump): (JSC::Wasm::LLIntGenerator::virtualRegisterForLocal): (JSC::Wasm::LLIntGenerator::tmpsForSignature): (JSC::Wasm::LLIntGenerator::jsNullConstant): (JSC::Wasm::LLIntGenerator::isConstant): (JSC::Wasm::parseAndCompileBytecode): (JSC::Wasm::LLIntGenerator::LLIntGenerator): (JSC::Wasm::LLIntGenerator::finalize): (JSC::Wasm::LLIntGenerator::callInformationFor): (JSC::Wasm::LLIntGenerator::addArguments): (JSC::Wasm::LLIntGenerator::addLocal): (JSC::Wasm::LLIntGenerator::addConstant): (JSC::Wasm::LLIntGenerator::getLocal): (JSC::Wasm::LLIntGenerator::setLocal): (JSC::Wasm::LLIntGenerator::getGlobal): (JSC::Wasm::LLIntGenerator::setGlobal): (JSC::Wasm::LLIntGenerator::addLoop): (JSC::Wasm::LLIntGenerator::addTopLevel): (JSC::Wasm::LLIntGenerator::addBlock): (JSC::Wasm::LLIntGenerator::addIf): (JSC::Wasm::LLIntGenerator::addElse): (JSC::Wasm::LLIntGenerator::addElseToUnreachable): (JSC::Wasm::LLIntGenerator::addReturn): (JSC::Wasm::LLIntGenerator::addBranch): (JSC::Wasm::LLIntGenerator::addSwitch): (JSC::Wasm::LLIntGenerator::endBlock): (JSC::Wasm::LLIntGenerator::addCall): (JSC::Wasm::LLIntGenerator::addCallIndirect): (JSC::Wasm::LLIntGenerator::addRefIsNull): (JSC::Wasm::LLIntGenerator::addRefFunc): (JSC::Wasm::LLIntGenerator::addTableGet): (JSC::Wasm::LLIntGenerator::addTableSet): (JSC::Wasm::LLIntGenerator::addTableSize): (JSC::Wasm::LLIntGenerator::addTableGrow): (JSC::Wasm::LLIntGenerator::addTableFill): (JSC::Wasm::LLIntGenerator::addUnreachable): (JSC::Wasm::LLIntGenerator::addCurrentMemory): (JSC::Wasm::LLIntGenerator::addGrowMemory): (JSC::Wasm::LLIntGenerator::addSelect): (JSC::Wasm::LLIntGenerator::load): (JSC::Wasm::LLIntGenerator::store): (JSC::GenericLabel<Wasm::GeneratorTraits>::setLocation): * wasm/WasmLLIntGenerator.h: Copied from Source/JavaScriptCore/wasm/WasmCompilationMode.h. * wasm/WasmLLIntPlan.cpp: Added. (JSC::Wasm::LLIntPlan::prepareImpl): (JSC::Wasm::LLIntPlan::compileFunction): (JSC::Wasm::LLIntPlan::didCompleteCompilation): (JSC::Wasm::LLIntPlan::initializeCallees): * wasm/WasmLLIntPlan.h: Copied from Source/JavaScriptCore/wasm/WasmOMGForOSREntryPlan.h. * wasm/WasmLLIntTierUpCounter.cpp: Copied from Source/JavaScriptCore/wasm/WasmCompilationMode.cpp. (JSC::Wasm::LLIntTierUpCounter::addOSREntryDataForLoop): (JSC::Wasm::LLIntTierUpCounter::osrEntryDataForLoop const const): * wasm/WasmLLIntTierUpCounter.h: Copied from Source/JavaScriptCore/wasm/WasmOMGForOSREntryPlan.h. (JSC::Wasm::LLIntTierUpCounter::LLIntTierUpCounter): (JSC::Wasm::LLIntTierUpCounter::optimizeAfterWarmUp): (JSC::Wasm::LLIntTierUpCounter::checkIfOptimizationThresholdReached): (JSC::Wasm::LLIntTierUpCounter::optimizeSoon): * wasm/WasmMemoryInformation.cpp: (JSC::Wasm::PinnedRegisterInfo::get): * wasm/WasmModule.cpp: (JSC::Wasm::makeValidationResult): (JSC::Wasm::makeValidationCallback): (JSC::Wasm::Module::validateSync): (JSC::Wasm::Module::validateAsync): * wasm/WasmOMGForOSREntryPlan.cpp: (JSC::Wasm::OMGForOSREntryPlan::OMGForOSREntryPlan): (JSC::Wasm::OMGForOSREntryPlan::work): * wasm/WasmOMGForOSREntryPlan.h: * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::work): * wasm/WasmSlowPaths.cpp: Added. (JSC::LLInt::jitCompileAndSetHeuristics): (JSC::LLInt::WASM_SLOW_PATH_DECL): (JSC::LLInt::doWasmCall): (JSC::LLInt::doWasmCallIndirect): (JSC::LLInt::slow_path_wasm_throw_exception): (JSC::LLInt::slow_path_wasm_popcount): (JSC::LLInt::slow_path_wasm_popcountll): * wasm/WasmSlowPaths.h: Added. * wasm/WasmTable.cpp: (JSC::Wasm::FuncRefTable::function const): (JSC::Wasm::FuncRefTable::instance const): * wasm/WasmTable.h: * wasm/WasmTierUpCount.h: * wasm/WasmValidate.cpp: (JSC::Wasm::Validate::isControlTypeIf): * wasm/js/JSToWasm.cpp: (JSC::Wasm::createJSToWasmWrapper): * wasm/js/JSToWasm.h: * wasm/js/WebAssemblyFunction.cpp: (JSC::WebAssemblyFunction::calleeSaves const): Tools: Add a mode that runs WebAssembly tests without the LLInt (i.e. only Air) and update the no-air mode to also disable the LLInt tier. * Scripts/run-jsc-stress-tests: Canonical link: https://commits.webkit.org/217068@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251886 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-31 22:32:52 +00:00
wasm/WasmEntryPlan.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
wasm/WasmFaultSignalHandler.cpp
wasm/WasmFormat.cpp
[WebAssembly] Create a Wasm interpreter https://bugs.webkit.org/show_bug.cgi?id=194257 <rdar://problem/44186794> Reviewed by Saam Barati. Source/JavaScriptCore: Add an interpreter tier to WebAssembly which reuses the LLInt infrastructure. The interpreter currently tiers up straight to OMG and can OSR enter at the prologue and from loops. The initial implementation of the interpreter is very naive, but despite the lack of optimizations it still shows a 2x improvement on the WebAssembly subtests in JetStream2 and 2x improvement on the PSPDFKit benchmark. It reduces "compilation" times by ~3x and it's neutral on throughput. The interpreter follows the same calling conventions as the BBQ/OMG, this means that: - We have to allocate locals for all argument registers and write all arguments registers to the stack in the prologue. - Calls have to allocate space for at least as many arguments as the number of argument registers. Before each call, all argument registers must be loaded from the stack, and after we return from the call, all registers must be stored back to the stack, in case they contain return values. We carefully layout the stack so that the arguments that would already have to be passed in the stack end up in the right place. The stack layout for calls is: [ gprs ][ fprs ][ optional stack arguments ][ callee frame ] ^ sp - The return opcode has to load all registers from the stack, since they might need to contain results of the function. - The calling convention requires that the callee should store itself in the callee slot of the call frame, which is impossible in the interpreter, since the code we execute is the same for all callees. In order to work around that, we generate an entry thunk to the wasm interpreter for each function. All this thunk does is store the callee in the call frame and tail call the interpreter. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::constantName const): (JSC::BytecodeDumper<Block>::dumpValue): (JSC::BytecodeDumper<Block>::dumpBytecode): (JSC::CodeBlockBytecodeDumper<Block>::vm const): (JSC::CodeBlockBytecodeDumper<Block>::identifier const): (JSC::CodeBlockBytecodeDumper<Block>::dumpIdentifiers): (JSC::CodeBlockBytecodeDumper<Block>::dumpConstants): (JSC::CodeBlockBytecodeDumper<Block>::dumpExceptionHandlers): (JSC::CodeBlockBytecodeDumper<Block>::dumpSwitchJumpTables): (JSC::CodeBlockBytecodeDumper<Block>::dumpStringSwitchJumpTables): (JSC::CodeBlockBytecodeDumper<Block>::dumpBlock): * bytecode/BytecodeDumper.h: (JSC::BytecodeDumper::dumpValue): (JSC::BytecodeDumper::BytecodeDumper): * bytecode/BytecodeGeneratorification.cpp: (JSC::performGeneratorification): * bytecode/BytecodeList.rb: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): * bytecode/Fits.h: * bytecode/Instruction.h: (JSC::BaseInstruction::BaseInstruction): (JSC::BaseInstruction::Impl::opcodeID const): (JSC::BaseInstruction::opcodeID const): (JSC::BaseInstruction::name const): (JSC::BaseInstruction::isWide16 const): (JSC::BaseInstruction::isWide32 const): (JSC::BaseInstruction::hasMetadata const): (JSC::BaseInstruction::sizeShiftAmount const): (JSC::BaseInstruction::size const): (JSC::BaseInstruction::is const): (JSC::BaseInstruction::as const): (JSC::BaseInstruction::cast): (JSC::BaseInstruction::cast const): (JSC::BaseInstruction::wide16 const): (JSC::BaseInstruction::wide32 const): * bytecode/InstructionStream.h: (JSC::InstructionStream::iterator::operator+=): (JSC::InstructionStream::iterator::operator++): (JSC::InstructionStreamWriter::iterator::operator+=): (JSC::InstructionStreamWriter::iterator::operator++): * bytecode/Opcode.cpp: * bytecode/Opcode.h: * bytecode/PreciseJumpTargetsInlines.h: * bytecode/UnlinkedCodeBlock.h: * bytecode/VirtualRegister.cpp: (JSC::VirtualRegister::VirtualRegister): * bytecode/VirtualRegister.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::GenericLabel<JSGeneratorTraits>::setLocation): (JSC::BytecodeGenerator::BytecodeGenerator): * bytecompiler/BytecodeGenerator.h: * bytecompiler/BytecodeGeneratorBase.h: Added. * bytecompiler/BytecodeGeneratorBaseInlines.h: Added. (JSC::shrinkToFit): (JSC::BytecodeGeneratorBase<Traits>::BytecodeGeneratorBase): (JSC::BytecodeGeneratorBase<Traits>::newLabel): (JSC::BytecodeGeneratorBase<Traits>::newEmittedLabel): (JSC::BytecodeGeneratorBase<Traits>::reclaimFreeRegisters): (JSC::BytecodeGeneratorBase<Traits>::emitLabel): (JSC::BytecodeGeneratorBase<Traits>::recordOpcode): (JSC::BytecodeGeneratorBase<Traits>::alignWideOpcode16): (JSC::BytecodeGeneratorBase<Traits>::alignWideOpcode32): (JSC::BytecodeGeneratorBase<Traits>::write): (JSC::BytecodeGeneratorBase<Traits>::newRegister): (JSC::BytecodeGeneratorBase<Traits>::newTemporary): (JSC::BytecodeGeneratorBase<Traits>::addVar): (JSC::BytecodeGeneratorBase<Traits>::allocateCalleeSaveSpace): * bytecompiler/Label.h: (JSC::GenericBoundLabel::GenericBoundLabel): (JSC::GenericBoundLabel::target): (JSC::GenericBoundLabel::saveTarget): (JSC::GenericBoundLabel::commitTarget): * dfg/DFGByteCodeParser.cpp: * dfg/DFGCapabilities.cpp: (JSC::DFG::capabilityLevel): * dfg/DFGOperations.cpp: * generator/Argument.rb: * generator/DSL.rb: * generator/GeneratedFile.rb: * generator/Opcode.rb: * generator/Options.rb: * generator/Section.rb: * generator/Wasm.rb: Added. * interpreter/Register.h: * interpreter/RegisterInlines.h: (JSC::Register::operator=): * jit/JITArithmetic.cpp: * jit/JITOpcodes.cpp: * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntData.h: (JSC::LLInt::wasmExceptionInstructions): * llint/LLIntOfflineAsmConfig.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntSlowPaths.cpp: * llint/LLIntThunks.cpp: (JSC::LLInt::generateThunkWithJumpTo): (JSC::LLInt::wasmFunctionEntryThunk): * llint/LLIntThunks.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * llint/WebAssembly.asm: Added. * offlineasm/arm64.rb: * offlineasm/instructions.rb: * offlineasm/parser.rb: * offlineasm/registers.rb: * offlineasm/transform.rb: * offlineasm/x86.rb: * parser/Nodes.h: * runtime/Error.cpp: (JSC::FindFirstCallerFrameWithCodeblockFunctor::operator() const): * runtime/ErrorInstance.cpp: (JSC::ErrorInstance::finishCreation): * runtime/Options.cpp: (JSC::overrideDefaults): * runtime/OptionsList.h: * runtime/SamplingProfiler.cpp: (JSC::FrameWalker::recordJITFrame): (JSC::FrameWalker::resetAtMachineFrame): * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::isControlTypeIf): (JSC::Wasm::AirIRGenerator::emitLoopTierUpCheck): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::isControlTypeIf): * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::prepareImpl): (JSC::Wasm::BBQPlan::work): (JSC::Wasm::BBQPlan::compileFunction): (JSC::Wasm::BBQPlan::didCompleteCompilation): (JSC::Wasm::BBQPlan::initializeCallees): * wasm/WasmBBQPlan.h: * wasm/WasmBBQPlanInlines.h: Removed. * wasm/WasmCallee.cpp: (JSC::Wasm::Callee::Callee): (JSC::Wasm::Callee::dump const): (JSC::Wasm::JITCallee::JITCallee): (JSC::Wasm::LLIntCallee::setEntrypoint): (JSC::Wasm::LLIntCallee::entrypoint const): (JSC::Wasm::LLIntCallee::calleeSaveRegisters): (JSC::Wasm:: const): * wasm/WasmCallee.h: (JSC::Wasm::Callee::setOSREntryCallee): (JSC::Wasm::JITCallee::wasmToWasmCallsites): (JSC::Wasm::JITCallee:: const): * wasm/WasmCallingConvention.h: * wasm/WasmCodeBlock.cpp: (JSC::Wasm::CodeBlock::CodeBlock): * wasm/WasmCodeBlock.h: (JSC::Wasm::CodeBlock::wasmEntrypointCalleeFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::wasmBBQCalleeFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::wasmToWasmExitStub): * wasm/WasmCompilationMode.cpp: (JSC::Wasm::makeString): * wasm/WasmCompilationMode.h: * wasm/WasmEmbedder.h: * wasm/WasmEntryPlan.cpp: Added. (JSC::Wasm::EntryPlan::EntryPlan): (JSC::Wasm::EntryPlan::stateString): (JSC::Wasm::EntryPlan::moveToState): (JSC::Wasm::EntryPlan::didReceiveFunctionData): (JSC::Wasm::EntryPlan::parseAndValidateModule): (JSC::Wasm::EntryPlan::prepare): (JSC::Wasm::EntryPlan::ThreadCountHolder::ThreadCountHolder): (JSC::Wasm::EntryPlan::ThreadCountHolder::~ThreadCountHolder): (JSC::Wasm::EntryPlan::complete): (JSC::Wasm::EntryPlan::compileFunctions): (JSC::Wasm::EntryPlan::work): * wasm/WasmEntryPlan.h: Copied from Source/JavaScriptCore/wasm/WasmBBQPlan.h. (JSC::Wasm::EntryPlan::parseAndValidateModule): (JSC::Wasm::EntryPlan::exports const): (JSC::Wasm::EntryPlan::internalFunctionCount const): (JSC::Wasm::EntryPlan::takeModuleInformation): (JSC::Wasm::EntryPlan::takeWasmToWasmExitStubs): (JSC::Wasm::EntryPlan::takeWasmToWasmCallsites): (JSC::Wasm::EntryPlan::hasBeenPrepared const): (JSC::Wasm::EntryPlan::tryReserveCapacity): * wasm/WasmFunctionCodeBlock.cpp: Added. (JSC::Wasm::FunctionCodeBlock::setInstructions): (JSC::Wasm::FunctionCodeBlock::dumpBytecode): (JSC::Wasm::FunctionCodeBlock::addOutOfLineJumpTarget): (JSC::Wasm::FunctionCodeBlock::outOfLineJumpOffset): (JSC::Wasm::FunctionCodeBlock::outOfLineJumpTarget): (JSC::Wasm::FunctionCodeBlock::addSignature): (JSC::Wasm::FunctionCodeBlock::signature const): (JSC::Wasm::FunctionCodeBlock::addJumpTable): (JSC::Wasm::FunctionCodeBlock::jumpTable const const): (JSC::Wasm::FunctionCodeBlock::numberOfJumpTables const): * wasm/WasmFunctionCodeBlock.h: Added. (JSC::Wasm::FunctionCodeBlock::FunctionCodeBlock): (JSC::Wasm::FunctionCodeBlock::getConstant const): (JSC::Wasm::FunctionCodeBlock::functionIndex const): (JSC::Wasm::FunctionCodeBlock::addJumpTarget): (JSC::Wasm::FunctionCodeBlock::numberOfJumpTargets): (JSC::Wasm::FunctionCodeBlock::lastJumpTarget): (JSC::Wasm::FunctionCodeBlock::outOfLineJumpOffset): (JSC::Wasm::FunctionCodeBlock::bytecodeOffset): (JSC::Wasm::FunctionCodeBlock::tierUpCounter): * wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser<Context>::parseExpression): (JSC::Wasm::FunctionParser<Context>::parseUnreachableExpression): * wasm/WasmInstance.h: * wasm/WasmLLIntGenerator.cpp: Added. (JSC::Wasm::LLIntGenerator::ControlType::ControlType): (JSC::Wasm::LLIntGenerator::ControlType::loop): (JSC::Wasm::LLIntGenerator::ControlType::topLevel): (JSC::Wasm::LLIntGenerator::ControlType::block): (JSC::Wasm::LLIntGenerator::ControlType::if_): (JSC::Wasm::LLIntGenerator::ControlType::targetLabelForBranch const): (JSC::Wasm::LLIntGenerator::fail const): (JSC::Wasm::LLIntGenerator::unifyValuesWithBlock): (JSC::Wasm::LLIntGenerator::emptyExpression): (JSC::Wasm::LLIntGenerator::createStack): (JSC::Wasm::LLIntGenerator::isControlTypeIf): (JSC::Wasm::LLIntGenerator::addEndToUnreachable): (JSC::Wasm::LLIntGenerator::setParser): (JSC::Wasm::LLIntGenerator::dump): (JSC::Wasm::LLIntGenerator::virtualRegisterForLocal): (JSC::Wasm::LLIntGenerator::tmpsForSignature): (JSC::Wasm::LLIntGenerator::jsNullConstant): (JSC::Wasm::LLIntGenerator::isConstant): (JSC::Wasm::parseAndCompileBytecode): (JSC::Wasm::LLIntGenerator::LLIntGenerator): (JSC::Wasm::LLIntGenerator::finalize): (JSC::Wasm::LLIntGenerator::callInformationFor): (JSC::Wasm::LLIntGenerator::addArguments): (JSC::Wasm::LLIntGenerator::addLocal): (JSC::Wasm::LLIntGenerator::addConstant): (JSC::Wasm::LLIntGenerator::getLocal): (JSC::Wasm::LLIntGenerator::setLocal): (JSC::Wasm::LLIntGenerator::getGlobal): (JSC::Wasm::LLIntGenerator::setGlobal): (JSC::Wasm::LLIntGenerator::addLoop): (JSC::Wasm::LLIntGenerator::addTopLevel): (JSC::Wasm::LLIntGenerator::addBlock): (JSC::Wasm::LLIntGenerator::addIf): (JSC::Wasm::LLIntGenerator::addElse): (JSC::Wasm::LLIntGenerator::addElseToUnreachable): (JSC::Wasm::LLIntGenerator::addReturn): (JSC::Wasm::LLIntGenerator::addBranch): (JSC::Wasm::LLIntGenerator::addSwitch): (JSC::Wasm::LLIntGenerator::endBlock): (JSC::Wasm::LLIntGenerator::addCall): (JSC::Wasm::LLIntGenerator::addCallIndirect): (JSC::Wasm::LLIntGenerator::addRefIsNull): (JSC::Wasm::LLIntGenerator::addRefFunc): (JSC::Wasm::LLIntGenerator::addTableGet): (JSC::Wasm::LLIntGenerator::addTableSet): (JSC::Wasm::LLIntGenerator::addTableSize): (JSC::Wasm::LLIntGenerator::addTableGrow): (JSC::Wasm::LLIntGenerator::addTableFill): (JSC::Wasm::LLIntGenerator::addUnreachable): (JSC::Wasm::LLIntGenerator::addCurrentMemory): (JSC::Wasm::LLIntGenerator::addGrowMemory): (JSC::Wasm::LLIntGenerator::addSelect): (JSC::Wasm::LLIntGenerator::load): (JSC::Wasm::LLIntGenerator::store): (JSC::GenericLabel<Wasm::GeneratorTraits>::setLocation): * wasm/WasmLLIntGenerator.h: Copied from Source/JavaScriptCore/wasm/WasmCompilationMode.h. * wasm/WasmLLIntPlan.cpp: Added. (JSC::Wasm::LLIntPlan::prepareImpl): (JSC::Wasm::LLIntPlan::compileFunction): (JSC::Wasm::LLIntPlan::didCompleteCompilation): (JSC::Wasm::LLIntPlan::initializeCallees): * wasm/WasmLLIntPlan.h: Copied from Source/JavaScriptCore/wasm/WasmOMGForOSREntryPlan.h. * wasm/WasmLLIntTierUpCounter.cpp: Copied from Source/JavaScriptCore/wasm/WasmCompilationMode.cpp. (JSC::Wasm::LLIntTierUpCounter::addOSREntryDataForLoop): (JSC::Wasm::LLIntTierUpCounter::osrEntryDataForLoop const const): * wasm/WasmLLIntTierUpCounter.h: Copied from Source/JavaScriptCore/wasm/WasmOMGForOSREntryPlan.h. (JSC::Wasm::LLIntTierUpCounter::LLIntTierUpCounter): (JSC::Wasm::LLIntTierUpCounter::optimizeAfterWarmUp): (JSC::Wasm::LLIntTierUpCounter::checkIfOptimizationThresholdReached): (JSC::Wasm::LLIntTierUpCounter::optimizeSoon): * wasm/WasmMemoryInformation.cpp: (JSC::Wasm::PinnedRegisterInfo::get): * wasm/WasmModule.cpp: (JSC::Wasm::makeValidationResult): (JSC::Wasm::makeValidationCallback): (JSC::Wasm::Module::validateSync): (JSC::Wasm::Module::validateAsync): * wasm/WasmOMGForOSREntryPlan.cpp: (JSC::Wasm::OMGForOSREntryPlan::OMGForOSREntryPlan): (JSC::Wasm::OMGForOSREntryPlan::work): * wasm/WasmOMGForOSREntryPlan.h: * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::work): * wasm/WasmSlowPaths.cpp: Added. (JSC::LLInt::jitCompileAndSetHeuristics): (JSC::LLInt::WASM_SLOW_PATH_DECL): (JSC::LLInt::doWasmCall): (JSC::LLInt::doWasmCallIndirect): (JSC::LLInt::slow_path_wasm_throw_exception): (JSC::LLInt::slow_path_wasm_popcount): (JSC::LLInt::slow_path_wasm_popcountll): * wasm/WasmSlowPaths.h: Added. * wasm/WasmTable.cpp: (JSC::Wasm::FuncRefTable::function const): (JSC::Wasm::FuncRefTable::instance const): * wasm/WasmTable.h: * wasm/WasmTierUpCount.h: * wasm/WasmValidate.cpp: (JSC::Wasm::Validate::isControlTypeIf): * wasm/js/JSToWasm.cpp: (JSC::Wasm::createJSToWasmWrapper): * wasm/js/JSToWasm.h: * wasm/js/WebAssemblyFunction.cpp: (JSC::WebAssemblyFunction::calleeSaves const): Tools: Add a mode that runs WebAssembly tests without the LLInt (i.e. only Air) and update the no-air mode to also disable the LLInt tier. * Scripts/run-jsc-stress-tests: Canonical link: https://commits.webkit.org/217068@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251886 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-31 22:32:52 +00:00
wasm/WasmFunctionCodeBlock.cpp
Adopt the new WebAssembly.Global system https://bugs.webkit.org/show_bug.cgi?id=186552 Reviewed by Keith Miller. JSTests: 1. Update spec-harness to accept newer tests. And we update several tests that does not work with the old harness. 2. Add WebAssembly.Global tests. * wasm/js-api/global-error.js: (assert.throws.new.WebAssembly.Module.bin): (new.WebAssembly.Module): (assert.throws): * wasm/js-api/global-external-init-from-import.js: * wasm/js-api/globals-export.js: * wasm/modules/js-wasm-global-namespace.js: (assert.throws): * wasm/modules/js-wasm-global.js: (assert.throws): * wasm/modules/wasm-import-wasm-export-i64-error.js: * wasm/references/anyref_globals.js: * wasm/references/func_ref.js: (assert.eq.instance.exports.fix): * wasm/spec-harness.js: (getGlobal): (let.console.log): * wasm/spec-harness/sync_index.js: Renamed from JSTests/wasm/spec-harness/index.js. (reinitializeRegistry.let.handler.get return): (module): * wasm/spec-tests/call.wast.js: * wasm/spec-tests/exports.wast.js: * wasm/spec-tests/globals.wast.js: * wasm/spec-tests/if.wast.js: * wasm/spec-tests/imports.wast.js: * wasm/spec-tests/linking.wast.js: * wasm/spec-tests/memory.wast.js: * wasm/stress/immutable-globals.js: Added. (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.i.assert.eq.instance.exports.getI32): (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.i.assert.eq): * wasm/stress/mutable-globals-cross.js: Added. (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.const.instance1): (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.const.instance2): * wasm/stress/mutable-globals.js: Added. (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.i.instance.exports.setI32AsI64): LayoutTests/imported/w3c: * web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any-expected.txt: * web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/global/constructor.any-expected.txt: * web-platform-tests/wasm/jsapi/global/constructor.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/global/toString.any-expected.txt: * web-platform-tests/wasm/jsapi/global/toString.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/global/value-set.any-expected.txt: * web-platform-tests/wasm/jsapi/global/value-set.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/global/valueOf.any-expected.txt: * web-platform-tests/wasm/jsapi/global/valueOf.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any-expected.txt: * web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt: * web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/interface.any-expected.txt: * web-platform-tests/wasm/jsapi/interface.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/module/exports.any-expected.txt: * web-platform-tests/wasm/jsapi/module/exports.any.worker-expected.txt: Source/JavaScriptCore: This patch adds WebAssembly.Global implementation. It is already included in the Wasm spec (this means, it is not in staging right now: it was stage-4, and included in the spec). WebAssembly.Global is a wrapper object around "global" binding. This object can hold "immutable" and "mutable" global binding, and we can access Wasm globals through this object. Furthermore, we can share mutable global binding through this object across WebAssembly modules. To implement it efficiently, this patch introduces BindingMode to Wasm globals. If the mode is EmbeddedInInstance, we continue using the current existing mechanism. If the mode is Portable, we store a pointer to actual value in Wasm globals array in Wasm::Instance, so that we can access it through one additional dereference. And we mark all immutable globals as EmbeddedInInstance. If the binding is immutable, internally we do not need to have one binding. We can just continue using the current mechanism since users cannot observe whether immutable bindings' storage is shared or not. If the global is mutable, and it is exported outside of the module, we use Portable mode. So, all the previously used wasm global bindings are EmbeddedInInstance. Only newly added "mutable" "exported" bindings are Portable and requires one additional dereference. To access portable bindings efficiently, we add new Wasm bytecodes, `get_global_portable_binding`, `set_global_portable_binding`, and `set_global_ref_portable_binding`. This patch improves WPT wasm coverage significantly. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/BytecodeList.rb: * heap/HeapCell.cpp: (JSC::keepAlive): (JSC::HeapCell::use const): Deleted. * heap/HeapCell.h: (JSC::keepAlive): (JSC::HeapCell::use const): * llint/WebAssembly.asm: * runtime/JSGlobalObject.cpp: * runtime/JSGlobalObject.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::getGlobal): (JSC::Wasm::AirIRGenerator::setGlobal): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::getGlobal): (JSC::Wasm::B3IRGenerator::setGlobal): * wasm/WasmFormat.h: * wasm/WasmGlobal.cpp: Added. (JSC::Wasm::Global::get const): (JSC::Wasm::Global::set): (JSC::Wasm::Global::visitAggregate): * wasm/WasmGlobal.h: Added. * wasm/WasmInstance.cpp: (JSC::Wasm::Instance::Instance): (JSC::Wasm::Instance::setGlobal): (JSC::Wasm::Instance::linkGlobal): * wasm/WasmInstance.h: (JSC::Wasm::Instance::loadI32Global const): (JSC::Wasm::Instance::loadI64Global const): (JSC::Wasm::Instance::setGlobal): (JSC::Wasm::Instance::globalsToBinding): (JSC::Wasm::Instance::getGlobalBinding): * wasm/WasmLLIntGenerator.cpp: (JSC::Wasm::LLIntGenerator::getGlobal): (JSC::Wasm::LLIntGenerator::setGlobal): * wasm/WasmModuleInformation.h: * wasm/WasmOperations.cpp: (JSC::Wasm::operationWasmWriteBarrierSlowPath): * wasm/WasmOperations.h: * wasm/WasmSectionParser.cpp: (JSC::Wasm::SectionParser::parseImport): (JSC::Wasm::SectionParser::parseGlobal): (JSC::Wasm::SectionParser::parseExport): (JSC::Wasm::SectionParser::parseInitExpr): (JSC::Wasm::SectionParser::parseGlobalType): * wasm/WasmSectionParser.h: * wasm/WasmSlowPaths.cpp: (JSC::LLInt::WASM_SLOW_PATH_DECL): * wasm/WasmSlowPaths.h: * wasm/WasmValidate.cpp: (JSC::Wasm::Validate::setGlobal): * wasm/js/JSWebAssembly.cpp: * wasm/js/JSWebAssemblyGlobal.cpp: Added. (JSC::JSWebAssemblyGlobal::create): (JSC::JSWebAssemblyGlobal::createStructure): (JSC::JSWebAssemblyGlobal::JSWebAssemblyGlobal): (JSC::JSWebAssemblyGlobal::finishCreation): (JSC::JSWebAssemblyGlobal::destroy): (JSC::JSWebAssemblyGlobal::visitChildren): * wasm/js/JSWebAssemblyGlobal.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyMemory.h. * wasm/js/JSWebAssemblyInstance.cpp: (JSC::JSWebAssemblyInstance::visitChildren): * wasm/js/JSWebAssemblyInstance.h: * wasm/js/JSWebAssemblyMemory.cpp: (JSC::JSWebAssemblyMemory::destroy): * wasm/js/JSWebAssemblyMemory.h: * wasm/js/JSWebAssemblyModule.h: * wasm/js/JSWebAssemblyTable.h: * wasm/js/WebAssemblyGlobalConstructor.cpp: Added. (JSC::constructJSWebAssemblyGlobal): (JSC::callJSWebAssemblyGlobal): (JSC::WebAssemblyGlobalConstructor::create): (JSC::WebAssemblyGlobalConstructor::createStructure): (JSC::WebAssemblyGlobalConstructor::finishCreation): (JSC::WebAssemblyGlobalConstructor::WebAssemblyGlobalConstructor): * wasm/js/WebAssemblyGlobalConstructor.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyMemory.h. * wasm/js/WebAssemblyGlobalPrototype.cpp: Added. (JSC::getGlobal): (JSC::webAssemblyGlobalProtoFuncValueOf): (JSC::webAssemblyGlobalProtoGetterFuncValue): (JSC::webAssemblyGlobalProtoSetterFuncValue): (JSC::WebAssemblyGlobalPrototype::create): (JSC::WebAssemblyGlobalPrototype::createStructure): (JSC::WebAssemblyGlobalPrototype::finishCreation): (JSC::WebAssemblyGlobalPrototype::WebAssemblyGlobalPrototype): * wasm/js/WebAssemblyGlobalPrototype.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyMemory.h. * wasm/js/WebAssemblyModuleRecord.cpp: (JSC::WebAssemblyModuleRecord::link): Canonical link: https://commits.webkit.org/218038@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-12-04 01:36:56 +00:00
wasm/WasmGlobal.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
wasm/WasmIndexOrName.cpp
WebAssembly: no VM / JS version of everything but Instance https://bugs.webkit.org/show_bug.cgi?id=177473 Reviewed by Filip Pizlo, Saam Barati. JSTests: - Exceeding max on memory growth now returns a range error as per spec. This is a (very minor) breaking change: it used to throw OOM error. Update the corresponding test. * wasm/js-api/memory-grow.js: (assertEq): * wasm/js-api/table.js: (assert.throws): Source/JavaScriptCore: This change entails cleaning up and splitting a bunch of code which we had intertwined between C++ classes which represent JS objects, and pure C++ implementation objects. This specific change goes most of the way towards allowing JSC's WebAssembly to work without VM / JS, up to but excluding JSWebAssemblyInstance (there's Wasm::Instance, but it's not *the* thing yet). Because of this we still have a few FIXME identifying places that need to change. A follow-up change will go the rest of the way. I went about this change in the simplest way possible: grep the JavaScriptCore/wasm directory for "JS[^C_]" as well as "VM" and exclude the /js/ sub-directory (which contains the JS implementation of WebAssembly). None of this change removes the need for a JIT entitlement to be able to use WebAssembly. We don't have an interpreter, the process therefore still needs to be allowed to JIT to use these pure-C++ APIs. Interesting things to note: - Remove VM from Plan and associated places. It can just live as a capture in the callback lambda if it's needed. - Wasm::Memory shouldn't require a VM. It was only used to ask the GC to collect. We now instead pass two lambdas at construction time for this purpose: one to notify of memory pressure, and the other to ask for syncrhonous memory reclamation. This allows whoever creates the memory to dictate how to react to both these cases, and for a JS embedding that's to call the GC (async or sync, respectively). - Move grow logic from JSWebAssemblyMemory to Wasm::Memory::grow. Use Expected there, with an enum class for failure types. - Exceeding max on memory growth now returns a range error as per spec. This is a (very minor) breaking change: it used to throw OOM error. Update the corresponding test. - When generating the grow_memory opcode, no need to get the VM. Instead, reach directly for Wasm::Memory and grow it. - JSWebAssemblyMemory::grow can now always throw on failure, because it's only ever called from JS (not from grow_memory as before). - Wasm::Memory now takes a callback for successful growth. This allows JS wrappers to register themselves when growth succeeds without Wasm::Memory knowning anything about JS. It'll also allow creating a list of callbacks for when we add thread support (we'll want to notify many wrappers, all under a lock). - Wasm::Memory is now back to being the source of truth about address / size, used directly by generated code instead of JSWebAssemblyMemory. - Move wasmToJS from the general WasmBinding header to its own header under wasm/js. It's only used by wasm/js/JSWebAssemblyCodeBlock.cpp, and uses VM, and therefore isn't general WebAssembly. - Make Wasm::Context an actual type (just a struct holding a JSWebAssemlyInstance for now) instead of an alias for that. Notably this doesn't add anything to the Context and doesn't change what actually gets passed around in JIT code (fast TLS or registers) because these changes potentially impact performance. The entire purpose of this change is to allow passing Wasm::Context around without having to know about VM. Since VM contains a Wasm::Context the JS embedding is effectively the same, but with this setup a non-JS embedding is much better off. - Move JSWebAssembly into the JS folder. - OMGPlan: use Wasm::CodeBlock directly instead of JSWebAssemblyCodeBlock. - wasm->JS stubs are now on the instance's tail as raw pointers, instead of being on JSWebAssemblyCodeBlock, and are now called wasm->Embedder stubs. The owned reference is still on JSWebAssemblyCodeBlock, and is still called wasm->JS stub. This move means that the embedder must, after creating a Wasm::CodeBlock, somehow create the stubs to call back into the embedder. This removes an indirection in the generated code because the B3 IR generator now reaches into the instance instead of JSWebAssemblyCodeBlock. - Move more CodeBlock things. Compilation completion is now marked by its own atomic<bool> flag instead of a nullptr plan: that required using a lock, and was causing a deadlock in stack-trace.js because before my changes JSWebAssemblyCodeBlock did its own completion checking separately from Wasm::CodeBlock, without getting the lock. Now that everything points to Wasm::CodeBlock and there's no cached completion marker, the lock was being acquired in a sanity-check assertion. - Embedder -> Wasm wrappers are now generated through a function that's passed in at compilation time, instead of being hard-coded as a JS -> Wasm wrapper. - WasmMemory doens't need to know about fault handling thunks. Only the IR generator should know, and should make sure that the exception throwing thunk is generated if any memory is present (note: with signal handling not all of them generate an exception check). - Make exception throwing pluggable: instead of having a hard-coded JS-specific lambda we now have a regular C++ function being called from JIT code when a WebAssembly exception is thrown. This allows any embedder to get called as they wish. For now a process can only have a single of these functions (i.e. only one embedder per process) because the trap handler is a singleton. That can be fixed in in #177475. - Create WasmEmbedder.h where all embedder plugging will live. - Split up JSWebAssemblyTable into Wasm::Table which is refcounted. JSWebAssemblyTable now only contains the JS functions in the table, and Wasm::Table is what's used by the JIT code to lookup where to call and do the instance check (for context switch). Note that this creates an extra allocation for all the instances in Wasm::Table, and in exchange removes an indirection in JIT code because the instance used to be obtained off of the JS function. Also note that it's the embedder than keeps the instances alive, not Wasm::Table (which holds a dumb pointer to the instance), because doing otherwise would cause reference cycles. - Add WasmInstance. It doesn't do much for now, owns globals. - JSWebAssembly instance now doesn't just contain the imported functions as JSObjects, it also has the corresponding import's instance and wasm entrypoint. This triples the space allocated per instance's imported function, but there shouldn't be that many imports. This has two upsides: it creates smaller and faster code, and makes is easier to disassociate embedder-specific things from embedder-neutral things. The small / faster win is in two places: B3 IR generator only needs offsetOfImportFunction for the call opcode (when the called index is an import) to know whether the import is wasm->wasm or wasm->embedder (this isn't known at compile-time because it's dependent on the import object), this is now done by seeing if that import function has an associated target instance (only wasm->wasm does); the other place is wasmBinding which uses offsetOfImportFunction to figure out the wasm->wasm target instance, and then gets WebAssemblyFunction::offsetOfWasmEntrypointLoadLocation to do a tail call. The disassociation comes because the target instance can be Wasm::Instance once we change what the Context is, and WasmEntrypointLoadLocation is already embedder-independent. As a next step I can move this tail allocation from JSWebAssemblyInstance to Wasm::Instance, and leave importFunction in as an opaque pointer which is embedder-specific, and in JS will remain WriteBarrier<JSObject>. - Rename VMEntryFrame to EntryFrame, and in many places pass a pointer to it around instead of VM. This is a first step in allowing entry frames which aren't stored on VM, but which are instead stored in an embedder-specific location. That change won't really affect JS except through code churn, but will allow WebAssembly to use some machinery in a generic manner without having a VM. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/PolymorphicAccess.cpp: (JSC::AccessGenerationState::emitExplicitExceptionHandler): * debugger/Debugger.cpp: (JSC::Debugger::stepOutOfFunction): (JSC::Debugger::returnEvent): (JSC::Debugger::unwindEvent): (JSC::Debugger::didExecuteProgram): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::compileExceptionHandlers): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExit.cpp: (JSC::DFG::OSRExit::compileOSRExit): (JSC::DFG::OSRExit::compileExit): * dfg/DFGThunks.cpp: (JSC::DFG::osrEntryThunkGenerator): * ftl/FTLCompile.cpp: (JSC::FTL::compile): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileStub): * interpreter/CallFrame.cpp: (JSC::CallFrame::wasmAwareLexicalGlobalObject): (JSC::CallFrame::callerFrame): (JSC::CallFrame::unsafeCallerFrame): * interpreter/CallFrame.h: (JSC::ExecState::callerFrame const): (JSC::ExecState::callerFrameOrEntryFrame const): (JSC::ExecState::unsafeCallerFrameOrEntryFrame const): * interpreter/FrameTracers.h: (JSC::NativeCallFrameTracer::NativeCallFrameTracer): (JSC::NativeCallFrameTracerWithRestore::NativeCallFrameTracerWithRestore): (JSC::NativeCallFrameTracerWithRestore::~NativeCallFrameTracerWithRestore): * interpreter/Interpreter.cpp: (JSC::UnwindFunctor::operator() const): (JSC::UnwindFunctor::copyCalleeSavesToEntryFrameCalleeSavesBuffer const): (JSC::Interpreter::unwind): * interpreter/StackVisitor.cpp: (JSC::StackVisitor::StackVisitor): (JSC::StackVisitor::gotoNextFrame): (JSC::StackVisitor::readNonInlinedFrame): (JSC::StackVisitor::Frame::dump const): * interpreter/StackVisitor.h: (JSC::StackVisitor::Frame::callerIsEntryFrame const): * interpreter/VMEntryRecord.h: (JSC::VMEntryRecord::prevTopEntryFrame): (JSC::VMEntryRecord::unsafePrevTopEntryFrame): (JSC::EntryFrame::vmEntryRecordOffset): * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::restoreCalleeSavesFromEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::loadWasmContextInstance): (JSC::AssemblyHelpers::storeWasmContextInstance): (JSC::AssemblyHelpers::loadWasmContextInstanceNeedsMacroScratchRegister): (JSC::AssemblyHelpers::storeWasmContextInstanceNeedsMacroScratchRegister): (JSC::AssemblyHelpers::copyCalleeSavesToEntryFrameCalleeSavesBufferImpl): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::copyCalleeSavesToVMEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::copyCalleeSavesToEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::copyCalleeSavesFromFrameOrRegisterToEntryFrameCalleeSavesBuffer): * jit/JIT.cpp: (JSC::JIT::emitEnterOptimizationCheck): (JSC::JIT::privateCompileExceptionHandlers): * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_throw): (JSC::JIT::emit_op_catch): (JSC::JIT::emitSlow_op_loop_hint): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_throw): (JSC::JIT::emit_op_catch): * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::throwExceptionFromCallSlowPathGenerator): (JSC::nativeForGenerator): * jsc.cpp: (functionDumpCallFrame): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntThunks.cpp: (JSC::vmEntryRecord): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * runtime/Options.cpp: (JSC::recomputeDependentOptions): * runtime/Options.h: * runtime/SamplingProfiler.cpp: (JSC::FrameWalker::FrameWalker): (JSC::FrameWalker::advanceToParentFrame): (JSC::SamplingProfiler::processUnverifiedStackTraces): * runtime/ThrowScope.cpp: (JSC::ThrowScope::~ThrowScope): * runtime/VM.cpp: (JSC::VM::VM): (JSC::VM::~VM): * runtime/VM.h: (JSC::VM::topEntryFrameOffset): * runtime/VMTraps.cpp: (JSC::isSaneFrame): (JSC::VMTraps::tryInstallTrapBreakpoints): (JSC::VMTraps::invalidateCodeBlocksOnStack): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::restoreWasmContextInstance): (JSC::Wasm::B3IRGenerator::B3IRGenerator): (JSC::Wasm::B3IRGenerator::restoreWebAssemblyGlobalState): (JSC::Wasm::B3IRGenerator::addGrowMemory): (JSC::Wasm::B3IRGenerator::addCurrentMemory): (JSC::Wasm::B3IRGenerator::addCall): (JSC::Wasm::B3IRGenerator::addCallIndirect): (JSC::Wasm::parseAndCompile): * wasm/WasmB3IRGenerator.h: * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::BBQPlan): (JSC::Wasm::BBQPlan::compileFunctions): (JSC::Wasm::BBQPlan::complete): * wasm/WasmBBQPlan.h: * wasm/WasmBBQPlanInlines.h: (JSC::Wasm::BBQPlan::initializeCallees): * wasm/WasmBinding.cpp: (JSC::Wasm::wasmToWasm): * wasm/WasmBinding.h: * wasm/WasmCodeBlock.cpp: (JSC::Wasm::CodeBlock::create): (JSC::Wasm::CodeBlock::CodeBlock): (JSC::Wasm::CodeBlock::compileAsync): (JSC::Wasm::CodeBlock::setCompilationFinished): * wasm/WasmCodeBlock.h: (JSC::Wasm::CodeBlock::offsetOfImportStubs): (JSC::Wasm::CodeBlock::allocationSize): (JSC::Wasm::CodeBlock::importWasmToEmbedderStub): (JSC::Wasm::CodeBlock::offsetOfImportWasmToEmbedderStub): (JSC::Wasm::CodeBlock::wasmToJSCallStubForImport): (JSC::Wasm::CodeBlock::compilationFinished): (JSC::Wasm::CodeBlock::jsEntrypointCalleeFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::wasmEntrypointCalleeFromFunctionIndexSpace): * wasm/WasmContext.cpp: (JSC::Wasm::Context::useFastTLS): (JSC::Wasm::Context::load const): (JSC::Wasm::Context::store): * wasm/WasmContext.h: * wasm/WasmEmbedder.h: Copied from Source/JavaScriptCore/wasm/WasmContext.h. * wasm/WasmFaultSignalHandler.cpp: * wasm/WasmFaultSignalHandler.h: * wasm/WasmFormat.h: * wasm/WasmInstance.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. (JSC::Wasm::Instance::Instance): (JSC::Wasm::Instance::~Instance): (JSC::Wasm::Instance::extraMemoryAllocated const): * wasm/WasmInstance.h: Added. (JSC::Wasm::Instance::create): (JSC::Wasm::Instance::finalizeCreation): (JSC::Wasm::Instance::module): (JSC::Wasm::Instance::codeBlock): (JSC::Wasm::Instance::memory): (JSC::Wasm::Instance::table): (JSC::Wasm::Instance::loadI32Global const): (JSC::Wasm::Instance::loadI64Global const): (JSC::Wasm::Instance::loadF32Global const): (JSC::Wasm::Instance::loadF64Global const): (JSC::Wasm::Instance::setGlobal): (JSC::Wasm::Instance::offsetOfCachedStackLimit): (JSC::Wasm::Instance::cachedStackLimit const): (JSC::Wasm::Instance::setCachedStackLimit): * wasm/WasmMemory.cpp: (JSC::Wasm::Memory::Memory): (JSC::Wasm::Memory::create): (JSC::Wasm::Memory::~Memory): (JSC::Wasm::Memory::grow): * wasm/WasmMemory.h: (JSC::Wasm::Memory::offsetOfMemory): (JSC::Wasm::Memory::offsetOfSize): * wasm/WasmMemoryInformation.cpp: (JSC::Wasm::PinnedRegisterInfo::get): (JSC::Wasm::PinnedRegisterInfo::PinnedRegisterInfo): * wasm/WasmMemoryInformation.h: (JSC::Wasm::PinnedRegisterInfo::toSave const): * wasm/WasmMemoryMode.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. (JSC::Wasm::makeString): * wasm/WasmMemoryMode.h: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. * wasm/WasmModule.cpp: (JSC::Wasm::makeValidationCallback): (JSC::Wasm::Module::validateSync): (JSC::Wasm::Module::validateAsync): (JSC::Wasm::Module::getOrCreateCodeBlock): (JSC::Wasm::Module::compileSync): (JSC::Wasm::Module::compileAsync): * wasm/WasmModule.h: * wasm/WasmModuleParser.cpp: (JSC::Wasm::ModuleParser::parseTableHelper): * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::OMGPlan): (JSC::Wasm::OMGPlan::runForIndex): * wasm/WasmOMGPlan.h: * wasm/WasmPageCount.h: (JSC::Wasm::PageCount::isValid const): * wasm/WasmPlan.cpp: (JSC::Wasm::Plan::Plan): (JSC::Wasm::Plan::runCompletionTasks): (JSC::Wasm::Plan::addCompletionTask): (JSC::Wasm::Plan::tryRemoveContextAndCancelIfLast): * wasm/WasmPlan.h: (JSC::Wasm::Plan::dontFinalize): * wasm/WasmSignature.cpp: * wasm/WasmSignature.h: * wasm/WasmTable.cpp: Added. (JSC::Wasm::Table::create): (JSC::Wasm::Table::~Table): (JSC::Wasm::Table::Table): (JSC::Wasm::Table::grow): (JSC::Wasm::Table::clearFunction): (JSC::Wasm::Table::setFunction): * wasm/WasmTable.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyTable.h. (JSC::Wasm::Table::maximum const): (JSC::Wasm::Table::size const): (JSC::Wasm::Table::offsetOfSize): (JSC::Wasm::Table::offsetOfFunctions): (JSC::Wasm::Table::offsetOfInstances): (JSC::Wasm::Table::isValidSize): * wasm/WasmThunks.cpp: (JSC::Wasm::throwExceptionFromWasmThunkGenerator): (JSC::Wasm::triggerOMGTierUpThunkGenerator): (JSC::Wasm::Thunks::setThrowWasmException): (JSC::Wasm::Thunks::throwWasmException): * wasm/WasmThunks.h: * wasm/WasmWorklist.cpp: (JSC::Wasm::Worklist::stopAllPlansForContext): * wasm/WasmWorklist.h: * wasm/js/JSToWasm.cpp: Added. (JSC::Wasm::createJSToWasmWrapper): * wasm/js/JSToWasm.h: Copied from Source/JavaScriptCore/wasm/WasmBinding.h. * wasm/js/JSWebAssembly.cpp: Renamed from Source/JavaScriptCore/wasm/JSWebAssembly.cpp. * wasm/js/JSWebAssembly.h: Renamed from Source/JavaScriptCore/wasm/JSWebAssembly.h. * wasm/js/JSWebAssemblyCodeBlock.cpp: (JSC::JSWebAssemblyCodeBlock::create): (JSC::JSWebAssemblyCodeBlock::JSWebAssemblyCodeBlock): * wasm/js/JSWebAssemblyCodeBlock.h: * wasm/js/JSWebAssemblyInstance.cpp: (JSC::JSWebAssemblyInstance::JSWebAssemblyInstance): (JSC::JSWebAssemblyInstance::finishCreation): (JSC::JSWebAssemblyInstance::visitChildren): (JSC::JSWebAssemblyInstance::finalizeCreation): (JSC::JSWebAssemblyInstance::create): * wasm/js/JSWebAssemblyInstance.h: (JSC::JSWebAssemblyInstance::instance): (JSC::JSWebAssemblyInstance::context const): (JSC::JSWebAssemblyInstance::table): (JSC::JSWebAssemblyInstance::webAssemblyToJSCallee): (JSC::JSWebAssemblyInstance::setMemory): (JSC::JSWebAssemblyInstance::offsetOfTail): (JSC::JSWebAssemblyInstance::importFunctionInfo): (JSC::JSWebAssemblyInstance::offsetOfTargetInstance): (JSC::JSWebAssemblyInstance::offsetOfWasmEntrypoint): (JSC::JSWebAssemblyInstance::offsetOfImportFunction): (JSC::JSWebAssemblyInstance::importFunction): (JSC::JSWebAssemblyInstance::internalMemory): (JSC::JSWebAssemblyInstance::wasmCodeBlock const): (JSC::JSWebAssemblyInstance::offsetOfWasmTable): (JSC::JSWebAssemblyInstance::offsetOfCallee): (JSC::JSWebAssemblyInstance::offsetOfGlobals): (JSC::JSWebAssemblyInstance::offsetOfWasmCodeBlock): (JSC::JSWebAssemblyInstance::offsetOfWasmMemory): (JSC::JSWebAssemblyInstance::cachedStackLimit const): (JSC::JSWebAssemblyInstance::setCachedStackLimit): (JSC::JSWebAssemblyInstance::wasmMemory): (JSC::JSWebAssemblyInstance::wasmModule): (JSC::JSWebAssemblyInstance::allocationSize): (JSC::JSWebAssemblyInstance::module const): * wasm/js/JSWebAssemblyMemory.cpp: (JSC::JSWebAssemblyMemory::create): (JSC::JSWebAssemblyMemory::adopt): (JSC::JSWebAssemblyMemory::JSWebAssemblyMemory): (JSC::JSWebAssemblyMemory::grow): (JSC::JSWebAssemblyMemory::growSuccessCallback): * wasm/js/JSWebAssemblyMemory.h: * wasm/js/JSWebAssemblyModule.cpp: (JSC::JSWebAssemblyModule::moduleInformation const): (JSC::JSWebAssemblyModule::exportSymbolTable const): (JSC::JSWebAssemblyModule::signatureIndexFromFunctionIndexSpace const): (JSC::JSWebAssemblyModule::callee const): (JSC::JSWebAssemblyModule::codeBlock): (JSC::JSWebAssemblyModule::module): * wasm/js/JSWebAssemblyModule.h: * wasm/js/JSWebAssemblyTable.cpp: (JSC::JSWebAssemblyTable::create): (JSC::JSWebAssemblyTable::JSWebAssemblyTable): (JSC::JSWebAssemblyTable::visitChildren): (JSC::JSWebAssemblyTable::grow): (JSC::JSWebAssemblyTable::getFunction): (JSC::JSWebAssemblyTable::clearFunction): (JSC::JSWebAssemblyTable::setFunction): * wasm/js/JSWebAssemblyTable.h: (JSC::JSWebAssemblyTable::isValidSize): (JSC::JSWebAssemblyTable::maximum const): (JSC::JSWebAssemblyTable::size const): (JSC::JSWebAssemblyTable::table): * wasm/js/WasmToJS.cpp: Copied from Source/JavaScriptCore/wasm/WasmBinding.cpp. (JSC::Wasm::materializeImportJSCell): (JSC::Wasm::wasmToJS): (JSC::Wasm::wasmToJSException): * wasm/js/WasmToJS.h: Copied from Source/JavaScriptCore/wasm/WasmBinding.h. * wasm/js/WebAssemblyFunction.cpp: (JSC::callWebAssemblyFunction): * wasm/js/WebAssemblyInstanceConstructor.cpp: (JSC::constructJSWebAssemblyInstance): * wasm/js/WebAssemblyMemoryConstructor.cpp: (JSC::constructJSWebAssemblyMemory): * wasm/js/WebAssemblyMemoryPrototype.cpp: (JSC::webAssemblyMemoryProtoFuncGrow): * wasm/js/WebAssemblyModuleConstructor.cpp: (JSC::constructJSWebAssemblyModule): (JSC::WebAssemblyModuleConstructor::createModule): * wasm/js/WebAssemblyModuleConstructor.h: * wasm/js/WebAssemblyModuleRecord.cpp: (JSC::WebAssemblyModuleRecord::link): (JSC::WebAssemblyModuleRecord::evaluate): * wasm/js/WebAssemblyPrototype.cpp: (JSC::webAssemblyCompileFunc): (JSC::instantiate): (JSC::compileAndInstantiate): (JSC::webAssemblyValidateFunc): * wasm/js/WebAssemblyTableConstructor.cpp: (JSC::constructJSWebAssemblyTable): * wasm/js/WebAssemblyWrapperFunction.cpp: (JSC::WebAssemblyWrapperFunction::create): Source/WebCore: * ForwardingHeaders/wasm/WasmModule.h: Added. This used to be included in JSWebAssemblyModule.h. * bindings/js/SerializedScriptValue.cpp: Update postMessage code according to C++ API changes. Canonical link: https://commits.webkit.org/194750@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223738 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-20 02:23:29 +00:00
wasm/WasmInstance.cpp
wasm/WasmInstance.h
[WebAssembly] Create a Wasm interpreter https://bugs.webkit.org/show_bug.cgi?id=194257 <rdar://problem/44186794> Reviewed by Saam Barati. Source/JavaScriptCore: Add an interpreter tier to WebAssembly which reuses the LLInt infrastructure. The interpreter currently tiers up straight to OMG and can OSR enter at the prologue and from loops. The initial implementation of the interpreter is very naive, but despite the lack of optimizations it still shows a 2x improvement on the WebAssembly subtests in JetStream2 and 2x improvement on the PSPDFKit benchmark. It reduces "compilation" times by ~3x and it's neutral on throughput. The interpreter follows the same calling conventions as the BBQ/OMG, this means that: - We have to allocate locals for all argument registers and write all arguments registers to the stack in the prologue. - Calls have to allocate space for at least as many arguments as the number of argument registers. Before each call, all argument registers must be loaded from the stack, and after we return from the call, all registers must be stored back to the stack, in case they contain return values. We carefully layout the stack so that the arguments that would already have to be passed in the stack end up in the right place. The stack layout for calls is: [ gprs ][ fprs ][ optional stack arguments ][ callee frame ] ^ sp - The return opcode has to load all registers from the stack, since they might need to contain results of the function. - The calling convention requires that the callee should store itself in the callee slot of the call frame, which is impossible in the interpreter, since the code we execute is the same for all callees. In order to work around that, we generate an entry thunk to the wasm interpreter for each function. All this thunk does is store the callee in the call frame and tail call the interpreter. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::constantName const): (JSC::BytecodeDumper<Block>::dumpValue): (JSC::BytecodeDumper<Block>::dumpBytecode): (JSC::CodeBlockBytecodeDumper<Block>::vm const): (JSC::CodeBlockBytecodeDumper<Block>::identifier const): (JSC::CodeBlockBytecodeDumper<Block>::dumpIdentifiers): (JSC::CodeBlockBytecodeDumper<Block>::dumpConstants): (JSC::CodeBlockBytecodeDumper<Block>::dumpExceptionHandlers): (JSC::CodeBlockBytecodeDumper<Block>::dumpSwitchJumpTables): (JSC::CodeBlockBytecodeDumper<Block>::dumpStringSwitchJumpTables): (JSC::CodeBlockBytecodeDumper<Block>::dumpBlock): * bytecode/BytecodeDumper.h: (JSC::BytecodeDumper::dumpValue): (JSC::BytecodeDumper::BytecodeDumper): * bytecode/BytecodeGeneratorification.cpp: (JSC::performGeneratorification): * bytecode/BytecodeList.rb: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): * bytecode/Fits.h: * bytecode/Instruction.h: (JSC::BaseInstruction::BaseInstruction): (JSC::BaseInstruction::Impl::opcodeID const): (JSC::BaseInstruction::opcodeID const): (JSC::BaseInstruction::name const): (JSC::BaseInstruction::isWide16 const): (JSC::BaseInstruction::isWide32 const): (JSC::BaseInstruction::hasMetadata const): (JSC::BaseInstruction::sizeShiftAmount const): (JSC::BaseInstruction::size const): (JSC::BaseInstruction::is const): (JSC::BaseInstruction::as const): (JSC::BaseInstruction::cast): (JSC::BaseInstruction::cast const): (JSC::BaseInstruction::wide16 const): (JSC::BaseInstruction::wide32 const): * bytecode/InstructionStream.h: (JSC::InstructionStream::iterator::operator+=): (JSC::InstructionStream::iterator::operator++): (JSC::InstructionStreamWriter::iterator::operator+=): (JSC::InstructionStreamWriter::iterator::operator++): * bytecode/Opcode.cpp: * bytecode/Opcode.h: * bytecode/PreciseJumpTargetsInlines.h: * bytecode/UnlinkedCodeBlock.h: * bytecode/VirtualRegister.cpp: (JSC::VirtualRegister::VirtualRegister): * bytecode/VirtualRegister.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::GenericLabel<JSGeneratorTraits>::setLocation): (JSC::BytecodeGenerator::BytecodeGenerator): * bytecompiler/BytecodeGenerator.h: * bytecompiler/BytecodeGeneratorBase.h: Added. * bytecompiler/BytecodeGeneratorBaseInlines.h: Added. (JSC::shrinkToFit): (JSC::BytecodeGeneratorBase<Traits>::BytecodeGeneratorBase): (JSC::BytecodeGeneratorBase<Traits>::newLabel): (JSC::BytecodeGeneratorBase<Traits>::newEmittedLabel): (JSC::BytecodeGeneratorBase<Traits>::reclaimFreeRegisters): (JSC::BytecodeGeneratorBase<Traits>::emitLabel): (JSC::BytecodeGeneratorBase<Traits>::recordOpcode): (JSC::BytecodeGeneratorBase<Traits>::alignWideOpcode16): (JSC::BytecodeGeneratorBase<Traits>::alignWideOpcode32): (JSC::BytecodeGeneratorBase<Traits>::write): (JSC::BytecodeGeneratorBase<Traits>::newRegister): (JSC::BytecodeGeneratorBase<Traits>::newTemporary): (JSC::BytecodeGeneratorBase<Traits>::addVar): (JSC::BytecodeGeneratorBase<Traits>::allocateCalleeSaveSpace): * bytecompiler/Label.h: (JSC::GenericBoundLabel::GenericBoundLabel): (JSC::GenericBoundLabel::target): (JSC::GenericBoundLabel::saveTarget): (JSC::GenericBoundLabel::commitTarget): * dfg/DFGByteCodeParser.cpp: * dfg/DFGCapabilities.cpp: (JSC::DFG::capabilityLevel): * dfg/DFGOperations.cpp: * generator/Argument.rb: * generator/DSL.rb: * generator/GeneratedFile.rb: * generator/Opcode.rb: * generator/Options.rb: * generator/Section.rb: * generator/Wasm.rb: Added. * interpreter/Register.h: * interpreter/RegisterInlines.h: (JSC::Register::operator=): * jit/JITArithmetic.cpp: * jit/JITOpcodes.cpp: * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntData.h: (JSC::LLInt::wasmExceptionInstructions): * llint/LLIntOfflineAsmConfig.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntSlowPaths.cpp: * llint/LLIntThunks.cpp: (JSC::LLInt::generateThunkWithJumpTo): (JSC::LLInt::wasmFunctionEntryThunk): * llint/LLIntThunks.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * llint/WebAssembly.asm: Added. * offlineasm/arm64.rb: * offlineasm/instructions.rb: * offlineasm/parser.rb: * offlineasm/registers.rb: * offlineasm/transform.rb: * offlineasm/x86.rb: * parser/Nodes.h: * runtime/Error.cpp: (JSC::FindFirstCallerFrameWithCodeblockFunctor::operator() const): * runtime/ErrorInstance.cpp: (JSC::ErrorInstance::finishCreation): * runtime/Options.cpp: (JSC::overrideDefaults): * runtime/OptionsList.h: * runtime/SamplingProfiler.cpp: (JSC::FrameWalker::recordJITFrame): (JSC::FrameWalker::resetAtMachineFrame): * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::isControlTypeIf): (JSC::Wasm::AirIRGenerator::emitLoopTierUpCheck): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::isControlTypeIf): * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::prepareImpl): (JSC::Wasm::BBQPlan::work): (JSC::Wasm::BBQPlan::compileFunction): (JSC::Wasm::BBQPlan::didCompleteCompilation): (JSC::Wasm::BBQPlan::initializeCallees): * wasm/WasmBBQPlan.h: * wasm/WasmBBQPlanInlines.h: Removed. * wasm/WasmCallee.cpp: (JSC::Wasm::Callee::Callee): (JSC::Wasm::Callee::dump const): (JSC::Wasm::JITCallee::JITCallee): (JSC::Wasm::LLIntCallee::setEntrypoint): (JSC::Wasm::LLIntCallee::entrypoint const): (JSC::Wasm::LLIntCallee::calleeSaveRegisters): (JSC::Wasm:: const): * wasm/WasmCallee.h: (JSC::Wasm::Callee::setOSREntryCallee): (JSC::Wasm::JITCallee::wasmToWasmCallsites): (JSC::Wasm::JITCallee:: const): * wasm/WasmCallingConvention.h: * wasm/WasmCodeBlock.cpp: (JSC::Wasm::CodeBlock::CodeBlock): * wasm/WasmCodeBlock.h: (JSC::Wasm::CodeBlock::wasmEntrypointCalleeFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::wasmBBQCalleeFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::wasmToWasmExitStub): * wasm/WasmCompilationMode.cpp: (JSC::Wasm::makeString): * wasm/WasmCompilationMode.h: * wasm/WasmEmbedder.h: * wasm/WasmEntryPlan.cpp: Added. (JSC::Wasm::EntryPlan::EntryPlan): (JSC::Wasm::EntryPlan::stateString): (JSC::Wasm::EntryPlan::moveToState): (JSC::Wasm::EntryPlan::didReceiveFunctionData): (JSC::Wasm::EntryPlan::parseAndValidateModule): (JSC::Wasm::EntryPlan::prepare): (JSC::Wasm::EntryPlan::ThreadCountHolder::ThreadCountHolder): (JSC::Wasm::EntryPlan::ThreadCountHolder::~ThreadCountHolder): (JSC::Wasm::EntryPlan::complete): (JSC::Wasm::EntryPlan::compileFunctions): (JSC::Wasm::EntryPlan::work): * wasm/WasmEntryPlan.h: Copied from Source/JavaScriptCore/wasm/WasmBBQPlan.h. (JSC::Wasm::EntryPlan::parseAndValidateModule): (JSC::Wasm::EntryPlan::exports const): (JSC::Wasm::EntryPlan::internalFunctionCount const): (JSC::Wasm::EntryPlan::takeModuleInformation): (JSC::Wasm::EntryPlan::takeWasmToWasmExitStubs): (JSC::Wasm::EntryPlan::takeWasmToWasmCallsites): (JSC::Wasm::EntryPlan::hasBeenPrepared const): (JSC::Wasm::EntryPlan::tryReserveCapacity): * wasm/WasmFunctionCodeBlock.cpp: Added. (JSC::Wasm::FunctionCodeBlock::setInstructions): (JSC::Wasm::FunctionCodeBlock::dumpBytecode): (JSC::Wasm::FunctionCodeBlock::addOutOfLineJumpTarget): (JSC::Wasm::FunctionCodeBlock::outOfLineJumpOffset): (JSC::Wasm::FunctionCodeBlock::outOfLineJumpTarget): (JSC::Wasm::FunctionCodeBlock::addSignature): (JSC::Wasm::FunctionCodeBlock::signature const): (JSC::Wasm::FunctionCodeBlock::addJumpTable): (JSC::Wasm::FunctionCodeBlock::jumpTable const const): (JSC::Wasm::FunctionCodeBlock::numberOfJumpTables const): * wasm/WasmFunctionCodeBlock.h: Added. (JSC::Wasm::FunctionCodeBlock::FunctionCodeBlock): (JSC::Wasm::FunctionCodeBlock::getConstant const): (JSC::Wasm::FunctionCodeBlock::functionIndex const): (JSC::Wasm::FunctionCodeBlock::addJumpTarget): (JSC::Wasm::FunctionCodeBlock::numberOfJumpTargets): (JSC::Wasm::FunctionCodeBlock::lastJumpTarget): (JSC::Wasm::FunctionCodeBlock::outOfLineJumpOffset): (JSC::Wasm::FunctionCodeBlock::bytecodeOffset): (JSC::Wasm::FunctionCodeBlock::tierUpCounter): * wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser<Context>::parseExpression): (JSC::Wasm::FunctionParser<Context>::parseUnreachableExpression): * wasm/WasmInstance.h: * wasm/WasmLLIntGenerator.cpp: Added. (JSC::Wasm::LLIntGenerator::ControlType::ControlType): (JSC::Wasm::LLIntGenerator::ControlType::loop): (JSC::Wasm::LLIntGenerator::ControlType::topLevel): (JSC::Wasm::LLIntGenerator::ControlType::block): (JSC::Wasm::LLIntGenerator::ControlType::if_): (JSC::Wasm::LLIntGenerator::ControlType::targetLabelForBranch const): (JSC::Wasm::LLIntGenerator::fail const): (JSC::Wasm::LLIntGenerator::unifyValuesWithBlock): (JSC::Wasm::LLIntGenerator::emptyExpression): (JSC::Wasm::LLIntGenerator::createStack): (JSC::Wasm::LLIntGenerator::isControlTypeIf): (JSC::Wasm::LLIntGenerator::addEndToUnreachable): (JSC::Wasm::LLIntGenerator::setParser): (JSC::Wasm::LLIntGenerator::dump): (JSC::Wasm::LLIntGenerator::virtualRegisterForLocal): (JSC::Wasm::LLIntGenerator::tmpsForSignature): (JSC::Wasm::LLIntGenerator::jsNullConstant): (JSC::Wasm::LLIntGenerator::isConstant): (JSC::Wasm::parseAndCompileBytecode): (JSC::Wasm::LLIntGenerator::LLIntGenerator): (JSC::Wasm::LLIntGenerator::finalize): (JSC::Wasm::LLIntGenerator::callInformationFor): (JSC::Wasm::LLIntGenerator::addArguments): (JSC::Wasm::LLIntGenerator::addLocal): (JSC::Wasm::LLIntGenerator::addConstant): (JSC::Wasm::LLIntGenerator::getLocal): (JSC::Wasm::LLIntGenerator::setLocal): (JSC::Wasm::LLIntGenerator::getGlobal): (JSC::Wasm::LLIntGenerator::setGlobal): (JSC::Wasm::LLIntGenerator::addLoop): (JSC::Wasm::LLIntGenerator::addTopLevel): (JSC::Wasm::LLIntGenerator::addBlock): (JSC::Wasm::LLIntGenerator::addIf): (JSC::Wasm::LLIntGenerator::addElse): (JSC::Wasm::LLIntGenerator::addElseToUnreachable): (JSC::Wasm::LLIntGenerator::addReturn): (JSC::Wasm::LLIntGenerator::addBranch): (JSC::Wasm::LLIntGenerator::addSwitch): (JSC::Wasm::LLIntGenerator::endBlock): (JSC::Wasm::LLIntGenerator::addCall): (JSC::Wasm::LLIntGenerator::addCallIndirect): (JSC::Wasm::LLIntGenerator::addRefIsNull): (JSC::Wasm::LLIntGenerator::addRefFunc): (JSC::Wasm::LLIntGenerator::addTableGet): (JSC::Wasm::LLIntGenerator::addTableSet): (JSC::Wasm::LLIntGenerator::addTableSize): (JSC::Wasm::LLIntGenerator::addTableGrow): (JSC::Wasm::LLIntGenerator::addTableFill): (JSC::Wasm::LLIntGenerator::addUnreachable): (JSC::Wasm::LLIntGenerator::addCurrentMemory): (JSC::Wasm::LLIntGenerator::addGrowMemory): (JSC::Wasm::LLIntGenerator::addSelect): (JSC::Wasm::LLIntGenerator::load): (JSC::Wasm::LLIntGenerator::store): (JSC::GenericLabel<Wasm::GeneratorTraits>::setLocation): * wasm/WasmLLIntGenerator.h: Copied from Source/JavaScriptCore/wasm/WasmCompilationMode.h. * wasm/WasmLLIntPlan.cpp: Added. (JSC::Wasm::LLIntPlan::prepareImpl): (JSC::Wasm::LLIntPlan::compileFunction): (JSC::Wasm::LLIntPlan::didCompleteCompilation): (JSC::Wasm::LLIntPlan::initializeCallees): * wasm/WasmLLIntPlan.h: Copied from Source/JavaScriptCore/wasm/WasmOMGForOSREntryPlan.h. * wasm/WasmLLIntTierUpCounter.cpp: Copied from Source/JavaScriptCore/wasm/WasmCompilationMode.cpp. (JSC::Wasm::LLIntTierUpCounter::addOSREntryDataForLoop): (JSC::Wasm::LLIntTierUpCounter::osrEntryDataForLoop const const): * wasm/WasmLLIntTierUpCounter.h: Copied from Source/JavaScriptCore/wasm/WasmOMGForOSREntryPlan.h. (JSC::Wasm::LLIntTierUpCounter::LLIntTierUpCounter): (JSC::Wasm::LLIntTierUpCounter::optimizeAfterWarmUp): (JSC::Wasm::LLIntTierUpCounter::checkIfOptimizationThresholdReached): (JSC::Wasm::LLIntTierUpCounter::optimizeSoon): * wasm/WasmMemoryInformation.cpp: (JSC::Wasm::PinnedRegisterInfo::get): * wasm/WasmModule.cpp: (JSC::Wasm::makeValidationResult): (JSC::Wasm::makeValidationCallback): (JSC::Wasm::Module::validateSync): (JSC::Wasm::Module::validateAsync): * wasm/WasmOMGForOSREntryPlan.cpp: (JSC::Wasm::OMGForOSREntryPlan::OMGForOSREntryPlan): (JSC::Wasm::OMGForOSREntryPlan::work): * wasm/WasmOMGForOSREntryPlan.h: * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::work): * wasm/WasmSlowPaths.cpp: Added. (JSC::LLInt::jitCompileAndSetHeuristics): (JSC::LLInt::WASM_SLOW_PATH_DECL): (JSC::LLInt::doWasmCall): (JSC::LLInt::doWasmCallIndirect): (JSC::LLInt::slow_path_wasm_throw_exception): (JSC::LLInt::slow_path_wasm_popcount): (JSC::LLInt::slow_path_wasm_popcountll): * wasm/WasmSlowPaths.h: Added. * wasm/WasmTable.cpp: (JSC::Wasm::FuncRefTable::function const): (JSC::Wasm::FuncRefTable::instance const): * wasm/WasmTable.h: * wasm/WasmTierUpCount.h: * wasm/WasmValidate.cpp: (JSC::Wasm::Validate::isControlTypeIf): * wasm/js/JSToWasm.cpp: (JSC::Wasm::createJSToWasmWrapper): * wasm/js/JSToWasm.h: * wasm/js/WebAssemblyFunction.cpp: (JSC::WebAssemblyFunction::calleeSaves const): Tools: Add a mode that runs WebAssembly tests without the LLInt (i.e. only Air) and update the no-air mode to also disable the LLInt tier. * Scripts/run-jsc-stress-tests: Canonical link: https://commits.webkit.org/217068@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251886 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-31 22:32:52 +00:00
wasm/WasmLLIntGenerator.cpp
wasm/WasmLLIntPlan.cpp
wasm/WasmLLIntTierUpCounter.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
wasm/WasmMachineThreads.cpp
wasm/WasmMemory.cpp
wasm/WasmMemoryInformation.cpp
WebAssembly: no VM / JS version of everything but Instance https://bugs.webkit.org/show_bug.cgi?id=177473 Reviewed by Filip Pizlo, Saam Barati. JSTests: - Exceeding max on memory growth now returns a range error as per spec. This is a (very minor) breaking change: it used to throw OOM error. Update the corresponding test. * wasm/js-api/memory-grow.js: (assertEq): * wasm/js-api/table.js: (assert.throws): Source/JavaScriptCore: This change entails cleaning up and splitting a bunch of code which we had intertwined between C++ classes which represent JS objects, and pure C++ implementation objects. This specific change goes most of the way towards allowing JSC's WebAssembly to work without VM / JS, up to but excluding JSWebAssemblyInstance (there's Wasm::Instance, but it's not *the* thing yet). Because of this we still have a few FIXME identifying places that need to change. A follow-up change will go the rest of the way. I went about this change in the simplest way possible: grep the JavaScriptCore/wasm directory for "JS[^C_]" as well as "VM" and exclude the /js/ sub-directory (which contains the JS implementation of WebAssembly). None of this change removes the need for a JIT entitlement to be able to use WebAssembly. We don't have an interpreter, the process therefore still needs to be allowed to JIT to use these pure-C++ APIs. Interesting things to note: - Remove VM from Plan and associated places. It can just live as a capture in the callback lambda if it's needed. - Wasm::Memory shouldn't require a VM. It was only used to ask the GC to collect. We now instead pass two lambdas at construction time for this purpose: one to notify of memory pressure, and the other to ask for syncrhonous memory reclamation. This allows whoever creates the memory to dictate how to react to both these cases, and for a JS embedding that's to call the GC (async or sync, respectively). - Move grow logic from JSWebAssemblyMemory to Wasm::Memory::grow. Use Expected there, with an enum class for failure types. - Exceeding max on memory growth now returns a range error as per spec. This is a (very minor) breaking change: it used to throw OOM error. Update the corresponding test. - When generating the grow_memory opcode, no need to get the VM. Instead, reach directly for Wasm::Memory and grow it. - JSWebAssemblyMemory::grow can now always throw on failure, because it's only ever called from JS (not from grow_memory as before). - Wasm::Memory now takes a callback for successful growth. This allows JS wrappers to register themselves when growth succeeds without Wasm::Memory knowning anything about JS. It'll also allow creating a list of callbacks for when we add thread support (we'll want to notify many wrappers, all under a lock). - Wasm::Memory is now back to being the source of truth about address / size, used directly by generated code instead of JSWebAssemblyMemory. - Move wasmToJS from the general WasmBinding header to its own header under wasm/js. It's only used by wasm/js/JSWebAssemblyCodeBlock.cpp, and uses VM, and therefore isn't general WebAssembly. - Make Wasm::Context an actual type (just a struct holding a JSWebAssemlyInstance for now) instead of an alias for that. Notably this doesn't add anything to the Context and doesn't change what actually gets passed around in JIT code (fast TLS or registers) because these changes potentially impact performance. The entire purpose of this change is to allow passing Wasm::Context around without having to know about VM. Since VM contains a Wasm::Context the JS embedding is effectively the same, but with this setup a non-JS embedding is much better off. - Move JSWebAssembly into the JS folder. - OMGPlan: use Wasm::CodeBlock directly instead of JSWebAssemblyCodeBlock. - wasm->JS stubs are now on the instance's tail as raw pointers, instead of being on JSWebAssemblyCodeBlock, and are now called wasm->Embedder stubs. The owned reference is still on JSWebAssemblyCodeBlock, and is still called wasm->JS stub. This move means that the embedder must, after creating a Wasm::CodeBlock, somehow create the stubs to call back into the embedder. This removes an indirection in the generated code because the B3 IR generator now reaches into the instance instead of JSWebAssemblyCodeBlock. - Move more CodeBlock things. Compilation completion is now marked by its own atomic<bool> flag instead of a nullptr plan: that required using a lock, and was causing a deadlock in stack-trace.js because before my changes JSWebAssemblyCodeBlock did its own completion checking separately from Wasm::CodeBlock, without getting the lock. Now that everything points to Wasm::CodeBlock and there's no cached completion marker, the lock was being acquired in a sanity-check assertion. - Embedder -> Wasm wrappers are now generated through a function that's passed in at compilation time, instead of being hard-coded as a JS -> Wasm wrapper. - WasmMemory doens't need to know about fault handling thunks. Only the IR generator should know, and should make sure that the exception throwing thunk is generated if any memory is present (note: with signal handling not all of them generate an exception check). - Make exception throwing pluggable: instead of having a hard-coded JS-specific lambda we now have a regular C++ function being called from JIT code when a WebAssembly exception is thrown. This allows any embedder to get called as they wish. For now a process can only have a single of these functions (i.e. only one embedder per process) because the trap handler is a singleton. That can be fixed in in #177475. - Create WasmEmbedder.h where all embedder plugging will live. - Split up JSWebAssemblyTable into Wasm::Table which is refcounted. JSWebAssemblyTable now only contains the JS functions in the table, and Wasm::Table is what's used by the JIT code to lookup where to call and do the instance check (for context switch). Note that this creates an extra allocation for all the instances in Wasm::Table, and in exchange removes an indirection in JIT code because the instance used to be obtained off of the JS function. Also note that it's the embedder than keeps the instances alive, not Wasm::Table (which holds a dumb pointer to the instance), because doing otherwise would cause reference cycles. - Add WasmInstance. It doesn't do much for now, owns globals. - JSWebAssembly instance now doesn't just contain the imported functions as JSObjects, it also has the corresponding import's instance and wasm entrypoint. This triples the space allocated per instance's imported function, but there shouldn't be that many imports. This has two upsides: it creates smaller and faster code, and makes is easier to disassociate embedder-specific things from embedder-neutral things. The small / faster win is in two places: B3 IR generator only needs offsetOfImportFunction for the call opcode (when the called index is an import) to know whether the import is wasm->wasm or wasm->embedder (this isn't known at compile-time because it's dependent on the import object), this is now done by seeing if that import function has an associated target instance (only wasm->wasm does); the other place is wasmBinding which uses offsetOfImportFunction to figure out the wasm->wasm target instance, and then gets WebAssemblyFunction::offsetOfWasmEntrypointLoadLocation to do a tail call. The disassociation comes because the target instance can be Wasm::Instance once we change what the Context is, and WasmEntrypointLoadLocation is already embedder-independent. As a next step I can move this tail allocation from JSWebAssemblyInstance to Wasm::Instance, and leave importFunction in as an opaque pointer which is embedder-specific, and in JS will remain WriteBarrier<JSObject>. - Rename VMEntryFrame to EntryFrame, and in many places pass a pointer to it around instead of VM. This is a first step in allowing entry frames which aren't stored on VM, but which are instead stored in an embedder-specific location. That change won't really affect JS except through code churn, but will allow WebAssembly to use some machinery in a generic manner without having a VM. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/PolymorphicAccess.cpp: (JSC::AccessGenerationState::emitExplicitExceptionHandler): * debugger/Debugger.cpp: (JSC::Debugger::stepOutOfFunction): (JSC::Debugger::returnEvent): (JSC::Debugger::unwindEvent): (JSC::Debugger::didExecuteProgram): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::compileExceptionHandlers): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExit.cpp: (JSC::DFG::OSRExit::compileOSRExit): (JSC::DFG::OSRExit::compileExit): * dfg/DFGThunks.cpp: (JSC::DFG::osrEntryThunkGenerator): * ftl/FTLCompile.cpp: (JSC::FTL::compile): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileStub): * interpreter/CallFrame.cpp: (JSC::CallFrame::wasmAwareLexicalGlobalObject): (JSC::CallFrame::callerFrame): (JSC::CallFrame::unsafeCallerFrame): * interpreter/CallFrame.h: (JSC::ExecState::callerFrame const): (JSC::ExecState::callerFrameOrEntryFrame const): (JSC::ExecState::unsafeCallerFrameOrEntryFrame const): * interpreter/FrameTracers.h: (JSC::NativeCallFrameTracer::NativeCallFrameTracer): (JSC::NativeCallFrameTracerWithRestore::NativeCallFrameTracerWithRestore): (JSC::NativeCallFrameTracerWithRestore::~NativeCallFrameTracerWithRestore): * interpreter/Interpreter.cpp: (JSC::UnwindFunctor::operator() const): (JSC::UnwindFunctor::copyCalleeSavesToEntryFrameCalleeSavesBuffer const): (JSC::Interpreter::unwind): * interpreter/StackVisitor.cpp: (JSC::StackVisitor::StackVisitor): (JSC::StackVisitor::gotoNextFrame): (JSC::StackVisitor::readNonInlinedFrame): (JSC::StackVisitor::Frame::dump const): * interpreter/StackVisitor.h: (JSC::StackVisitor::Frame::callerIsEntryFrame const): * interpreter/VMEntryRecord.h: (JSC::VMEntryRecord::prevTopEntryFrame): (JSC::VMEntryRecord::unsafePrevTopEntryFrame): (JSC::EntryFrame::vmEntryRecordOffset): * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::restoreCalleeSavesFromEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::loadWasmContextInstance): (JSC::AssemblyHelpers::storeWasmContextInstance): (JSC::AssemblyHelpers::loadWasmContextInstanceNeedsMacroScratchRegister): (JSC::AssemblyHelpers::storeWasmContextInstanceNeedsMacroScratchRegister): (JSC::AssemblyHelpers::copyCalleeSavesToEntryFrameCalleeSavesBufferImpl): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::copyCalleeSavesToVMEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::copyCalleeSavesToEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::copyCalleeSavesFromFrameOrRegisterToEntryFrameCalleeSavesBuffer): * jit/JIT.cpp: (JSC::JIT::emitEnterOptimizationCheck): (JSC::JIT::privateCompileExceptionHandlers): * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_throw): (JSC::JIT::emit_op_catch): (JSC::JIT::emitSlow_op_loop_hint): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_throw): (JSC::JIT::emit_op_catch): * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::throwExceptionFromCallSlowPathGenerator): (JSC::nativeForGenerator): * jsc.cpp: (functionDumpCallFrame): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntThunks.cpp: (JSC::vmEntryRecord): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * runtime/Options.cpp: (JSC::recomputeDependentOptions): * runtime/Options.h: * runtime/SamplingProfiler.cpp: (JSC::FrameWalker::FrameWalker): (JSC::FrameWalker::advanceToParentFrame): (JSC::SamplingProfiler::processUnverifiedStackTraces): * runtime/ThrowScope.cpp: (JSC::ThrowScope::~ThrowScope): * runtime/VM.cpp: (JSC::VM::VM): (JSC::VM::~VM): * runtime/VM.h: (JSC::VM::topEntryFrameOffset): * runtime/VMTraps.cpp: (JSC::isSaneFrame): (JSC::VMTraps::tryInstallTrapBreakpoints): (JSC::VMTraps::invalidateCodeBlocksOnStack): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::restoreWasmContextInstance): (JSC::Wasm::B3IRGenerator::B3IRGenerator): (JSC::Wasm::B3IRGenerator::restoreWebAssemblyGlobalState): (JSC::Wasm::B3IRGenerator::addGrowMemory): (JSC::Wasm::B3IRGenerator::addCurrentMemory): (JSC::Wasm::B3IRGenerator::addCall): (JSC::Wasm::B3IRGenerator::addCallIndirect): (JSC::Wasm::parseAndCompile): * wasm/WasmB3IRGenerator.h: * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::BBQPlan): (JSC::Wasm::BBQPlan::compileFunctions): (JSC::Wasm::BBQPlan::complete): * wasm/WasmBBQPlan.h: * wasm/WasmBBQPlanInlines.h: (JSC::Wasm::BBQPlan::initializeCallees): * wasm/WasmBinding.cpp: (JSC::Wasm::wasmToWasm): * wasm/WasmBinding.h: * wasm/WasmCodeBlock.cpp: (JSC::Wasm::CodeBlock::create): (JSC::Wasm::CodeBlock::CodeBlock): (JSC::Wasm::CodeBlock::compileAsync): (JSC::Wasm::CodeBlock::setCompilationFinished): * wasm/WasmCodeBlock.h: (JSC::Wasm::CodeBlock::offsetOfImportStubs): (JSC::Wasm::CodeBlock::allocationSize): (JSC::Wasm::CodeBlock::importWasmToEmbedderStub): (JSC::Wasm::CodeBlock::offsetOfImportWasmToEmbedderStub): (JSC::Wasm::CodeBlock::wasmToJSCallStubForImport): (JSC::Wasm::CodeBlock::compilationFinished): (JSC::Wasm::CodeBlock::jsEntrypointCalleeFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::wasmEntrypointCalleeFromFunctionIndexSpace): * wasm/WasmContext.cpp: (JSC::Wasm::Context::useFastTLS): (JSC::Wasm::Context::load const): (JSC::Wasm::Context::store): * wasm/WasmContext.h: * wasm/WasmEmbedder.h: Copied from Source/JavaScriptCore/wasm/WasmContext.h. * wasm/WasmFaultSignalHandler.cpp: * wasm/WasmFaultSignalHandler.h: * wasm/WasmFormat.h: * wasm/WasmInstance.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. (JSC::Wasm::Instance::Instance): (JSC::Wasm::Instance::~Instance): (JSC::Wasm::Instance::extraMemoryAllocated const): * wasm/WasmInstance.h: Added. (JSC::Wasm::Instance::create): (JSC::Wasm::Instance::finalizeCreation): (JSC::Wasm::Instance::module): (JSC::Wasm::Instance::codeBlock): (JSC::Wasm::Instance::memory): (JSC::Wasm::Instance::table): (JSC::Wasm::Instance::loadI32Global const): (JSC::Wasm::Instance::loadI64Global const): (JSC::Wasm::Instance::loadF32Global const): (JSC::Wasm::Instance::loadF64Global const): (JSC::Wasm::Instance::setGlobal): (JSC::Wasm::Instance::offsetOfCachedStackLimit): (JSC::Wasm::Instance::cachedStackLimit const): (JSC::Wasm::Instance::setCachedStackLimit): * wasm/WasmMemory.cpp: (JSC::Wasm::Memory::Memory): (JSC::Wasm::Memory::create): (JSC::Wasm::Memory::~Memory): (JSC::Wasm::Memory::grow): * wasm/WasmMemory.h: (JSC::Wasm::Memory::offsetOfMemory): (JSC::Wasm::Memory::offsetOfSize): * wasm/WasmMemoryInformation.cpp: (JSC::Wasm::PinnedRegisterInfo::get): (JSC::Wasm::PinnedRegisterInfo::PinnedRegisterInfo): * wasm/WasmMemoryInformation.h: (JSC::Wasm::PinnedRegisterInfo::toSave const): * wasm/WasmMemoryMode.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. (JSC::Wasm::makeString): * wasm/WasmMemoryMode.h: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. * wasm/WasmModule.cpp: (JSC::Wasm::makeValidationCallback): (JSC::Wasm::Module::validateSync): (JSC::Wasm::Module::validateAsync): (JSC::Wasm::Module::getOrCreateCodeBlock): (JSC::Wasm::Module::compileSync): (JSC::Wasm::Module::compileAsync): * wasm/WasmModule.h: * wasm/WasmModuleParser.cpp: (JSC::Wasm::ModuleParser::parseTableHelper): * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::OMGPlan): (JSC::Wasm::OMGPlan::runForIndex): * wasm/WasmOMGPlan.h: * wasm/WasmPageCount.h: (JSC::Wasm::PageCount::isValid const): * wasm/WasmPlan.cpp: (JSC::Wasm::Plan::Plan): (JSC::Wasm::Plan::runCompletionTasks): (JSC::Wasm::Plan::addCompletionTask): (JSC::Wasm::Plan::tryRemoveContextAndCancelIfLast): * wasm/WasmPlan.h: (JSC::Wasm::Plan::dontFinalize): * wasm/WasmSignature.cpp: * wasm/WasmSignature.h: * wasm/WasmTable.cpp: Added. (JSC::Wasm::Table::create): (JSC::Wasm::Table::~Table): (JSC::Wasm::Table::Table): (JSC::Wasm::Table::grow): (JSC::Wasm::Table::clearFunction): (JSC::Wasm::Table::setFunction): * wasm/WasmTable.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyTable.h. (JSC::Wasm::Table::maximum const): (JSC::Wasm::Table::size const): (JSC::Wasm::Table::offsetOfSize): (JSC::Wasm::Table::offsetOfFunctions): (JSC::Wasm::Table::offsetOfInstances): (JSC::Wasm::Table::isValidSize): * wasm/WasmThunks.cpp: (JSC::Wasm::throwExceptionFromWasmThunkGenerator): (JSC::Wasm::triggerOMGTierUpThunkGenerator): (JSC::Wasm::Thunks::setThrowWasmException): (JSC::Wasm::Thunks::throwWasmException): * wasm/WasmThunks.h: * wasm/WasmWorklist.cpp: (JSC::Wasm::Worklist::stopAllPlansForContext): * wasm/WasmWorklist.h: * wasm/js/JSToWasm.cpp: Added. (JSC::Wasm::createJSToWasmWrapper): * wasm/js/JSToWasm.h: Copied from Source/JavaScriptCore/wasm/WasmBinding.h. * wasm/js/JSWebAssembly.cpp: Renamed from Source/JavaScriptCore/wasm/JSWebAssembly.cpp. * wasm/js/JSWebAssembly.h: Renamed from Source/JavaScriptCore/wasm/JSWebAssembly.h. * wasm/js/JSWebAssemblyCodeBlock.cpp: (JSC::JSWebAssemblyCodeBlock::create): (JSC::JSWebAssemblyCodeBlock::JSWebAssemblyCodeBlock): * wasm/js/JSWebAssemblyCodeBlock.h: * wasm/js/JSWebAssemblyInstance.cpp: (JSC::JSWebAssemblyInstance::JSWebAssemblyInstance): (JSC::JSWebAssemblyInstance::finishCreation): (JSC::JSWebAssemblyInstance::visitChildren): (JSC::JSWebAssemblyInstance::finalizeCreation): (JSC::JSWebAssemblyInstance::create): * wasm/js/JSWebAssemblyInstance.h: (JSC::JSWebAssemblyInstance::instance): (JSC::JSWebAssemblyInstance::context const): (JSC::JSWebAssemblyInstance::table): (JSC::JSWebAssemblyInstance::webAssemblyToJSCallee): (JSC::JSWebAssemblyInstance::setMemory): (JSC::JSWebAssemblyInstance::offsetOfTail): (JSC::JSWebAssemblyInstance::importFunctionInfo): (JSC::JSWebAssemblyInstance::offsetOfTargetInstance): (JSC::JSWebAssemblyInstance::offsetOfWasmEntrypoint): (JSC::JSWebAssemblyInstance::offsetOfImportFunction): (JSC::JSWebAssemblyInstance::importFunction): (JSC::JSWebAssemblyInstance::internalMemory): (JSC::JSWebAssemblyInstance::wasmCodeBlock const): (JSC::JSWebAssemblyInstance::offsetOfWasmTable): (JSC::JSWebAssemblyInstance::offsetOfCallee): (JSC::JSWebAssemblyInstance::offsetOfGlobals): (JSC::JSWebAssemblyInstance::offsetOfWasmCodeBlock): (JSC::JSWebAssemblyInstance::offsetOfWasmMemory): (JSC::JSWebAssemblyInstance::cachedStackLimit const): (JSC::JSWebAssemblyInstance::setCachedStackLimit): (JSC::JSWebAssemblyInstance::wasmMemory): (JSC::JSWebAssemblyInstance::wasmModule): (JSC::JSWebAssemblyInstance::allocationSize): (JSC::JSWebAssemblyInstance::module const): * wasm/js/JSWebAssemblyMemory.cpp: (JSC::JSWebAssemblyMemory::create): (JSC::JSWebAssemblyMemory::adopt): (JSC::JSWebAssemblyMemory::JSWebAssemblyMemory): (JSC::JSWebAssemblyMemory::grow): (JSC::JSWebAssemblyMemory::growSuccessCallback): * wasm/js/JSWebAssemblyMemory.h: * wasm/js/JSWebAssemblyModule.cpp: (JSC::JSWebAssemblyModule::moduleInformation const): (JSC::JSWebAssemblyModule::exportSymbolTable const): (JSC::JSWebAssemblyModule::signatureIndexFromFunctionIndexSpace const): (JSC::JSWebAssemblyModule::callee const): (JSC::JSWebAssemblyModule::codeBlock): (JSC::JSWebAssemblyModule::module): * wasm/js/JSWebAssemblyModule.h: * wasm/js/JSWebAssemblyTable.cpp: (JSC::JSWebAssemblyTable::create): (JSC::JSWebAssemblyTable::JSWebAssemblyTable): (JSC::JSWebAssemblyTable::visitChildren): (JSC::JSWebAssemblyTable::grow): (JSC::JSWebAssemblyTable::getFunction): (JSC::JSWebAssemblyTable::clearFunction): (JSC::JSWebAssemblyTable::setFunction): * wasm/js/JSWebAssemblyTable.h: (JSC::JSWebAssemblyTable::isValidSize): (JSC::JSWebAssemblyTable::maximum const): (JSC::JSWebAssemblyTable::size const): (JSC::JSWebAssemblyTable::table): * wasm/js/WasmToJS.cpp: Copied from Source/JavaScriptCore/wasm/WasmBinding.cpp. (JSC::Wasm::materializeImportJSCell): (JSC::Wasm::wasmToJS): (JSC::Wasm::wasmToJSException): * wasm/js/WasmToJS.h: Copied from Source/JavaScriptCore/wasm/WasmBinding.h. * wasm/js/WebAssemblyFunction.cpp: (JSC::callWebAssemblyFunction): * wasm/js/WebAssemblyInstanceConstructor.cpp: (JSC::constructJSWebAssemblyInstance): * wasm/js/WebAssemblyMemoryConstructor.cpp: (JSC::constructJSWebAssemblyMemory): * wasm/js/WebAssemblyMemoryPrototype.cpp: (JSC::webAssemblyMemoryProtoFuncGrow): * wasm/js/WebAssemblyModuleConstructor.cpp: (JSC::constructJSWebAssemblyModule): (JSC::WebAssemblyModuleConstructor::createModule): * wasm/js/WebAssemblyModuleConstructor.h: * wasm/js/WebAssemblyModuleRecord.cpp: (JSC::WebAssemblyModuleRecord::link): (JSC::WebAssemblyModuleRecord::evaluate): * wasm/js/WebAssemblyPrototype.cpp: (JSC::webAssemblyCompileFunc): (JSC::instantiate): (JSC::compileAndInstantiate): (JSC::webAssemblyValidateFunc): * wasm/js/WebAssemblyTableConstructor.cpp: (JSC::constructJSWebAssemblyTable): * wasm/js/WebAssemblyWrapperFunction.cpp: (JSC::WebAssemblyWrapperFunction::create): Source/WebCore: * ForwardingHeaders/wasm/WasmModule.h: Added. This used to be included in JSWebAssemblyModule.h. * bindings/js/SerializedScriptValue.cpp: Update postMessage code according to C++ API changes. Canonical link: https://commits.webkit.org/194750@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223738 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-20 02:23:29 +00:00
wasm/WasmMemoryMode.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
wasm/WasmModule.cpp
wasm/WasmModuleInformation.cpp
wasm/WasmNameSectionParser.cpp
[JSC] OSR entry to Wasm OMG https://bugs.webkit.org/show_bug.cgi?id=200362 Reviewed by Michael Saboff. JSTests: * wasm/stress/osr-entry-basic.js: Added. (instance.exports.loop): * wasm/stress/osr-entry-many-locals-f32.js: Added. * wasm/stress/osr-entry-many-locals-f64.js: Added. * wasm/stress/osr-entry-many-locals-i32.js: Added. * wasm/stress/osr-entry-many-locals-i64.js: Added. * wasm/stress/osr-entry-many-stacks-f32.js: Added. * wasm/stress/osr-entry-many-stacks-f64.js: Added. * wasm/stress/osr-entry-many-stacks-i32.js: Added. * wasm/stress/osr-entry-many-stacks-i64.js: Added. Source/JavaScriptCore: This patch implements Wasm OSR entry mechanism from BBQ tier to OMG tier. We found that one of JetStream2 test heavily relies on OSR entry feature. gcc-loops-wasm consumes most of time in BBQ tier since one of the function takes significantly long time. And since we did not have OSR entry feature, we cannot use OMG function until that BBQ function finishes. To implement Wasm OSR feature, we first capture all locals and stacks in the patchpoint to generate the stackmap. Once the threshold is crossed, the patchpoint calls `MacroAssembler::probe` feature to capture whole register context, and C++ runtime function reads stackmap and Probe::Context to perform OSR entry. This patch intentionally makes OSR entry written in C++ runtime side as much as possible to make it easily reusable for the other tiers. For example, we are planning to introduce Wasm interpreter, and it can easily use this tier-up function. Because of this simplicity, this generic implementation can cover both BBQ Air and BBQ B3 tier-up features. So, in the feature, it is possible that we revive BBQ B3, and construct the wasm pipeline like, interpreter->BBQ B3->OMG B3. To generate OMG code for OSR entry, we add a new mode OMGForOSREntry, which mimics the FTLForOSREntry. In FTLForOSREntry, we cut unrelated blocks including the usual entry point in DFG tier and later convert graph to SSA. This is possible because DFG is not SSA. On the other hand, B3 is SSA and we cannot take the same thing without a hack. This patch introduce a hack: making all wasm locals and stack values B3::Variable for OMGForOSREntry mode. Then, we can cut blocks easily and we can generate the B3 graph without doing reachability analysis from the OSR entry point. B3 will remove unreachable blocks later. Tier-up function mimics DFG->FTL OSR entry heuristics and threshold as much as possible. And this patch adjusts the tier-up count threshold to make it close to DFG->FTL ones. Wasm tier-up is now using ExecutionCounter, which is inherited from Wasm::TierUpCount. Since wasm can execute concurrently, the tier-up counter can be racily updated. But this is OK in practice. Even if we see some more tier-up function calls or tier-up function calls are delayed, the critical part is guarded by a lock in tier-up function. In iMac Pro, it shows ~4x runtime improvement for gcc-loops-wasm. On iOS device (iPhone XR), we saw ~2x improvement. ToT: HashSet-wasm:Score: 24.6pt stdev=4.6% :Time:Geometric: 204ms stdev=4.4% Runtime:Time: 689ms stdev=1.0% Startup:Time: 60.3ms stdev=8.4% gcc-loops-wasm:Score: 8.41pt stdev=6.7% :Time:Geometric: 597ms stdev=6.5% Runtime:Time: 8.509s stdev=0.7% Startup:Time: 42ms stdev=12.4% quicksort-wasm:Score: 347pt stdev=20.9% :Time:Geometric: 15ms stdev=18.6% Runtime:Time: 28.2ms stdev=7.9% Startup:Time: 8.2ms stdev=35.0% richards-wasm:Score: 77.6pt stdev=4.5% :Time:Geometric: 64.6ms stdev=4.4% Runtime:Time: 544ms stdev=3.3% Startup:Time: 7.67ms stdev=6.7% tsf-wasm:Score: 47.9pt stdev=4.5% :Time:Geometric: 104ms stdev=4.8% Runtime:Time: 259ms stdev=4.4% Startup:Time: 42.2ms stdev=8.5% Patched: HashSet-wasm:Score: 24.1pt stdev=4.1% :Time:Geometric: 208ms stdev=4.1% Runtime:Time: 684ms stdev=1.1% Startup:Time: 63.2ms stdev=8.1% gcc-loops-wasm:Score: 15.7pt stdev=5.1% :Time:Geometric: 319ms stdev=5.3% Runtime:Time: 2.491s stdev=0.7% Startup:Time: 41ms stdev=11.0% quicksort-wasm:Score: 353pt stdev=13.7% :Time:Geometric: 14ms stdev=12.7% Runtime:Time: 26.2ms stdev=2.9% Startup:Time: 8.0ms stdev=23.7% richards-wasm:Score: 77.4pt stdev=5.3% :Time:Geometric: 64.7ms stdev=5.3% Runtime:Time: 536ms stdev=1.5% Startup:Time: 7.83ms stdev=9.6% tsf-wasm:Score: 47.3pt stdev=5.7% :Time:Geometric: 106ms stdev=6.1% Runtime:Time: 250ms stdev=3.5% Startup:Time: 45ms stdev=13.8% * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/MacroAssemblerARM64.h: (JSC::MacroAssemblerARM64::branchAdd32): * b3/B3ValueRep.h: * bytecode/CodeBlock.h: * bytecode/ExecutionCounter.cpp: (JSC::applyMemoryUsageHeuristics): (JSC::ExecutionCounter<countingVariant>::setThreshold): * bytecode/ExecutionCounter.h: (JSC::ExecutionCounter::clippedThreshold): * dfg/DFGJITCode.h: * dfg/DFGOperations.cpp: * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::prologueStackPointerDelta): * runtime/Options.h: * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::createStack): (JSC::Wasm::AirIRGenerator::emitPatchpoint): (JSC::Wasm::AirIRGenerator::outerLoopIndex const): (JSC::Wasm::AirIRGenerator::AirIRGenerator): (JSC::Wasm::AirIRGenerator::emitEntryTierUpCheck): (JSC::Wasm::AirIRGenerator::emitLoopTierUpCheck): (JSC::Wasm::AirIRGenerator::addLoop): (JSC::Wasm::AirIRGenerator::addElse): (JSC::Wasm::AirIRGenerator::addBranch): (JSC::Wasm::AirIRGenerator::addSwitch): (JSC::Wasm::AirIRGenerator::endBlock): (JSC::Wasm::AirIRGenerator::addEndToUnreachable): (JSC::Wasm::AirIRGenerator::unifyValuesWithBlock): (JSC::Wasm::AirIRGenerator::dump): (JSC::Wasm::AirIRGenerator::emitTierUpCheck): Deleted. * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::Stack::Stack): (JSC::Wasm::B3IRGenerator::Stack::append): (JSC::Wasm::B3IRGenerator::Stack::takeLast): (JSC::Wasm::B3IRGenerator::Stack::last): (JSC::Wasm::B3IRGenerator::Stack::size const): (JSC::Wasm::B3IRGenerator::Stack::isEmpty const): (JSC::Wasm::B3IRGenerator::Stack::convertToExpressionList): (JSC::Wasm::B3IRGenerator::Stack::at const): (JSC::Wasm::B3IRGenerator::Stack::variableAt const): (JSC::Wasm::B3IRGenerator::Stack::shrink): (JSC::Wasm::B3IRGenerator::Stack::swap): (JSC::Wasm::B3IRGenerator::Stack::dump const): (JSC::Wasm::B3IRGenerator::createStack): (JSC::Wasm::B3IRGenerator::outerLoopIndex const): (JSC::Wasm::B3IRGenerator::B3IRGenerator): (JSC::Wasm::B3IRGenerator::emitEntryTierUpCheck): (JSC::Wasm::B3IRGenerator::emitLoopTierUpCheck): (JSC::Wasm::B3IRGenerator::addLoop): (JSC::Wasm::B3IRGenerator::addElse): (JSC::Wasm::B3IRGenerator::addBranch): (JSC::Wasm::B3IRGenerator::addSwitch): (JSC::Wasm::B3IRGenerator::endBlock): (JSC::Wasm::B3IRGenerator::addEndToUnreachable): (JSC::Wasm::B3IRGenerator::unifyValuesWithBlock): (JSC::Wasm::B3IRGenerator::dump): (JSC::Wasm::parseAndCompile): (JSC::Wasm::B3IRGenerator::emitTierUpCheck): Deleted. (JSC::Wasm::dumpExpressionStack): Deleted. * wasm/WasmB3IRGenerator.h: * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::compileFunctions): * wasm/WasmBBQPlan.h: * wasm/WasmBBQPlanInlines.h: (JSC::Wasm::BBQPlan::initializeCallees): * wasm/WasmCallee.h: * wasm/WasmCodeBlock.cpp: (JSC::Wasm::CodeBlock::CodeBlock): * wasm/WasmCodeBlock.h: (JSC::Wasm::CodeBlock::wasmBBQCalleeFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::entrypointLoadLocationFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::tierUpCount): Deleted. * wasm/WasmCompilationMode.cpp: (JSC::Wasm::makeString): * wasm/WasmCompilationMode.h: * wasm/WasmContext.cpp: Copied from Source/JavaScriptCore/wasm/WasmCompilationMode.cpp. (JSC::Wasm::Context::scratchBufferForSize): * wasm/WasmContext.h: * wasm/WasmContextInlines.h: (JSC::Wasm::Context::tryLoadInstanceFromTLS): * wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser<Context>::FunctionParser): (JSC::Wasm::FunctionParser<Context>::parseBody): (JSC::Wasm::FunctionParser<Context>::parseExpression): * wasm/WasmOMGForOSREntryPlan.cpp: Copied from Source/JavaScriptCore/wasm/WasmOMGPlan.cpp. (JSC::Wasm::OMGForOSREntryPlan::OMGForOSREntryPlan): (JSC::Wasm::OMGForOSREntryPlan::work): * wasm/WasmOMGForOSREntryPlan.h: Copied from Source/JavaScriptCore/wasm/WasmOMGPlan.h. * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::work): (JSC::Wasm::OMGPlan::runForIndex): Deleted. * wasm/WasmOMGPlan.h: * wasm/WasmOSREntryData.h: Copied from Source/JavaScriptCore/wasm/WasmContext.h. (JSC::Wasm::OSREntryValue::OSREntryValue): (JSC::Wasm::OSREntryValue::type const): (JSC::Wasm::OSREntryData::OSREntryData): (JSC::Wasm::OSREntryData::functionIndex const): (JSC::Wasm::OSREntryData::loopIndex const): (JSC::Wasm::OSREntryData::values): * wasm/WasmOperations.cpp: Added. (JSC::Wasm::shouldTriggerOMGCompile): (JSC::Wasm::triggerOMGReplacementCompile): (JSC::Wasm::doOSREntry): (JSC::Wasm::triggerOSREntryNow): (JSC::Wasm::triggerTierUpNow): * wasm/WasmOperations.h: Copied from Source/JavaScriptCore/wasm/WasmCompilationMode.h. * wasm/WasmThunks.cpp: (JSC::Wasm::triggerOMGEntryTierUpThunkGenerator): (JSC::Wasm::triggerOMGTierUpThunkGenerator): Deleted. * wasm/WasmThunks.h: * wasm/WasmTierUpCount.cpp: Copied from Source/JavaScriptCore/wasm/WasmCompilationMode.cpp. (JSC::Wasm::TierUpCount::TierUpCount): (JSC::Wasm::TierUpCount::addOSREntryData): * wasm/WasmTierUpCount.h: (JSC::Wasm::TierUpCount::loopIncrement): (JSC::Wasm::TierUpCount::functionEntryIncrement): (JSC::Wasm::TierUpCount::osrEntryTriggers): (JSC::Wasm::TierUpCount::outerLoops): (JSC::Wasm::TierUpCount::getLock): (JSC::Wasm::TierUpCount::optimizeAfterWarmUp): (JSC::Wasm::TierUpCount::checkIfOptimizationThresholdReached): (JSC::Wasm::TierUpCount::dontOptimizeAnytimeSoon): (JSC::Wasm::TierUpCount::optimizeNextInvocation): (JSC::Wasm::TierUpCount::optimizeSoon): (JSC::Wasm::TierUpCount::setOptimizationThresholdBasedOnCompilationResult): (JSC::Wasm::TierUpCount::TierUpCount): Deleted. (JSC::Wasm::TierUpCount::loopDecrement): Deleted. (JSC::Wasm::TierUpCount::functionEntryDecrement): Deleted. (JSC::Wasm::TierUpCount::shouldStartTierUp): Deleted. (JSC::Wasm::TierUpCount::count): Deleted. * wasm/WasmValidate.cpp: (JSC::Wasm::Validate::createStack): (JSC::Wasm::Validate::addLoop): (JSC::Wasm::Validate::addElse): (JSC::Wasm::Validate::checkBranchTarget): (JSC::Wasm::Validate::addBranch): (JSC::Wasm::Validate::addSwitch): (JSC::Wasm::Validate::endBlock): (JSC::Wasm::Validate::unify): (JSC::Wasm::dumpExpressionStack): (JSC::Wasm::Validate::dump): Tools: * Scripts/run-jsc-stress-tests: Canonical link: https://commits.webkit.org/214633@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-20 00:21:29 +00:00
wasm/WasmOMGForOSREntryPlan.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
wasm/WasmOMGPlan.cpp
wasm/WasmOpcodeOrigin.cpp
[JSC] OSR entry to Wasm OMG https://bugs.webkit.org/show_bug.cgi?id=200362 Reviewed by Michael Saboff. JSTests: * wasm/stress/osr-entry-basic.js: Added. (instance.exports.loop): * wasm/stress/osr-entry-many-locals-f32.js: Added. * wasm/stress/osr-entry-many-locals-f64.js: Added. * wasm/stress/osr-entry-many-locals-i32.js: Added. * wasm/stress/osr-entry-many-locals-i64.js: Added. * wasm/stress/osr-entry-many-stacks-f32.js: Added. * wasm/stress/osr-entry-many-stacks-f64.js: Added. * wasm/stress/osr-entry-many-stacks-i32.js: Added. * wasm/stress/osr-entry-many-stacks-i64.js: Added. Source/JavaScriptCore: This patch implements Wasm OSR entry mechanism from BBQ tier to OMG tier. We found that one of JetStream2 test heavily relies on OSR entry feature. gcc-loops-wasm consumes most of time in BBQ tier since one of the function takes significantly long time. And since we did not have OSR entry feature, we cannot use OMG function until that BBQ function finishes. To implement Wasm OSR feature, we first capture all locals and stacks in the patchpoint to generate the stackmap. Once the threshold is crossed, the patchpoint calls `MacroAssembler::probe` feature to capture whole register context, and C++ runtime function reads stackmap and Probe::Context to perform OSR entry. This patch intentionally makes OSR entry written in C++ runtime side as much as possible to make it easily reusable for the other tiers. For example, we are planning to introduce Wasm interpreter, and it can easily use this tier-up function. Because of this simplicity, this generic implementation can cover both BBQ Air and BBQ B3 tier-up features. So, in the feature, it is possible that we revive BBQ B3, and construct the wasm pipeline like, interpreter->BBQ B3->OMG B3. To generate OMG code for OSR entry, we add a new mode OMGForOSREntry, which mimics the FTLForOSREntry. In FTLForOSREntry, we cut unrelated blocks including the usual entry point in DFG tier and later convert graph to SSA. This is possible because DFG is not SSA. On the other hand, B3 is SSA and we cannot take the same thing without a hack. This patch introduce a hack: making all wasm locals and stack values B3::Variable for OMGForOSREntry mode. Then, we can cut blocks easily and we can generate the B3 graph without doing reachability analysis from the OSR entry point. B3 will remove unreachable blocks later. Tier-up function mimics DFG->FTL OSR entry heuristics and threshold as much as possible. And this patch adjusts the tier-up count threshold to make it close to DFG->FTL ones. Wasm tier-up is now using ExecutionCounter, which is inherited from Wasm::TierUpCount. Since wasm can execute concurrently, the tier-up counter can be racily updated. But this is OK in practice. Even if we see some more tier-up function calls or tier-up function calls are delayed, the critical part is guarded by a lock in tier-up function. In iMac Pro, it shows ~4x runtime improvement for gcc-loops-wasm. On iOS device (iPhone XR), we saw ~2x improvement. ToT: HashSet-wasm:Score: 24.6pt stdev=4.6% :Time:Geometric: 204ms stdev=4.4% Runtime:Time: 689ms stdev=1.0% Startup:Time: 60.3ms stdev=8.4% gcc-loops-wasm:Score: 8.41pt stdev=6.7% :Time:Geometric: 597ms stdev=6.5% Runtime:Time: 8.509s stdev=0.7% Startup:Time: 42ms stdev=12.4% quicksort-wasm:Score: 347pt stdev=20.9% :Time:Geometric: 15ms stdev=18.6% Runtime:Time: 28.2ms stdev=7.9% Startup:Time: 8.2ms stdev=35.0% richards-wasm:Score: 77.6pt stdev=4.5% :Time:Geometric: 64.6ms stdev=4.4% Runtime:Time: 544ms stdev=3.3% Startup:Time: 7.67ms stdev=6.7% tsf-wasm:Score: 47.9pt stdev=4.5% :Time:Geometric: 104ms stdev=4.8% Runtime:Time: 259ms stdev=4.4% Startup:Time: 42.2ms stdev=8.5% Patched: HashSet-wasm:Score: 24.1pt stdev=4.1% :Time:Geometric: 208ms stdev=4.1% Runtime:Time: 684ms stdev=1.1% Startup:Time: 63.2ms stdev=8.1% gcc-loops-wasm:Score: 15.7pt stdev=5.1% :Time:Geometric: 319ms stdev=5.3% Runtime:Time: 2.491s stdev=0.7% Startup:Time: 41ms stdev=11.0% quicksort-wasm:Score: 353pt stdev=13.7% :Time:Geometric: 14ms stdev=12.7% Runtime:Time: 26.2ms stdev=2.9% Startup:Time: 8.0ms stdev=23.7% richards-wasm:Score: 77.4pt stdev=5.3% :Time:Geometric: 64.7ms stdev=5.3% Runtime:Time: 536ms stdev=1.5% Startup:Time: 7.83ms stdev=9.6% tsf-wasm:Score: 47.3pt stdev=5.7% :Time:Geometric: 106ms stdev=6.1% Runtime:Time: 250ms stdev=3.5% Startup:Time: 45ms stdev=13.8% * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/MacroAssemblerARM64.h: (JSC::MacroAssemblerARM64::branchAdd32): * b3/B3ValueRep.h: * bytecode/CodeBlock.h: * bytecode/ExecutionCounter.cpp: (JSC::applyMemoryUsageHeuristics): (JSC::ExecutionCounter<countingVariant>::setThreshold): * bytecode/ExecutionCounter.h: (JSC::ExecutionCounter::clippedThreshold): * dfg/DFGJITCode.h: * dfg/DFGOperations.cpp: * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::prologueStackPointerDelta): * runtime/Options.h: * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::createStack): (JSC::Wasm::AirIRGenerator::emitPatchpoint): (JSC::Wasm::AirIRGenerator::outerLoopIndex const): (JSC::Wasm::AirIRGenerator::AirIRGenerator): (JSC::Wasm::AirIRGenerator::emitEntryTierUpCheck): (JSC::Wasm::AirIRGenerator::emitLoopTierUpCheck): (JSC::Wasm::AirIRGenerator::addLoop): (JSC::Wasm::AirIRGenerator::addElse): (JSC::Wasm::AirIRGenerator::addBranch): (JSC::Wasm::AirIRGenerator::addSwitch): (JSC::Wasm::AirIRGenerator::endBlock): (JSC::Wasm::AirIRGenerator::addEndToUnreachable): (JSC::Wasm::AirIRGenerator::unifyValuesWithBlock): (JSC::Wasm::AirIRGenerator::dump): (JSC::Wasm::AirIRGenerator::emitTierUpCheck): Deleted. * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::Stack::Stack): (JSC::Wasm::B3IRGenerator::Stack::append): (JSC::Wasm::B3IRGenerator::Stack::takeLast): (JSC::Wasm::B3IRGenerator::Stack::last): (JSC::Wasm::B3IRGenerator::Stack::size const): (JSC::Wasm::B3IRGenerator::Stack::isEmpty const): (JSC::Wasm::B3IRGenerator::Stack::convertToExpressionList): (JSC::Wasm::B3IRGenerator::Stack::at const): (JSC::Wasm::B3IRGenerator::Stack::variableAt const): (JSC::Wasm::B3IRGenerator::Stack::shrink): (JSC::Wasm::B3IRGenerator::Stack::swap): (JSC::Wasm::B3IRGenerator::Stack::dump const): (JSC::Wasm::B3IRGenerator::createStack): (JSC::Wasm::B3IRGenerator::outerLoopIndex const): (JSC::Wasm::B3IRGenerator::B3IRGenerator): (JSC::Wasm::B3IRGenerator::emitEntryTierUpCheck): (JSC::Wasm::B3IRGenerator::emitLoopTierUpCheck): (JSC::Wasm::B3IRGenerator::addLoop): (JSC::Wasm::B3IRGenerator::addElse): (JSC::Wasm::B3IRGenerator::addBranch): (JSC::Wasm::B3IRGenerator::addSwitch): (JSC::Wasm::B3IRGenerator::endBlock): (JSC::Wasm::B3IRGenerator::addEndToUnreachable): (JSC::Wasm::B3IRGenerator::unifyValuesWithBlock): (JSC::Wasm::B3IRGenerator::dump): (JSC::Wasm::parseAndCompile): (JSC::Wasm::B3IRGenerator::emitTierUpCheck): Deleted. (JSC::Wasm::dumpExpressionStack): Deleted. * wasm/WasmB3IRGenerator.h: * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::compileFunctions): * wasm/WasmBBQPlan.h: * wasm/WasmBBQPlanInlines.h: (JSC::Wasm::BBQPlan::initializeCallees): * wasm/WasmCallee.h: * wasm/WasmCodeBlock.cpp: (JSC::Wasm::CodeBlock::CodeBlock): * wasm/WasmCodeBlock.h: (JSC::Wasm::CodeBlock::wasmBBQCalleeFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::entrypointLoadLocationFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::tierUpCount): Deleted. * wasm/WasmCompilationMode.cpp: (JSC::Wasm::makeString): * wasm/WasmCompilationMode.h: * wasm/WasmContext.cpp: Copied from Source/JavaScriptCore/wasm/WasmCompilationMode.cpp. (JSC::Wasm::Context::scratchBufferForSize): * wasm/WasmContext.h: * wasm/WasmContextInlines.h: (JSC::Wasm::Context::tryLoadInstanceFromTLS): * wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser<Context>::FunctionParser): (JSC::Wasm::FunctionParser<Context>::parseBody): (JSC::Wasm::FunctionParser<Context>::parseExpression): * wasm/WasmOMGForOSREntryPlan.cpp: Copied from Source/JavaScriptCore/wasm/WasmOMGPlan.cpp. (JSC::Wasm::OMGForOSREntryPlan::OMGForOSREntryPlan): (JSC::Wasm::OMGForOSREntryPlan::work): * wasm/WasmOMGForOSREntryPlan.h: Copied from Source/JavaScriptCore/wasm/WasmOMGPlan.h. * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::work): (JSC::Wasm::OMGPlan::runForIndex): Deleted. * wasm/WasmOMGPlan.h: * wasm/WasmOSREntryData.h: Copied from Source/JavaScriptCore/wasm/WasmContext.h. (JSC::Wasm::OSREntryValue::OSREntryValue): (JSC::Wasm::OSREntryValue::type const): (JSC::Wasm::OSREntryData::OSREntryData): (JSC::Wasm::OSREntryData::functionIndex const): (JSC::Wasm::OSREntryData::loopIndex const): (JSC::Wasm::OSREntryData::values): * wasm/WasmOperations.cpp: Added. (JSC::Wasm::shouldTriggerOMGCompile): (JSC::Wasm::triggerOMGReplacementCompile): (JSC::Wasm::doOSREntry): (JSC::Wasm::triggerOSREntryNow): (JSC::Wasm::triggerTierUpNow): * wasm/WasmOperations.h: Copied from Source/JavaScriptCore/wasm/WasmCompilationMode.h. * wasm/WasmThunks.cpp: (JSC::Wasm::triggerOMGEntryTierUpThunkGenerator): (JSC::Wasm::triggerOMGTierUpThunkGenerator): Deleted. * wasm/WasmThunks.h: * wasm/WasmTierUpCount.cpp: Copied from Source/JavaScriptCore/wasm/WasmCompilationMode.cpp. (JSC::Wasm::TierUpCount::TierUpCount): (JSC::Wasm::TierUpCount::addOSREntryData): * wasm/WasmTierUpCount.h: (JSC::Wasm::TierUpCount::loopIncrement): (JSC::Wasm::TierUpCount::functionEntryIncrement): (JSC::Wasm::TierUpCount::osrEntryTriggers): (JSC::Wasm::TierUpCount::outerLoops): (JSC::Wasm::TierUpCount::getLock): (JSC::Wasm::TierUpCount::optimizeAfterWarmUp): (JSC::Wasm::TierUpCount::checkIfOptimizationThresholdReached): (JSC::Wasm::TierUpCount::dontOptimizeAnytimeSoon): (JSC::Wasm::TierUpCount::optimizeNextInvocation): (JSC::Wasm::TierUpCount::optimizeSoon): (JSC::Wasm::TierUpCount::setOptimizationThresholdBasedOnCompilationResult): (JSC::Wasm::TierUpCount::TierUpCount): Deleted. (JSC::Wasm::TierUpCount::loopDecrement): Deleted. (JSC::Wasm::TierUpCount::functionEntryDecrement): Deleted. (JSC::Wasm::TierUpCount::shouldStartTierUp): Deleted. (JSC::Wasm::TierUpCount::count): Deleted. * wasm/WasmValidate.cpp: (JSC::Wasm::Validate::createStack): (JSC::Wasm::Validate::addLoop): (JSC::Wasm::Validate::addElse): (JSC::Wasm::Validate::checkBranchTarget): (JSC::Wasm::Validate::addBranch): (JSC::Wasm::Validate::addSwitch): (JSC::Wasm::Validate::endBlock): (JSC::Wasm::Validate::unify): (JSC::Wasm::dumpExpressionStack): (JSC::Wasm::Validate::dump): Tools: * Scripts/run-jsc-stress-tests: Canonical link: https://commits.webkit.org/214633@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-20 00:21:29 +00:00
wasm/WasmOperations.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
wasm/WasmPageCount.cpp
wasm/WasmPlan.cpp
[WebAssembly] Parse wasm modules in a streaming fashion https://bugs.webkit.org/show_bug.cgi?id=188943 Reviewed by Mark Lam. JSTests: Wasm parsing error should not report the total byte size since streaming parsing does not want to load all the bytes. Add a simple test wasm/stress/streaming-basic.js for initial streaming parsing implementation. * wasm/function-tests/invalid-duplicate-export.js: * wasm/function-tests/memory-alignment.js: (const.op.of.WASM.opcodes): * wasm/function-tests/memory-section-and-import.js: * wasm/function-tests/void-argument-type-should-be-a-validation-error.js: * wasm/js-api/Module-compile.js: (async.testPromiseAPI): * wasm/js-api/element.js: (assert.throws.new.WebAssembly.Module.builder.WebAssembly): (assert.throws): * wasm/js-api/global-error.js: (assert.throws.new.WebAssembly.Module.bin): (assert.throws): * wasm/js-api/table.js: (new.WebAssembly.Module): (assert.throws): (assertBadTableImport): * wasm/js-api/test_Data.js: (DataSectionWithoutMemory): * wasm/js-api/test_Start.js: (InvalidStartFunctionIndex): * wasm/js-api/test_basic_api.js: (const.c.in.constructorProperties.switch): * wasm/js-api/version.js: * wasm/stress/nameSection.wasm: Added. * wasm/stress/streaming-basic.js: Added. (check): Source/JavaScriptCore: This patch adds Wasm::StreamingParser, which parses wasm binary in a streaming fashion. Currently, this StreamingParser is not enabled and integrated. In subsequent patches, we start integrating it into BBQPlan and dropping the old ModuleParser. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * tools/JSDollarVM.cpp: (WTF::WasmStreamingParser::WasmStreamingParser): (WTF::WasmStreamingParser::create): (WTF::WasmStreamingParser::createStructure): (WTF::WasmStreamingParser::streamingParser): (WTF::WasmStreamingParser::finishCreation): (WTF::functionWasmStreamingParserAddBytes): (WTF::functionWasmStreamingParserFinalize): (JSC::functionCreateWasmStreamingParser): (JSC::JSDollarVM::finishCreation): The $vm Wasm::StreamingParser object is introduced for testing purpose. Added new stress test uses this interface to test streaming parser in the JSC shell. * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::BBQPlan): (JSC::Wasm::BBQPlan::parseAndValidateModule): (JSC::Wasm::BBQPlan::prepare): (JSC::Wasm::BBQPlan::compileFunctions): (JSC::Wasm::BBQPlan::complete): (JSC::Wasm::BBQPlan::work): * wasm/WasmBBQPlan.h: BBQPlan has m_source, but once ModuleInformation is parsed, it is no longer necessary. In subsequent patches, we will remove this, and stream the data into the BBQPlan. * wasm/WasmFormat.h: * wasm/WasmModuleInformation.cpp: (JSC::Wasm::ModuleInformation::ModuleInformation): * wasm/WasmModuleInformation.h: One of the largest change in this patch is that ModuleInformation no longer holds source bytes, since source bytes can be added in a streaming fashion. Instead of holding all the source bytes in ModuleInformation, each function (ModuleInformation::functions, FunctionData) should have Vector<uint8_t> for its data. This data is eventually filled by StreamingParser, and compiling a function with this data can be done concurrently with StreamingParser. (JSC::Wasm::ModuleInformation::create): (JSC::Wasm::ModuleInformation::memoryCount const): (JSC::Wasm::ModuleInformation::tableCount const): memoryCount and tableCount should be recorded in ModuleInformation. * wasm/WasmModuleParser.cpp: (JSC::Wasm::ModuleParser::parse): (JSC::Wasm::makeI32InitExpr): Deleted. (JSC::Wasm::ModuleParser::parseType): Deleted. (JSC::Wasm::ModuleParser::parseImport): Deleted. (JSC::Wasm::ModuleParser::parseFunction): Deleted. (JSC::Wasm::ModuleParser::parseResizableLimits): Deleted. (JSC::Wasm::ModuleParser::parseTableHelper): Deleted. (JSC::Wasm::ModuleParser::parseTable): Deleted. (JSC::Wasm::ModuleParser::parseMemoryHelper): Deleted. (JSC::Wasm::ModuleParser::parseMemory): Deleted. (JSC::Wasm::ModuleParser::parseGlobal): Deleted. (JSC::Wasm::ModuleParser::parseExport): Deleted. (JSC::Wasm::ModuleParser::parseStart): Deleted. (JSC::Wasm::ModuleParser::parseElement): Deleted. (JSC::Wasm::ModuleParser::parseCode): Deleted. (JSC::Wasm::ModuleParser::parseInitExpr): Deleted. (JSC::Wasm::ModuleParser::parseGlobalType): Deleted. (JSC::Wasm::ModuleParser::parseData): Deleted. (JSC::Wasm::ModuleParser::parseCustom): Deleted. Extract section parsing code out from ModuleParser. We create SectionParser and ModuleParser uses it. SectionParser is also used by StreamingParser. * wasm/WasmModuleParser.h: (): Deleted. * wasm/WasmNameSection.h: (JSC::Wasm::NameSection::NameSection): (JSC::Wasm::NameSection::create): (JSC::Wasm::NameSection::setHash): Hash calculation is deferred since all the source is not available in streaming parsing. * wasm/WasmNameSectionParser.cpp: (JSC::Wasm::NameSectionParser::parse): * wasm/WasmNameSectionParser.h: Use Ref<NameSection>. * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::work): Wasm::Plan no longer have m_source since data will be eventually filled in a streaming fashion. OMGPlan can get data of the function by using ModuleInformation::functions. * wasm/WasmParser.h: (JSC::Wasm::Parser::source const): (JSC::Wasm::Parser::length const): (JSC::Wasm::Parser::offset const): (JSC::Wasm::Parser::fail const): (JSC::Wasm::makeI32InitExpr): * wasm/WasmPlan.cpp: (JSC::Wasm::Plan::Plan): Wasm::Plan should not have all the source apriori. Streamed data will be pumped from the provider. * wasm/WasmPlan.h: * wasm/WasmSectionParser.cpp: Copied from Source/JavaScriptCore/wasm/WasmModuleParser.cpp. SectionParser is extracted from ModuleParser. And it is used by both the old (currently working) ModuleParser and the new StreamingParser. (JSC::Wasm::SectionParser::parseType): (JSC::Wasm::SectionParser::parseImport): (JSC::Wasm::SectionParser::parseFunction): (JSC::Wasm::SectionParser::parseResizableLimits): (JSC::Wasm::SectionParser::parseTableHelper): (JSC::Wasm::SectionParser::parseTable): (JSC::Wasm::SectionParser::parseMemoryHelper): (JSC::Wasm::SectionParser::parseMemory): (JSC::Wasm::SectionParser::parseGlobal): (JSC::Wasm::SectionParser::parseExport): (JSC::Wasm::SectionParser::parseStart): (JSC::Wasm::SectionParser::parseElement): (JSC::Wasm::SectionParser::parseCode): (JSC::Wasm::SectionParser::parseInitExpr): (JSC::Wasm::SectionParser::parseGlobalType): (JSC::Wasm::SectionParser::parseData): (JSC::Wasm::SectionParser::parseCustom): * wasm/WasmSectionParser.h: Copied from Source/JavaScriptCore/wasm/WasmModuleParser.h. * wasm/WasmStreamingParser.cpp: Added. (JSC::Wasm::parseUInt7): (JSC::Wasm::StreamingParser::fail): (JSC::Wasm::StreamingParser::StreamingParser): (JSC::Wasm::StreamingParser::parseModuleHeader): (JSC::Wasm::StreamingParser::parseSectionID): (JSC::Wasm::StreamingParser::parseSectionSize): (JSC::Wasm::StreamingParser::parseCodeSectionSize): Code section in Wasm binary is specially handled compared with the other sections since it includes a bunch of functions. StreamingParser extracts each function in a streaming fashion and enable streaming validation / compilation of Wasm functions. (JSC::Wasm::StreamingParser::parseFunctionSize): (JSC::Wasm::StreamingParser::parseFunctionPayload): (JSC::Wasm::StreamingParser::parseSectionPayload): (JSC::Wasm::StreamingParser::consume): (JSC::Wasm::StreamingParser::consumeVarUInt32): (JSC::Wasm::StreamingParser::addBytes): (JSC::Wasm::StreamingParser::failOnState): (JSC::Wasm::StreamingParser::finalize): * wasm/WasmStreamingParser.h: Added. (JSC::Wasm::StreamingParser::addBytes): (JSC::Wasm::StreamingParser::errorMessage const): This is our new StreamingParser implementation. StreamingParser::consumeXXX functions get data, and StreamingParser::parseXXX functions parse consumed data. The user of StreamingParser calls StreamingParser::addBytes() to pump the bytes stream into the parser. And once all the data is pumped, the user calls StreamingParser::finalize. StreamingParser is a state machine which feeds on the incoming byte stream. * wasm/js/JSWebAssemblyModule.cpp: (JSC::JSWebAssemblyModule::source const): Deleted. All the source should not be held. * wasm/js/JSWebAssemblyModule.h: * wasm/js/WebAssemblyPrototype.cpp: (JSC::webAssemblyValidateFunc): Source/WTF: Add maxByteLength function to get the maximum size for T. * wtf/LEBDecoder.h: (WTF::LEBDecoder::maxByteLength): (WTF::LEBDecoder::decodeUInt): (WTF::LEBDecoder::decodeInt): Canonical link: https://commits.webkit.org/204074@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235420 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-08-28 06:38:29 +00:00
wasm/WasmSectionParser.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
wasm/WasmSignature.cpp
[WebAssembly] Create a Wasm interpreter https://bugs.webkit.org/show_bug.cgi?id=194257 <rdar://problem/44186794> Reviewed by Saam Barati. Source/JavaScriptCore: Add an interpreter tier to WebAssembly which reuses the LLInt infrastructure. The interpreter currently tiers up straight to OMG and can OSR enter at the prologue and from loops. The initial implementation of the interpreter is very naive, but despite the lack of optimizations it still shows a 2x improvement on the WebAssembly subtests in JetStream2 and 2x improvement on the PSPDFKit benchmark. It reduces "compilation" times by ~3x and it's neutral on throughput. The interpreter follows the same calling conventions as the BBQ/OMG, this means that: - We have to allocate locals for all argument registers and write all arguments registers to the stack in the prologue. - Calls have to allocate space for at least as many arguments as the number of argument registers. Before each call, all argument registers must be loaded from the stack, and after we return from the call, all registers must be stored back to the stack, in case they contain return values. We carefully layout the stack so that the arguments that would already have to be passed in the stack end up in the right place. The stack layout for calls is: [ gprs ][ fprs ][ optional stack arguments ][ callee frame ] ^ sp - The return opcode has to load all registers from the stack, since they might need to contain results of the function. - The calling convention requires that the callee should store itself in the callee slot of the call frame, which is impossible in the interpreter, since the code we execute is the same for all callees. In order to work around that, we generate an entry thunk to the wasm interpreter for each function. All this thunk does is store the callee in the call frame and tail call the interpreter. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/BytecodeDumper.cpp: (JSC::BytecodeDumper<Block>::constantName const): (JSC::BytecodeDumper<Block>::dumpValue): (JSC::BytecodeDumper<Block>::dumpBytecode): (JSC::CodeBlockBytecodeDumper<Block>::vm const): (JSC::CodeBlockBytecodeDumper<Block>::identifier const): (JSC::CodeBlockBytecodeDumper<Block>::dumpIdentifiers): (JSC::CodeBlockBytecodeDumper<Block>::dumpConstants): (JSC::CodeBlockBytecodeDumper<Block>::dumpExceptionHandlers): (JSC::CodeBlockBytecodeDumper<Block>::dumpSwitchJumpTables): (JSC::CodeBlockBytecodeDumper<Block>::dumpStringSwitchJumpTables): (JSC::CodeBlockBytecodeDumper<Block>::dumpBlock): * bytecode/BytecodeDumper.h: (JSC::BytecodeDumper::dumpValue): (JSC::BytecodeDumper::BytecodeDumper): * bytecode/BytecodeGeneratorification.cpp: (JSC::performGeneratorification): * bytecode/BytecodeList.rb: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): * bytecode/Fits.h: * bytecode/Instruction.h: (JSC::BaseInstruction::BaseInstruction): (JSC::BaseInstruction::Impl::opcodeID const): (JSC::BaseInstruction::opcodeID const): (JSC::BaseInstruction::name const): (JSC::BaseInstruction::isWide16 const): (JSC::BaseInstruction::isWide32 const): (JSC::BaseInstruction::hasMetadata const): (JSC::BaseInstruction::sizeShiftAmount const): (JSC::BaseInstruction::size const): (JSC::BaseInstruction::is const): (JSC::BaseInstruction::as const): (JSC::BaseInstruction::cast): (JSC::BaseInstruction::cast const): (JSC::BaseInstruction::wide16 const): (JSC::BaseInstruction::wide32 const): * bytecode/InstructionStream.h: (JSC::InstructionStream::iterator::operator+=): (JSC::InstructionStream::iterator::operator++): (JSC::InstructionStreamWriter::iterator::operator+=): (JSC::InstructionStreamWriter::iterator::operator++): * bytecode/Opcode.cpp: * bytecode/Opcode.h: * bytecode/PreciseJumpTargetsInlines.h: * bytecode/UnlinkedCodeBlock.h: * bytecode/VirtualRegister.cpp: (JSC::VirtualRegister::VirtualRegister): * bytecode/VirtualRegister.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::GenericLabel<JSGeneratorTraits>::setLocation): (JSC::BytecodeGenerator::BytecodeGenerator): * bytecompiler/BytecodeGenerator.h: * bytecompiler/BytecodeGeneratorBase.h: Added. * bytecompiler/BytecodeGeneratorBaseInlines.h: Added. (JSC::shrinkToFit): (JSC::BytecodeGeneratorBase<Traits>::BytecodeGeneratorBase): (JSC::BytecodeGeneratorBase<Traits>::newLabel): (JSC::BytecodeGeneratorBase<Traits>::newEmittedLabel): (JSC::BytecodeGeneratorBase<Traits>::reclaimFreeRegisters): (JSC::BytecodeGeneratorBase<Traits>::emitLabel): (JSC::BytecodeGeneratorBase<Traits>::recordOpcode): (JSC::BytecodeGeneratorBase<Traits>::alignWideOpcode16): (JSC::BytecodeGeneratorBase<Traits>::alignWideOpcode32): (JSC::BytecodeGeneratorBase<Traits>::write): (JSC::BytecodeGeneratorBase<Traits>::newRegister): (JSC::BytecodeGeneratorBase<Traits>::newTemporary): (JSC::BytecodeGeneratorBase<Traits>::addVar): (JSC::BytecodeGeneratorBase<Traits>::allocateCalleeSaveSpace): * bytecompiler/Label.h: (JSC::GenericBoundLabel::GenericBoundLabel): (JSC::GenericBoundLabel::target): (JSC::GenericBoundLabel::saveTarget): (JSC::GenericBoundLabel::commitTarget): * dfg/DFGByteCodeParser.cpp: * dfg/DFGCapabilities.cpp: (JSC::DFG::capabilityLevel): * dfg/DFGOperations.cpp: * generator/Argument.rb: * generator/DSL.rb: * generator/GeneratedFile.rb: * generator/Opcode.rb: * generator/Options.rb: * generator/Section.rb: * generator/Wasm.rb: Added. * interpreter/Register.h: * interpreter/RegisterInlines.h: (JSC::Register::operator=): * jit/JITArithmetic.cpp: * jit/JITOpcodes.cpp: * llint/LLIntData.cpp: (JSC::LLInt::initialize): * llint/LLIntData.h: (JSC::LLInt::wasmExceptionInstructions): * llint/LLIntOfflineAsmConfig.h: * llint/LLIntOffsetsExtractor.cpp: * llint/LLIntSlowPaths.cpp: * llint/LLIntThunks.cpp: (JSC::LLInt::generateThunkWithJumpTo): (JSC::LLInt::wasmFunctionEntryThunk): * llint/LLIntThunks.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * llint/WebAssembly.asm: Added. * offlineasm/arm64.rb: * offlineasm/instructions.rb: * offlineasm/parser.rb: * offlineasm/registers.rb: * offlineasm/transform.rb: * offlineasm/x86.rb: * parser/Nodes.h: * runtime/Error.cpp: (JSC::FindFirstCallerFrameWithCodeblockFunctor::operator() const): * runtime/ErrorInstance.cpp: (JSC::ErrorInstance::finishCreation): * runtime/Options.cpp: (JSC::overrideDefaults): * runtime/OptionsList.h: * runtime/SamplingProfiler.cpp: (JSC::FrameWalker::recordJITFrame): (JSC::FrameWalker::resetAtMachineFrame): * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::isControlTypeIf): (JSC::Wasm::AirIRGenerator::emitLoopTierUpCheck): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::isControlTypeIf): * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::prepareImpl): (JSC::Wasm::BBQPlan::work): (JSC::Wasm::BBQPlan::compileFunction): (JSC::Wasm::BBQPlan::didCompleteCompilation): (JSC::Wasm::BBQPlan::initializeCallees): * wasm/WasmBBQPlan.h: * wasm/WasmBBQPlanInlines.h: Removed. * wasm/WasmCallee.cpp: (JSC::Wasm::Callee::Callee): (JSC::Wasm::Callee::dump const): (JSC::Wasm::JITCallee::JITCallee): (JSC::Wasm::LLIntCallee::setEntrypoint): (JSC::Wasm::LLIntCallee::entrypoint const): (JSC::Wasm::LLIntCallee::calleeSaveRegisters): (JSC::Wasm:: const): * wasm/WasmCallee.h: (JSC::Wasm::Callee::setOSREntryCallee): (JSC::Wasm::JITCallee::wasmToWasmCallsites): (JSC::Wasm::JITCallee:: const): * wasm/WasmCallingConvention.h: * wasm/WasmCodeBlock.cpp: (JSC::Wasm::CodeBlock::CodeBlock): * wasm/WasmCodeBlock.h: (JSC::Wasm::CodeBlock::wasmEntrypointCalleeFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::wasmBBQCalleeFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::wasmToWasmExitStub): * wasm/WasmCompilationMode.cpp: (JSC::Wasm::makeString): * wasm/WasmCompilationMode.h: * wasm/WasmEmbedder.h: * wasm/WasmEntryPlan.cpp: Added. (JSC::Wasm::EntryPlan::EntryPlan): (JSC::Wasm::EntryPlan::stateString): (JSC::Wasm::EntryPlan::moveToState): (JSC::Wasm::EntryPlan::didReceiveFunctionData): (JSC::Wasm::EntryPlan::parseAndValidateModule): (JSC::Wasm::EntryPlan::prepare): (JSC::Wasm::EntryPlan::ThreadCountHolder::ThreadCountHolder): (JSC::Wasm::EntryPlan::ThreadCountHolder::~ThreadCountHolder): (JSC::Wasm::EntryPlan::complete): (JSC::Wasm::EntryPlan::compileFunctions): (JSC::Wasm::EntryPlan::work): * wasm/WasmEntryPlan.h: Copied from Source/JavaScriptCore/wasm/WasmBBQPlan.h. (JSC::Wasm::EntryPlan::parseAndValidateModule): (JSC::Wasm::EntryPlan::exports const): (JSC::Wasm::EntryPlan::internalFunctionCount const): (JSC::Wasm::EntryPlan::takeModuleInformation): (JSC::Wasm::EntryPlan::takeWasmToWasmExitStubs): (JSC::Wasm::EntryPlan::takeWasmToWasmCallsites): (JSC::Wasm::EntryPlan::hasBeenPrepared const): (JSC::Wasm::EntryPlan::tryReserveCapacity): * wasm/WasmFunctionCodeBlock.cpp: Added. (JSC::Wasm::FunctionCodeBlock::setInstructions): (JSC::Wasm::FunctionCodeBlock::dumpBytecode): (JSC::Wasm::FunctionCodeBlock::addOutOfLineJumpTarget): (JSC::Wasm::FunctionCodeBlock::outOfLineJumpOffset): (JSC::Wasm::FunctionCodeBlock::outOfLineJumpTarget): (JSC::Wasm::FunctionCodeBlock::addSignature): (JSC::Wasm::FunctionCodeBlock::signature const): (JSC::Wasm::FunctionCodeBlock::addJumpTable): (JSC::Wasm::FunctionCodeBlock::jumpTable const const): (JSC::Wasm::FunctionCodeBlock::numberOfJumpTables const): * wasm/WasmFunctionCodeBlock.h: Added. (JSC::Wasm::FunctionCodeBlock::FunctionCodeBlock): (JSC::Wasm::FunctionCodeBlock::getConstant const): (JSC::Wasm::FunctionCodeBlock::functionIndex const): (JSC::Wasm::FunctionCodeBlock::addJumpTarget): (JSC::Wasm::FunctionCodeBlock::numberOfJumpTargets): (JSC::Wasm::FunctionCodeBlock::lastJumpTarget): (JSC::Wasm::FunctionCodeBlock::outOfLineJumpOffset): (JSC::Wasm::FunctionCodeBlock::bytecodeOffset): (JSC::Wasm::FunctionCodeBlock::tierUpCounter): * wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser<Context>::parseExpression): (JSC::Wasm::FunctionParser<Context>::parseUnreachableExpression): * wasm/WasmInstance.h: * wasm/WasmLLIntGenerator.cpp: Added. (JSC::Wasm::LLIntGenerator::ControlType::ControlType): (JSC::Wasm::LLIntGenerator::ControlType::loop): (JSC::Wasm::LLIntGenerator::ControlType::topLevel): (JSC::Wasm::LLIntGenerator::ControlType::block): (JSC::Wasm::LLIntGenerator::ControlType::if_): (JSC::Wasm::LLIntGenerator::ControlType::targetLabelForBranch const): (JSC::Wasm::LLIntGenerator::fail const): (JSC::Wasm::LLIntGenerator::unifyValuesWithBlock): (JSC::Wasm::LLIntGenerator::emptyExpression): (JSC::Wasm::LLIntGenerator::createStack): (JSC::Wasm::LLIntGenerator::isControlTypeIf): (JSC::Wasm::LLIntGenerator::addEndToUnreachable): (JSC::Wasm::LLIntGenerator::setParser): (JSC::Wasm::LLIntGenerator::dump): (JSC::Wasm::LLIntGenerator::virtualRegisterForLocal): (JSC::Wasm::LLIntGenerator::tmpsForSignature): (JSC::Wasm::LLIntGenerator::jsNullConstant): (JSC::Wasm::LLIntGenerator::isConstant): (JSC::Wasm::parseAndCompileBytecode): (JSC::Wasm::LLIntGenerator::LLIntGenerator): (JSC::Wasm::LLIntGenerator::finalize): (JSC::Wasm::LLIntGenerator::callInformationFor): (JSC::Wasm::LLIntGenerator::addArguments): (JSC::Wasm::LLIntGenerator::addLocal): (JSC::Wasm::LLIntGenerator::addConstant): (JSC::Wasm::LLIntGenerator::getLocal): (JSC::Wasm::LLIntGenerator::setLocal): (JSC::Wasm::LLIntGenerator::getGlobal): (JSC::Wasm::LLIntGenerator::setGlobal): (JSC::Wasm::LLIntGenerator::addLoop): (JSC::Wasm::LLIntGenerator::addTopLevel): (JSC::Wasm::LLIntGenerator::addBlock): (JSC::Wasm::LLIntGenerator::addIf): (JSC::Wasm::LLIntGenerator::addElse): (JSC::Wasm::LLIntGenerator::addElseToUnreachable): (JSC::Wasm::LLIntGenerator::addReturn): (JSC::Wasm::LLIntGenerator::addBranch): (JSC::Wasm::LLIntGenerator::addSwitch): (JSC::Wasm::LLIntGenerator::endBlock): (JSC::Wasm::LLIntGenerator::addCall): (JSC::Wasm::LLIntGenerator::addCallIndirect): (JSC::Wasm::LLIntGenerator::addRefIsNull): (JSC::Wasm::LLIntGenerator::addRefFunc): (JSC::Wasm::LLIntGenerator::addTableGet): (JSC::Wasm::LLIntGenerator::addTableSet): (JSC::Wasm::LLIntGenerator::addTableSize): (JSC::Wasm::LLIntGenerator::addTableGrow): (JSC::Wasm::LLIntGenerator::addTableFill): (JSC::Wasm::LLIntGenerator::addUnreachable): (JSC::Wasm::LLIntGenerator::addCurrentMemory): (JSC::Wasm::LLIntGenerator::addGrowMemory): (JSC::Wasm::LLIntGenerator::addSelect): (JSC::Wasm::LLIntGenerator::load): (JSC::Wasm::LLIntGenerator::store): (JSC::GenericLabel<Wasm::GeneratorTraits>::setLocation): * wasm/WasmLLIntGenerator.h: Copied from Source/JavaScriptCore/wasm/WasmCompilationMode.h. * wasm/WasmLLIntPlan.cpp: Added. (JSC::Wasm::LLIntPlan::prepareImpl): (JSC::Wasm::LLIntPlan::compileFunction): (JSC::Wasm::LLIntPlan::didCompleteCompilation): (JSC::Wasm::LLIntPlan::initializeCallees): * wasm/WasmLLIntPlan.h: Copied from Source/JavaScriptCore/wasm/WasmOMGForOSREntryPlan.h. * wasm/WasmLLIntTierUpCounter.cpp: Copied from Source/JavaScriptCore/wasm/WasmCompilationMode.cpp. (JSC::Wasm::LLIntTierUpCounter::addOSREntryDataForLoop): (JSC::Wasm::LLIntTierUpCounter::osrEntryDataForLoop const const): * wasm/WasmLLIntTierUpCounter.h: Copied from Source/JavaScriptCore/wasm/WasmOMGForOSREntryPlan.h. (JSC::Wasm::LLIntTierUpCounter::LLIntTierUpCounter): (JSC::Wasm::LLIntTierUpCounter::optimizeAfterWarmUp): (JSC::Wasm::LLIntTierUpCounter::checkIfOptimizationThresholdReached): (JSC::Wasm::LLIntTierUpCounter::optimizeSoon): * wasm/WasmMemoryInformation.cpp: (JSC::Wasm::PinnedRegisterInfo::get): * wasm/WasmModule.cpp: (JSC::Wasm::makeValidationResult): (JSC::Wasm::makeValidationCallback): (JSC::Wasm::Module::validateSync): (JSC::Wasm::Module::validateAsync): * wasm/WasmOMGForOSREntryPlan.cpp: (JSC::Wasm::OMGForOSREntryPlan::OMGForOSREntryPlan): (JSC::Wasm::OMGForOSREntryPlan::work): * wasm/WasmOMGForOSREntryPlan.h: * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::work): * wasm/WasmSlowPaths.cpp: Added. (JSC::LLInt::jitCompileAndSetHeuristics): (JSC::LLInt::WASM_SLOW_PATH_DECL): (JSC::LLInt::doWasmCall): (JSC::LLInt::doWasmCallIndirect): (JSC::LLInt::slow_path_wasm_throw_exception): (JSC::LLInt::slow_path_wasm_popcount): (JSC::LLInt::slow_path_wasm_popcountll): * wasm/WasmSlowPaths.h: Added. * wasm/WasmTable.cpp: (JSC::Wasm::FuncRefTable::function const): (JSC::Wasm::FuncRefTable::instance const): * wasm/WasmTable.h: * wasm/WasmTierUpCount.h: * wasm/WasmValidate.cpp: (JSC::Wasm::Validate::isControlTypeIf): * wasm/js/JSToWasm.cpp: (JSC::Wasm::createJSToWasmWrapper): * wasm/js/JSToWasm.h: * wasm/js/WebAssemblyFunction.cpp: (JSC::WebAssemblyFunction::calleeSaves const): Tools: Add a mode that runs WebAssembly tests without the LLInt (i.e. only Air) and update the no-air mode to also disable the LLInt tier. * Scripts/run-jsc-stress-tests: Canonical link: https://commits.webkit.org/217068@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251886 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-31 22:32:52 +00:00
wasm/WasmSlowPaths.cpp
WebAssembly: add support for stream APIs https://bugs.webkit.org/show_bug.cgi?id=173105 Reviewed by Keith Miller. .: * Source/cmake/OptionsFTW.cmake: * Source/cmake/WebKitFeatures.cmake: JSTests: * wasm/stress/resources/tsf.wasm: Added. * wasm/stress/wasm-streaming-compiler-compile.js: Added. (shouldBe): (slice): (async main): (main.catch): * wasm/stress/wasm-streaming-compiler-instantiate.js: Added. (shouldBe): (slice): (async main.): (async main): (main.catch): LayoutTests/imported/w3c: * web-platform-tests/wasm/wasm_stream_compile_test-expected.txt: * web-platform-tests/wasm/wasm_stream_compile_test.html: * web-platform-tests/wasm/wasm_stream_instantiate_test-expected.txt: * web-platform-tests/wasm/wasm_stream_instantiate_test.html: * web-platform-tests/wasm/webapi/abort.any-expected.txt: * web-platform-tests/wasm/webapi/abort.any.worker-expected.txt: * web-platform-tests/wasm/webapi/body.any-expected.txt: * web-platform-tests/wasm/webapi/body.any.worker-expected.txt: * web-platform-tests/wasm/webapi/contenttype.any-expected.txt: * web-platform-tests/wasm/webapi/contenttype.any.worker-expected.txt: * web-platform-tests/wasm/webapi/empty-body.any-expected.txt: * web-platform-tests/wasm/webapi/empty-body.any.worker-expected.txt: * web-platform-tests/wasm/webapi/historical.any-expected.txt: * web-platform-tests/wasm/webapi/historical.any.worker-expected.txt: * web-platform-tests/wasm/webapi/idlharness.any-expected.txt: * web-platform-tests/wasm/webapi/idlharness.any.worker-expected.txt: * web-platform-tests/wasm/webapi/instantiateStreaming-bad-imports.any-expected.txt: * web-platform-tests/wasm/webapi/instantiateStreaming-bad-imports.any.worker-expected.txt: * web-platform-tests/wasm/webapi/instantiateStreaming.any-expected.txt: * web-platform-tests/wasm/webapi/instantiateStreaming.any.worker-expected.txt: * web-platform-tests/wasm/webapi/invalid-args.any-expected.txt: * web-platform-tests/wasm/webapi/invalid-args.any.worker-expected.txt: * web-platform-tests/wasm/webapi/invalid-code.any-expected.txt: * web-platform-tests/wasm/webapi/invalid-code.any.worker-expected.txt: * web-platform-tests/wasm/webapi/modified-contenttype.any-expected.txt: * web-platform-tests/wasm/webapi/modified-contenttype.any.worker-expected.txt: * web-platform-tests/wasm/webapi/origin.sub.any-expected.txt: * web-platform-tests/wasm/webapi/origin.sub.any.worker-expected.txt: * web-platform-tests/wasm/webapi/rejected-arg.any-expected.txt: * web-platform-tests/wasm/webapi/rejected-arg.any.worker-expected.txt: * web-platform-tests/wasm/webapi/status.any-expected.txt: * web-platform-tests/wasm/webapi/status.any.worker-expected.txt: Source/JavaScriptCore: This patch implements WebAssembly.{compileStreaming,instantiateStreaming}. JavaScriptCore offers Wasm::StreamingCompiler interface to WebCore, so that WebCore can feed FetchResponse and compile wasm code in a streaming fashion. Wasm::StreamingCompiler drives Wasm::LLIntPlan while it does not use Wasm::Worklist since currently Wasm::Worklist is not suitable abstraction for streaming compilation which generates compilation tasks incrementally. Instead, Wasm::StreamingCompiler generates Wasm::StreamingPlan and enqueues them to Wasm::Worklist, and each StreamingPlan compiles one function at a time. And we gather these compiled functions into the one LLIntPlan and finally Wasm::StreamingCompiler completes Wasm::LLIntPlan. We already have Wasm::StreamingParser, which is designed for streaming compilation. We can pass bytes to this parser, and this parser invokes a callback when a new wasm function is found. Then, Wasm::StreamingCompiler generates Wasm::StreamingPlan for that. We add WasmStreamingCompiler JS objects to JSC shell to test streaming compilation easily. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/WebAssembly.js: (compileStreaming): (instantiateStreaming): * runtime/DeferredWorkTimer.cpp: (JSC::DeferredWorkTimer::cancelPendingWork): * runtime/DeferredWorkTimer.h: * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * runtime/JSGlobalObject.h: * runtime/OptionsList.h: * tools/JSDollarVM.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): (JSC::JSDollarVM::finishCreation): * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::BBQPlan): * wasm/WasmBBQPlan.h: * wasm/WasmCodeBlock.cpp: (JSC::Wasm::CodeBlock::CodeBlock): * wasm/WasmEntryPlan.cpp: (JSC::Wasm::EntryPlan::EntryPlan): * wasm/WasmEntryPlan.h: * wasm/WasmLLIntPlan.cpp: (JSC::Wasm::LLIntPlan::LLIntPlan): (JSC::Wasm::LLIntPlan::didCompleteCompilation): (JSC::Wasm::LLIntPlan::completeInStreaming): (JSC::Wasm::LLIntPlan::didCompileFunctionInStreaming): (JSC::Wasm::LLIntPlan::didFailInStreaming): * wasm/WasmLLIntPlan.h: * wasm/WasmModule.cpp: (JSC::Wasm::Module::validateSync): (JSC::Wasm::Module::validateAsync): * wasm/WasmStreamingCompiler.cpp: Added. (JSC::Wasm::StreamingCompiler::StreamingCompiler): (JSC::Wasm::StreamingCompiler::~StreamingCompiler): (JSC::Wasm::StreamingCompiler::create): (JSC::Wasm::StreamingCompiler::didReceiveFunctionData): (JSC::Wasm::StreamingCompiler::didCompileFunction): (JSC::Wasm::StreamingCompiler::didFinishParsing): (JSC::Wasm::StreamingCompiler::completeIfNecessary): (JSC::Wasm::StreamingCompiler::didComplete): (JSC::Wasm::StreamingCompiler::finalize): (JSC::Wasm::StreamingCompiler::fail): (JSC::Wasm::StreamingCompiler::cancel): * wasm/WasmStreamingCompiler.h: Added. * wasm/WasmStreamingParser.cpp: * wasm/WasmStreamingParser.h: * wasm/WasmStreamingPlan.cpp: Copied from Source/JavaScriptCore/builtins/WebAssembly.js. (JSC::Wasm::StreamingPlan::StreamingPlan): (JSC::Wasm::StreamingPlan::work): * wasm/WasmStreamingPlan.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssembly.h. * wasm/js/JSWebAssembly.cpp: (JSC::JSWebAssembly::finishCreation): (JSC::JSWebAssembly::instantiateForStreaming): (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/JSWebAssembly.h: Source/WebCore: Since WebAssembly.{compileStreaming,instantiateStreaming} needs to handle FetchResponse which is WebCore type, they need to be implemented in WebCore side. To achieve that, JSC offers callback to JSGlobalObject, and WebCore JSDOMGlobalObject can implement them to offer WebAssembly.{compileStreaming,instantiateStreaming} features. We use JSC's Wasm::StreamingCompiler to implement them. WebCore feeds bytes from FetchResponse and drives Wasm::StreamingCompiler. * bindings/js/JSDOMGlobalObject.cpp: (WebCore::handleResponseOnStreamingAction): (WebCore::JSDOMGlobalObject::compileStreaming): (WebCore::JSDOMGlobalObject::instantiateStreaming): * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMPromiseDeferred.cpp: * bindings/js/JSDOMWindowBase.cpp: (WebCore::tryAllocate): Deleted. (WebCore::isResponseCorrect): Deleted. (WebCore::handleResponseOnStreamingAction): Deleted. (WebCore::JSDOMWindowBase::compileStreaming): Deleted. (WebCore::JSDOMWindowBase::instantiateStreaming): Deleted. * bindings/js/JSDOMWindowBase.h: * bindings/js/JSWorkerGlobalScopeBase.cpp: * bindings/js/JSWorkletGlobalScopeBase.cpp: Source/WTF: * wtf/PlatformEnable.h: Canonical link: https://commits.webkit.org/233426@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271993 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-01-28 01:31:34 +00:00
wasm/WasmStreamingCompiler.cpp
[WebAssembly] Parse wasm modules in a streaming fashion https://bugs.webkit.org/show_bug.cgi?id=188943 Reviewed by Mark Lam. JSTests: Wasm parsing error should not report the total byte size since streaming parsing does not want to load all the bytes. Add a simple test wasm/stress/streaming-basic.js for initial streaming parsing implementation. * wasm/function-tests/invalid-duplicate-export.js: * wasm/function-tests/memory-alignment.js: (const.op.of.WASM.opcodes): * wasm/function-tests/memory-section-and-import.js: * wasm/function-tests/void-argument-type-should-be-a-validation-error.js: * wasm/js-api/Module-compile.js: (async.testPromiseAPI): * wasm/js-api/element.js: (assert.throws.new.WebAssembly.Module.builder.WebAssembly): (assert.throws): * wasm/js-api/global-error.js: (assert.throws.new.WebAssembly.Module.bin): (assert.throws): * wasm/js-api/table.js: (new.WebAssembly.Module): (assert.throws): (assertBadTableImport): * wasm/js-api/test_Data.js: (DataSectionWithoutMemory): * wasm/js-api/test_Start.js: (InvalidStartFunctionIndex): * wasm/js-api/test_basic_api.js: (const.c.in.constructorProperties.switch): * wasm/js-api/version.js: * wasm/stress/nameSection.wasm: Added. * wasm/stress/streaming-basic.js: Added. (check): Source/JavaScriptCore: This patch adds Wasm::StreamingParser, which parses wasm binary in a streaming fashion. Currently, this StreamingParser is not enabled and integrated. In subsequent patches, we start integrating it into BBQPlan and dropping the old ModuleParser. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * tools/JSDollarVM.cpp: (WTF::WasmStreamingParser::WasmStreamingParser): (WTF::WasmStreamingParser::create): (WTF::WasmStreamingParser::createStructure): (WTF::WasmStreamingParser::streamingParser): (WTF::WasmStreamingParser::finishCreation): (WTF::functionWasmStreamingParserAddBytes): (WTF::functionWasmStreamingParserFinalize): (JSC::functionCreateWasmStreamingParser): (JSC::JSDollarVM::finishCreation): The $vm Wasm::StreamingParser object is introduced for testing purpose. Added new stress test uses this interface to test streaming parser in the JSC shell. * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::BBQPlan): (JSC::Wasm::BBQPlan::parseAndValidateModule): (JSC::Wasm::BBQPlan::prepare): (JSC::Wasm::BBQPlan::compileFunctions): (JSC::Wasm::BBQPlan::complete): (JSC::Wasm::BBQPlan::work): * wasm/WasmBBQPlan.h: BBQPlan has m_source, but once ModuleInformation is parsed, it is no longer necessary. In subsequent patches, we will remove this, and stream the data into the BBQPlan. * wasm/WasmFormat.h: * wasm/WasmModuleInformation.cpp: (JSC::Wasm::ModuleInformation::ModuleInformation): * wasm/WasmModuleInformation.h: One of the largest change in this patch is that ModuleInformation no longer holds source bytes, since source bytes can be added in a streaming fashion. Instead of holding all the source bytes in ModuleInformation, each function (ModuleInformation::functions, FunctionData) should have Vector<uint8_t> for its data. This data is eventually filled by StreamingParser, and compiling a function with this data can be done concurrently with StreamingParser. (JSC::Wasm::ModuleInformation::create): (JSC::Wasm::ModuleInformation::memoryCount const): (JSC::Wasm::ModuleInformation::tableCount const): memoryCount and tableCount should be recorded in ModuleInformation. * wasm/WasmModuleParser.cpp: (JSC::Wasm::ModuleParser::parse): (JSC::Wasm::makeI32InitExpr): Deleted. (JSC::Wasm::ModuleParser::parseType): Deleted. (JSC::Wasm::ModuleParser::parseImport): Deleted. (JSC::Wasm::ModuleParser::parseFunction): Deleted. (JSC::Wasm::ModuleParser::parseResizableLimits): Deleted. (JSC::Wasm::ModuleParser::parseTableHelper): Deleted. (JSC::Wasm::ModuleParser::parseTable): Deleted. (JSC::Wasm::ModuleParser::parseMemoryHelper): Deleted. (JSC::Wasm::ModuleParser::parseMemory): Deleted. (JSC::Wasm::ModuleParser::parseGlobal): Deleted. (JSC::Wasm::ModuleParser::parseExport): Deleted. (JSC::Wasm::ModuleParser::parseStart): Deleted. (JSC::Wasm::ModuleParser::parseElement): Deleted. (JSC::Wasm::ModuleParser::parseCode): Deleted. (JSC::Wasm::ModuleParser::parseInitExpr): Deleted. (JSC::Wasm::ModuleParser::parseGlobalType): Deleted. (JSC::Wasm::ModuleParser::parseData): Deleted. (JSC::Wasm::ModuleParser::parseCustom): Deleted. Extract section parsing code out from ModuleParser. We create SectionParser and ModuleParser uses it. SectionParser is also used by StreamingParser. * wasm/WasmModuleParser.h: (): Deleted. * wasm/WasmNameSection.h: (JSC::Wasm::NameSection::NameSection): (JSC::Wasm::NameSection::create): (JSC::Wasm::NameSection::setHash): Hash calculation is deferred since all the source is not available in streaming parsing. * wasm/WasmNameSectionParser.cpp: (JSC::Wasm::NameSectionParser::parse): * wasm/WasmNameSectionParser.h: Use Ref<NameSection>. * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::work): Wasm::Plan no longer have m_source since data will be eventually filled in a streaming fashion. OMGPlan can get data of the function by using ModuleInformation::functions. * wasm/WasmParser.h: (JSC::Wasm::Parser::source const): (JSC::Wasm::Parser::length const): (JSC::Wasm::Parser::offset const): (JSC::Wasm::Parser::fail const): (JSC::Wasm::makeI32InitExpr): * wasm/WasmPlan.cpp: (JSC::Wasm::Plan::Plan): Wasm::Plan should not have all the source apriori. Streamed data will be pumped from the provider. * wasm/WasmPlan.h: * wasm/WasmSectionParser.cpp: Copied from Source/JavaScriptCore/wasm/WasmModuleParser.cpp. SectionParser is extracted from ModuleParser. And it is used by both the old (currently working) ModuleParser and the new StreamingParser. (JSC::Wasm::SectionParser::parseType): (JSC::Wasm::SectionParser::parseImport): (JSC::Wasm::SectionParser::parseFunction): (JSC::Wasm::SectionParser::parseResizableLimits): (JSC::Wasm::SectionParser::parseTableHelper): (JSC::Wasm::SectionParser::parseTable): (JSC::Wasm::SectionParser::parseMemoryHelper): (JSC::Wasm::SectionParser::parseMemory): (JSC::Wasm::SectionParser::parseGlobal): (JSC::Wasm::SectionParser::parseExport): (JSC::Wasm::SectionParser::parseStart): (JSC::Wasm::SectionParser::parseElement): (JSC::Wasm::SectionParser::parseCode): (JSC::Wasm::SectionParser::parseInitExpr): (JSC::Wasm::SectionParser::parseGlobalType): (JSC::Wasm::SectionParser::parseData): (JSC::Wasm::SectionParser::parseCustom): * wasm/WasmSectionParser.h: Copied from Source/JavaScriptCore/wasm/WasmModuleParser.h. * wasm/WasmStreamingParser.cpp: Added. (JSC::Wasm::parseUInt7): (JSC::Wasm::StreamingParser::fail): (JSC::Wasm::StreamingParser::StreamingParser): (JSC::Wasm::StreamingParser::parseModuleHeader): (JSC::Wasm::StreamingParser::parseSectionID): (JSC::Wasm::StreamingParser::parseSectionSize): (JSC::Wasm::StreamingParser::parseCodeSectionSize): Code section in Wasm binary is specially handled compared with the other sections since it includes a bunch of functions. StreamingParser extracts each function in a streaming fashion and enable streaming validation / compilation of Wasm functions. (JSC::Wasm::StreamingParser::parseFunctionSize): (JSC::Wasm::StreamingParser::parseFunctionPayload): (JSC::Wasm::StreamingParser::parseSectionPayload): (JSC::Wasm::StreamingParser::consume): (JSC::Wasm::StreamingParser::consumeVarUInt32): (JSC::Wasm::StreamingParser::addBytes): (JSC::Wasm::StreamingParser::failOnState): (JSC::Wasm::StreamingParser::finalize): * wasm/WasmStreamingParser.h: Added. (JSC::Wasm::StreamingParser::addBytes): (JSC::Wasm::StreamingParser::errorMessage const): This is our new StreamingParser implementation. StreamingParser::consumeXXX functions get data, and StreamingParser::parseXXX functions parse consumed data. The user of StreamingParser calls StreamingParser::addBytes() to pump the bytes stream into the parser. And once all the data is pumped, the user calls StreamingParser::finalize. StreamingParser is a state machine which feeds on the incoming byte stream. * wasm/js/JSWebAssemblyModule.cpp: (JSC::JSWebAssemblyModule::source const): Deleted. All the source should not be held. * wasm/js/JSWebAssemblyModule.h: * wasm/js/WebAssemblyPrototype.cpp: (JSC::webAssemblyValidateFunc): Source/WTF: Add maxByteLength function to get the maximum size for T. * wtf/LEBDecoder.h: (WTF::LEBDecoder::maxByteLength): (WTF::LEBDecoder::decodeUInt): (WTF::LEBDecoder::decodeInt): Canonical link: https://commits.webkit.org/204074@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235420 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-08-28 06:38:29 +00:00
wasm/WasmStreamingParser.cpp
WebAssembly: add support for stream APIs https://bugs.webkit.org/show_bug.cgi?id=173105 Reviewed by Keith Miller. .: * Source/cmake/OptionsFTW.cmake: * Source/cmake/WebKitFeatures.cmake: JSTests: * wasm/stress/resources/tsf.wasm: Added. * wasm/stress/wasm-streaming-compiler-compile.js: Added. (shouldBe): (slice): (async main): (main.catch): * wasm/stress/wasm-streaming-compiler-instantiate.js: Added. (shouldBe): (slice): (async main.): (async main): (main.catch): LayoutTests/imported/w3c: * web-platform-tests/wasm/wasm_stream_compile_test-expected.txt: * web-platform-tests/wasm/wasm_stream_compile_test.html: * web-platform-tests/wasm/wasm_stream_instantiate_test-expected.txt: * web-platform-tests/wasm/wasm_stream_instantiate_test.html: * web-platform-tests/wasm/webapi/abort.any-expected.txt: * web-platform-tests/wasm/webapi/abort.any.worker-expected.txt: * web-platform-tests/wasm/webapi/body.any-expected.txt: * web-platform-tests/wasm/webapi/body.any.worker-expected.txt: * web-platform-tests/wasm/webapi/contenttype.any-expected.txt: * web-platform-tests/wasm/webapi/contenttype.any.worker-expected.txt: * web-platform-tests/wasm/webapi/empty-body.any-expected.txt: * web-platform-tests/wasm/webapi/empty-body.any.worker-expected.txt: * web-platform-tests/wasm/webapi/historical.any-expected.txt: * web-platform-tests/wasm/webapi/historical.any.worker-expected.txt: * web-platform-tests/wasm/webapi/idlharness.any-expected.txt: * web-platform-tests/wasm/webapi/idlharness.any.worker-expected.txt: * web-platform-tests/wasm/webapi/instantiateStreaming-bad-imports.any-expected.txt: * web-platform-tests/wasm/webapi/instantiateStreaming-bad-imports.any.worker-expected.txt: * web-platform-tests/wasm/webapi/instantiateStreaming.any-expected.txt: * web-platform-tests/wasm/webapi/instantiateStreaming.any.worker-expected.txt: * web-platform-tests/wasm/webapi/invalid-args.any-expected.txt: * web-platform-tests/wasm/webapi/invalid-args.any.worker-expected.txt: * web-platform-tests/wasm/webapi/invalid-code.any-expected.txt: * web-platform-tests/wasm/webapi/invalid-code.any.worker-expected.txt: * web-platform-tests/wasm/webapi/modified-contenttype.any-expected.txt: * web-platform-tests/wasm/webapi/modified-contenttype.any.worker-expected.txt: * web-platform-tests/wasm/webapi/origin.sub.any-expected.txt: * web-platform-tests/wasm/webapi/origin.sub.any.worker-expected.txt: * web-platform-tests/wasm/webapi/rejected-arg.any-expected.txt: * web-platform-tests/wasm/webapi/rejected-arg.any.worker-expected.txt: * web-platform-tests/wasm/webapi/status.any-expected.txt: * web-platform-tests/wasm/webapi/status.any.worker-expected.txt: Source/JavaScriptCore: This patch implements WebAssembly.{compileStreaming,instantiateStreaming}. JavaScriptCore offers Wasm::StreamingCompiler interface to WebCore, so that WebCore can feed FetchResponse and compile wasm code in a streaming fashion. Wasm::StreamingCompiler drives Wasm::LLIntPlan while it does not use Wasm::Worklist since currently Wasm::Worklist is not suitable abstraction for streaming compilation which generates compilation tasks incrementally. Instead, Wasm::StreamingCompiler generates Wasm::StreamingPlan and enqueues them to Wasm::Worklist, and each StreamingPlan compiles one function at a time. And we gather these compiled functions into the one LLIntPlan and finally Wasm::StreamingCompiler completes Wasm::LLIntPlan. We already have Wasm::StreamingParser, which is designed for streaming compilation. We can pass bytes to this parser, and this parser invokes a callback when a new wasm function is found. Then, Wasm::StreamingCompiler generates Wasm::StreamingPlan for that. We add WasmStreamingCompiler JS objects to JSC shell to test streaming compilation easily. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * builtins/WebAssembly.js: (compileStreaming): (instantiateStreaming): * runtime/DeferredWorkTimer.cpp: (JSC::DeferredWorkTimer::cancelPendingWork): * runtime/DeferredWorkTimer.h: * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * runtime/JSGlobalObject.h: * runtime/OptionsList.h: * tools/JSDollarVM.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): (JSC::JSDollarVM::finishCreation): * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::BBQPlan): * wasm/WasmBBQPlan.h: * wasm/WasmCodeBlock.cpp: (JSC::Wasm::CodeBlock::CodeBlock): * wasm/WasmEntryPlan.cpp: (JSC::Wasm::EntryPlan::EntryPlan): * wasm/WasmEntryPlan.h: * wasm/WasmLLIntPlan.cpp: (JSC::Wasm::LLIntPlan::LLIntPlan): (JSC::Wasm::LLIntPlan::didCompleteCompilation): (JSC::Wasm::LLIntPlan::completeInStreaming): (JSC::Wasm::LLIntPlan::didCompileFunctionInStreaming): (JSC::Wasm::LLIntPlan::didFailInStreaming): * wasm/WasmLLIntPlan.h: * wasm/WasmModule.cpp: (JSC::Wasm::Module::validateSync): (JSC::Wasm::Module::validateAsync): * wasm/WasmStreamingCompiler.cpp: Added. (JSC::Wasm::StreamingCompiler::StreamingCompiler): (JSC::Wasm::StreamingCompiler::~StreamingCompiler): (JSC::Wasm::StreamingCompiler::create): (JSC::Wasm::StreamingCompiler::didReceiveFunctionData): (JSC::Wasm::StreamingCompiler::didCompileFunction): (JSC::Wasm::StreamingCompiler::didFinishParsing): (JSC::Wasm::StreamingCompiler::completeIfNecessary): (JSC::Wasm::StreamingCompiler::didComplete): (JSC::Wasm::StreamingCompiler::finalize): (JSC::Wasm::StreamingCompiler::fail): (JSC::Wasm::StreamingCompiler::cancel): * wasm/WasmStreamingCompiler.h: Added. * wasm/WasmStreamingParser.cpp: * wasm/WasmStreamingParser.h: * wasm/WasmStreamingPlan.cpp: Copied from Source/JavaScriptCore/builtins/WebAssembly.js. (JSC::Wasm::StreamingPlan::StreamingPlan): (JSC::Wasm::StreamingPlan::work): * wasm/WasmStreamingPlan.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssembly.h. * wasm/js/JSWebAssembly.cpp: (JSC::JSWebAssembly::finishCreation): (JSC::JSWebAssembly::instantiateForStreaming): (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/JSWebAssembly.h: Source/WebCore: Since WebAssembly.{compileStreaming,instantiateStreaming} needs to handle FetchResponse which is WebCore type, they need to be implemented in WebCore side. To achieve that, JSC offers callback to JSGlobalObject, and WebCore JSDOMGlobalObject can implement them to offer WebAssembly.{compileStreaming,instantiateStreaming} features. We use JSC's Wasm::StreamingCompiler to implement them. WebCore feeds bytes from FetchResponse and drives Wasm::StreamingCompiler. * bindings/js/JSDOMGlobalObject.cpp: (WebCore::handleResponseOnStreamingAction): (WebCore::JSDOMGlobalObject::compileStreaming): (WebCore::JSDOMGlobalObject::instantiateStreaming): * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMPromiseDeferred.cpp: * bindings/js/JSDOMWindowBase.cpp: (WebCore::tryAllocate): Deleted. (WebCore::isResponseCorrect): Deleted. (WebCore::handleResponseOnStreamingAction): Deleted. (WebCore::JSDOMWindowBase::compileStreaming): Deleted. (WebCore::JSDOMWindowBase::instantiateStreaming): Deleted. * bindings/js/JSDOMWindowBase.h: * bindings/js/JSWorkerGlobalScopeBase.cpp: * bindings/js/JSWorkletGlobalScopeBase.cpp: Source/WTF: * wtf/PlatformEnable.h: Canonical link: https://commits.webkit.org/233426@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271993 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-01-28 01:31:34 +00:00
wasm/WasmStreamingPlan.cpp
WebAssembly: no VM / JS version of everything but Instance https://bugs.webkit.org/show_bug.cgi?id=177473 Reviewed by Filip Pizlo, Saam Barati. JSTests: - Exceeding max on memory growth now returns a range error as per spec. This is a (very minor) breaking change: it used to throw OOM error. Update the corresponding test. * wasm/js-api/memory-grow.js: (assertEq): * wasm/js-api/table.js: (assert.throws): Source/JavaScriptCore: This change entails cleaning up and splitting a bunch of code which we had intertwined between C++ classes which represent JS objects, and pure C++ implementation objects. This specific change goes most of the way towards allowing JSC's WebAssembly to work without VM / JS, up to but excluding JSWebAssemblyInstance (there's Wasm::Instance, but it's not *the* thing yet). Because of this we still have a few FIXME identifying places that need to change. A follow-up change will go the rest of the way. I went about this change in the simplest way possible: grep the JavaScriptCore/wasm directory for "JS[^C_]" as well as "VM" and exclude the /js/ sub-directory (which contains the JS implementation of WebAssembly). None of this change removes the need for a JIT entitlement to be able to use WebAssembly. We don't have an interpreter, the process therefore still needs to be allowed to JIT to use these pure-C++ APIs. Interesting things to note: - Remove VM from Plan and associated places. It can just live as a capture in the callback lambda if it's needed. - Wasm::Memory shouldn't require a VM. It was only used to ask the GC to collect. We now instead pass two lambdas at construction time for this purpose: one to notify of memory pressure, and the other to ask for syncrhonous memory reclamation. This allows whoever creates the memory to dictate how to react to both these cases, and for a JS embedding that's to call the GC (async or sync, respectively). - Move grow logic from JSWebAssemblyMemory to Wasm::Memory::grow. Use Expected there, with an enum class for failure types. - Exceeding max on memory growth now returns a range error as per spec. This is a (very minor) breaking change: it used to throw OOM error. Update the corresponding test. - When generating the grow_memory opcode, no need to get the VM. Instead, reach directly for Wasm::Memory and grow it. - JSWebAssemblyMemory::grow can now always throw on failure, because it's only ever called from JS (not from grow_memory as before). - Wasm::Memory now takes a callback for successful growth. This allows JS wrappers to register themselves when growth succeeds without Wasm::Memory knowning anything about JS. It'll also allow creating a list of callbacks for when we add thread support (we'll want to notify many wrappers, all under a lock). - Wasm::Memory is now back to being the source of truth about address / size, used directly by generated code instead of JSWebAssemblyMemory. - Move wasmToJS from the general WasmBinding header to its own header under wasm/js. It's only used by wasm/js/JSWebAssemblyCodeBlock.cpp, and uses VM, and therefore isn't general WebAssembly. - Make Wasm::Context an actual type (just a struct holding a JSWebAssemlyInstance for now) instead of an alias for that. Notably this doesn't add anything to the Context and doesn't change what actually gets passed around in JIT code (fast TLS or registers) because these changes potentially impact performance. The entire purpose of this change is to allow passing Wasm::Context around without having to know about VM. Since VM contains a Wasm::Context the JS embedding is effectively the same, but with this setup a non-JS embedding is much better off. - Move JSWebAssembly into the JS folder. - OMGPlan: use Wasm::CodeBlock directly instead of JSWebAssemblyCodeBlock. - wasm->JS stubs are now on the instance's tail as raw pointers, instead of being on JSWebAssemblyCodeBlock, and are now called wasm->Embedder stubs. The owned reference is still on JSWebAssemblyCodeBlock, and is still called wasm->JS stub. This move means that the embedder must, after creating a Wasm::CodeBlock, somehow create the stubs to call back into the embedder. This removes an indirection in the generated code because the B3 IR generator now reaches into the instance instead of JSWebAssemblyCodeBlock. - Move more CodeBlock things. Compilation completion is now marked by its own atomic<bool> flag instead of a nullptr plan: that required using a lock, and was causing a deadlock in stack-trace.js because before my changes JSWebAssemblyCodeBlock did its own completion checking separately from Wasm::CodeBlock, without getting the lock. Now that everything points to Wasm::CodeBlock and there's no cached completion marker, the lock was being acquired in a sanity-check assertion. - Embedder -> Wasm wrappers are now generated through a function that's passed in at compilation time, instead of being hard-coded as a JS -> Wasm wrapper. - WasmMemory doens't need to know about fault handling thunks. Only the IR generator should know, and should make sure that the exception throwing thunk is generated if any memory is present (note: with signal handling not all of them generate an exception check). - Make exception throwing pluggable: instead of having a hard-coded JS-specific lambda we now have a regular C++ function being called from JIT code when a WebAssembly exception is thrown. This allows any embedder to get called as they wish. For now a process can only have a single of these functions (i.e. only one embedder per process) because the trap handler is a singleton. That can be fixed in in #177475. - Create WasmEmbedder.h where all embedder plugging will live. - Split up JSWebAssemblyTable into Wasm::Table which is refcounted. JSWebAssemblyTable now only contains the JS functions in the table, and Wasm::Table is what's used by the JIT code to lookup where to call and do the instance check (for context switch). Note that this creates an extra allocation for all the instances in Wasm::Table, and in exchange removes an indirection in JIT code because the instance used to be obtained off of the JS function. Also note that it's the embedder than keeps the instances alive, not Wasm::Table (which holds a dumb pointer to the instance), because doing otherwise would cause reference cycles. - Add WasmInstance. It doesn't do much for now, owns globals. - JSWebAssembly instance now doesn't just contain the imported functions as JSObjects, it also has the corresponding import's instance and wasm entrypoint. This triples the space allocated per instance's imported function, but there shouldn't be that many imports. This has two upsides: it creates smaller and faster code, and makes is easier to disassociate embedder-specific things from embedder-neutral things. The small / faster win is in two places: B3 IR generator only needs offsetOfImportFunction for the call opcode (when the called index is an import) to know whether the import is wasm->wasm or wasm->embedder (this isn't known at compile-time because it's dependent on the import object), this is now done by seeing if that import function has an associated target instance (only wasm->wasm does); the other place is wasmBinding which uses offsetOfImportFunction to figure out the wasm->wasm target instance, and then gets WebAssemblyFunction::offsetOfWasmEntrypointLoadLocation to do a tail call. The disassociation comes because the target instance can be Wasm::Instance once we change what the Context is, and WasmEntrypointLoadLocation is already embedder-independent. As a next step I can move this tail allocation from JSWebAssemblyInstance to Wasm::Instance, and leave importFunction in as an opaque pointer which is embedder-specific, and in JS will remain WriteBarrier<JSObject>. - Rename VMEntryFrame to EntryFrame, and in many places pass a pointer to it around instead of VM. This is a first step in allowing entry frames which aren't stored on VM, but which are instead stored in an embedder-specific location. That change won't really affect JS except through code churn, but will allow WebAssembly to use some machinery in a generic manner without having a VM. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/PolymorphicAccess.cpp: (JSC::AccessGenerationState::emitExplicitExceptionHandler): * debugger/Debugger.cpp: (JSC::Debugger::stepOutOfFunction): (JSC::Debugger::returnEvent): (JSC::Debugger::unwindEvent): (JSC::Debugger::didExecuteProgram): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::compileExceptionHandlers): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExit.cpp: (JSC::DFG::OSRExit::compileOSRExit): (JSC::DFG::OSRExit::compileExit): * dfg/DFGThunks.cpp: (JSC::DFG::osrEntryThunkGenerator): * ftl/FTLCompile.cpp: (JSC::FTL::compile): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileStub): * interpreter/CallFrame.cpp: (JSC::CallFrame::wasmAwareLexicalGlobalObject): (JSC::CallFrame::callerFrame): (JSC::CallFrame::unsafeCallerFrame): * interpreter/CallFrame.h: (JSC::ExecState::callerFrame const): (JSC::ExecState::callerFrameOrEntryFrame const): (JSC::ExecState::unsafeCallerFrameOrEntryFrame const): * interpreter/FrameTracers.h: (JSC::NativeCallFrameTracer::NativeCallFrameTracer): (JSC::NativeCallFrameTracerWithRestore::NativeCallFrameTracerWithRestore): (JSC::NativeCallFrameTracerWithRestore::~NativeCallFrameTracerWithRestore): * interpreter/Interpreter.cpp: (JSC::UnwindFunctor::operator() const): (JSC::UnwindFunctor::copyCalleeSavesToEntryFrameCalleeSavesBuffer const): (JSC::Interpreter::unwind): * interpreter/StackVisitor.cpp: (JSC::StackVisitor::StackVisitor): (JSC::StackVisitor::gotoNextFrame): (JSC::StackVisitor::readNonInlinedFrame): (JSC::StackVisitor::Frame::dump const): * interpreter/StackVisitor.h: (JSC::StackVisitor::Frame::callerIsEntryFrame const): * interpreter/VMEntryRecord.h: (JSC::VMEntryRecord::prevTopEntryFrame): (JSC::VMEntryRecord::unsafePrevTopEntryFrame): (JSC::EntryFrame::vmEntryRecordOffset): * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::restoreCalleeSavesFromEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::loadWasmContextInstance): (JSC::AssemblyHelpers::storeWasmContextInstance): (JSC::AssemblyHelpers::loadWasmContextInstanceNeedsMacroScratchRegister): (JSC::AssemblyHelpers::storeWasmContextInstanceNeedsMacroScratchRegister): (JSC::AssemblyHelpers::copyCalleeSavesToEntryFrameCalleeSavesBufferImpl): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::copyCalleeSavesToVMEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::copyCalleeSavesToEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::copyCalleeSavesFromFrameOrRegisterToEntryFrameCalleeSavesBuffer): * jit/JIT.cpp: (JSC::JIT::emitEnterOptimizationCheck): (JSC::JIT::privateCompileExceptionHandlers): * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_throw): (JSC::JIT::emit_op_catch): (JSC::JIT::emitSlow_op_loop_hint): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_throw): (JSC::JIT::emit_op_catch): * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::throwExceptionFromCallSlowPathGenerator): (JSC::nativeForGenerator): * jsc.cpp: (functionDumpCallFrame): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntThunks.cpp: (JSC::vmEntryRecord): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * runtime/Options.cpp: (JSC::recomputeDependentOptions): * runtime/Options.h: * runtime/SamplingProfiler.cpp: (JSC::FrameWalker::FrameWalker): (JSC::FrameWalker::advanceToParentFrame): (JSC::SamplingProfiler::processUnverifiedStackTraces): * runtime/ThrowScope.cpp: (JSC::ThrowScope::~ThrowScope): * runtime/VM.cpp: (JSC::VM::VM): (JSC::VM::~VM): * runtime/VM.h: (JSC::VM::topEntryFrameOffset): * runtime/VMTraps.cpp: (JSC::isSaneFrame): (JSC::VMTraps::tryInstallTrapBreakpoints): (JSC::VMTraps::invalidateCodeBlocksOnStack): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::restoreWasmContextInstance): (JSC::Wasm::B3IRGenerator::B3IRGenerator): (JSC::Wasm::B3IRGenerator::restoreWebAssemblyGlobalState): (JSC::Wasm::B3IRGenerator::addGrowMemory): (JSC::Wasm::B3IRGenerator::addCurrentMemory): (JSC::Wasm::B3IRGenerator::addCall): (JSC::Wasm::B3IRGenerator::addCallIndirect): (JSC::Wasm::parseAndCompile): * wasm/WasmB3IRGenerator.h: * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::BBQPlan): (JSC::Wasm::BBQPlan::compileFunctions): (JSC::Wasm::BBQPlan::complete): * wasm/WasmBBQPlan.h: * wasm/WasmBBQPlanInlines.h: (JSC::Wasm::BBQPlan::initializeCallees): * wasm/WasmBinding.cpp: (JSC::Wasm::wasmToWasm): * wasm/WasmBinding.h: * wasm/WasmCodeBlock.cpp: (JSC::Wasm::CodeBlock::create): (JSC::Wasm::CodeBlock::CodeBlock): (JSC::Wasm::CodeBlock::compileAsync): (JSC::Wasm::CodeBlock::setCompilationFinished): * wasm/WasmCodeBlock.h: (JSC::Wasm::CodeBlock::offsetOfImportStubs): (JSC::Wasm::CodeBlock::allocationSize): (JSC::Wasm::CodeBlock::importWasmToEmbedderStub): (JSC::Wasm::CodeBlock::offsetOfImportWasmToEmbedderStub): (JSC::Wasm::CodeBlock::wasmToJSCallStubForImport): (JSC::Wasm::CodeBlock::compilationFinished): (JSC::Wasm::CodeBlock::jsEntrypointCalleeFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::wasmEntrypointCalleeFromFunctionIndexSpace): * wasm/WasmContext.cpp: (JSC::Wasm::Context::useFastTLS): (JSC::Wasm::Context::load const): (JSC::Wasm::Context::store): * wasm/WasmContext.h: * wasm/WasmEmbedder.h: Copied from Source/JavaScriptCore/wasm/WasmContext.h. * wasm/WasmFaultSignalHandler.cpp: * wasm/WasmFaultSignalHandler.h: * wasm/WasmFormat.h: * wasm/WasmInstance.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. (JSC::Wasm::Instance::Instance): (JSC::Wasm::Instance::~Instance): (JSC::Wasm::Instance::extraMemoryAllocated const): * wasm/WasmInstance.h: Added. (JSC::Wasm::Instance::create): (JSC::Wasm::Instance::finalizeCreation): (JSC::Wasm::Instance::module): (JSC::Wasm::Instance::codeBlock): (JSC::Wasm::Instance::memory): (JSC::Wasm::Instance::table): (JSC::Wasm::Instance::loadI32Global const): (JSC::Wasm::Instance::loadI64Global const): (JSC::Wasm::Instance::loadF32Global const): (JSC::Wasm::Instance::loadF64Global const): (JSC::Wasm::Instance::setGlobal): (JSC::Wasm::Instance::offsetOfCachedStackLimit): (JSC::Wasm::Instance::cachedStackLimit const): (JSC::Wasm::Instance::setCachedStackLimit): * wasm/WasmMemory.cpp: (JSC::Wasm::Memory::Memory): (JSC::Wasm::Memory::create): (JSC::Wasm::Memory::~Memory): (JSC::Wasm::Memory::grow): * wasm/WasmMemory.h: (JSC::Wasm::Memory::offsetOfMemory): (JSC::Wasm::Memory::offsetOfSize): * wasm/WasmMemoryInformation.cpp: (JSC::Wasm::PinnedRegisterInfo::get): (JSC::Wasm::PinnedRegisterInfo::PinnedRegisterInfo): * wasm/WasmMemoryInformation.h: (JSC::Wasm::PinnedRegisterInfo::toSave const): * wasm/WasmMemoryMode.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. (JSC::Wasm::makeString): * wasm/WasmMemoryMode.h: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. * wasm/WasmModule.cpp: (JSC::Wasm::makeValidationCallback): (JSC::Wasm::Module::validateSync): (JSC::Wasm::Module::validateAsync): (JSC::Wasm::Module::getOrCreateCodeBlock): (JSC::Wasm::Module::compileSync): (JSC::Wasm::Module::compileAsync): * wasm/WasmModule.h: * wasm/WasmModuleParser.cpp: (JSC::Wasm::ModuleParser::parseTableHelper): * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::OMGPlan): (JSC::Wasm::OMGPlan::runForIndex): * wasm/WasmOMGPlan.h: * wasm/WasmPageCount.h: (JSC::Wasm::PageCount::isValid const): * wasm/WasmPlan.cpp: (JSC::Wasm::Plan::Plan): (JSC::Wasm::Plan::runCompletionTasks): (JSC::Wasm::Plan::addCompletionTask): (JSC::Wasm::Plan::tryRemoveContextAndCancelIfLast): * wasm/WasmPlan.h: (JSC::Wasm::Plan::dontFinalize): * wasm/WasmSignature.cpp: * wasm/WasmSignature.h: * wasm/WasmTable.cpp: Added. (JSC::Wasm::Table::create): (JSC::Wasm::Table::~Table): (JSC::Wasm::Table::Table): (JSC::Wasm::Table::grow): (JSC::Wasm::Table::clearFunction): (JSC::Wasm::Table::setFunction): * wasm/WasmTable.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyTable.h. (JSC::Wasm::Table::maximum const): (JSC::Wasm::Table::size const): (JSC::Wasm::Table::offsetOfSize): (JSC::Wasm::Table::offsetOfFunctions): (JSC::Wasm::Table::offsetOfInstances): (JSC::Wasm::Table::isValidSize): * wasm/WasmThunks.cpp: (JSC::Wasm::throwExceptionFromWasmThunkGenerator): (JSC::Wasm::triggerOMGTierUpThunkGenerator): (JSC::Wasm::Thunks::setThrowWasmException): (JSC::Wasm::Thunks::throwWasmException): * wasm/WasmThunks.h: * wasm/WasmWorklist.cpp: (JSC::Wasm::Worklist::stopAllPlansForContext): * wasm/WasmWorklist.h: * wasm/js/JSToWasm.cpp: Added. (JSC::Wasm::createJSToWasmWrapper): * wasm/js/JSToWasm.h: Copied from Source/JavaScriptCore/wasm/WasmBinding.h. * wasm/js/JSWebAssembly.cpp: Renamed from Source/JavaScriptCore/wasm/JSWebAssembly.cpp. * wasm/js/JSWebAssembly.h: Renamed from Source/JavaScriptCore/wasm/JSWebAssembly.h. * wasm/js/JSWebAssemblyCodeBlock.cpp: (JSC::JSWebAssemblyCodeBlock::create): (JSC::JSWebAssemblyCodeBlock::JSWebAssemblyCodeBlock): * wasm/js/JSWebAssemblyCodeBlock.h: * wasm/js/JSWebAssemblyInstance.cpp: (JSC::JSWebAssemblyInstance::JSWebAssemblyInstance): (JSC::JSWebAssemblyInstance::finishCreation): (JSC::JSWebAssemblyInstance::visitChildren): (JSC::JSWebAssemblyInstance::finalizeCreation): (JSC::JSWebAssemblyInstance::create): * wasm/js/JSWebAssemblyInstance.h: (JSC::JSWebAssemblyInstance::instance): (JSC::JSWebAssemblyInstance::context const): (JSC::JSWebAssemblyInstance::table): (JSC::JSWebAssemblyInstance::webAssemblyToJSCallee): (JSC::JSWebAssemblyInstance::setMemory): (JSC::JSWebAssemblyInstance::offsetOfTail): (JSC::JSWebAssemblyInstance::importFunctionInfo): (JSC::JSWebAssemblyInstance::offsetOfTargetInstance): (JSC::JSWebAssemblyInstance::offsetOfWasmEntrypoint): (JSC::JSWebAssemblyInstance::offsetOfImportFunction): (JSC::JSWebAssemblyInstance::importFunction): (JSC::JSWebAssemblyInstance::internalMemory): (JSC::JSWebAssemblyInstance::wasmCodeBlock const): (JSC::JSWebAssemblyInstance::offsetOfWasmTable): (JSC::JSWebAssemblyInstance::offsetOfCallee): (JSC::JSWebAssemblyInstance::offsetOfGlobals): (JSC::JSWebAssemblyInstance::offsetOfWasmCodeBlock): (JSC::JSWebAssemblyInstance::offsetOfWasmMemory): (JSC::JSWebAssemblyInstance::cachedStackLimit const): (JSC::JSWebAssemblyInstance::setCachedStackLimit): (JSC::JSWebAssemblyInstance::wasmMemory): (JSC::JSWebAssemblyInstance::wasmModule): (JSC::JSWebAssemblyInstance::allocationSize): (JSC::JSWebAssemblyInstance::module const): * wasm/js/JSWebAssemblyMemory.cpp: (JSC::JSWebAssemblyMemory::create): (JSC::JSWebAssemblyMemory::adopt): (JSC::JSWebAssemblyMemory::JSWebAssemblyMemory): (JSC::JSWebAssemblyMemory::grow): (JSC::JSWebAssemblyMemory::growSuccessCallback): * wasm/js/JSWebAssemblyMemory.h: * wasm/js/JSWebAssemblyModule.cpp: (JSC::JSWebAssemblyModule::moduleInformation const): (JSC::JSWebAssemblyModule::exportSymbolTable const): (JSC::JSWebAssemblyModule::signatureIndexFromFunctionIndexSpace const): (JSC::JSWebAssemblyModule::callee const): (JSC::JSWebAssemblyModule::codeBlock): (JSC::JSWebAssemblyModule::module): * wasm/js/JSWebAssemblyModule.h: * wasm/js/JSWebAssemblyTable.cpp: (JSC::JSWebAssemblyTable::create): (JSC::JSWebAssemblyTable::JSWebAssemblyTable): (JSC::JSWebAssemblyTable::visitChildren): (JSC::JSWebAssemblyTable::grow): (JSC::JSWebAssemblyTable::getFunction): (JSC::JSWebAssemblyTable::clearFunction): (JSC::JSWebAssemblyTable::setFunction): * wasm/js/JSWebAssemblyTable.h: (JSC::JSWebAssemblyTable::isValidSize): (JSC::JSWebAssemblyTable::maximum const): (JSC::JSWebAssemblyTable::size const): (JSC::JSWebAssemblyTable::table): * wasm/js/WasmToJS.cpp: Copied from Source/JavaScriptCore/wasm/WasmBinding.cpp. (JSC::Wasm::materializeImportJSCell): (JSC::Wasm::wasmToJS): (JSC::Wasm::wasmToJSException): * wasm/js/WasmToJS.h: Copied from Source/JavaScriptCore/wasm/WasmBinding.h. * wasm/js/WebAssemblyFunction.cpp: (JSC::callWebAssemblyFunction): * wasm/js/WebAssemblyInstanceConstructor.cpp: (JSC::constructJSWebAssemblyInstance): * wasm/js/WebAssemblyMemoryConstructor.cpp: (JSC::constructJSWebAssemblyMemory): * wasm/js/WebAssemblyMemoryPrototype.cpp: (JSC::webAssemblyMemoryProtoFuncGrow): * wasm/js/WebAssemblyModuleConstructor.cpp: (JSC::constructJSWebAssemblyModule): (JSC::WebAssemblyModuleConstructor::createModule): * wasm/js/WebAssemblyModuleConstructor.h: * wasm/js/WebAssemblyModuleRecord.cpp: (JSC::WebAssemblyModuleRecord::link): (JSC::WebAssemblyModuleRecord::evaluate): * wasm/js/WebAssemblyPrototype.cpp: (JSC::webAssemblyCompileFunc): (JSC::instantiate): (JSC::compileAndInstantiate): (JSC::webAssemblyValidateFunc): * wasm/js/WebAssemblyTableConstructor.cpp: (JSC::constructJSWebAssemblyTable): * wasm/js/WebAssemblyWrapperFunction.cpp: (JSC::WebAssemblyWrapperFunction::create): Source/WebCore: * ForwardingHeaders/wasm/WasmModule.h: Added. This used to be included in JSWebAssemblyModule.h. * bindings/js/SerializedScriptValue.cpp: Update postMessage code according to C++ API changes. Canonical link: https://commits.webkit.org/194750@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223738 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-20 02:23:29 +00:00
wasm/WasmTable.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
wasm/WasmThunks.cpp
[JSC] OSR entry to Wasm OMG https://bugs.webkit.org/show_bug.cgi?id=200362 Reviewed by Michael Saboff. JSTests: * wasm/stress/osr-entry-basic.js: Added. (instance.exports.loop): * wasm/stress/osr-entry-many-locals-f32.js: Added. * wasm/stress/osr-entry-many-locals-f64.js: Added. * wasm/stress/osr-entry-many-locals-i32.js: Added. * wasm/stress/osr-entry-many-locals-i64.js: Added. * wasm/stress/osr-entry-many-stacks-f32.js: Added. * wasm/stress/osr-entry-many-stacks-f64.js: Added. * wasm/stress/osr-entry-many-stacks-i32.js: Added. * wasm/stress/osr-entry-many-stacks-i64.js: Added. Source/JavaScriptCore: This patch implements Wasm OSR entry mechanism from BBQ tier to OMG tier. We found that one of JetStream2 test heavily relies on OSR entry feature. gcc-loops-wasm consumes most of time in BBQ tier since one of the function takes significantly long time. And since we did not have OSR entry feature, we cannot use OMG function until that BBQ function finishes. To implement Wasm OSR feature, we first capture all locals and stacks in the patchpoint to generate the stackmap. Once the threshold is crossed, the patchpoint calls `MacroAssembler::probe` feature to capture whole register context, and C++ runtime function reads stackmap and Probe::Context to perform OSR entry. This patch intentionally makes OSR entry written in C++ runtime side as much as possible to make it easily reusable for the other tiers. For example, we are planning to introduce Wasm interpreter, and it can easily use this tier-up function. Because of this simplicity, this generic implementation can cover both BBQ Air and BBQ B3 tier-up features. So, in the feature, it is possible that we revive BBQ B3, and construct the wasm pipeline like, interpreter->BBQ B3->OMG B3. To generate OMG code for OSR entry, we add a new mode OMGForOSREntry, which mimics the FTLForOSREntry. In FTLForOSREntry, we cut unrelated blocks including the usual entry point in DFG tier and later convert graph to SSA. This is possible because DFG is not SSA. On the other hand, B3 is SSA and we cannot take the same thing without a hack. This patch introduce a hack: making all wasm locals and stack values B3::Variable for OMGForOSREntry mode. Then, we can cut blocks easily and we can generate the B3 graph without doing reachability analysis from the OSR entry point. B3 will remove unreachable blocks later. Tier-up function mimics DFG->FTL OSR entry heuristics and threshold as much as possible. And this patch adjusts the tier-up count threshold to make it close to DFG->FTL ones. Wasm tier-up is now using ExecutionCounter, which is inherited from Wasm::TierUpCount. Since wasm can execute concurrently, the tier-up counter can be racily updated. But this is OK in practice. Even if we see some more tier-up function calls or tier-up function calls are delayed, the critical part is guarded by a lock in tier-up function. In iMac Pro, it shows ~4x runtime improvement for gcc-loops-wasm. On iOS device (iPhone XR), we saw ~2x improvement. ToT: HashSet-wasm:Score: 24.6pt stdev=4.6% :Time:Geometric: 204ms stdev=4.4% Runtime:Time: 689ms stdev=1.0% Startup:Time: 60.3ms stdev=8.4% gcc-loops-wasm:Score: 8.41pt stdev=6.7% :Time:Geometric: 597ms stdev=6.5% Runtime:Time: 8.509s stdev=0.7% Startup:Time: 42ms stdev=12.4% quicksort-wasm:Score: 347pt stdev=20.9% :Time:Geometric: 15ms stdev=18.6% Runtime:Time: 28.2ms stdev=7.9% Startup:Time: 8.2ms stdev=35.0% richards-wasm:Score: 77.6pt stdev=4.5% :Time:Geometric: 64.6ms stdev=4.4% Runtime:Time: 544ms stdev=3.3% Startup:Time: 7.67ms stdev=6.7% tsf-wasm:Score: 47.9pt stdev=4.5% :Time:Geometric: 104ms stdev=4.8% Runtime:Time: 259ms stdev=4.4% Startup:Time: 42.2ms stdev=8.5% Patched: HashSet-wasm:Score: 24.1pt stdev=4.1% :Time:Geometric: 208ms stdev=4.1% Runtime:Time: 684ms stdev=1.1% Startup:Time: 63.2ms stdev=8.1% gcc-loops-wasm:Score: 15.7pt stdev=5.1% :Time:Geometric: 319ms stdev=5.3% Runtime:Time: 2.491s stdev=0.7% Startup:Time: 41ms stdev=11.0% quicksort-wasm:Score: 353pt stdev=13.7% :Time:Geometric: 14ms stdev=12.7% Runtime:Time: 26.2ms stdev=2.9% Startup:Time: 8.0ms stdev=23.7% richards-wasm:Score: 77.4pt stdev=5.3% :Time:Geometric: 64.7ms stdev=5.3% Runtime:Time: 536ms stdev=1.5% Startup:Time: 7.83ms stdev=9.6% tsf-wasm:Score: 47.3pt stdev=5.7% :Time:Geometric: 106ms stdev=6.1% Runtime:Time: 250ms stdev=3.5% Startup:Time: 45ms stdev=13.8% * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/MacroAssemblerARM64.h: (JSC::MacroAssemblerARM64::branchAdd32): * b3/B3ValueRep.h: * bytecode/CodeBlock.h: * bytecode/ExecutionCounter.cpp: (JSC::applyMemoryUsageHeuristics): (JSC::ExecutionCounter<countingVariant>::setThreshold): * bytecode/ExecutionCounter.h: (JSC::ExecutionCounter::clippedThreshold): * dfg/DFGJITCode.h: * dfg/DFGOperations.cpp: * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::prologueStackPointerDelta): * runtime/Options.h: * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::createStack): (JSC::Wasm::AirIRGenerator::emitPatchpoint): (JSC::Wasm::AirIRGenerator::outerLoopIndex const): (JSC::Wasm::AirIRGenerator::AirIRGenerator): (JSC::Wasm::AirIRGenerator::emitEntryTierUpCheck): (JSC::Wasm::AirIRGenerator::emitLoopTierUpCheck): (JSC::Wasm::AirIRGenerator::addLoop): (JSC::Wasm::AirIRGenerator::addElse): (JSC::Wasm::AirIRGenerator::addBranch): (JSC::Wasm::AirIRGenerator::addSwitch): (JSC::Wasm::AirIRGenerator::endBlock): (JSC::Wasm::AirIRGenerator::addEndToUnreachable): (JSC::Wasm::AirIRGenerator::unifyValuesWithBlock): (JSC::Wasm::AirIRGenerator::dump): (JSC::Wasm::AirIRGenerator::emitTierUpCheck): Deleted. * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::Stack::Stack): (JSC::Wasm::B3IRGenerator::Stack::append): (JSC::Wasm::B3IRGenerator::Stack::takeLast): (JSC::Wasm::B3IRGenerator::Stack::last): (JSC::Wasm::B3IRGenerator::Stack::size const): (JSC::Wasm::B3IRGenerator::Stack::isEmpty const): (JSC::Wasm::B3IRGenerator::Stack::convertToExpressionList): (JSC::Wasm::B3IRGenerator::Stack::at const): (JSC::Wasm::B3IRGenerator::Stack::variableAt const): (JSC::Wasm::B3IRGenerator::Stack::shrink): (JSC::Wasm::B3IRGenerator::Stack::swap): (JSC::Wasm::B3IRGenerator::Stack::dump const): (JSC::Wasm::B3IRGenerator::createStack): (JSC::Wasm::B3IRGenerator::outerLoopIndex const): (JSC::Wasm::B3IRGenerator::B3IRGenerator): (JSC::Wasm::B3IRGenerator::emitEntryTierUpCheck): (JSC::Wasm::B3IRGenerator::emitLoopTierUpCheck): (JSC::Wasm::B3IRGenerator::addLoop): (JSC::Wasm::B3IRGenerator::addElse): (JSC::Wasm::B3IRGenerator::addBranch): (JSC::Wasm::B3IRGenerator::addSwitch): (JSC::Wasm::B3IRGenerator::endBlock): (JSC::Wasm::B3IRGenerator::addEndToUnreachable): (JSC::Wasm::B3IRGenerator::unifyValuesWithBlock): (JSC::Wasm::B3IRGenerator::dump): (JSC::Wasm::parseAndCompile): (JSC::Wasm::B3IRGenerator::emitTierUpCheck): Deleted. (JSC::Wasm::dumpExpressionStack): Deleted. * wasm/WasmB3IRGenerator.h: * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::compileFunctions): * wasm/WasmBBQPlan.h: * wasm/WasmBBQPlanInlines.h: (JSC::Wasm::BBQPlan::initializeCallees): * wasm/WasmCallee.h: * wasm/WasmCodeBlock.cpp: (JSC::Wasm::CodeBlock::CodeBlock): * wasm/WasmCodeBlock.h: (JSC::Wasm::CodeBlock::wasmBBQCalleeFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::entrypointLoadLocationFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::tierUpCount): Deleted. * wasm/WasmCompilationMode.cpp: (JSC::Wasm::makeString): * wasm/WasmCompilationMode.h: * wasm/WasmContext.cpp: Copied from Source/JavaScriptCore/wasm/WasmCompilationMode.cpp. (JSC::Wasm::Context::scratchBufferForSize): * wasm/WasmContext.h: * wasm/WasmContextInlines.h: (JSC::Wasm::Context::tryLoadInstanceFromTLS): * wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser<Context>::FunctionParser): (JSC::Wasm::FunctionParser<Context>::parseBody): (JSC::Wasm::FunctionParser<Context>::parseExpression): * wasm/WasmOMGForOSREntryPlan.cpp: Copied from Source/JavaScriptCore/wasm/WasmOMGPlan.cpp. (JSC::Wasm::OMGForOSREntryPlan::OMGForOSREntryPlan): (JSC::Wasm::OMGForOSREntryPlan::work): * wasm/WasmOMGForOSREntryPlan.h: Copied from Source/JavaScriptCore/wasm/WasmOMGPlan.h. * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::work): (JSC::Wasm::OMGPlan::runForIndex): Deleted. * wasm/WasmOMGPlan.h: * wasm/WasmOSREntryData.h: Copied from Source/JavaScriptCore/wasm/WasmContext.h. (JSC::Wasm::OSREntryValue::OSREntryValue): (JSC::Wasm::OSREntryValue::type const): (JSC::Wasm::OSREntryData::OSREntryData): (JSC::Wasm::OSREntryData::functionIndex const): (JSC::Wasm::OSREntryData::loopIndex const): (JSC::Wasm::OSREntryData::values): * wasm/WasmOperations.cpp: Added. (JSC::Wasm::shouldTriggerOMGCompile): (JSC::Wasm::triggerOMGReplacementCompile): (JSC::Wasm::doOSREntry): (JSC::Wasm::triggerOSREntryNow): (JSC::Wasm::triggerTierUpNow): * wasm/WasmOperations.h: Copied from Source/JavaScriptCore/wasm/WasmCompilationMode.h. * wasm/WasmThunks.cpp: (JSC::Wasm::triggerOMGEntryTierUpThunkGenerator): (JSC::Wasm::triggerOMGTierUpThunkGenerator): Deleted. * wasm/WasmThunks.h: * wasm/WasmTierUpCount.cpp: Copied from Source/JavaScriptCore/wasm/WasmCompilationMode.cpp. (JSC::Wasm::TierUpCount::TierUpCount): (JSC::Wasm::TierUpCount::addOSREntryData): * wasm/WasmTierUpCount.h: (JSC::Wasm::TierUpCount::loopIncrement): (JSC::Wasm::TierUpCount::functionEntryIncrement): (JSC::Wasm::TierUpCount::osrEntryTriggers): (JSC::Wasm::TierUpCount::outerLoops): (JSC::Wasm::TierUpCount::getLock): (JSC::Wasm::TierUpCount::optimizeAfterWarmUp): (JSC::Wasm::TierUpCount::checkIfOptimizationThresholdReached): (JSC::Wasm::TierUpCount::dontOptimizeAnytimeSoon): (JSC::Wasm::TierUpCount::optimizeNextInvocation): (JSC::Wasm::TierUpCount::optimizeSoon): (JSC::Wasm::TierUpCount::setOptimizationThresholdBasedOnCompilationResult): (JSC::Wasm::TierUpCount::TierUpCount): Deleted. (JSC::Wasm::TierUpCount::loopDecrement): Deleted. (JSC::Wasm::TierUpCount::functionEntryDecrement): Deleted. (JSC::Wasm::TierUpCount::shouldStartTierUp): Deleted. (JSC::Wasm::TierUpCount::count): Deleted. * wasm/WasmValidate.cpp: (JSC::Wasm::Validate::createStack): (JSC::Wasm::Validate::addLoop): (JSC::Wasm::Validate::addElse): (JSC::Wasm::Validate::checkBranchTarget): (JSC::Wasm::Validate::addBranch): (JSC::Wasm::Validate::addSwitch): (JSC::Wasm::Validate::endBlock): (JSC::Wasm::Validate::unify): (JSC::Wasm::dumpExpressionStack): (JSC::Wasm::Validate::dump): Tools: * Scripts/run-jsc-stress-tests: Canonical link: https://commits.webkit.org/214633@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-08-20 00:21:29 +00:00
wasm/WasmTierUpCount.cpp
[JSC] Implement a B3::ValueRep replacement for wasm-llint https://bugs.webkit.org/show_bug.cgi?id=220412 Patch by Xan Lopez <xan@igalia.com> on 2021-01-14 Reviewed by Yusuke Suzuki. The LLInt code in WebAssembly uses B3::ValueRep to store information about the calling convention for functions. We will use instead a new class with just enough functionality for those needs (basically, whether a value in a function call will be in a register or the stack) and convert to B3::ValueRep when transitioning into B3/Air. This is part of the work needed to allow WebAssembly to work without B3, and eventually in interpreted mode only. * Sources.txt: add new sources. * b3/B3ValueRep.h: (JSC::B3::ValueRep::ValueRep): include WasmValueLocation.h and add a method to convert B3::ValueRep to Wasm::ValueLocation. * JavaScriptCore.xcodeproj/project.pbxproj: add new sources. * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::emitCallPatchpoint): covert existing Wasm::ValueLocation into B3::ValueRep. * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::createCallPatchpoint): ditto. * wasm/WasmCallingConvention.h: (JSC::Wasm::CallInformation::computeResultsOffsetList): use Wasm::ValueLocation. * wasm/WasmOperations.cpp: (JSC::Wasm::JSC_DEFINE_JIT_OPERATION): ditto. * wasm/WasmValueLocation.cpp: new class, basically B3::ValueRep without all the stuff we don't need in WasmLLInt. (JSC::Wasm::ValueLocation::dump const): (WTF::printInternal): * wasm/WasmValueLocation.h: ditto. (JSC::Wasm::ValueLocation::ValueLocation): (JSC::Wasm::ValueLocation::reg): (JSC::Wasm::ValueLocation::stack): (JSC::Wasm::ValueLocation::stackArgument): (JSC::Wasm::ValueLocation::kind const): (JSC::Wasm::ValueLocation::isReg const): (JSC::Wasm::ValueLocation::reg const): (JSC::Wasm::ValueLocation::isGPR const): (JSC::Wasm::ValueLocation::isFPR const): (JSC::Wasm::ValueLocation::gpr const): (JSC::Wasm::ValueLocation::fpr const): (JSC::Wasm::ValueLocation::isStack const): (JSC::Wasm::ValueLocation::offsetFromFP const): (JSC::Wasm::ValueLocation::isStackArgument const): (JSC::Wasm::ValueLocation::offsetFromSP const): * wasm/js/JSToWasm.cpp: (JSC::Wasm::marshallJSResult): use Wasm::ValueLocation. Canonical link: https://commits.webkit.org/233052@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271500 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-01-14 22:48:43 +00:00
wasm/WasmValueLocation.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
wasm/WasmWorklist.cpp
WebAssembly: no VM / JS version of everything but Instance https://bugs.webkit.org/show_bug.cgi?id=177473 Reviewed by Filip Pizlo, Saam Barati. JSTests: - Exceeding max on memory growth now returns a range error as per spec. This is a (very minor) breaking change: it used to throw OOM error. Update the corresponding test. * wasm/js-api/memory-grow.js: (assertEq): * wasm/js-api/table.js: (assert.throws): Source/JavaScriptCore: This change entails cleaning up and splitting a bunch of code which we had intertwined between C++ classes which represent JS objects, and pure C++ implementation objects. This specific change goes most of the way towards allowing JSC's WebAssembly to work without VM / JS, up to but excluding JSWebAssemblyInstance (there's Wasm::Instance, but it's not *the* thing yet). Because of this we still have a few FIXME identifying places that need to change. A follow-up change will go the rest of the way. I went about this change in the simplest way possible: grep the JavaScriptCore/wasm directory for "JS[^C_]" as well as "VM" and exclude the /js/ sub-directory (which contains the JS implementation of WebAssembly). None of this change removes the need for a JIT entitlement to be able to use WebAssembly. We don't have an interpreter, the process therefore still needs to be allowed to JIT to use these pure-C++ APIs. Interesting things to note: - Remove VM from Plan and associated places. It can just live as a capture in the callback lambda if it's needed. - Wasm::Memory shouldn't require a VM. It was only used to ask the GC to collect. We now instead pass two lambdas at construction time for this purpose: one to notify of memory pressure, and the other to ask for syncrhonous memory reclamation. This allows whoever creates the memory to dictate how to react to both these cases, and for a JS embedding that's to call the GC (async or sync, respectively). - Move grow logic from JSWebAssemblyMemory to Wasm::Memory::grow. Use Expected there, with an enum class for failure types. - Exceeding max on memory growth now returns a range error as per spec. This is a (very minor) breaking change: it used to throw OOM error. Update the corresponding test. - When generating the grow_memory opcode, no need to get the VM. Instead, reach directly for Wasm::Memory and grow it. - JSWebAssemblyMemory::grow can now always throw on failure, because it's only ever called from JS (not from grow_memory as before). - Wasm::Memory now takes a callback for successful growth. This allows JS wrappers to register themselves when growth succeeds without Wasm::Memory knowning anything about JS. It'll also allow creating a list of callbacks for when we add thread support (we'll want to notify many wrappers, all under a lock). - Wasm::Memory is now back to being the source of truth about address / size, used directly by generated code instead of JSWebAssemblyMemory. - Move wasmToJS from the general WasmBinding header to its own header under wasm/js. It's only used by wasm/js/JSWebAssemblyCodeBlock.cpp, and uses VM, and therefore isn't general WebAssembly. - Make Wasm::Context an actual type (just a struct holding a JSWebAssemlyInstance for now) instead of an alias for that. Notably this doesn't add anything to the Context and doesn't change what actually gets passed around in JIT code (fast TLS or registers) because these changes potentially impact performance. The entire purpose of this change is to allow passing Wasm::Context around without having to know about VM. Since VM contains a Wasm::Context the JS embedding is effectively the same, but with this setup a non-JS embedding is much better off. - Move JSWebAssembly into the JS folder. - OMGPlan: use Wasm::CodeBlock directly instead of JSWebAssemblyCodeBlock. - wasm->JS stubs are now on the instance's tail as raw pointers, instead of being on JSWebAssemblyCodeBlock, and are now called wasm->Embedder stubs. The owned reference is still on JSWebAssemblyCodeBlock, and is still called wasm->JS stub. This move means that the embedder must, after creating a Wasm::CodeBlock, somehow create the stubs to call back into the embedder. This removes an indirection in the generated code because the B3 IR generator now reaches into the instance instead of JSWebAssemblyCodeBlock. - Move more CodeBlock things. Compilation completion is now marked by its own atomic<bool> flag instead of a nullptr plan: that required using a lock, and was causing a deadlock in stack-trace.js because before my changes JSWebAssemblyCodeBlock did its own completion checking separately from Wasm::CodeBlock, without getting the lock. Now that everything points to Wasm::CodeBlock and there's no cached completion marker, the lock was being acquired in a sanity-check assertion. - Embedder -> Wasm wrappers are now generated through a function that's passed in at compilation time, instead of being hard-coded as a JS -> Wasm wrapper. - WasmMemory doens't need to know about fault handling thunks. Only the IR generator should know, and should make sure that the exception throwing thunk is generated if any memory is present (note: with signal handling not all of them generate an exception check). - Make exception throwing pluggable: instead of having a hard-coded JS-specific lambda we now have a regular C++ function being called from JIT code when a WebAssembly exception is thrown. This allows any embedder to get called as they wish. For now a process can only have a single of these functions (i.e. only one embedder per process) because the trap handler is a singleton. That can be fixed in in #177475. - Create WasmEmbedder.h where all embedder plugging will live. - Split up JSWebAssemblyTable into Wasm::Table which is refcounted. JSWebAssemblyTable now only contains the JS functions in the table, and Wasm::Table is what's used by the JIT code to lookup where to call and do the instance check (for context switch). Note that this creates an extra allocation for all the instances in Wasm::Table, and in exchange removes an indirection in JIT code because the instance used to be obtained off of the JS function. Also note that it's the embedder than keeps the instances alive, not Wasm::Table (which holds a dumb pointer to the instance), because doing otherwise would cause reference cycles. - Add WasmInstance. It doesn't do much for now, owns globals. - JSWebAssembly instance now doesn't just contain the imported functions as JSObjects, it also has the corresponding import's instance and wasm entrypoint. This triples the space allocated per instance's imported function, but there shouldn't be that many imports. This has two upsides: it creates smaller and faster code, and makes is easier to disassociate embedder-specific things from embedder-neutral things. The small / faster win is in two places: B3 IR generator only needs offsetOfImportFunction for the call opcode (when the called index is an import) to know whether the import is wasm->wasm or wasm->embedder (this isn't known at compile-time because it's dependent on the import object), this is now done by seeing if that import function has an associated target instance (only wasm->wasm does); the other place is wasmBinding which uses offsetOfImportFunction to figure out the wasm->wasm target instance, and then gets WebAssemblyFunction::offsetOfWasmEntrypointLoadLocation to do a tail call. The disassociation comes because the target instance can be Wasm::Instance once we change what the Context is, and WasmEntrypointLoadLocation is already embedder-independent. As a next step I can move this tail allocation from JSWebAssemblyInstance to Wasm::Instance, and leave importFunction in as an opaque pointer which is embedder-specific, and in JS will remain WriteBarrier<JSObject>. - Rename VMEntryFrame to EntryFrame, and in many places pass a pointer to it around instead of VM. This is a first step in allowing entry frames which aren't stored on VM, but which are instead stored in an embedder-specific location. That change won't really affect JS except through code churn, but will allow WebAssembly to use some machinery in a generic manner without having a VM. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/PolymorphicAccess.cpp: (JSC::AccessGenerationState::emitExplicitExceptionHandler): * debugger/Debugger.cpp: (JSC::Debugger::stepOutOfFunction): (JSC::Debugger::returnEvent): (JSC::Debugger::unwindEvent): (JSC::Debugger::didExecuteProgram): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::compileExceptionHandlers): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExit.cpp: (JSC::DFG::OSRExit::compileOSRExit): (JSC::DFG::OSRExit::compileExit): * dfg/DFGThunks.cpp: (JSC::DFG::osrEntryThunkGenerator): * ftl/FTLCompile.cpp: (JSC::FTL::compile): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileStub): * interpreter/CallFrame.cpp: (JSC::CallFrame::wasmAwareLexicalGlobalObject): (JSC::CallFrame::callerFrame): (JSC::CallFrame::unsafeCallerFrame): * interpreter/CallFrame.h: (JSC::ExecState::callerFrame const): (JSC::ExecState::callerFrameOrEntryFrame const): (JSC::ExecState::unsafeCallerFrameOrEntryFrame const): * interpreter/FrameTracers.h: (JSC::NativeCallFrameTracer::NativeCallFrameTracer): (JSC::NativeCallFrameTracerWithRestore::NativeCallFrameTracerWithRestore): (JSC::NativeCallFrameTracerWithRestore::~NativeCallFrameTracerWithRestore): * interpreter/Interpreter.cpp: (JSC::UnwindFunctor::operator() const): (JSC::UnwindFunctor::copyCalleeSavesToEntryFrameCalleeSavesBuffer const): (JSC::Interpreter::unwind): * interpreter/StackVisitor.cpp: (JSC::StackVisitor::StackVisitor): (JSC::StackVisitor::gotoNextFrame): (JSC::StackVisitor::readNonInlinedFrame): (JSC::StackVisitor::Frame::dump const): * interpreter/StackVisitor.h: (JSC::StackVisitor::Frame::callerIsEntryFrame const): * interpreter/VMEntryRecord.h: (JSC::VMEntryRecord::prevTopEntryFrame): (JSC::VMEntryRecord::unsafePrevTopEntryFrame): (JSC::EntryFrame::vmEntryRecordOffset): * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::restoreCalleeSavesFromEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::loadWasmContextInstance): (JSC::AssemblyHelpers::storeWasmContextInstance): (JSC::AssemblyHelpers::loadWasmContextInstanceNeedsMacroScratchRegister): (JSC::AssemblyHelpers::storeWasmContextInstanceNeedsMacroScratchRegister): (JSC::AssemblyHelpers::copyCalleeSavesToEntryFrameCalleeSavesBufferImpl): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::copyCalleeSavesToVMEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::copyCalleeSavesToEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::copyCalleeSavesFromFrameOrRegisterToEntryFrameCalleeSavesBuffer): * jit/JIT.cpp: (JSC::JIT::emitEnterOptimizationCheck): (JSC::JIT::privateCompileExceptionHandlers): * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_throw): (JSC::JIT::emit_op_catch): (JSC::JIT::emitSlow_op_loop_hint): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_throw): (JSC::JIT::emit_op_catch): * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::throwExceptionFromCallSlowPathGenerator): (JSC::nativeForGenerator): * jsc.cpp: (functionDumpCallFrame): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntThunks.cpp: (JSC::vmEntryRecord): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * runtime/Options.cpp: (JSC::recomputeDependentOptions): * runtime/Options.h: * runtime/SamplingProfiler.cpp: (JSC::FrameWalker::FrameWalker): (JSC::FrameWalker::advanceToParentFrame): (JSC::SamplingProfiler::processUnverifiedStackTraces): * runtime/ThrowScope.cpp: (JSC::ThrowScope::~ThrowScope): * runtime/VM.cpp: (JSC::VM::VM): (JSC::VM::~VM): * runtime/VM.h: (JSC::VM::topEntryFrameOffset): * runtime/VMTraps.cpp: (JSC::isSaneFrame): (JSC::VMTraps::tryInstallTrapBreakpoints): (JSC::VMTraps::invalidateCodeBlocksOnStack): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::restoreWasmContextInstance): (JSC::Wasm::B3IRGenerator::B3IRGenerator): (JSC::Wasm::B3IRGenerator::restoreWebAssemblyGlobalState): (JSC::Wasm::B3IRGenerator::addGrowMemory): (JSC::Wasm::B3IRGenerator::addCurrentMemory): (JSC::Wasm::B3IRGenerator::addCall): (JSC::Wasm::B3IRGenerator::addCallIndirect): (JSC::Wasm::parseAndCompile): * wasm/WasmB3IRGenerator.h: * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::BBQPlan): (JSC::Wasm::BBQPlan::compileFunctions): (JSC::Wasm::BBQPlan::complete): * wasm/WasmBBQPlan.h: * wasm/WasmBBQPlanInlines.h: (JSC::Wasm::BBQPlan::initializeCallees): * wasm/WasmBinding.cpp: (JSC::Wasm::wasmToWasm): * wasm/WasmBinding.h: * wasm/WasmCodeBlock.cpp: (JSC::Wasm::CodeBlock::create): (JSC::Wasm::CodeBlock::CodeBlock): (JSC::Wasm::CodeBlock::compileAsync): (JSC::Wasm::CodeBlock::setCompilationFinished): * wasm/WasmCodeBlock.h: (JSC::Wasm::CodeBlock::offsetOfImportStubs): (JSC::Wasm::CodeBlock::allocationSize): (JSC::Wasm::CodeBlock::importWasmToEmbedderStub): (JSC::Wasm::CodeBlock::offsetOfImportWasmToEmbedderStub): (JSC::Wasm::CodeBlock::wasmToJSCallStubForImport): (JSC::Wasm::CodeBlock::compilationFinished): (JSC::Wasm::CodeBlock::jsEntrypointCalleeFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::wasmEntrypointCalleeFromFunctionIndexSpace): * wasm/WasmContext.cpp: (JSC::Wasm::Context::useFastTLS): (JSC::Wasm::Context::load const): (JSC::Wasm::Context::store): * wasm/WasmContext.h: * wasm/WasmEmbedder.h: Copied from Source/JavaScriptCore/wasm/WasmContext.h. * wasm/WasmFaultSignalHandler.cpp: * wasm/WasmFaultSignalHandler.h: * wasm/WasmFormat.h: * wasm/WasmInstance.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. (JSC::Wasm::Instance::Instance): (JSC::Wasm::Instance::~Instance): (JSC::Wasm::Instance::extraMemoryAllocated const): * wasm/WasmInstance.h: Added. (JSC::Wasm::Instance::create): (JSC::Wasm::Instance::finalizeCreation): (JSC::Wasm::Instance::module): (JSC::Wasm::Instance::codeBlock): (JSC::Wasm::Instance::memory): (JSC::Wasm::Instance::table): (JSC::Wasm::Instance::loadI32Global const): (JSC::Wasm::Instance::loadI64Global const): (JSC::Wasm::Instance::loadF32Global const): (JSC::Wasm::Instance::loadF64Global const): (JSC::Wasm::Instance::setGlobal): (JSC::Wasm::Instance::offsetOfCachedStackLimit): (JSC::Wasm::Instance::cachedStackLimit const): (JSC::Wasm::Instance::setCachedStackLimit): * wasm/WasmMemory.cpp: (JSC::Wasm::Memory::Memory): (JSC::Wasm::Memory::create): (JSC::Wasm::Memory::~Memory): (JSC::Wasm::Memory::grow): * wasm/WasmMemory.h: (JSC::Wasm::Memory::offsetOfMemory): (JSC::Wasm::Memory::offsetOfSize): * wasm/WasmMemoryInformation.cpp: (JSC::Wasm::PinnedRegisterInfo::get): (JSC::Wasm::PinnedRegisterInfo::PinnedRegisterInfo): * wasm/WasmMemoryInformation.h: (JSC::Wasm::PinnedRegisterInfo::toSave const): * wasm/WasmMemoryMode.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. (JSC::Wasm::makeString): * wasm/WasmMemoryMode.h: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. * wasm/WasmModule.cpp: (JSC::Wasm::makeValidationCallback): (JSC::Wasm::Module::validateSync): (JSC::Wasm::Module::validateAsync): (JSC::Wasm::Module::getOrCreateCodeBlock): (JSC::Wasm::Module::compileSync): (JSC::Wasm::Module::compileAsync): * wasm/WasmModule.h: * wasm/WasmModuleParser.cpp: (JSC::Wasm::ModuleParser::parseTableHelper): * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::OMGPlan): (JSC::Wasm::OMGPlan::runForIndex): * wasm/WasmOMGPlan.h: * wasm/WasmPageCount.h: (JSC::Wasm::PageCount::isValid const): * wasm/WasmPlan.cpp: (JSC::Wasm::Plan::Plan): (JSC::Wasm::Plan::runCompletionTasks): (JSC::Wasm::Plan::addCompletionTask): (JSC::Wasm::Plan::tryRemoveContextAndCancelIfLast): * wasm/WasmPlan.h: (JSC::Wasm::Plan::dontFinalize): * wasm/WasmSignature.cpp: * wasm/WasmSignature.h: * wasm/WasmTable.cpp: Added. (JSC::Wasm::Table::create): (JSC::Wasm::Table::~Table): (JSC::Wasm::Table::Table): (JSC::Wasm::Table::grow): (JSC::Wasm::Table::clearFunction): (JSC::Wasm::Table::setFunction): * wasm/WasmTable.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyTable.h. (JSC::Wasm::Table::maximum const): (JSC::Wasm::Table::size const): (JSC::Wasm::Table::offsetOfSize): (JSC::Wasm::Table::offsetOfFunctions): (JSC::Wasm::Table::offsetOfInstances): (JSC::Wasm::Table::isValidSize): * wasm/WasmThunks.cpp: (JSC::Wasm::throwExceptionFromWasmThunkGenerator): (JSC::Wasm::triggerOMGTierUpThunkGenerator): (JSC::Wasm::Thunks::setThrowWasmException): (JSC::Wasm::Thunks::throwWasmException): * wasm/WasmThunks.h: * wasm/WasmWorklist.cpp: (JSC::Wasm::Worklist::stopAllPlansForContext): * wasm/WasmWorklist.h: * wasm/js/JSToWasm.cpp: Added. (JSC::Wasm::createJSToWasmWrapper): * wasm/js/JSToWasm.h: Copied from Source/JavaScriptCore/wasm/WasmBinding.h. * wasm/js/JSWebAssembly.cpp: Renamed from Source/JavaScriptCore/wasm/JSWebAssembly.cpp. * wasm/js/JSWebAssembly.h: Renamed from Source/JavaScriptCore/wasm/JSWebAssembly.h. * wasm/js/JSWebAssemblyCodeBlock.cpp: (JSC::JSWebAssemblyCodeBlock::create): (JSC::JSWebAssemblyCodeBlock::JSWebAssemblyCodeBlock): * wasm/js/JSWebAssemblyCodeBlock.h: * wasm/js/JSWebAssemblyInstance.cpp: (JSC::JSWebAssemblyInstance::JSWebAssemblyInstance): (JSC::JSWebAssemblyInstance::finishCreation): (JSC::JSWebAssemblyInstance::visitChildren): (JSC::JSWebAssemblyInstance::finalizeCreation): (JSC::JSWebAssemblyInstance::create): * wasm/js/JSWebAssemblyInstance.h: (JSC::JSWebAssemblyInstance::instance): (JSC::JSWebAssemblyInstance::context const): (JSC::JSWebAssemblyInstance::table): (JSC::JSWebAssemblyInstance::webAssemblyToJSCallee): (JSC::JSWebAssemblyInstance::setMemory): (JSC::JSWebAssemblyInstance::offsetOfTail): (JSC::JSWebAssemblyInstance::importFunctionInfo): (JSC::JSWebAssemblyInstance::offsetOfTargetInstance): (JSC::JSWebAssemblyInstance::offsetOfWasmEntrypoint): (JSC::JSWebAssemblyInstance::offsetOfImportFunction): (JSC::JSWebAssemblyInstance::importFunction): (JSC::JSWebAssemblyInstance::internalMemory): (JSC::JSWebAssemblyInstance::wasmCodeBlock const): (JSC::JSWebAssemblyInstance::offsetOfWasmTable): (JSC::JSWebAssemblyInstance::offsetOfCallee): (JSC::JSWebAssemblyInstance::offsetOfGlobals): (JSC::JSWebAssemblyInstance::offsetOfWasmCodeBlock): (JSC::JSWebAssemblyInstance::offsetOfWasmMemory): (JSC::JSWebAssemblyInstance::cachedStackLimit const): (JSC::JSWebAssemblyInstance::setCachedStackLimit): (JSC::JSWebAssemblyInstance::wasmMemory): (JSC::JSWebAssemblyInstance::wasmModule): (JSC::JSWebAssemblyInstance::allocationSize): (JSC::JSWebAssemblyInstance::module const): * wasm/js/JSWebAssemblyMemory.cpp: (JSC::JSWebAssemblyMemory::create): (JSC::JSWebAssemblyMemory::adopt): (JSC::JSWebAssemblyMemory::JSWebAssemblyMemory): (JSC::JSWebAssemblyMemory::grow): (JSC::JSWebAssemblyMemory::growSuccessCallback): * wasm/js/JSWebAssemblyMemory.h: * wasm/js/JSWebAssemblyModule.cpp: (JSC::JSWebAssemblyModule::moduleInformation const): (JSC::JSWebAssemblyModule::exportSymbolTable const): (JSC::JSWebAssemblyModule::signatureIndexFromFunctionIndexSpace const): (JSC::JSWebAssemblyModule::callee const): (JSC::JSWebAssemblyModule::codeBlock): (JSC::JSWebAssemblyModule::module): * wasm/js/JSWebAssemblyModule.h: * wasm/js/JSWebAssemblyTable.cpp: (JSC::JSWebAssemblyTable::create): (JSC::JSWebAssemblyTable::JSWebAssemblyTable): (JSC::JSWebAssemblyTable::visitChildren): (JSC::JSWebAssemblyTable::grow): (JSC::JSWebAssemblyTable::getFunction): (JSC::JSWebAssemblyTable::clearFunction): (JSC::JSWebAssemblyTable::setFunction): * wasm/js/JSWebAssemblyTable.h: (JSC::JSWebAssemblyTable::isValidSize): (JSC::JSWebAssemblyTable::maximum const): (JSC::JSWebAssemblyTable::size const): (JSC::JSWebAssemblyTable::table): * wasm/js/WasmToJS.cpp: Copied from Source/JavaScriptCore/wasm/WasmBinding.cpp. (JSC::Wasm::materializeImportJSCell): (JSC::Wasm::wasmToJS): (JSC::Wasm::wasmToJSException): * wasm/js/WasmToJS.h: Copied from Source/JavaScriptCore/wasm/WasmBinding.h. * wasm/js/WebAssemblyFunction.cpp: (JSC::callWebAssemblyFunction): * wasm/js/WebAssemblyInstanceConstructor.cpp: (JSC::constructJSWebAssemblyInstance): * wasm/js/WebAssemblyMemoryConstructor.cpp: (JSC::constructJSWebAssemblyMemory): * wasm/js/WebAssemblyMemoryPrototype.cpp: (JSC::webAssemblyMemoryProtoFuncGrow): * wasm/js/WebAssemblyModuleConstructor.cpp: (JSC::constructJSWebAssemblyModule): (JSC::WebAssemblyModuleConstructor::createModule): * wasm/js/WebAssemblyModuleConstructor.h: * wasm/js/WebAssemblyModuleRecord.cpp: (JSC::WebAssemblyModuleRecord::link): (JSC::WebAssemblyModuleRecord::evaluate): * wasm/js/WebAssemblyPrototype.cpp: (JSC::webAssemblyCompileFunc): (JSC::instantiate): (JSC::compileAndInstantiate): (JSC::webAssemblyValidateFunc): * wasm/js/WebAssemblyTableConstructor.cpp: (JSC::constructJSWebAssemblyTable): * wasm/js/WebAssemblyWrapperFunction.cpp: (JSC::WebAssemblyWrapperFunction::create): Source/WebCore: * ForwardingHeaders/wasm/WasmModule.h: Added. This used to be included in JSWebAssemblyModule.h. * bindings/js/SerializedScriptValue.cpp: Update postMessage code according to C++ API changes. Canonical link: https://commits.webkit.org/194750@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223738 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-20 02:23:29 +00:00
wasm/js/JSToWasm.cpp
wasm/js/JSToWasm.h
Teach Call ICs how to call Wasm https://bugs.webkit.org/show_bug.cgi?id=196387 Reviewed by Filip Pizlo. JSTests: * wasm/function-tests/stack-trace.js: Source/JavaScriptCore: This patch teaches JS to call Wasm without going through the native thunk. Currently, we emit a JIT "JS" callee stub which marshals arguments from JS to Wasm. Like the native version of this, this thunk is responsible for saving and restoring the VM's current Wasm context. Instead of emitting an exception handler, we also teach the unwinder how to read the previous wasm context to restore it as it unwindws past this frame. This patch is straight forward, and leaves some areas for perf improvement: - We can teach the DFG/FTL to directly use the Wasm calling convention when it knows it's calling a single Wasm function. This way we don't shuffle registers to the stack and then back into registers. - We bail out to the slow path for mismatched arity. I opened a bug to fix optimize arity check failures: https://bugs.webkit.org/show_bug.cgi?id=196564 - We bail out to the slow path Double JSValues flowing into i32 arguments. We should teach this thunk how to do that conversion directly. This patch also refactors the code to explicitly have a single pinned size register. We used pretend in some places that we could have more than one pinned size register. However, there was other code that just asserted the size was one. This patch just rips out this code since we never moved to having more than one pinned size register. Doing this refactoring cleans up the various places where we set up the size register. This patch is a 50-60% progression on JetStream 2's richards-wasm. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * assembler/MacroAssemblerCodeRef.h: (JSC::MacroAssemblerCodeRef::operator=): (JSC::MacroAssemblerCodeRef::MacroAssemblerCodeRef): * interpreter/Interpreter.cpp: (JSC::UnwindFunctor::operator() const): (JSC::UnwindFunctor::copyCalleeSavesToEntryFrameCalleeSavesBuffer const): * interpreter/StackVisitor.cpp: (JSC::StackVisitor::Frame::calleeSaveRegistersForUnwinding): (JSC::StackVisitor::Frame::calleeSaveRegisters): Deleted. * interpreter/StackVisitor.h: * jit/JITOperations.cpp: * jit/RegisterSet.cpp: (JSC::RegisterSet::runtimeTagRegisters): (JSC::RegisterSet::specialRegisters): (JSC::RegisterSet::runtimeRegisters): Deleted. * jit/RegisterSet.h: * jit/Repatch.cpp: (JSC::linkPolymorphicCall): * runtime/JSFunction.cpp: (JSC::getCalculatedDisplayName): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::visitChildren): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::jsToWasmICCalleeStructure const): * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::AirIRGenerator): (JSC::Wasm::AirIRGenerator::restoreWebAssemblyGlobalState): (JSC::Wasm::AirIRGenerator::addCallIndirect): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::B3IRGenerator): (JSC::Wasm::B3IRGenerator::restoreWebAssemblyGlobalState): (JSC::Wasm::B3IRGenerator::addCallIndirect): * wasm/WasmBinding.cpp: (JSC::Wasm::wasmToWasm): * wasm/WasmContext.h: (JSC::Wasm::Context::pointerToInstance): * wasm/WasmContextInlines.h: (JSC::Wasm::Context::store): * wasm/WasmMemoryInformation.cpp: (JSC::Wasm::getPinnedRegisters): (JSC::Wasm::PinnedRegisterInfo::get): (JSC::Wasm::PinnedRegisterInfo::PinnedRegisterInfo): * wasm/WasmMemoryInformation.h: (JSC::Wasm::PinnedRegisterInfo::toSave const): * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::work): * wasm/js/JSToWasm.cpp: (JSC::Wasm::createJSToWasmWrapper): * wasm/js/JSToWasmICCallee.cpp: Added. (JSC::JSToWasmICCallee::create): (JSC::JSToWasmICCallee::createStructure): (JSC::JSToWasmICCallee::visitChildren): * wasm/js/JSToWasmICCallee.h: Added. (JSC::JSToWasmICCallee::function): (JSC::JSToWasmICCallee::JSToWasmICCallee): * wasm/js/WebAssemblyFunction.cpp: (JSC::WebAssemblyFunction::useTagRegisters const): (JSC::WebAssemblyFunction::calleeSaves const): (JSC::WebAssemblyFunction::usedCalleeSaveRegisters const): (JSC::WebAssemblyFunction::previousInstanceOffset const): (JSC::WebAssemblyFunction::previousInstance): (JSC::WebAssemblyFunction::jsCallEntrypointSlow): (JSC::WebAssemblyFunction::visitChildren): (JSC::WebAssemblyFunction::destroy): * wasm/js/WebAssemblyFunction.h: * wasm/js/WebAssemblyFunctionHeapCellType.cpp: Added. (JSC::WebAssemblyFunctionDestroyFunc::operator() const): (JSC::WebAssemblyFunctionHeapCellType::WebAssemblyFunctionHeapCellType): (JSC::WebAssemblyFunctionHeapCellType::~WebAssemblyFunctionHeapCellType): (JSC::WebAssemblyFunctionHeapCellType::finishSweep): (JSC::WebAssemblyFunctionHeapCellType::destroy): * wasm/js/WebAssemblyFunctionHeapCellType.h: Added. * wasm/js/WebAssemblyPrototype.h: Canonical link: https://commits.webkit.org/210878@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243886 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-04 18:54:16 +00:00
wasm/js/JSToWasmICCallee.cpp
WebAssembly: no VM / JS version of everything but Instance https://bugs.webkit.org/show_bug.cgi?id=177473 Reviewed by Filip Pizlo, Saam Barati. JSTests: - Exceeding max on memory growth now returns a range error as per spec. This is a (very minor) breaking change: it used to throw OOM error. Update the corresponding test. * wasm/js-api/memory-grow.js: (assertEq): * wasm/js-api/table.js: (assert.throws): Source/JavaScriptCore: This change entails cleaning up and splitting a bunch of code which we had intertwined between C++ classes which represent JS objects, and pure C++ implementation objects. This specific change goes most of the way towards allowing JSC's WebAssembly to work without VM / JS, up to but excluding JSWebAssemblyInstance (there's Wasm::Instance, but it's not *the* thing yet). Because of this we still have a few FIXME identifying places that need to change. A follow-up change will go the rest of the way. I went about this change in the simplest way possible: grep the JavaScriptCore/wasm directory for "JS[^C_]" as well as "VM" and exclude the /js/ sub-directory (which contains the JS implementation of WebAssembly). None of this change removes the need for a JIT entitlement to be able to use WebAssembly. We don't have an interpreter, the process therefore still needs to be allowed to JIT to use these pure-C++ APIs. Interesting things to note: - Remove VM from Plan and associated places. It can just live as a capture in the callback lambda if it's needed. - Wasm::Memory shouldn't require a VM. It was only used to ask the GC to collect. We now instead pass two lambdas at construction time for this purpose: one to notify of memory pressure, and the other to ask for syncrhonous memory reclamation. This allows whoever creates the memory to dictate how to react to both these cases, and for a JS embedding that's to call the GC (async or sync, respectively). - Move grow logic from JSWebAssemblyMemory to Wasm::Memory::grow. Use Expected there, with an enum class for failure types. - Exceeding max on memory growth now returns a range error as per spec. This is a (very minor) breaking change: it used to throw OOM error. Update the corresponding test. - When generating the grow_memory opcode, no need to get the VM. Instead, reach directly for Wasm::Memory and grow it. - JSWebAssemblyMemory::grow can now always throw on failure, because it's only ever called from JS (not from grow_memory as before). - Wasm::Memory now takes a callback for successful growth. This allows JS wrappers to register themselves when growth succeeds without Wasm::Memory knowning anything about JS. It'll also allow creating a list of callbacks for when we add thread support (we'll want to notify many wrappers, all under a lock). - Wasm::Memory is now back to being the source of truth about address / size, used directly by generated code instead of JSWebAssemblyMemory. - Move wasmToJS from the general WasmBinding header to its own header under wasm/js. It's only used by wasm/js/JSWebAssemblyCodeBlock.cpp, and uses VM, and therefore isn't general WebAssembly. - Make Wasm::Context an actual type (just a struct holding a JSWebAssemlyInstance for now) instead of an alias for that. Notably this doesn't add anything to the Context and doesn't change what actually gets passed around in JIT code (fast TLS or registers) because these changes potentially impact performance. The entire purpose of this change is to allow passing Wasm::Context around without having to know about VM. Since VM contains a Wasm::Context the JS embedding is effectively the same, but with this setup a non-JS embedding is much better off. - Move JSWebAssembly into the JS folder. - OMGPlan: use Wasm::CodeBlock directly instead of JSWebAssemblyCodeBlock. - wasm->JS stubs are now on the instance's tail as raw pointers, instead of being on JSWebAssemblyCodeBlock, and are now called wasm->Embedder stubs. The owned reference is still on JSWebAssemblyCodeBlock, and is still called wasm->JS stub. This move means that the embedder must, after creating a Wasm::CodeBlock, somehow create the stubs to call back into the embedder. This removes an indirection in the generated code because the B3 IR generator now reaches into the instance instead of JSWebAssemblyCodeBlock. - Move more CodeBlock things. Compilation completion is now marked by its own atomic<bool> flag instead of a nullptr plan: that required using a lock, and was causing a deadlock in stack-trace.js because before my changes JSWebAssemblyCodeBlock did its own completion checking separately from Wasm::CodeBlock, without getting the lock. Now that everything points to Wasm::CodeBlock and there's no cached completion marker, the lock was being acquired in a sanity-check assertion. - Embedder -> Wasm wrappers are now generated through a function that's passed in at compilation time, instead of being hard-coded as a JS -> Wasm wrapper. - WasmMemory doens't need to know about fault handling thunks. Only the IR generator should know, and should make sure that the exception throwing thunk is generated if any memory is present (note: with signal handling not all of them generate an exception check). - Make exception throwing pluggable: instead of having a hard-coded JS-specific lambda we now have a regular C++ function being called from JIT code when a WebAssembly exception is thrown. This allows any embedder to get called as they wish. For now a process can only have a single of these functions (i.e. only one embedder per process) because the trap handler is a singleton. That can be fixed in in #177475. - Create WasmEmbedder.h where all embedder plugging will live. - Split up JSWebAssemblyTable into Wasm::Table which is refcounted. JSWebAssemblyTable now only contains the JS functions in the table, and Wasm::Table is what's used by the JIT code to lookup where to call and do the instance check (for context switch). Note that this creates an extra allocation for all the instances in Wasm::Table, and in exchange removes an indirection in JIT code because the instance used to be obtained off of the JS function. Also note that it's the embedder than keeps the instances alive, not Wasm::Table (which holds a dumb pointer to the instance), because doing otherwise would cause reference cycles. - Add WasmInstance. It doesn't do much for now, owns globals. - JSWebAssembly instance now doesn't just contain the imported functions as JSObjects, it also has the corresponding import's instance and wasm entrypoint. This triples the space allocated per instance's imported function, but there shouldn't be that many imports. This has two upsides: it creates smaller and faster code, and makes is easier to disassociate embedder-specific things from embedder-neutral things. The small / faster win is in two places: B3 IR generator only needs offsetOfImportFunction for the call opcode (when the called index is an import) to know whether the import is wasm->wasm or wasm->embedder (this isn't known at compile-time because it's dependent on the import object), this is now done by seeing if that import function has an associated target instance (only wasm->wasm does); the other place is wasmBinding which uses offsetOfImportFunction to figure out the wasm->wasm target instance, and then gets WebAssemblyFunction::offsetOfWasmEntrypointLoadLocation to do a tail call. The disassociation comes because the target instance can be Wasm::Instance once we change what the Context is, and WasmEntrypointLoadLocation is already embedder-independent. As a next step I can move this tail allocation from JSWebAssemblyInstance to Wasm::Instance, and leave importFunction in as an opaque pointer which is embedder-specific, and in JS will remain WriteBarrier<JSObject>. - Rename VMEntryFrame to EntryFrame, and in many places pass a pointer to it around instead of VM. This is a first step in allowing entry frames which aren't stored on VM, but which are instead stored in an embedder-specific location. That change won't really affect JS except through code churn, but will allow WebAssembly to use some machinery in a generic manner without having a VM. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/PolymorphicAccess.cpp: (JSC::AccessGenerationState::emitExplicitExceptionHandler): * debugger/Debugger.cpp: (JSC::Debugger::stepOutOfFunction): (JSC::Debugger::returnEvent): (JSC::Debugger::unwindEvent): (JSC::Debugger::didExecuteProgram): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::compileExceptionHandlers): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExit.cpp: (JSC::DFG::OSRExit::compileOSRExit): (JSC::DFG::OSRExit::compileExit): * dfg/DFGThunks.cpp: (JSC::DFG::osrEntryThunkGenerator): * ftl/FTLCompile.cpp: (JSC::FTL::compile): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileStub): * interpreter/CallFrame.cpp: (JSC::CallFrame::wasmAwareLexicalGlobalObject): (JSC::CallFrame::callerFrame): (JSC::CallFrame::unsafeCallerFrame): * interpreter/CallFrame.h: (JSC::ExecState::callerFrame const): (JSC::ExecState::callerFrameOrEntryFrame const): (JSC::ExecState::unsafeCallerFrameOrEntryFrame const): * interpreter/FrameTracers.h: (JSC::NativeCallFrameTracer::NativeCallFrameTracer): (JSC::NativeCallFrameTracerWithRestore::NativeCallFrameTracerWithRestore): (JSC::NativeCallFrameTracerWithRestore::~NativeCallFrameTracerWithRestore): * interpreter/Interpreter.cpp: (JSC::UnwindFunctor::operator() const): (JSC::UnwindFunctor::copyCalleeSavesToEntryFrameCalleeSavesBuffer const): (JSC::Interpreter::unwind): * interpreter/StackVisitor.cpp: (JSC::StackVisitor::StackVisitor): (JSC::StackVisitor::gotoNextFrame): (JSC::StackVisitor::readNonInlinedFrame): (JSC::StackVisitor::Frame::dump const): * interpreter/StackVisitor.h: (JSC::StackVisitor::Frame::callerIsEntryFrame const): * interpreter/VMEntryRecord.h: (JSC::VMEntryRecord::prevTopEntryFrame): (JSC::VMEntryRecord::unsafePrevTopEntryFrame): (JSC::EntryFrame::vmEntryRecordOffset): * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::restoreCalleeSavesFromEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::loadWasmContextInstance): (JSC::AssemblyHelpers::storeWasmContextInstance): (JSC::AssemblyHelpers::loadWasmContextInstanceNeedsMacroScratchRegister): (JSC::AssemblyHelpers::storeWasmContextInstanceNeedsMacroScratchRegister): (JSC::AssemblyHelpers::copyCalleeSavesToEntryFrameCalleeSavesBufferImpl): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::copyCalleeSavesToVMEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::copyCalleeSavesToEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::copyCalleeSavesFromFrameOrRegisterToEntryFrameCalleeSavesBuffer): * jit/JIT.cpp: (JSC::JIT::emitEnterOptimizationCheck): (JSC::JIT::privateCompileExceptionHandlers): * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_throw): (JSC::JIT::emit_op_catch): (JSC::JIT::emitSlow_op_loop_hint): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_throw): (JSC::JIT::emit_op_catch): * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::throwExceptionFromCallSlowPathGenerator): (JSC::nativeForGenerator): * jsc.cpp: (functionDumpCallFrame): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntThunks.cpp: (JSC::vmEntryRecord): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * runtime/Options.cpp: (JSC::recomputeDependentOptions): * runtime/Options.h: * runtime/SamplingProfiler.cpp: (JSC::FrameWalker::FrameWalker): (JSC::FrameWalker::advanceToParentFrame): (JSC::SamplingProfiler::processUnverifiedStackTraces): * runtime/ThrowScope.cpp: (JSC::ThrowScope::~ThrowScope): * runtime/VM.cpp: (JSC::VM::VM): (JSC::VM::~VM): * runtime/VM.h: (JSC::VM::topEntryFrameOffset): * runtime/VMTraps.cpp: (JSC::isSaneFrame): (JSC::VMTraps::tryInstallTrapBreakpoints): (JSC::VMTraps::invalidateCodeBlocksOnStack): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::restoreWasmContextInstance): (JSC::Wasm::B3IRGenerator::B3IRGenerator): (JSC::Wasm::B3IRGenerator::restoreWebAssemblyGlobalState): (JSC::Wasm::B3IRGenerator::addGrowMemory): (JSC::Wasm::B3IRGenerator::addCurrentMemory): (JSC::Wasm::B3IRGenerator::addCall): (JSC::Wasm::B3IRGenerator::addCallIndirect): (JSC::Wasm::parseAndCompile): * wasm/WasmB3IRGenerator.h: * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::BBQPlan): (JSC::Wasm::BBQPlan::compileFunctions): (JSC::Wasm::BBQPlan::complete): * wasm/WasmBBQPlan.h: * wasm/WasmBBQPlanInlines.h: (JSC::Wasm::BBQPlan::initializeCallees): * wasm/WasmBinding.cpp: (JSC::Wasm::wasmToWasm): * wasm/WasmBinding.h: * wasm/WasmCodeBlock.cpp: (JSC::Wasm::CodeBlock::create): (JSC::Wasm::CodeBlock::CodeBlock): (JSC::Wasm::CodeBlock::compileAsync): (JSC::Wasm::CodeBlock::setCompilationFinished): * wasm/WasmCodeBlock.h: (JSC::Wasm::CodeBlock::offsetOfImportStubs): (JSC::Wasm::CodeBlock::allocationSize): (JSC::Wasm::CodeBlock::importWasmToEmbedderStub): (JSC::Wasm::CodeBlock::offsetOfImportWasmToEmbedderStub): (JSC::Wasm::CodeBlock::wasmToJSCallStubForImport): (JSC::Wasm::CodeBlock::compilationFinished): (JSC::Wasm::CodeBlock::jsEntrypointCalleeFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::wasmEntrypointCalleeFromFunctionIndexSpace): * wasm/WasmContext.cpp: (JSC::Wasm::Context::useFastTLS): (JSC::Wasm::Context::load const): (JSC::Wasm::Context::store): * wasm/WasmContext.h: * wasm/WasmEmbedder.h: Copied from Source/JavaScriptCore/wasm/WasmContext.h. * wasm/WasmFaultSignalHandler.cpp: * wasm/WasmFaultSignalHandler.h: * wasm/WasmFormat.h: * wasm/WasmInstance.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. (JSC::Wasm::Instance::Instance): (JSC::Wasm::Instance::~Instance): (JSC::Wasm::Instance::extraMemoryAllocated const): * wasm/WasmInstance.h: Added. (JSC::Wasm::Instance::create): (JSC::Wasm::Instance::finalizeCreation): (JSC::Wasm::Instance::module): (JSC::Wasm::Instance::codeBlock): (JSC::Wasm::Instance::memory): (JSC::Wasm::Instance::table): (JSC::Wasm::Instance::loadI32Global const): (JSC::Wasm::Instance::loadI64Global const): (JSC::Wasm::Instance::loadF32Global const): (JSC::Wasm::Instance::loadF64Global const): (JSC::Wasm::Instance::setGlobal): (JSC::Wasm::Instance::offsetOfCachedStackLimit): (JSC::Wasm::Instance::cachedStackLimit const): (JSC::Wasm::Instance::setCachedStackLimit): * wasm/WasmMemory.cpp: (JSC::Wasm::Memory::Memory): (JSC::Wasm::Memory::create): (JSC::Wasm::Memory::~Memory): (JSC::Wasm::Memory::grow): * wasm/WasmMemory.h: (JSC::Wasm::Memory::offsetOfMemory): (JSC::Wasm::Memory::offsetOfSize): * wasm/WasmMemoryInformation.cpp: (JSC::Wasm::PinnedRegisterInfo::get): (JSC::Wasm::PinnedRegisterInfo::PinnedRegisterInfo): * wasm/WasmMemoryInformation.h: (JSC::Wasm::PinnedRegisterInfo::toSave const): * wasm/WasmMemoryMode.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. (JSC::Wasm::makeString): * wasm/WasmMemoryMode.h: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. * wasm/WasmModule.cpp: (JSC::Wasm::makeValidationCallback): (JSC::Wasm::Module::validateSync): (JSC::Wasm::Module::validateAsync): (JSC::Wasm::Module::getOrCreateCodeBlock): (JSC::Wasm::Module::compileSync): (JSC::Wasm::Module::compileAsync): * wasm/WasmModule.h: * wasm/WasmModuleParser.cpp: (JSC::Wasm::ModuleParser::parseTableHelper): * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::OMGPlan): (JSC::Wasm::OMGPlan::runForIndex): * wasm/WasmOMGPlan.h: * wasm/WasmPageCount.h: (JSC::Wasm::PageCount::isValid const): * wasm/WasmPlan.cpp: (JSC::Wasm::Plan::Plan): (JSC::Wasm::Plan::runCompletionTasks): (JSC::Wasm::Plan::addCompletionTask): (JSC::Wasm::Plan::tryRemoveContextAndCancelIfLast): * wasm/WasmPlan.h: (JSC::Wasm::Plan::dontFinalize): * wasm/WasmSignature.cpp: * wasm/WasmSignature.h: * wasm/WasmTable.cpp: Added. (JSC::Wasm::Table::create): (JSC::Wasm::Table::~Table): (JSC::Wasm::Table::Table): (JSC::Wasm::Table::grow): (JSC::Wasm::Table::clearFunction): (JSC::Wasm::Table::setFunction): * wasm/WasmTable.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyTable.h. (JSC::Wasm::Table::maximum const): (JSC::Wasm::Table::size const): (JSC::Wasm::Table::offsetOfSize): (JSC::Wasm::Table::offsetOfFunctions): (JSC::Wasm::Table::offsetOfInstances): (JSC::Wasm::Table::isValidSize): * wasm/WasmThunks.cpp: (JSC::Wasm::throwExceptionFromWasmThunkGenerator): (JSC::Wasm::triggerOMGTierUpThunkGenerator): (JSC::Wasm::Thunks::setThrowWasmException): (JSC::Wasm::Thunks::throwWasmException): * wasm/WasmThunks.h: * wasm/WasmWorklist.cpp: (JSC::Wasm::Worklist::stopAllPlansForContext): * wasm/WasmWorklist.h: * wasm/js/JSToWasm.cpp: Added. (JSC::Wasm::createJSToWasmWrapper): * wasm/js/JSToWasm.h: Copied from Source/JavaScriptCore/wasm/WasmBinding.h. * wasm/js/JSWebAssembly.cpp: Renamed from Source/JavaScriptCore/wasm/JSWebAssembly.cpp. * wasm/js/JSWebAssembly.h: Renamed from Source/JavaScriptCore/wasm/JSWebAssembly.h. * wasm/js/JSWebAssemblyCodeBlock.cpp: (JSC::JSWebAssemblyCodeBlock::create): (JSC::JSWebAssemblyCodeBlock::JSWebAssemblyCodeBlock): * wasm/js/JSWebAssemblyCodeBlock.h: * wasm/js/JSWebAssemblyInstance.cpp: (JSC::JSWebAssemblyInstance::JSWebAssemblyInstance): (JSC::JSWebAssemblyInstance::finishCreation): (JSC::JSWebAssemblyInstance::visitChildren): (JSC::JSWebAssemblyInstance::finalizeCreation): (JSC::JSWebAssemblyInstance::create): * wasm/js/JSWebAssemblyInstance.h: (JSC::JSWebAssemblyInstance::instance): (JSC::JSWebAssemblyInstance::context const): (JSC::JSWebAssemblyInstance::table): (JSC::JSWebAssemblyInstance::webAssemblyToJSCallee): (JSC::JSWebAssemblyInstance::setMemory): (JSC::JSWebAssemblyInstance::offsetOfTail): (JSC::JSWebAssemblyInstance::importFunctionInfo): (JSC::JSWebAssemblyInstance::offsetOfTargetInstance): (JSC::JSWebAssemblyInstance::offsetOfWasmEntrypoint): (JSC::JSWebAssemblyInstance::offsetOfImportFunction): (JSC::JSWebAssemblyInstance::importFunction): (JSC::JSWebAssemblyInstance::internalMemory): (JSC::JSWebAssemblyInstance::wasmCodeBlock const): (JSC::JSWebAssemblyInstance::offsetOfWasmTable): (JSC::JSWebAssemblyInstance::offsetOfCallee): (JSC::JSWebAssemblyInstance::offsetOfGlobals): (JSC::JSWebAssemblyInstance::offsetOfWasmCodeBlock): (JSC::JSWebAssemblyInstance::offsetOfWasmMemory): (JSC::JSWebAssemblyInstance::cachedStackLimit const): (JSC::JSWebAssemblyInstance::setCachedStackLimit): (JSC::JSWebAssemblyInstance::wasmMemory): (JSC::JSWebAssemblyInstance::wasmModule): (JSC::JSWebAssemblyInstance::allocationSize): (JSC::JSWebAssemblyInstance::module const): * wasm/js/JSWebAssemblyMemory.cpp: (JSC::JSWebAssemblyMemory::create): (JSC::JSWebAssemblyMemory::adopt): (JSC::JSWebAssemblyMemory::JSWebAssemblyMemory): (JSC::JSWebAssemblyMemory::grow): (JSC::JSWebAssemblyMemory::growSuccessCallback): * wasm/js/JSWebAssemblyMemory.h: * wasm/js/JSWebAssemblyModule.cpp: (JSC::JSWebAssemblyModule::moduleInformation const): (JSC::JSWebAssemblyModule::exportSymbolTable const): (JSC::JSWebAssemblyModule::signatureIndexFromFunctionIndexSpace const): (JSC::JSWebAssemblyModule::callee const): (JSC::JSWebAssemblyModule::codeBlock): (JSC::JSWebAssemblyModule::module): * wasm/js/JSWebAssemblyModule.h: * wasm/js/JSWebAssemblyTable.cpp: (JSC::JSWebAssemblyTable::create): (JSC::JSWebAssemblyTable::JSWebAssemblyTable): (JSC::JSWebAssemblyTable::visitChildren): (JSC::JSWebAssemblyTable::grow): (JSC::JSWebAssemblyTable::getFunction): (JSC::JSWebAssemblyTable::clearFunction): (JSC::JSWebAssemblyTable::setFunction): * wasm/js/JSWebAssemblyTable.h: (JSC::JSWebAssemblyTable::isValidSize): (JSC::JSWebAssemblyTable::maximum const): (JSC::JSWebAssemblyTable::size const): (JSC::JSWebAssemblyTable::table): * wasm/js/WasmToJS.cpp: Copied from Source/JavaScriptCore/wasm/WasmBinding.cpp. (JSC::Wasm::materializeImportJSCell): (JSC::Wasm::wasmToJS): (JSC::Wasm::wasmToJSException): * wasm/js/WasmToJS.h: Copied from Source/JavaScriptCore/wasm/WasmBinding.h. * wasm/js/WebAssemblyFunction.cpp: (JSC::callWebAssemblyFunction): * wasm/js/WebAssemblyInstanceConstructor.cpp: (JSC::constructJSWebAssemblyInstance): * wasm/js/WebAssemblyMemoryConstructor.cpp: (JSC::constructJSWebAssemblyMemory): * wasm/js/WebAssemblyMemoryPrototype.cpp: (JSC::webAssemblyMemoryProtoFuncGrow): * wasm/js/WebAssemblyModuleConstructor.cpp: (JSC::constructJSWebAssemblyModule): (JSC::WebAssemblyModuleConstructor::createModule): * wasm/js/WebAssemblyModuleConstructor.h: * wasm/js/WebAssemblyModuleRecord.cpp: (JSC::WebAssemblyModuleRecord::link): (JSC::WebAssemblyModuleRecord::evaluate): * wasm/js/WebAssemblyPrototype.cpp: (JSC::webAssemblyCompileFunc): (JSC::instantiate): (JSC::compileAndInstantiate): (JSC::webAssemblyValidateFunc): * wasm/js/WebAssemblyTableConstructor.cpp: (JSC::constructJSWebAssemblyTable): * wasm/js/WebAssemblyWrapperFunction.cpp: (JSC::WebAssemblyWrapperFunction::create): Source/WebCore: * ForwardingHeaders/wasm/WasmModule.h: Added. This used to be included in JSWebAssemblyModule.h. * bindings/js/SerializedScriptValue.cpp: Update postMessage code according to C++ API changes. Canonical link: https://commits.webkit.org/194750@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223738 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-20 02:23:29 +00:00
wasm/js/JSWebAssembly.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
wasm/js/JSWebAssemblyCodeBlock.cpp
wasm/js/JSWebAssemblyCompileError.cpp
Adopt the new WebAssembly.Global system https://bugs.webkit.org/show_bug.cgi?id=186552 Reviewed by Keith Miller. JSTests: 1. Update spec-harness to accept newer tests. And we update several tests that does not work with the old harness. 2. Add WebAssembly.Global tests. * wasm/js-api/global-error.js: (assert.throws.new.WebAssembly.Module.bin): (new.WebAssembly.Module): (assert.throws): * wasm/js-api/global-external-init-from-import.js: * wasm/js-api/globals-export.js: * wasm/modules/js-wasm-global-namespace.js: (assert.throws): * wasm/modules/js-wasm-global.js: (assert.throws): * wasm/modules/wasm-import-wasm-export-i64-error.js: * wasm/references/anyref_globals.js: * wasm/references/func_ref.js: (assert.eq.instance.exports.fix): * wasm/spec-harness.js: (getGlobal): (let.console.log): * wasm/spec-harness/sync_index.js: Renamed from JSTests/wasm/spec-harness/index.js. (reinitializeRegistry.let.handler.get return): (module): * wasm/spec-tests/call.wast.js: * wasm/spec-tests/exports.wast.js: * wasm/spec-tests/globals.wast.js: * wasm/spec-tests/if.wast.js: * wasm/spec-tests/imports.wast.js: * wasm/spec-tests/linking.wast.js: * wasm/spec-tests/memory.wast.js: * wasm/stress/immutable-globals.js: Added. (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.i.assert.eq.instance.exports.getI32): (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.i.assert.eq): * wasm/stress/mutable-globals-cross.js: Added. (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.const.instance1): (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.const.instance2): * wasm/stress/mutable-globals.js: Added. (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.i.instance.exports.setI32AsI64): LayoutTests/imported/w3c: * web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any-expected.txt: * web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/global/constructor.any-expected.txt: * web-platform-tests/wasm/jsapi/global/constructor.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/global/toString.any-expected.txt: * web-platform-tests/wasm/jsapi/global/toString.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/global/value-set.any-expected.txt: * web-platform-tests/wasm/jsapi/global/value-set.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/global/valueOf.any-expected.txt: * web-platform-tests/wasm/jsapi/global/valueOf.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any-expected.txt: * web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt: * web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/interface.any-expected.txt: * web-platform-tests/wasm/jsapi/interface.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/module/exports.any-expected.txt: * web-platform-tests/wasm/jsapi/module/exports.any.worker-expected.txt: Source/JavaScriptCore: This patch adds WebAssembly.Global implementation. It is already included in the Wasm spec (this means, it is not in staging right now: it was stage-4, and included in the spec). WebAssembly.Global is a wrapper object around "global" binding. This object can hold "immutable" and "mutable" global binding, and we can access Wasm globals through this object. Furthermore, we can share mutable global binding through this object across WebAssembly modules. To implement it efficiently, this patch introduces BindingMode to Wasm globals. If the mode is EmbeddedInInstance, we continue using the current existing mechanism. If the mode is Portable, we store a pointer to actual value in Wasm globals array in Wasm::Instance, so that we can access it through one additional dereference. And we mark all immutable globals as EmbeddedInInstance. If the binding is immutable, internally we do not need to have one binding. We can just continue using the current mechanism since users cannot observe whether immutable bindings' storage is shared or not. If the global is mutable, and it is exported outside of the module, we use Portable mode. So, all the previously used wasm global bindings are EmbeddedInInstance. Only newly added "mutable" "exported" bindings are Portable and requires one additional dereference. To access portable bindings efficiently, we add new Wasm bytecodes, `get_global_portable_binding`, `set_global_portable_binding`, and `set_global_ref_portable_binding`. This patch improves WPT wasm coverage significantly. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/BytecodeList.rb: * heap/HeapCell.cpp: (JSC::keepAlive): (JSC::HeapCell::use const): Deleted. * heap/HeapCell.h: (JSC::keepAlive): (JSC::HeapCell::use const): * llint/WebAssembly.asm: * runtime/JSGlobalObject.cpp: * runtime/JSGlobalObject.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::getGlobal): (JSC::Wasm::AirIRGenerator::setGlobal): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::getGlobal): (JSC::Wasm::B3IRGenerator::setGlobal): * wasm/WasmFormat.h: * wasm/WasmGlobal.cpp: Added. (JSC::Wasm::Global::get const): (JSC::Wasm::Global::set): (JSC::Wasm::Global::visitAggregate): * wasm/WasmGlobal.h: Added. * wasm/WasmInstance.cpp: (JSC::Wasm::Instance::Instance): (JSC::Wasm::Instance::setGlobal): (JSC::Wasm::Instance::linkGlobal): * wasm/WasmInstance.h: (JSC::Wasm::Instance::loadI32Global const): (JSC::Wasm::Instance::loadI64Global const): (JSC::Wasm::Instance::setGlobal): (JSC::Wasm::Instance::globalsToBinding): (JSC::Wasm::Instance::getGlobalBinding): * wasm/WasmLLIntGenerator.cpp: (JSC::Wasm::LLIntGenerator::getGlobal): (JSC::Wasm::LLIntGenerator::setGlobal): * wasm/WasmModuleInformation.h: * wasm/WasmOperations.cpp: (JSC::Wasm::operationWasmWriteBarrierSlowPath): * wasm/WasmOperations.h: * wasm/WasmSectionParser.cpp: (JSC::Wasm::SectionParser::parseImport): (JSC::Wasm::SectionParser::parseGlobal): (JSC::Wasm::SectionParser::parseExport): (JSC::Wasm::SectionParser::parseInitExpr): (JSC::Wasm::SectionParser::parseGlobalType): * wasm/WasmSectionParser.h: * wasm/WasmSlowPaths.cpp: (JSC::LLInt::WASM_SLOW_PATH_DECL): * wasm/WasmSlowPaths.h: * wasm/WasmValidate.cpp: (JSC::Wasm::Validate::setGlobal): * wasm/js/JSWebAssembly.cpp: * wasm/js/JSWebAssemblyGlobal.cpp: Added. (JSC::JSWebAssemblyGlobal::create): (JSC::JSWebAssemblyGlobal::createStructure): (JSC::JSWebAssemblyGlobal::JSWebAssemblyGlobal): (JSC::JSWebAssemblyGlobal::finishCreation): (JSC::JSWebAssemblyGlobal::destroy): (JSC::JSWebAssemblyGlobal::visitChildren): * wasm/js/JSWebAssemblyGlobal.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyMemory.h. * wasm/js/JSWebAssemblyInstance.cpp: (JSC::JSWebAssemblyInstance::visitChildren): * wasm/js/JSWebAssemblyInstance.h: * wasm/js/JSWebAssemblyMemory.cpp: (JSC::JSWebAssemblyMemory::destroy): * wasm/js/JSWebAssemblyMemory.h: * wasm/js/JSWebAssemblyModule.h: * wasm/js/JSWebAssemblyTable.h: * wasm/js/WebAssemblyGlobalConstructor.cpp: Added. (JSC::constructJSWebAssemblyGlobal): (JSC::callJSWebAssemblyGlobal): (JSC::WebAssemblyGlobalConstructor::create): (JSC::WebAssemblyGlobalConstructor::createStructure): (JSC::WebAssemblyGlobalConstructor::finishCreation): (JSC::WebAssemblyGlobalConstructor::WebAssemblyGlobalConstructor): * wasm/js/WebAssemblyGlobalConstructor.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyMemory.h. * wasm/js/WebAssemblyGlobalPrototype.cpp: Added. (JSC::getGlobal): (JSC::webAssemblyGlobalProtoFuncValueOf): (JSC::webAssemblyGlobalProtoGetterFuncValue): (JSC::webAssemblyGlobalProtoSetterFuncValue): (JSC::WebAssemblyGlobalPrototype::create): (JSC::WebAssemblyGlobalPrototype::createStructure): (JSC::WebAssemblyGlobalPrototype::finishCreation): (JSC::WebAssemblyGlobalPrototype::WebAssemblyGlobalPrototype): * wasm/js/WebAssemblyGlobalPrototype.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyMemory.h. * wasm/js/WebAssemblyModuleRecord.cpp: (JSC::WebAssemblyModuleRecord::link): Canonical link: https://commits.webkit.org/218038@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-12-04 01:36:56 +00:00
wasm/js/JSWebAssemblyGlobal.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
wasm/js/JSWebAssemblyInstance.cpp
wasm/js/JSWebAssemblyLinkError.cpp
wasm/js/JSWebAssemblyMemory.cpp
wasm/js/JSWebAssemblyModule.cpp
wasm/js/JSWebAssemblyRuntimeError.cpp
wasm/js/JSWebAssemblyTable.cpp
WebAssembly: no VM / JS version of everything but Instance https://bugs.webkit.org/show_bug.cgi?id=177473 Reviewed by Filip Pizlo, Saam Barati. JSTests: - Exceeding max on memory growth now returns a range error as per spec. This is a (very minor) breaking change: it used to throw OOM error. Update the corresponding test. * wasm/js-api/memory-grow.js: (assertEq): * wasm/js-api/table.js: (assert.throws): Source/JavaScriptCore: This change entails cleaning up and splitting a bunch of code which we had intertwined between C++ classes which represent JS objects, and pure C++ implementation objects. This specific change goes most of the way towards allowing JSC's WebAssembly to work without VM / JS, up to but excluding JSWebAssemblyInstance (there's Wasm::Instance, but it's not *the* thing yet). Because of this we still have a few FIXME identifying places that need to change. A follow-up change will go the rest of the way. I went about this change in the simplest way possible: grep the JavaScriptCore/wasm directory for "JS[^C_]" as well as "VM" and exclude the /js/ sub-directory (which contains the JS implementation of WebAssembly). None of this change removes the need for a JIT entitlement to be able to use WebAssembly. We don't have an interpreter, the process therefore still needs to be allowed to JIT to use these pure-C++ APIs. Interesting things to note: - Remove VM from Plan and associated places. It can just live as a capture in the callback lambda if it's needed. - Wasm::Memory shouldn't require a VM. It was only used to ask the GC to collect. We now instead pass two lambdas at construction time for this purpose: one to notify of memory pressure, and the other to ask for syncrhonous memory reclamation. This allows whoever creates the memory to dictate how to react to both these cases, and for a JS embedding that's to call the GC (async or sync, respectively). - Move grow logic from JSWebAssemblyMemory to Wasm::Memory::grow. Use Expected there, with an enum class for failure types. - Exceeding max on memory growth now returns a range error as per spec. This is a (very minor) breaking change: it used to throw OOM error. Update the corresponding test. - When generating the grow_memory opcode, no need to get the VM. Instead, reach directly for Wasm::Memory and grow it. - JSWebAssemblyMemory::grow can now always throw on failure, because it's only ever called from JS (not from grow_memory as before). - Wasm::Memory now takes a callback for successful growth. This allows JS wrappers to register themselves when growth succeeds without Wasm::Memory knowning anything about JS. It'll also allow creating a list of callbacks for when we add thread support (we'll want to notify many wrappers, all under a lock). - Wasm::Memory is now back to being the source of truth about address / size, used directly by generated code instead of JSWebAssemblyMemory. - Move wasmToJS from the general WasmBinding header to its own header under wasm/js. It's only used by wasm/js/JSWebAssemblyCodeBlock.cpp, and uses VM, and therefore isn't general WebAssembly. - Make Wasm::Context an actual type (just a struct holding a JSWebAssemlyInstance for now) instead of an alias for that. Notably this doesn't add anything to the Context and doesn't change what actually gets passed around in JIT code (fast TLS or registers) because these changes potentially impact performance. The entire purpose of this change is to allow passing Wasm::Context around without having to know about VM. Since VM contains a Wasm::Context the JS embedding is effectively the same, but with this setup a non-JS embedding is much better off. - Move JSWebAssembly into the JS folder. - OMGPlan: use Wasm::CodeBlock directly instead of JSWebAssemblyCodeBlock. - wasm->JS stubs are now on the instance's tail as raw pointers, instead of being on JSWebAssemblyCodeBlock, and are now called wasm->Embedder stubs. The owned reference is still on JSWebAssemblyCodeBlock, and is still called wasm->JS stub. This move means that the embedder must, after creating a Wasm::CodeBlock, somehow create the stubs to call back into the embedder. This removes an indirection in the generated code because the B3 IR generator now reaches into the instance instead of JSWebAssemblyCodeBlock. - Move more CodeBlock things. Compilation completion is now marked by its own atomic<bool> flag instead of a nullptr plan: that required using a lock, and was causing a deadlock in stack-trace.js because before my changes JSWebAssemblyCodeBlock did its own completion checking separately from Wasm::CodeBlock, without getting the lock. Now that everything points to Wasm::CodeBlock and there's no cached completion marker, the lock was being acquired in a sanity-check assertion. - Embedder -> Wasm wrappers are now generated through a function that's passed in at compilation time, instead of being hard-coded as a JS -> Wasm wrapper. - WasmMemory doens't need to know about fault handling thunks. Only the IR generator should know, and should make sure that the exception throwing thunk is generated if any memory is present (note: with signal handling not all of them generate an exception check). - Make exception throwing pluggable: instead of having a hard-coded JS-specific lambda we now have a regular C++ function being called from JIT code when a WebAssembly exception is thrown. This allows any embedder to get called as they wish. For now a process can only have a single of these functions (i.e. only one embedder per process) because the trap handler is a singleton. That can be fixed in in #177475. - Create WasmEmbedder.h where all embedder plugging will live. - Split up JSWebAssemblyTable into Wasm::Table which is refcounted. JSWebAssemblyTable now only contains the JS functions in the table, and Wasm::Table is what's used by the JIT code to lookup where to call and do the instance check (for context switch). Note that this creates an extra allocation for all the instances in Wasm::Table, and in exchange removes an indirection in JIT code because the instance used to be obtained off of the JS function. Also note that it's the embedder than keeps the instances alive, not Wasm::Table (which holds a dumb pointer to the instance), because doing otherwise would cause reference cycles. - Add WasmInstance. It doesn't do much for now, owns globals. - JSWebAssembly instance now doesn't just contain the imported functions as JSObjects, it also has the corresponding import's instance and wasm entrypoint. This triples the space allocated per instance's imported function, but there shouldn't be that many imports. This has two upsides: it creates smaller and faster code, and makes is easier to disassociate embedder-specific things from embedder-neutral things. The small / faster win is in two places: B3 IR generator only needs offsetOfImportFunction for the call opcode (when the called index is an import) to know whether the import is wasm->wasm or wasm->embedder (this isn't known at compile-time because it's dependent on the import object), this is now done by seeing if that import function has an associated target instance (only wasm->wasm does); the other place is wasmBinding which uses offsetOfImportFunction to figure out the wasm->wasm target instance, and then gets WebAssemblyFunction::offsetOfWasmEntrypointLoadLocation to do a tail call. The disassociation comes because the target instance can be Wasm::Instance once we change what the Context is, and WasmEntrypointLoadLocation is already embedder-independent. As a next step I can move this tail allocation from JSWebAssemblyInstance to Wasm::Instance, and leave importFunction in as an opaque pointer which is embedder-specific, and in JS will remain WriteBarrier<JSObject>. - Rename VMEntryFrame to EntryFrame, and in many places pass a pointer to it around instead of VM. This is a first step in allowing entry frames which aren't stored on VM, but which are instead stored in an embedder-specific location. That change won't really affect JS except through code churn, but will allow WebAssembly to use some machinery in a generic manner without having a VM. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/PolymorphicAccess.cpp: (JSC::AccessGenerationState::emitExplicitExceptionHandler): * debugger/Debugger.cpp: (JSC::Debugger::stepOutOfFunction): (JSC::Debugger::returnEvent): (JSC::Debugger::unwindEvent): (JSC::Debugger::didExecuteProgram): * dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::compileExceptionHandlers): * dfg/DFGOSREntry.cpp: (JSC::DFG::prepareOSREntry): * dfg/DFGOSRExit.cpp: (JSC::DFG::OSRExit::compileOSRExit): (JSC::DFG::OSRExit::compileExit): * dfg/DFGThunks.cpp: (JSC::DFG::osrEntryThunkGenerator): * ftl/FTLCompile.cpp: (JSC::FTL::compile): * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): * ftl/FTLOSRExitCompiler.cpp: (JSC::FTL::compileStub): * interpreter/CallFrame.cpp: (JSC::CallFrame::wasmAwareLexicalGlobalObject): (JSC::CallFrame::callerFrame): (JSC::CallFrame::unsafeCallerFrame): * interpreter/CallFrame.h: (JSC::ExecState::callerFrame const): (JSC::ExecState::callerFrameOrEntryFrame const): (JSC::ExecState::unsafeCallerFrameOrEntryFrame const): * interpreter/FrameTracers.h: (JSC::NativeCallFrameTracer::NativeCallFrameTracer): (JSC::NativeCallFrameTracerWithRestore::NativeCallFrameTracerWithRestore): (JSC::NativeCallFrameTracerWithRestore::~NativeCallFrameTracerWithRestore): * interpreter/Interpreter.cpp: (JSC::UnwindFunctor::operator() const): (JSC::UnwindFunctor::copyCalleeSavesToEntryFrameCalleeSavesBuffer const): (JSC::Interpreter::unwind): * interpreter/StackVisitor.cpp: (JSC::StackVisitor::StackVisitor): (JSC::StackVisitor::gotoNextFrame): (JSC::StackVisitor::readNonInlinedFrame): (JSC::StackVisitor::Frame::dump const): * interpreter/StackVisitor.h: (JSC::StackVisitor::Frame::callerIsEntryFrame const): * interpreter/VMEntryRecord.h: (JSC::VMEntryRecord::prevTopEntryFrame): (JSC::VMEntryRecord::unsafePrevTopEntryFrame): (JSC::EntryFrame::vmEntryRecordOffset): * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::restoreCalleeSavesFromEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::loadWasmContextInstance): (JSC::AssemblyHelpers::storeWasmContextInstance): (JSC::AssemblyHelpers::loadWasmContextInstanceNeedsMacroScratchRegister): (JSC::AssemblyHelpers::storeWasmContextInstanceNeedsMacroScratchRegister): (JSC::AssemblyHelpers::copyCalleeSavesToEntryFrameCalleeSavesBufferImpl): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::copyCalleeSavesToVMEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::copyCalleeSavesToEntryFrameCalleeSavesBuffer): (JSC::AssemblyHelpers::copyCalleeSavesFromFrameOrRegisterToEntryFrameCalleeSavesBuffer): * jit/JIT.cpp: (JSC::JIT::emitEnterOptimizationCheck): (JSC::JIT::privateCompileExceptionHandlers): * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_throw): (JSC::JIT::emit_op_catch): (JSC::JIT::emitSlow_op_loop_hint): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_throw): (JSC::JIT::emit_op_catch): * jit/JITOperations.cpp: * jit/ThunkGenerators.cpp: (JSC::throwExceptionFromCallSlowPathGenerator): (JSC::nativeForGenerator): * jsc.cpp: (functionDumpCallFrame): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntThunks.cpp: (JSC::vmEntryRecord): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * runtime/Options.cpp: (JSC::recomputeDependentOptions): * runtime/Options.h: * runtime/SamplingProfiler.cpp: (JSC::FrameWalker::FrameWalker): (JSC::FrameWalker::advanceToParentFrame): (JSC::SamplingProfiler::processUnverifiedStackTraces): * runtime/ThrowScope.cpp: (JSC::ThrowScope::~ThrowScope): * runtime/VM.cpp: (JSC::VM::VM): (JSC::VM::~VM): * runtime/VM.h: (JSC::VM::topEntryFrameOffset): * runtime/VMTraps.cpp: (JSC::isSaneFrame): (JSC::VMTraps::tryInstallTrapBreakpoints): (JSC::VMTraps::invalidateCodeBlocksOnStack): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::restoreWasmContextInstance): (JSC::Wasm::B3IRGenerator::B3IRGenerator): (JSC::Wasm::B3IRGenerator::restoreWebAssemblyGlobalState): (JSC::Wasm::B3IRGenerator::addGrowMemory): (JSC::Wasm::B3IRGenerator::addCurrentMemory): (JSC::Wasm::B3IRGenerator::addCall): (JSC::Wasm::B3IRGenerator::addCallIndirect): (JSC::Wasm::parseAndCompile): * wasm/WasmB3IRGenerator.h: * wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::BBQPlan): (JSC::Wasm::BBQPlan::compileFunctions): (JSC::Wasm::BBQPlan::complete): * wasm/WasmBBQPlan.h: * wasm/WasmBBQPlanInlines.h: (JSC::Wasm::BBQPlan::initializeCallees): * wasm/WasmBinding.cpp: (JSC::Wasm::wasmToWasm): * wasm/WasmBinding.h: * wasm/WasmCodeBlock.cpp: (JSC::Wasm::CodeBlock::create): (JSC::Wasm::CodeBlock::CodeBlock): (JSC::Wasm::CodeBlock::compileAsync): (JSC::Wasm::CodeBlock::setCompilationFinished): * wasm/WasmCodeBlock.h: (JSC::Wasm::CodeBlock::offsetOfImportStubs): (JSC::Wasm::CodeBlock::allocationSize): (JSC::Wasm::CodeBlock::importWasmToEmbedderStub): (JSC::Wasm::CodeBlock::offsetOfImportWasmToEmbedderStub): (JSC::Wasm::CodeBlock::wasmToJSCallStubForImport): (JSC::Wasm::CodeBlock::compilationFinished): (JSC::Wasm::CodeBlock::jsEntrypointCalleeFromFunctionIndexSpace): (JSC::Wasm::CodeBlock::wasmEntrypointCalleeFromFunctionIndexSpace): * wasm/WasmContext.cpp: (JSC::Wasm::Context::useFastTLS): (JSC::Wasm::Context::load const): (JSC::Wasm::Context::store): * wasm/WasmContext.h: * wasm/WasmEmbedder.h: Copied from Source/JavaScriptCore/wasm/WasmContext.h. * wasm/WasmFaultSignalHandler.cpp: * wasm/WasmFaultSignalHandler.h: * wasm/WasmFormat.h: * wasm/WasmInstance.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. (JSC::Wasm::Instance::Instance): (JSC::Wasm::Instance::~Instance): (JSC::Wasm::Instance::extraMemoryAllocated const): * wasm/WasmInstance.h: Added. (JSC::Wasm::Instance::create): (JSC::Wasm::Instance::finalizeCreation): (JSC::Wasm::Instance::module): (JSC::Wasm::Instance::codeBlock): (JSC::Wasm::Instance::memory): (JSC::Wasm::Instance::table): (JSC::Wasm::Instance::loadI32Global const): (JSC::Wasm::Instance::loadI64Global const): (JSC::Wasm::Instance::loadF32Global const): (JSC::Wasm::Instance::loadF64Global const): (JSC::Wasm::Instance::setGlobal): (JSC::Wasm::Instance::offsetOfCachedStackLimit): (JSC::Wasm::Instance::cachedStackLimit const): (JSC::Wasm::Instance::setCachedStackLimit): * wasm/WasmMemory.cpp: (JSC::Wasm::Memory::Memory): (JSC::Wasm::Memory::create): (JSC::Wasm::Memory::~Memory): (JSC::Wasm::Memory::grow): * wasm/WasmMemory.h: (JSC::Wasm::Memory::offsetOfMemory): (JSC::Wasm::Memory::offsetOfSize): * wasm/WasmMemoryInformation.cpp: (JSC::Wasm::PinnedRegisterInfo::get): (JSC::Wasm::PinnedRegisterInfo::PinnedRegisterInfo): * wasm/WasmMemoryInformation.h: (JSC::Wasm::PinnedRegisterInfo::toSave const): * wasm/WasmMemoryMode.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. (JSC::Wasm::makeString): * wasm/WasmMemoryMode.h: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h. * wasm/WasmModule.cpp: (JSC::Wasm::makeValidationCallback): (JSC::Wasm::Module::validateSync): (JSC::Wasm::Module::validateAsync): (JSC::Wasm::Module::getOrCreateCodeBlock): (JSC::Wasm::Module::compileSync): (JSC::Wasm::Module::compileAsync): * wasm/WasmModule.h: * wasm/WasmModuleParser.cpp: (JSC::Wasm::ModuleParser::parseTableHelper): * wasm/WasmOMGPlan.cpp: (JSC::Wasm::OMGPlan::OMGPlan): (JSC::Wasm::OMGPlan::runForIndex): * wasm/WasmOMGPlan.h: * wasm/WasmPageCount.h: (JSC::Wasm::PageCount::isValid const): * wasm/WasmPlan.cpp: (JSC::Wasm::Plan::Plan): (JSC::Wasm::Plan::runCompletionTasks): (JSC::Wasm::Plan::addCompletionTask): (JSC::Wasm::Plan::tryRemoveContextAndCancelIfLast): * wasm/WasmPlan.h: (JSC::Wasm::Plan::dontFinalize): * wasm/WasmSignature.cpp: * wasm/WasmSignature.h: * wasm/WasmTable.cpp: Added. (JSC::Wasm::Table::create): (JSC::Wasm::Table::~Table): (JSC::Wasm::Table::Table): (JSC::Wasm::Table::grow): (JSC::Wasm::Table::clearFunction): (JSC::Wasm::Table::setFunction): * wasm/WasmTable.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyTable.h. (JSC::Wasm::Table::maximum const): (JSC::Wasm::Table::size const): (JSC::Wasm::Table::offsetOfSize): (JSC::Wasm::Table::offsetOfFunctions): (JSC::Wasm::Table::offsetOfInstances): (JSC::Wasm::Table::isValidSize): * wasm/WasmThunks.cpp: (JSC::Wasm::throwExceptionFromWasmThunkGenerator): (JSC::Wasm::triggerOMGTierUpThunkGenerator): (JSC::Wasm::Thunks::setThrowWasmException): (JSC::Wasm::Thunks::throwWasmException): * wasm/WasmThunks.h: * wasm/WasmWorklist.cpp: (JSC::Wasm::Worklist::stopAllPlansForContext): * wasm/WasmWorklist.h: * wasm/js/JSToWasm.cpp: Added. (JSC::Wasm::createJSToWasmWrapper): * wasm/js/JSToWasm.h: Copied from Source/JavaScriptCore/wasm/WasmBinding.h. * wasm/js/JSWebAssembly.cpp: Renamed from Source/JavaScriptCore/wasm/JSWebAssembly.cpp. * wasm/js/JSWebAssembly.h: Renamed from Source/JavaScriptCore/wasm/JSWebAssembly.h. * wasm/js/JSWebAssemblyCodeBlock.cpp: (JSC::JSWebAssemblyCodeBlock::create): (JSC::JSWebAssemblyCodeBlock::JSWebAssemblyCodeBlock): * wasm/js/JSWebAssemblyCodeBlock.h: * wasm/js/JSWebAssemblyInstance.cpp: (JSC::JSWebAssemblyInstance::JSWebAssemblyInstance): (JSC::JSWebAssemblyInstance::finishCreation): (JSC::JSWebAssemblyInstance::visitChildren): (JSC::JSWebAssemblyInstance::finalizeCreation): (JSC::JSWebAssemblyInstance::create): * wasm/js/JSWebAssemblyInstance.h: (JSC::JSWebAssemblyInstance::instance): (JSC::JSWebAssemblyInstance::context const): (JSC::JSWebAssemblyInstance::table): (JSC::JSWebAssemblyInstance::webAssemblyToJSCallee): (JSC::JSWebAssemblyInstance::setMemory): (JSC::JSWebAssemblyInstance::offsetOfTail): (JSC::JSWebAssemblyInstance::importFunctionInfo): (JSC::JSWebAssemblyInstance::offsetOfTargetInstance): (JSC::JSWebAssemblyInstance::offsetOfWasmEntrypoint): (JSC::JSWebAssemblyInstance::offsetOfImportFunction): (JSC::JSWebAssemblyInstance::importFunction): (JSC::JSWebAssemblyInstance::internalMemory): (JSC::JSWebAssemblyInstance::wasmCodeBlock const): (JSC::JSWebAssemblyInstance::offsetOfWasmTable): (JSC::JSWebAssemblyInstance::offsetOfCallee): (JSC::JSWebAssemblyInstance::offsetOfGlobals): (JSC::JSWebAssemblyInstance::offsetOfWasmCodeBlock): (JSC::JSWebAssemblyInstance::offsetOfWasmMemory): (JSC::JSWebAssemblyInstance::cachedStackLimit const): (JSC::JSWebAssemblyInstance::setCachedStackLimit): (JSC::JSWebAssemblyInstance::wasmMemory): (JSC::JSWebAssemblyInstance::wasmModule): (JSC::JSWebAssemblyInstance::allocationSize): (JSC::JSWebAssemblyInstance::module const): * wasm/js/JSWebAssemblyMemory.cpp: (JSC::JSWebAssemblyMemory::create): (JSC::JSWebAssemblyMemory::adopt): (JSC::JSWebAssemblyMemory::JSWebAssemblyMemory): (JSC::JSWebAssemblyMemory::grow): (JSC::JSWebAssemblyMemory::growSuccessCallback): * wasm/js/JSWebAssemblyMemory.h: * wasm/js/JSWebAssemblyModule.cpp: (JSC::JSWebAssemblyModule::moduleInformation const): (JSC::JSWebAssemblyModule::exportSymbolTable const): (JSC::JSWebAssemblyModule::signatureIndexFromFunctionIndexSpace const): (JSC::JSWebAssemblyModule::callee const): (JSC::JSWebAssemblyModule::codeBlock): (JSC::JSWebAssemblyModule::module): * wasm/js/JSWebAssemblyModule.h: * wasm/js/JSWebAssemblyTable.cpp: (JSC::JSWebAssemblyTable::create): (JSC::JSWebAssemblyTable::JSWebAssemblyTable): (JSC::JSWebAssemblyTable::visitChildren): (JSC::JSWebAssemblyTable::grow): (JSC::JSWebAssemblyTable::getFunction): (JSC::JSWebAssemblyTable::clearFunction): (JSC::JSWebAssemblyTable::setFunction): * wasm/js/JSWebAssemblyTable.h: (JSC::JSWebAssemblyTable::isValidSize): (JSC::JSWebAssemblyTable::maximum const): (JSC::JSWebAssemblyTable::size const): (JSC::JSWebAssemblyTable::table): * wasm/js/WasmToJS.cpp: Copied from Source/JavaScriptCore/wasm/WasmBinding.cpp. (JSC::Wasm::materializeImportJSCell): (JSC::Wasm::wasmToJS): (JSC::Wasm::wasmToJSException): * wasm/js/WasmToJS.h: Copied from Source/JavaScriptCore/wasm/WasmBinding.h. * wasm/js/WebAssemblyFunction.cpp: (JSC::callWebAssemblyFunction): * wasm/js/WebAssemblyInstanceConstructor.cpp: (JSC::constructJSWebAssemblyInstance): * wasm/js/WebAssemblyMemoryConstructor.cpp: (JSC::constructJSWebAssemblyMemory): * wasm/js/WebAssemblyMemoryPrototype.cpp: (JSC::webAssemblyMemoryProtoFuncGrow): * wasm/js/WebAssemblyModuleConstructor.cpp: (JSC::constructJSWebAssemblyModule): (JSC::WebAssemblyModuleConstructor::createModule): * wasm/js/WebAssemblyModuleConstructor.h: * wasm/js/WebAssemblyModuleRecord.cpp: (JSC::WebAssemblyModuleRecord::link): (JSC::WebAssemblyModuleRecord::evaluate): * wasm/js/WebAssemblyPrototype.cpp: (JSC::webAssemblyCompileFunc): (JSC::instantiate): (JSC::compileAndInstantiate): (JSC::webAssemblyValidateFunc): * wasm/js/WebAssemblyTableConstructor.cpp: (JSC::constructJSWebAssemblyTable): * wasm/js/WebAssemblyWrapperFunction.cpp: (JSC::WebAssemblyWrapperFunction::create): Source/WebCore: * ForwardingHeaders/wasm/WasmModule.h: Added. This used to be included in JSWebAssemblyModule.h. * bindings/js/SerializedScriptValue.cpp: Update postMessage code according to C++ API changes. Canonical link: https://commits.webkit.org/194750@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223738 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-20 02:23:29 +00:00
wasm/js/WasmToJS.cpp
wasm/js/WasmToJS.h
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
wasm/js/WebAssemblyCompileErrorConstructor.cpp
wasm/js/WebAssemblyCompileErrorPrototype.cpp
wasm/js/WebAssemblyFunction.cpp
wasm/js/WebAssemblyFunctionBase.cpp
Adopt the new WebAssembly.Global system https://bugs.webkit.org/show_bug.cgi?id=186552 Reviewed by Keith Miller. JSTests: 1. Update spec-harness to accept newer tests. And we update several tests that does not work with the old harness. 2. Add WebAssembly.Global tests. * wasm/js-api/global-error.js: (assert.throws.new.WebAssembly.Module.bin): (new.WebAssembly.Module): (assert.throws): * wasm/js-api/global-external-init-from-import.js: * wasm/js-api/globals-export.js: * wasm/modules/js-wasm-global-namespace.js: (assert.throws): * wasm/modules/js-wasm-global.js: (assert.throws): * wasm/modules/wasm-import-wasm-export-i64-error.js: * wasm/references/anyref_globals.js: * wasm/references/func_ref.js: (assert.eq.instance.exports.fix): * wasm/spec-harness.js: (getGlobal): (let.console.log): * wasm/spec-harness/sync_index.js: Renamed from JSTests/wasm/spec-harness/index.js. (reinitializeRegistry.let.handler.get return): (module): * wasm/spec-tests/call.wast.js: * wasm/spec-tests/exports.wast.js: * wasm/spec-tests/globals.wast.js: * wasm/spec-tests/if.wast.js: * wasm/spec-tests/imports.wast.js: * wasm/spec-tests/linking.wast.js: * wasm/spec-tests/memory.wast.js: * wasm/stress/immutable-globals.js: Added. (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.i.assert.eq.instance.exports.getI32): (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.i.assert.eq): * wasm/stress/mutable-globals-cross.js: Added. (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.const.instance1): (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.const.instance2): * wasm/stress/mutable-globals.js: Added. (import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.i.instance.exports.setI32AsI64): LayoutTests/imported/w3c: * web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any-expected.txt: * web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/global/constructor.any-expected.txt: * web-platform-tests/wasm/jsapi/global/constructor.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/global/toString.any-expected.txt: * web-platform-tests/wasm/jsapi/global/toString.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/global/value-set.any-expected.txt: * web-platform-tests/wasm/jsapi/global/value-set.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/global/valueOf.any-expected.txt: * web-platform-tests/wasm/jsapi/global/valueOf.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any-expected.txt: * web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt: * web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/interface.any-expected.txt: * web-platform-tests/wasm/jsapi/interface.any.worker-expected.txt: * web-platform-tests/wasm/jsapi/module/exports.any-expected.txt: * web-platform-tests/wasm/jsapi/module/exports.any.worker-expected.txt: Source/JavaScriptCore: This patch adds WebAssembly.Global implementation. It is already included in the Wasm spec (this means, it is not in staging right now: it was stage-4, and included in the spec). WebAssembly.Global is a wrapper object around "global" binding. This object can hold "immutable" and "mutable" global binding, and we can access Wasm globals through this object. Furthermore, we can share mutable global binding through this object across WebAssembly modules. To implement it efficiently, this patch introduces BindingMode to Wasm globals. If the mode is EmbeddedInInstance, we continue using the current existing mechanism. If the mode is Portable, we store a pointer to actual value in Wasm globals array in Wasm::Instance, so that we can access it through one additional dereference. And we mark all immutable globals as EmbeddedInInstance. If the binding is immutable, internally we do not need to have one binding. We can just continue using the current mechanism since users cannot observe whether immutable bindings' storage is shared or not. If the global is mutable, and it is exported outside of the module, we use Portable mode. So, all the previously used wasm global bindings are EmbeddedInInstance. Only newly added "mutable" "exported" bindings are Portable and requires one additional dereference. To access portable bindings efficiently, we add new Wasm bytecodes, `get_global_portable_binding`, `set_global_portable_binding`, and `set_global_ref_portable_binding`. This patch improves WPT wasm coverage significantly. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/BytecodeList.rb: * heap/HeapCell.cpp: (JSC::keepAlive): (JSC::HeapCell::use const): Deleted. * heap/HeapCell.h: (JSC::keepAlive): (JSC::HeapCell::use const): * llint/WebAssembly.asm: * runtime/JSGlobalObject.cpp: * runtime/JSGlobalObject.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: * wasm/WasmAirIRGenerator.cpp: (JSC::Wasm::AirIRGenerator::getGlobal): (JSC::Wasm::AirIRGenerator::setGlobal): * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::getGlobal): (JSC::Wasm::B3IRGenerator::setGlobal): * wasm/WasmFormat.h: * wasm/WasmGlobal.cpp: Added. (JSC::Wasm::Global::get const): (JSC::Wasm::Global::set): (JSC::Wasm::Global::visitAggregate): * wasm/WasmGlobal.h: Added. * wasm/WasmInstance.cpp: (JSC::Wasm::Instance::Instance): (JSC::Wasm::Instance::setGlobal): (JSC::Wasm::Instance::linkGlobal): * wasm/WasmInstance.h: (JSC::Wasm::Instance::loadI32Global const): (JSC::Wasm::Instance::loadI64Global const): (JSC::Wasm::Instance::setGlobal): (JSC::Wasm::Instance::globalsToBinding): (JSC::Wasm::Instance::getGlobalBinding): * wasm/WasmLLIntGenerator.cpp: (JSC::Wasm::LLIntGenerator::getGlobal): (JSC::Wasm::LLIntGenerator::setGlobal): * wasm/WasmModuleInformation.h: * wasm/WasmOperations.cpp: (JSC::Wasm::operationWasmWriteBarrierSlowPath): * wasm/WasmOperations.h: * wasm/WasmSectionParser.cpp: (JSC::Wasm::SectionParser::parseImport): (JSC::Wasm::SectionParser::parseGlobal): (JSC::Wasm::SectionParser::parseExport): (JSC::Wasm::SectionParser::parseInitExpr): (JSC::Wasm::SectionParser::parseGlobalType): * wasm/WasmSectionParser.h: * wasm/WasmSlowPaths.cpp: (JSC::LLInt::WASM_SLOW_PATH_DECL): * wasm/WasmSlowPaths.h: * wasm/WasmValidate.cpp: (JSC::Wasm::Validate::setGlobal): * wasm/js/JSWebAssembly.cpp: * wasm/js/JSWebAssemblyGlobal.cpp: Added. (JSC::JSWebAssemblyGlobal::create): (JSC::JSWebAssemblyGlobal::createStructure): (JSC::JSWebAssemblyGlobal::JSWebAssemblyGlobal): (JSC::JSWebAssemblyGlobal::finishCreation): (JSC::JSWebAssemblyGlobal::destroy): (JSC::JSWebAssemblyGlobal::visitChildren): * wasm/js/JSWebAssemblyGlobal.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyMemory.h. * wasm/js/JSWebAssemblyInstance.cpp: (JSC::JSWebAssemblyInstance::visitChildren): * wasm/js/JSWebAssemblyInstance.h: * wasm/js/JSWebAssemblyMemory.cpp: (JSC::JSWebAssemblyMemory::destroy): * wasm/js/JSWebAssemblyMemory.h: * wasm/js/JSWebAssemblyModule.h: * wasm/js/JSWebAssemblyTable.h: * wasm/js/WebAssemblyGlobalConstructor.cpp: Added. (JSC::constructJSWebAssemblyGlobal): (JSC::callJSWebAssemblyGlobal): (JSC::WebAssemblyGlobalConstructor::create): (JSC::WebAssemblyGlobalConstructor::createStructure): (JSC::WebAssemblyGlobalConstructor::finishCreation): (JSC::WebAssemblyGlobalConstructor::WebAssemblyGlobalConstructor): * wasm/js/WebAssemblyGlobalConstructor.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyMemory.h. * wasm/js/WebAssemblyGlobalPrototype.cpp: Added. (JSC::getGlobal): (JSC::webAssemblyGlobalProtoFuncValueOf): (JSC::webAssemblyGlobalProtoGetterFuncValue): (JSC::webAssemblyGlobalProtoSetterFuncValue): (JSC::WebAssemblyGlobalPrototype::create): (JSC::WebAssemblyGlobalPrototype::createStructure): (JSC::WebAssemblyGlobalPrototype::finishCreation): (JSC::WebAssemblyGlobalPrototype::WebAssemblyGlobalPrototype): * wasm/js/WebAssemblyGlobalPrototype.h: Copied from Source/JavaScriptCore/wasm/js/JSWebAssemblyMemory.h. * wasm/js/WebAssemblyModuleRecord.cpp: (JSC::WebAssemblyModuleRecord::link): Canonical link: https://commits.webkit.org/218038@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-12-04 01:36:56 +00:00
wasm/js/WebAssemblyGlobalConstructor.cpp
wasm/js/WebAssemblyGlobalPrototype.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
wasm/js/WebAssemblyInstanceConstructor.cpp
wasm/js/WebAssemblyInstancePrototype.cpp
wasm/js/WebAssemblyLinkErrorConstructor.cpp
wasm/js/WebAssemblyLinkErrorPrototype.cpp
wasm/js/WebAssemblyMemoryConstructor.cpp
wasm/js/WebAssemblyMemoryPrototype.cpp
wasm/js/WebAssemblyModuleConstructor.cpp
wasm/js/WebAssemblyModulePrototype.cpp
wasm/js/WebAssemblyModuleRecord.cpp
wasm/js/WebAssemblyRuntimeErrorConstructor.cpp
wasm/js/WebAssemblyRuntimeErrorPrototype.cpp
wasm/js/WebAssemblyTableConstructor.cpp
wasm/js/WebAssemblyTablePrototype.cpp
wasm/js/WebAssemblyWrapperFunction.cpp
yarr/RegularExpression.cpp
yarr/YarrCanonicalizeUCS2.cpp
Yarr JIT should include annotations with dumpDisassembly=true https://bugs.webkit.org/show_bug.cgi?id=188415 Reviewed by Yusuke Suzuki. Created a YarrDisassembler class that handles annotations similar to the baseline JIT. Given that the Yarr creates matching code bu going through the YarrPattern ops forward and then the backtracking code through the YarrPattern ops in reverse order, the disassembler needs to do the same think. Restructured some of the logging code in YarrPattern to eliminate redundent code and factor out simple methods for what was needed by the YarrDisassembler. Here is abbreviated sample output after this change. Generated JIT code for 8-bit regular expression /ab*c/: Code at [0x469561c03720, 0x469561c03840): 0x469561c03720: push %rbp 0x469561c03721: mov %rsp, %rbp ... 0x469561c03762: sub $0x40, %rsp == Matching == 0:OpBodyAlternativeBegin minimum size 2 0x469561c03766: add $0x2, %esi 0x469561c03769: cmp %edx, %esi 0x469561c0376b: ja 0x469561c037fa 1:OpTerm TypePatternCharacter 'a' 0x469561c03771: movzx -0x2(%rdi,%rsi), %eax 0x469561c03776: cmp $0x61, %eax 0x469561c03779: jnz 0x469561c037e9 2:OpTerm TypePatternCharacter 'b' {0,...} greedy 0x469561c0377f: xor %r9d, %r9d 0x469561c03782: cmp %edx, %esi 0x469561c03784: jz 0x469561c037a2 ... 0x469561c0379d: jmp 0x469561c03782 0x469561c037a2: mov %r9, 0x8(%rsp) 3:OpTerm TypePatternCharacter 'c' 0x469561c037a7: movzx -0x1(%rdi,%rsi), %eax 0x469561c037ac: cmp $0x63, %eax 0x469561c037af: jnz 0x469561c037d1 4:OpBodyAlternativeEnd 0x469561c037b5: add $0x40, %rsp ... 0x469561c037cf: pop %rbp 0x469561c037d0: ret == Backtracking == 4:OpBodyAlternativeEnd 3:OpTerm TypePatternCharacter 'c' 2:OpTerm TypePatternCharacter 'b' {0,...} greedy 0x469561c037d1: mov 0x8(%rsp), %r9 ... 0x469561c037e4: jmp 0x469561c037a2 1:OpTerm TypePatternCharacter 'a' 0:OpBodyAlternativeBegin minimum size 2 0x469561c037e9: mov %rsi, %rax ... 0x469561c0382f: pop %rbp 0x469561c03830: ret * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * runtime/RegExp.cpp: (JSC::RegExp::compile): (JSC::RegExp::compileMatchOnly): * yarr/YarrDisassembler.cpp: Added. (JSC::Yarr::YarrDisassembler::indentString): (JSC::Yarr::YarrDisassembler::YarrDisassembler): (JSC::Yarr::YarrDisassembler::~YarrDisassembler): (JSC::Yarr::YarrDisassembler::dump): (JSC::Yarr::YarrDisassembler::dumpHeader): (JSC::Yarr::YarrDisassembler::dumpVectorForInstructions): (JSC::Yarr::YarrDisassembler::dumpForInstructions): (JSC::Yarr::YarrDisassembler::dumpDisassembly): * yarr/YarrDisassembler.h: Added. (JSC::Yarr::YarrJITInfo::~YarrJITInfo): (JSC::Yarr::YarrDisassembler::setStartOfCode): (JSC::Yarr::YarrDisassembler::setForGenerate): (JSC::Yarr::YarrDisassembler::setForBacktrack): (JSC::Yarr::YarrDisassembler::setEndOfGenerate): (JSC::Yarr::YarrDisassembler::setEndOfBacktrack): (JSC::Yarr::YarrDisassembler::setEndOfCode): (JSC::Yarr::YarrDisassembler::indentString): * yarr/YarrJIT.cpp: (JSC::Yarr::YarrGenerator::generate): (JSC::Yarr::YarrGenerator::backtrack): (JSC::Yarr::YarrGenerator::YarrGenerator): (JSC::Yarr::YarrGenerator::compile): (JSC::Yarr::jitCompile): * yarr/YarrJIT.h: * yarr/YarrPattern.cpp: (JSC::Yarr::dumpCharacterClass): (JSC::Yarr::PatternTerm::dump): (JSC::Yarr::YarrPattern::dumpPatternString): (JSC::Yarr::YarrPattern::dumpPattern): * yarr/YarrPattern.h: Canonical link: https://commits.webkit.org/203528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234713 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-08-08 22:42:30 +00:00
yarr/YarrDisassembler.cpp
[YARR] Yarr should return ErrorCode instead of error messages (const char*) https://bugs.webkit.org/show_bug.cgi?id=180966 Reviewed by Mark Lam. Source/JavaScriptCore: Currently, Yarr returns const char*` for an error message when needed. But it is easier to handle error status if Yarr returns an error code instead of `const char*`. In this patch, we introduce Yarr::ErrorCode. Yarr returns it instead of `const char*`. `std::expected<void, Yarr::ErrorCode>` would be appropriate for the Yarr API interface. But it requires substantial changes removing ErrorCode::NoError, so this patch just uses the current Yarr::ErrorCode as a first step. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * inspector/ContentSearchUtilities.cpp: (Inspector::ContentSearchUtilities::findMagicComment): * parser/ASTBuilder.h: (JSC::ASTBuilder::createRegExp): * parser/Parser.cpp: (JSC::Parser<LexerType>::parsePrimaryExpression): * parser/SyntaxChecker.h: (JSC::SyntaxChecker::createRegExp): * runtime/RegExp.cpp: (JSC::RegExp::RegExp): (JSC::RegExp::byteCodeCompileIfNecessary): (JSC::RegExp::compile): (JSC::RegExp::compileMatchOnly): * runtime/RegExp.h: * yarr/RegularExpression.cpp: (JSC::Yarr::RegularExpression::Private::Private): (JSC::Yarr::RegularExpression::Private::compile): * yarr/YarrErrorCode.cpp: Added. (JSC::Yarr::errorMessage): * yarr/YarrErrorCode.h: Copied from Source/JavaScriptCore/yarr/YarrSyntaxChecker.h. (JSC::Yarr::hasError): * yarr/YarrParser.h: (JSC::Yarr::Parser::CharacterClassParserDelegate::CharacterClassParserDelegate): (JSC::Yarr::Parser::CharacterClassParserDelegate::atomPatternCharacter): (JSC::Yarr::Parser::Parser): (JSC::Yarr::Parser::isIdentityEscapeAnError): (JSC::Yarr::Parser::parseEscape): (JSC::Yarr::Parser::parseCharacterClass): (JSC::Yarr::Parser::parseParenthesesBegin): (JSC::Yarr::Parser::parseParenthesesEnd): (JSC::Yarr::Parser::parseQuantifier): (JSC::Yarr::Parser::parseTokens): (JSC::Yarr::Parser::parse): (JSC::Yarr::Parser::tryConsumeUnicodeEscape): (JSC::Yarr::Parser::tryConsumeUnicodePropertyExpression): (JSC::Yarr::parse): * yarr/YarrPattern.cpp: (JSC::Yarr::YarrPatternConstructor::YarrPatternConstructor): (JSC::Yarr::YarrPatternConstructor::setupDisjunctionOffsets): (JSC::Yarr::YarrPatternConstructor::setupOffsets): (JSC::Yarr::YarrPattern::compile): (JSC::Yarr::YarrPattern::YarrPattern): (JSC::Yarr::YarrPattern::errorMessage): Deleted. * yarr/YarrPattern.h: (JSC::Yarr::YarrPattern::reset): * yarr/YarrSyntaxChecker.cpp: (JSC::Yarr::checkSyntax): * yarr/YarrSyntaxChecker.h: Source/WebCore: Remove unnecessary String creation. No behavior change. * contentextensions/URLFilterParser.cpp: (WebCore::ContentExtensions::URLFilterParser::addPattern): Canonical link: https://commits.webkit.org/196868@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226128 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-12-19 19:16:21 +00:00
yarr/YarrErrorCode.cpp
Invalid flags in a RegExp literal should be an early SyntaxError https://bugs.webkit.org/show_bug.cgi?id=195514 Reviewed by Darin Adler. JSTests: * test262/expectations.yaml: Mark 4 test cases as passing. * stress/regexp-syntax-error-invalid-flags.js: * stress/regress-161995.js: Removed. Update existing test, merging in an older test for the same behavior. Source/JavaScriptCore: Currently we're throwing a *runtime* SyntaxError; this should occur at parse time. 12.2.8.1 Static Semantics: Early Errors PrimaryExpression : RegularExpressionLiteral - It is a Syntax Error if BodyText of RegularExpressionLiteral cannot be recognized using the goal symbol Pattern of the ECMAScript RegExp grammar specified in 21.2.1. - It is a Syntax Error if FlagText of RegularExpressionLiteral contains any code points other than "g", "i", "m", "s", "u", or "y", or if it contains the same code point more than once. In fixing this, let's also move flag handling from runtime/ to yarr/. * yarr/YarrSyntaxChecker.cpp: (JSC::Yarr::checkSyntax): Check flags before checking pattern. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecompiler/NodesCodegen.cpp: (JSC::RegExpNode::emitBytecode): * inspector/ContentSearchUtilities.cpp: (Inspector::ContentSearchUtilities::findMagicComment): * runtime/CachedTypes.cpp: * runtime/RegExp.cpp: (JSC::RegExp::RegExp): (JSC::RegExp::createWithoutCaching): (JSC::RegExp::create): (JSC::regExpFlags): Deleted. * runtime/RegExp.h: * runtime/RegExpCache.cpp: (JSC::RegExpCache::lookupOrCreate): (JSC::RegExpCache::ensureEmptyRegExpSlow): * runtime/RegExpCache.h: * runtime/RegExpConstructor.cpp: (JSC::toFlags): (JSC::regExpCreate): (JSC::constructRegExp): * runtime/RegExpKey.h: (JSC::RegExpKey::RegExpKey): (WTF::HashTraits<JSC::RegExpKey>::constructDeletedValue): (WTF::HashTraits<JSC::RegExpKey>::isDeletedValue): (): Deleted. * runtime/RegExpPrototype.cpp: (JSC::regExpProtoFuncCompile): * testRegExp.cpp: (parseRegExpLine): * yarr/RegularExpression.cpp: (JSC::Yarr::RegularExpression::Private::compile): * yarr/YarrFlags.cpp: Added. (JSC::Yarr::parseFlags): * yarr/YarrFlags.h: Added. * yarr/YarrInterpreter.h: (JSC::Yarr::BytecodePattern::ignoreCase const): (JSC::Yarr::BytecodePattern::multiline const): (JSC::Yarr::BytecodePattern::sticky const): (JSC::Yarr::BytecodePattern::unicode const): (JSC::Yarr::BytecodePattern::dotAll const): * yarr/YarrPattern.cpp: (JSC::Yarr::YarrPattern::compile): (JSC::Yarr::YarrPattern::YarrPattern): (JSC::Yarr::YarrPattern::dumpPattern): * yarr/YarrPattern.h: (JSC::Yarr::YarrPattern::global const): (JSC::Yarr::YarrPattern::ignoreCase const): (JSC::Yarr::YarrPattern::multiline const): (JSC::Yarr::YarrPattern::sticky const): (JSC::Yarr::YarrPattern::unicode const): (JSC::Yarr::YarrPattern::dotAll const): Move flag handling to Yarr and modernize API. Source/WebCore: * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readTerminal): Consume YarrFlags. Canonical link: https://commits.webkit.org/209831@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242699 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-03-11 06:20:53 +00:00
yarr/YarrFlags.cpp
JSC Xcode build should use unified sources for platform independent files https://bugs.webkit.org/show_bug.cgi?id=177190 Reviewed by Saam Barati. .: Add a macro for collecting the set of "header" source files and adding the bundle files to the "sources" list. * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch changes the Xcode build to use unified sources. The main difference from a development perspective is that instead of added source files to Xcode they need to be added to the shared sources.txt. For now, platform specific files are still added to the JavaScriptCore target. Because Xcode needs to know about all the files before we generate them all the unified source files need to be added to the JavaScriptCore framework target. As a result, if we run out of bundle files more will need to be added to the project. Currently, there are no spare files. If adding more bundle files becomes problematic we can change this. LowLevelInterpreter.cpp can't be added to the unified source list yet due to a clang bug. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * sources.txt: Added. Source/WTF: Add a new directory for build scripts that are forwarded to subsequent framework builds. * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb. * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: Canonical link: https://commits.webkit.org/193609@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222297 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-20 23:08:50 +00:00
yarr/YarrInterpreter.cpp
yarr/YarrJIT.cpp
yarr/YarrPattern.cpp
yarr/YarrSyntaxChecker.cpp
Implement RegExp Unicode property escapes https://bugs.webkit.org/show_bug.cgi?id=172069 Reviewed by JF Bastien. JSTests: Enabled Unicode Property tests. * test262.yaml: Source/JavaScriptCore: Added Unicode Properties by extending the existing CharacterClass processing. Introduced a new Python script, generateYarrUnicodePropertyTables.py, that parses Unicode Database files to create character class data. The result is a set of functions that return character classes, one for each of the required Unicode properties. There are many cases where many properties are handled by one function, primarily due to property aliases, but also due to Script_Extension properties that are the same as the Script property for the same script value. Extended the BuiltInCharacterClassID enum so it can be used also for Unicode property character classes. Unicode properties are the enum value BaseUnicodePropertyID plus a zero based value, that value being the index to the corrensponding character class function. The generation script also creates static hashing tables similar to what we use for the generated .lut.h lookup table files. These hashing tables map property names to the function index. Using these hashing tables, we can lookup a property name and if present convert it to a function index. We add that index to BaseUnicodePropertyID to create a BuiltInCharacterClassID. When we do syntax parsing, we convert the property to its corresponding BuiltInCharacterClassID. When doing real parsing we takes the returned BuiltInCharacterClassID and use it to get the actual character class by calling the corresponding generated function. Added a new CharacterClass constructor that can take literal arrays for ranges and matches to make the creation of large static character classes more efficent. Since the Unicode character classes typically have more matches and ranges, the character class matching in the interpreter has been updated to use binary searching for matches and ranges with more than 6 entries. * CMakeLists.txt: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Scripts/generateYarrUnicodePropertyTables.py: Added. (openOrExit): (openUCDFileOrExit): (verifyUCDFilesExist): (ceilingToPowerOf2): (Aliases): (Aliases.__init__): (Aliases.parsePropertyAliasesFile): (Aliases.parsePropertyValueAliasesFile): (Aliases.globalAliasesFor): (Aliases.generalCategoryAliasesFor): (Aliases.generalCategoryForAlias): (Aliases.scriptAliasesFor): (Aliases.scriptNameForAlias): (PropertyData): (PropertyData.__init__): (PropertyData.setAliases): (PropertyData.makeCopy): (PropertyData.getIndex): (PropertyData.getCreateFuncName): (PropertyData.addMatch): (PropertyData.addRange): (PropertyData.addMatchUnorderedForMatchesAndRanges): (PropertyData.addRangeUnorderedForMatchesAndRanges): (PropertyData.addMatchUnordered): (PropertyData.addRangeUnordered): (PropertyData.removeMatchFromRanges): (PropertyData.removeMatch): (PropertyData.dumpMatchData): (PropertyData.dump): (PropertyData.dumpAll): (PropertyData.dumpAll.std): (PropertyData.createAndDumpHashTable): (Scripts): (Scripts.__init__): (Scripts.parseScriptsFile): (Scripts.parseScriptExtensionsFile): (Scripts.dump): (GeneralCategory): (GeneralCategory.__init__): (GeneralCategory.createSpecialPropertyData): (GeneralCategory.findPropertyGroupFor): (GeneralCategory.addNextCodePoints): (GeneralCategory.parse): (GeneralCategory.dump): (BinaryProperty): (BinaryProperty.__init__): (BinaryProperty.parsePropertyFile): (BinaryProperty.dump): * Scripts/hasher.py: Added. (stringHash): * Sources.txt: * ucd/DerivedBinaryProperties.txt: Added. * ucd/DerivedCoreProperties.txt: Added. * ucd/DerivedNormalizationProps.txt: Added. * ucd/PropList.txt: Added. * ucd/PropertyAliases.txt: Added. * ucd/PropertyValueAliases.txt: Added. * ucd/ScriptExtensions.txt: Added. * ucd/Scripts.txt: Added. * ucd/UnicodeData.txt: Added. * ucd/emoji-data.txt: Added. * yarr/Yarr.h: * yarr/YarrInterpreter.cpp: (JSC::Yarr::Interpreter::testCharacterClass): * yarr/YarrParser.h: (JSC::Yarr::Parser::parseEscape): (JSC::Yarr::Parser::parseTokens): (JSC::Yarr::Parser::isUnicodePropertyValueExpressionChar): (JSC::Yarr::Parser::tryConsumeUnicodePropertyExpression): * yarr/YarrPattern.cpp: (JSC::Yarr::CharacterClassConstructor::appendInverted): (JSC::Yarr::YarrPatternConstructor::atomBuiltInCharacterClass): (JSC::Yarr::YarrPatternConstructor::atomCharacterClassBuiltIn): (JSC::Yarr::YarrPattern::errorMessage): (JSC::Yarr::PatternTerm::dump): * yarr/YarrPattern.h: (JSC::Yarr::CharacterRange::CharacterRange): (JSC::Yarr::CharacterClass::CharacterClass): (JSC::Yarr::YarrPattern::reset): (JSC::Yarr::YarrPattern::unicodeCharacterClassFor): * yarr/YarrUnicodeProperties.cpp: Added. (JSC::Yarr::HashTable::entry const): (JSC::Yarr::unicodeMatchPropertyValue): (JSC::Yarr::unicodeMatchProperty): (JSC::Yarr::createUnicodeCharacterClassFor): * yarr/YarrUnicodeProperties.h: Added. Source/WebCore: Refactoring change - Added BuiltInCharacterClassID:: prefix to uses of the enum. * contentextensions/URLFilterParser.cpp: (WebCore::ContentExtensions::PatternParser::atomBuiltInCharacterClass): LayoutTests: New test. * js/regexp-unicode-properties-expected.txt: Added. * js/regexp-unicode-properties.html: Added. * js/script-tests/regexp-unicode-properties.js: Added. Canonical link: https://commits.webkit.org/194348@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223081 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-09 23:14:46 +00:00
yarr/YarrUnicodeProperties.cpp
JSC build should use unified sources for derived sources https://bugs.webkit.org/show_bug.cgi?id=177421 Reviewed by JF Bastien. .: * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch make a couple of changes: 1) Make derived sources added to relevant bundles. I was going to add JSCBuiltins.cpp to runtime but that kept breaking the windows build. I'll get back to it later 2) Move the derived location of some sources both for clarity and for ease of use. 3) Make auto generator scripts able to create directories if needed. 4) Move some scripts from the top level of the JavaScriptCore directory to a more appropriate directory. 5) Move some CMake generation commands around for clarity. * CMakeLists.txt: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Scripts/lazywriter.py: (LazyFileWriter.close): * Sources.txt: * inspector/scripts/generate-inspector-protocol-bindings.py: (IncrementalFileWriter.close): * yarr/create_regex_tables: Renamed from Source/JavaScriptCore/create_regex_tables. * yarr/generateYarrCanonicalizeUnicode: Renamed from Source/JavaScriptCore/generateYarrCanonicalizeUnicode. Source/WTF: The script now needs to determine if a file is from a derived source. This is only relevant for the CMake build since the script needs to provide a list of the bundled source files. If the script does not provide the full path for derived sources then CMake will be unable to find them and the build will fail. Additionally, I move the error message for the Xcode build outside the main loop. This means that the error message will contain all the files you need to add to Xcode and all those files will now be written in DerivedSources so they should be easier to add. * Scripts/generate-unified-source-bundles.rb: Canonical link: https://commits.webkit.org/193793@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-26 15:34:19 +00:00
Setup WebCore build to start using unified sources. https://bugs.webkit.org/show_bug.cgi?id=178362 Reviewed by Tim Horton. .: Pass features to the unified source bundler script. * Source/cmake/WebKitCommon.cmake: * Source/cmake/WebKitFeatures.cmake: * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: Change comments in source list files. Also, pass explicit names for build files. * CMakeLists.txt: * PlatformGTK.cmake: * PlatformMac.cmake: * Sources.txt: * SourcesGTK.txt: * SourcesMac.txt: Source/WebCore: This patch adds all the long tooling needed to start adding unified sources to WebCore. Most of the source list files are empty to start but will be filled over the next few days. I started by moving all the non-derived bindings code to unified sources to make sure everything worked correctly. * CMakeLists.txt: * Configurations/GenerateUnifiedSources.xcconfig: Added. * Configurations/WebCore.xcconfig: * PlatformMac.cmake: * Sources.txt: Added. * SourcesCocoa.txt: Added. * SourcesIOS.txt: Added. * SourcesMac.txt: Added. * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSMediaStreamCapabilitiesCustom.cpp: Removed. No one seems to use this... Source/WTF: There are a number of changes to the bundler script. First, it is now possible to enable or disable building files based on if the associated feature flag is enabled or not. The syntax for this is similar to how we do #ifs in C++ code. e.g. #if ENABLE_APPLE_PAY myApplePayFile.cpp #endif would enable myApplePayFile.cpp if and only if the APPLE_PAY feature define is set. I also changed comments from # to // to make it less likely they would be confused with a #if. Finally, this patch enables bundling files in the same relative directory across source list files. Previously, if SourcesCocoa.txt had platform/cf/foo.cpp and SourcesMac.txt had platform/cf/bar.cpp those files would not be put in the same unified source bundle. Now, those files will be put into the same bundle but bar.cpp will always follow foo.cpp. The idea is that by putting more specific files after more general files we can avoid random build failures. * Scripts/generate-unified-source-bundles.rb: Canonical link: https://commits.webkit.org/194673@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223621 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-18 19:14:51 +00:00
// Derived Sources
JSC build should use unified sources for derived sources https://bugs.webkit.org/show_bug.cgi?id=177421 Reviewed by JF Bastien. .: * Source/cmake/WebKitMacros.cmake: Source/JavaScriptCore: This patch make a couple of changes: 1) Make derived sources added to relevant bundles. I was going to add JSCBuiltins.cpp to runtime but that kept breaking the windows build. I'll get back to it later 2) Move the derived location of some sources both for clarity and for ease of use. 3) Make auto generator scripts able to create directories if needed. 4) Move some scripts from the top level of the JavaScriptCore directory to a more appropriate directory. 5) Move some CMake generation commands around for clarity. * CMakeLists.txt: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Scripts/lazywriter.py: (LazyFileWriter.close): * Sources.txt: * inspector/scripts/generate-inspector-protocol-bindings.py: (IncrementalFileWriter.close): * yarr/create_regex_tables: Renamed from Source/JavaScriptCore/create_regex_tables. * yarr/generateYarrCanonicalizeUnicode: Renamed from Source/JavaScriptCore/generateYarrCanonicalizeUnicode. Source/WTF: The script now needs to determine if a file is from a derived source. This is only relevant for the CMake build since the script needs to provide a list of the bundled source files. If the script does not provide the full path for derived sources then CMake will be unable to find them and the build will fail. Additionally, I move the error message for the Xcode build outside the main loop. This means that the error message will contain all the files you need to add to Xcode and all those files will now be written in DerivedSources so they should be easier to add. * Scripts/generate-unified-source-bundles.rb: Canonical link: https://commits.webkit.org/193793@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-26 15:34:19 +00:00
yarr/YarrCanonicalizeUnicode.cpp