Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (277304 => 277305)
--- trunk/Source/_javascript_Core/ChangeLog 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/ChangeLog 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,3 +1,132 @@
+2021-05-10 Mark Lam <mark....@apple.com>
+
+ Add support to collect stats on cumulative LinkBuffer linked sizes based on profiles.
+ https://bugs.webkit.org/show_bug.cgi?id=225617
+
+ Reviewed by Saam Barati.
+
+ There are 2 ways to dump the stats:
+ 1. Specify --dumpLinkBufferStats as an argument to the jsc shell.
+ 2. Call $vm.dumpLinkBufferStats() from your JS script to get the stats as a string.
+ e.g.
+ $vm.print($vm.dumpLinkBufferStats());
+
+ Here's an example of what the dump looks like:
+
+ Cummulative LinkBuffer profile sizes:
+ BaselineJIT: 79480320 (75.798340 MB)
+ DFG: 36108672 (34.435913 MB)
+ Thunk: 22495360 (21.453247 MB)
+ InlineCache: 19538521 (18.633386 MB)
+ FTL: 5186240 (4.945984 MB)
+ Wasm: 1998272 (1.905701 MB)
+ YarrJIT: 1331072 (1.269409 MB)
+ CSSJIT: 0
+ Uncategorized: 0
+
+ The stats are currently grouped into some coarse profiles. If needed, we can
+ break these down into more fine grain profiles later.
+
+ * assembler/LinkBuffer.cpp:
+ (JSC::LinkBuffer::performFinalization):
+ (JSC::LinkBuffer::dumpProfileStatistics):
+ * assembler/LinkBuffer.h:
+ (JSC::LinkBuffer::LinkBuffer):
+ * bytecode/InlineAccess.cpp:
+ (JSC::linkCodeInline):
+ (JSC::InlineAccess::rewireStubAsJump):
+ * bytecode/PolymorphicAccess.cpp:
+ (JSC::PolymorphicAccess::regenerate):
+ * dfg/DFGJITCompiler.cpp:
+ (JSC::DFG::JITCompiler::compile):
+ (JSC::DFG::JITCompiler::compileFunction):
+ * dfg/DFGOSRExit.cpp:
+ (JSC::DFG::JSC_DEFINE_JIT_OPERATION):
+ * dfg/DFGThunks.cpp:
+ (JSC::DFG::osrExitGenerationThunkGenerator):
+ (JSC::DFG::osrEntryThunkGenerator):
+ * ftl/FTLCompile.cpp:
+ (JSC::FTL::compile):
+ * ftl/FTLLazySlowPath.cpp:
+ (JSC::FTL::LazySlowPath::generate):
+ * ftl/FTLLink.cpp:
+ (JSC::FTL::link):
+ * ftl/FTLOSRExitCompiler.cpp:
+ (JSC::FTL::compileStub):
+ * ftl/FTLThunks.cpp:
+ (JSC::FTL::genericGenerationThunkGenerator):
+ (JSC::FTL::slowPathCallThunkGenerator):
+ * jit/ExecutableAllocator.cpp:
+ (JSC::jitWriteThunkGenerator):
+ * jit/JIT.cpp:
+ (JSC::JIT::compileWithoutLinking):
+ * jit/JITMathIC.h:
+ (JSC::JITMathIC::generateOutOfLine):
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileHasIndexedProperty):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileHasIndexedProperty):
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::privateCompilePutByVal):
+ (JSC::JIT::privateCompilePutPrivateNameWithCachedId):
+ (JSC::JIT::privateCompilePutByValWithCachedId):
+ * jit/Repatch.cpp:
+ (JSC::linkPolymorphicCall):
+ * jit/SpecializedThunkJIT.h:
+ (JSC::SpecializedThunkJIT::finalize):
+ * jit/ThunkGenerators.cpp:
+ (JSC::throwExceptionFromCallSlowPathGenerator):
+ (JSC::linkCallThunkGenerator):
+ (JSC::linkPolymorphicCallThunkGenerator):
+ (JSC::virtualThunkFor):
+ (JSC::nativeForGenerator):
+ (JSC::arityFixupGenerator):
+ (JSC::unreachableGenerator):
+ (JSC::stringGetByValGenerator):
+ (JSC::boundFunctionCallGenerator):
+ * jsc.cpp:
+ (CommandLine::parseArguments):
+ (jscmain):
+ * llint/LLIntThunks.cpp:
+ (JSC::LLInt::generateThunkWithJumpTo):
+ (JSC::LLInt::generateThunkWithJumpToPrologue):
+ (JSC::LLInt::generateThunkWithJumpToLLIntReturnPoint):
+ (JSC::LLInt::getHostCallReturnValueThunk):
+ (JSC::LLInt::createJSGateThunk):
+ (JSC::LLInt::createWasmGateThunk):
+ (JSC::LLInt::createTailCallGate):
+ (JSC::LLInt::loopOSREntryGateThunk):
+ (JSC::LLInt::entryOSREntryGateThunk):
+ (JSC::LLInt::wasmOSREntryGateThunk):
+ (JSC::LLInt::exceptionHandlerGateThunk):
+ (JSC::LLInt::returnFromLLIntGateThunk):
+ (JSC::LLInt::tagGateThunk):
+ (JSC::LLInt::untagGateThunk):
+ (JSC::LLInt::jitCagePtrThunk):
+ * tools/JSDollarVM.cpp:
+ (JSC::JSC_DEFINE_HOST_FUNCTION):
+ (JSC::JSDollarVM::finishCreation):
+ * wasm/WasmBBQPlan.cpp:
+ (JSC::Wasm::BBQPlan::work):
+ (JSC::Wasm::BBQPlan::didCompleteCompilation):
+ * wasm/WasmBinding.cpp:
+ (JSC::Wasm::wasmToWasm):
+ * wasm/WasmLLIntPlan.cpp:
+ (JSC::Wasm::LLIntPlan::didCompleteCompilation):
+ * wasm/WasmOMGForOSREntryPlan.cpp:
+ (JSC::Wasm::OMGForOSREntryPlan::work):
+ * wasm/WasmOMGPlan.cpp:
+ (JSC::Wasm::OMGPlan::work):
+ * wasm/WasmThunks.cpp:
+ (JSC::Wasm::throwExceptionFromWasmThunkGenerator):
+ (JSC::Wasm::throwStackOverflowFromWasmThunkGenerator):
+ (JSC::Wasm::triggerOMGEntryTierUpThunkGenerator):
+ * wasm/js/WasmToJS.cpp:
+ (JSC::Wasm::wasmToJS):
+ * wasm/js/WebAssemblyFunction.cpp:
+ (JSC::WebAssemblyFunction::jsCallEntrypointSlow):
+ * yarr/YarrJIT.cpp:
+
2021-05-08 Darin Adler <da...@apple.com>
Remove calls to the String::toInt family of functions from _javascript_Core
Modified: trunk/Source/_javascript_Core/assembler/LinkBuffer.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/assembler/LinkBuffer.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/assembler/LinkBuffer.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -40,6 +40,8 @@
namespace JSC {
+size_t LinkBuffer::s_profileCummulativeLinkedSizes[LinkBuffer::numberOfProfiles];
+
bool shouldDumpDisassemblyFor(CodeBlock* codeBlock)
{
if (codeBlock && JITCode::isOptimizingJIT(codeBlock->jitType()) && Options::dumpDFGDisassembly())
@@ -477,6 +479,7 @@
m_completed = true;
#endif
+ s_profileCummulativeLinkedSizes[static_cast<unsigned>(m_profile)] += m_size;
MacroAssembler::cacheFlush(code(), m_size);
}
@@ -527,6 +530,59 @@
}
#endif
+void LinkBuffer::dumpProfileStatistics(Optional<PrintStream*> outStream)
+{
+ struct Stat {
+ Profile profile;
+ size_t size;
+ };
+
+ Stat sortedStats[numberOfProfiles];
+ PrintStream& out = outStream ? *outStream.value() : WTF::dataFile();
+
+#define RETURN_LINKBUFFER_PROFILE_NAME(name) case Profile::name: return #name;
+ auto name = [] (Profile profile) -> const char* {
+ switch (profile) {
+ FOR_EACH_LINKBUFFER_PROFILE(RETURN_LINKBUFFER_PROFILE_NAME)
+ }
+ RELEASE_ASSERT_NOT_REACHED();
+ };
+#undef RETURN_LINKBUFFER_PROFILE_NAME
+
+ auto dumpStat = [&] (const Stat& stat) {
+ char formattedName[21];
+ snprintf(formattedName, 21, "%20s", name(stat.profile));
+
+ const char* largerUnit = nullptr;
+ double sizeInLargerUnit = stat.size;
+ if (stat.size > 1 * MB) {
+ largerUnit = "MB";
+ sizeInLargerUnit = sizeInLargerUnit / MB;
+ } else if (stat.size > 1 * KB) {
+ largerUnit = "KB";
+ sizeInLargerUnit = sizeInLargerUnit / KB;
+ }
+
+ if (largerUnit)
+ out.println(" ", formattedName, ": ", stat.size, " (", sizeInLargerUnit, " ", largerUnit, ")");
+ else
+ out.println(" ", formattedName, ": ", stat.size);
+ };
+
+ for (unsigned i = 0; i < numberOfProfiles; ++i) {
+ sortedStats[i].profile = ""
+ sortedStats[i].size = s_profileCummulativeLinkedSizes[i];
+ }
+ std::sort(&sortedStats[0], &sortedStats[numberOfProfiles],
+ [] (Stat& a, Stat& b) -> bool {
+ return a.size > b.size;
+ });
+
+ out.println("Cummulative LinkBuffer profile sizes:");
+ for (unsigned i = 0; i < numberOfProfiles; ++i)
+ dumpStat(sortedStats[i]);
+}
+
} // namespace JSC
#endif // ENABLE(ASSEMBLER)
Modified: trunk/Source/_javascript_Core/assembler/LinkBuffer.h (277304 => 277305)
--- trunk/Source/_javascript_Core/assembler/LinkBuffer.h 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/assembler/LinkBuffer.h 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2009-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -40,6 +40,7 @@
#include <wtf/DataLog.h>
#include <wtf/FastMalloc.h>
#include <wtf/Noncopyable.h>
+#include <wtf/Optional.h>
namespace JSC {
@@ -83,12 +84,35 @@
#endif
public:
- LinkBuffer(MacroAssembler& macroAssembler, void* ownerUID, JITCompilationEffort effort = JITCompilationMustSucceed)
+
+#define FOR_EACH_LINKBUFFER_PROFILE(v) \
+ v(BaselineJIT) \
+ v(DFG) \
+ v(FTL) \
+ v(InlineCache) \
+ v(Thunk) \
+ v(Wasm) \
+ v(YarrJIT) \
+ v(CSSJIT) \
+ v(Uncategorized)
+
+#define DECLARE_LINKBUFFER_PROFILE(name) name,
+ enum class Profile {
+ FOR_EACH_LINKBUFFER_PROFILE(DECLARE_LINKBUFFER_PROFILE)
+ };
+#undef DECLARE_LINKBUFFER_PROFILE
+
+#define COUNT_LINKBUFFER_PROFILE(name) + 1
+ static constexpr unsigned numberOfProfiles = FOR_EACH_LINKBUFFER_PROFILE(COUNT_LINKBUFFER_PROFILE);
+#undef COUNT_LINKBUFFER_PROFILE
+
+ LinkBuffer(MacroAssembler& macroAssembler, void* ownerUID, Profile profile = "" JITCompilationEffort effort = JITCompilationMustSucceed)
: m_size(0)
, m_didAllocate(false)
#ifndef NDEBUG
, m_completed(false)
#endif
+ , m_profile(profile)
{
UNUSED_PARAM(ownerUID);
linkCode(macroAssembler, effort);
@@ -95,12 +119,13 @@
}
template<PtrTag tag>
- LinkBuffer(MacroAssembler& macroAssembler, MacroAssemblerCodePtr<tag> code, size_t size, JITCompilationEffort effort = JITCompilationMustSucceed, bool shouldPerformBranchCompaction = true)
+ LinkBuffer(MacroAssembler& macroAssembler, MacroAssemblerCodePtr<tag> code, size_t size, Profile profile = "" JITCompilationEffort effort = JITCompilationMustSucceed, bool shouldPerformBranchCompaction = true)
: m_size(size)
, m_didAllocate(false)
#ifndef NDEBUG
, m_completed(false)
#endif
+ , m_profile(profile)
, m_code(code.template retagged<LinkBufferPtrTag>())
{
#if ENABLE(BRANCH_COMPACTION)
@@ -298,6 +323,8 @@
bool wasAlreadyDisassembled() const { return m_alreadyDisassembled; }
void didAlreadyDisassemble() { m_alreadyDisassembled = true; }
+ JS_EXPORT_PRIVATE static void dumpProfileStatistics(Optional<PrintStream*> = WTF::nullopt);
+
private:
JS_EXPORT_PRIVATE CodeRef<LinkBufferPtrTag> finalizeCodeWithoutDisassemblyImpl();
JS_EXPORT_PRIVATE CodeRef<LinkBufferPtrTag> finalizeCodeWithDisassemblyImpl(bool dumpDisassembly, const char* format, ...) WTF_ATTRIBUTE_PRINTF(3, 4);
@@ -355,7 +382,7 @@
#if DUMP_CODE
static void dumpCode(void* code, size_t);
#endif
-
+
RefPtr<ExecutableMemoryHandle> m_executableMemory;
size_t m_size;
#if ENABLE(BRANCH_COMPACTION)
@@ -373,8 +400,11 @@
bool m_isJumpIsland { false };
#endif
bool m_alreadyDisassembled { false };
+ Profile m_profile { Profile::Uncategorized };
MacroAssemblerCodePtr<LinkBufferPtrTag> m_code;
Vector<RefPtr<SharedTask<void(LinkBuffer&)>>> m_linkTasks;
+
+ static size_t s_profileCummulativeLinkedSizes[numberOfProfiles];
};
#if OS(LINUX)
Modified: trunk/Source/_javascript_Core/bytecode/InlineAccess.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/bytecode/InlineAccess.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/bytecode/InlineAccess.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -154,7 +154,7 @@
{
if (jit.m_assembler.buffer().codeSize() <= stubInfo.inlineSize()) {
bool needsBranchCompaction = true;
- LinkBuffer linkBuffer(jit, stubInfo.start, stubInfo.inlineSize(), JITCompilationMustSucceed, needsBranchCompaction);
+ LinkBuffer linkBuffer(jit, stubInfo.start, stubInfo.inlineSize(), LinkBuffer::Profile::InlineCache, JITCompilationMustSucceed, needsBranchCompaction);
ASSERT(linkBuffer.isValid());
function(linkBuffer);
FINALIZE_CODE(linkBuffer, NoPtrTag, "InlineAccessType: '%s'", name);
@@ -387,7 +387,7 @@
// We don't need a nop sled here because nobody should be jumping into the middle of an IC.
bool needsBranchCompaction = false;
- LinkBuffer linkBuffer(jit, stubInfo.start, jit.m_assembler.buffer().codeSize(), JITCompilationMustSucceed, needsBranchCompaction);
+ LinkBuffer linkBuffer(jit, stubInfo.start, jit.m_assembler.buffer().codeSize(), LinkBuffer::Profile::InlineCache, JITCompilationMustSucceed, needsBranchCompaction);
RELEASE_ASSERT(linkBuffer.isValid());
linkBuffer.link(jump, target);
Modified: trunk/Source/_javascript_Core/bytecode/PolymorphicAccess.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/bytecode/PolymorphicAccess.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/bytecode/PolymorphicAccess.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -734,7 +734,7 @@
callSiteIndexForExceptionHandling = state.callSiteIndexForExceptionHandling();
}
- LinkBuffer linkBuffer(jit, codeBlock, JITCompilationCanFail);
+ LinkBuffer linkBuffer(jit, codeBlock, LinkBuffer::Profile::InlineCache, JITCompilationCanFail);
if (linkBuffer.didFailToAllocate()) {
if (PolymorphicAccessInternal::verbose)
dataLog("Did fail to allocate.\n");
Modified: trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -391,7 +391,7 @@
m_speculative->createOSREntries();
setEndOfCode();
- auto linkBuffer = makeUnique<LinkBuffer>(*this, m_codeBlock, JITCompilationCanFail);
+ auto linkBuffer = makeUnique<LinkBuffer>(*this, m_codeBlock, LinkBuffer::Profile::DFG, JITCompilationCanFail);
if (linkBuffer->didFailToAllocate()) {
m_graph.m_plan.setFinalizer(makeUnique<FailedFinalizer>(m_graph.m_plan));
return;
@@ -491,7 +491,7 @@
setEndOfCode();
// === Link ===
- auto linkBuffer = makeUnique<LinkBuffer>(*this, m_codeBlock, JITCompilationCanFail);
+ auto linkBuffer = makeUnique<LinkBuffer>(*this, m_codeBlock, LinkBuffer::Profile::DFG, JITCompilationCanFail);
if (linkBuffer->didFailToAllocate()) {
m_graph.m_plan.setFinalizer(makeUnique<FailedFinalizer>(m_graph.m_plan));
return;
Modified: trunk/Source/_javascript_Core/dfg/DFGOSRExit.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/dfg/DFGOSRExit.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/dfg/DFGOSRExit.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -203,7 +203,7 @@
OSRExit::compileExit(jit, vm, exit, operands, recovery);
- LinkBuffer patchBuffer(jit, codeBlock);
+ LinkBuffer patchBuffer(jit, codeBlock, LinkBuffer::Profile::Thunk);
exit.m_code = FINALIZE_CODE_IF(
shouldDumpDisassembly() || Options::verboseOSR() || Options::verboseDFGOSRExit(),
patchBuffer, OSRExitPtrTag,
Modified: trunk/Source/_javascript_Core/dfg/DFGThunks.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/dfg/DFGThunks.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/dfg/DFGThunks.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -89,7 +89,7 @@
jit.farJump(MacroAssembler::AbsoluteAddress(&vm.osrExitJumpDestination), OSRExitPtrTag);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
patchBuffer.link(functionCall, FunctionPtr<OperationPtrTag>(operationCompileOSRExit));
@@ -134,7 +134,7 @@
jit.farJump(GPRInfo::regT1, GPRInfo::callFrameRegister);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "DFG OSR entry thunk");
}
Modified: trunk/Source/_javascript_Core/ftl/FTLCompile.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/ftl/FTLCompile.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/ftl/FTLCompile.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -135,7 +135,7 @@
linkBuffer.link(call, FunctionPtr<OperationPtrTag>(operationLookupExceptionHandler));
});
- state.finalizer->b3CodeLinkBuffer = makeUnique<LinkBuffer>(jit, codeBlock, JITCompilationCanFail);
+ state.finalizer->b3CodeLinkBuffer = makeUnique<LinkBuffer>(jit, codeBlock, LinkBuffer::Profile::FTL, JITCompilationCanFail);
if (state.finalizer->b3CodeLinkBuffer->didFailToAllocate()) {
state.allocationFailed = true;
Modified: trunk/Source/_javascript_Core/ftl/FTLLazySlowPath.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/ftl/FTLLazySlowPath.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/ftl/FTLLazySlowPath.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -62,7 +62,7 @@
m_generator->run(jit, params);
- LinkBuffer linkBuffer(jit, codeBlock, JITCompilationMustSucceed);
+ LinkBuffer linkBuffer(jit, codeBlock, LinkBuffer::Profile::FTL, JITCompilationMustSucceed);
linkBuffer.link(params.doneJumps, m_done);
if (m_exceptionTarget)
linkBuffer.link(exceptionJumps, m_exceptionTarget);
Modified: trunk/Source/_javascript_Core/ftl/FTLLink.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/ftl/FTLLink.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/ftl/FTLLink.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -168,7 +168,7 @@
jit.untagReturnAddress();
mainPathJumps.append(jit.jump());
- linkBuffer = makeUnique<LinkBuffer>(jit, codeBlock, JITCompilationCanFail);
+ linkBuffer = makeUnique<LinkBuffer>(jit, codeBlock, LinkBuffer::Profile::FTL, JITCompilationCanFail);
if (linkBuffer->didFailToAllocate()) {
state.allocationFailed = true;
return;
@@ -193,7 +193,7 @@
jit.untagReturnAddress();
CCallHelpers::Jump mainPathJump = jit.jump();
- linkBuffer = makeUnique<LinkBuffer>(jit, codeBlock, JITCompilationCanFail);
+ linkBuffer = makeUnique<LinkBuffer>(jit, codeBlock, LinkBuffer::Profile::FTL, JITCompilationCanFail);
if (linkBuffer->didFailToAllocate()) {
state.allocationFailed = true;
return;
Modified: trunk/Source/_javascript_Core/ftl/FTLOSRExitCompiler.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/ftl/FTLOSRExitCompiler.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/ftl/FTLOSRExitCompiler.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -506,7 +506,7 @@
reifyInlinedCallFrames(jit, exit);
adjustAndJumpToTarget(vm, jit, exit);
- LinkBuffer patchBuffer(jit, codeBlock);
+ LinkBuffer patchBuffer(jit, codeBlock, LinkBuffer::Profile::Thunk);
exit.m_code = FINALIZE_CODE_IF(
shouldDumpDisassembly() || Options::verboseOSR() || Options::verboseFTLOSRExit(),
patchBuffer, OSRExitPtrTag,
Modified: trunk/Source/_javascript_Core/ftl/FTLThunks.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/ftl/FTLThunks.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/ftl/FTLThunks.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -124,7 +124,7 @@
#endif
jit.ret();
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
patchBuffer.link(functionCall, generationFunction.retagged<OperationPtrTag>());
return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "%s", name);
}
@@ -231,7 +231,7 @@
jit.ret();
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
patchBuffer.link(call, key.callTarget());
return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "FTL slow path call thunk for %s", toCString(key).data());
}
Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -233,7 +233,7 @@
jit.ret();
auto stubBaseCodePtr = MacroAssemblerCodePtr<LinkBufferPtrTag>(tagCodePtr<LinkBufferPtrTag>(stubBase));
- LinkBuffer linkBuffer(jit, stubBaseCodePtr, stubSize);
+ LinkBuffer linkBuffer(jit, stubBaseCodePtr, stubSize, LinkBuffer::Profile::Thunk);
// We don't use FINALIZE_CODE() for two reasons.
// The first is that we don't want the writeable address, as disassembled instructions,
// to appear in the console or anywhere in memory, via the PrintStream buffer.
@@ -644,7 +644,7 @@
MacroAssembler jit;
auto jump = jit.jump();
- LinkBuffer linkBuffer(jit, MacroAssemblerCodePtr<NoPtrTag>(currentIsland), islandSizeInBytes, JITCompilationMustSucceed, false);
+ LinkBuffer linkBuffer(jit, MacroAssemblerCodePtr<NoPtrTag>(currentIsland), islandSizeInBytes, LinkBuffer::Profile::Thunk, JITCompilationMustSucceed, false);
RELEASE_ASSERT(linkBuffer.isValid());
// We use this to appease the assertion that we're not finalizing on a compiler thread. In this situation, it's
Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/jit/JIT.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -842,7 +842,7 @@
m_disassembler->setEndOfCode(label());
m_pcToCodeOriginMapBuilder.appendItem(label(), PCToCodeOriginMapBuilder::defaultCodeOrigin());
- m_linkBuffer = std::unique_ptr<LinkBuffer>(new LinkBuffer(*this, m_codeBlock, effort));
+ m_linkBuffer = std::unique_ptr<LinkBuffer>(new LinkBuffer(*this, m_codeBlock, LinkBuffer::Profile::BaselineJIT, effort));
MonotonicTime after { };
if (UNLIKELY(computeCompileTimes())) {
Modified: trunk/Source/_javascript_Core/jit/JITMathIC.h (277304 => 277305)
--- trunk/Source/_javascript_Core/jit/JITMathIC.h 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/jit/JITMathIC.h 2021-05-10 23:21:41 UTC (rev 277305)
@@ -128,7 +128,7 @@
// We don't need a nop sled here because nobody should be jumping into the middle of an IC.
bool needsBranchCompaction = false;
RELEASE_ASSERT(jit.m_assembler.buffer().codeSize() <= static_cast<size_t>(MacroAssembler::differenceBetweenCodePtr(m_inlineStart, m_inlineEnd)));
- LinkBuffer linkBuffer(jit, m_inlineStart, jit.m_assembler.buffer().codeSize(), JITCompilationMustSucceed, needsBranchCompaction);
+ LinkBuffer linkBuffer(jit, m_inlineStart, jit.m_assembler.buffer().codeSize(), LinkBuffer::Profile::InlineCache, JITCompilationMustSucceed, needsBranchCompaction);
RELEASE_ASSERT(linkBuffer.isValid());
linkBuffer.link(jump, CodeLocationLabel<JITStubRoutinePtrTag>(m_code.code()));
FINALIZE_CODE(linkBuffer, NoPtrTag, "JITMathIC: linking constant jump to out of line stub");
@@ -156,7 +156,7 @@
if (generatedInline) {
auto jumpToDone = jit.jump();
- LinkBuffer linkBuffer(jit, codeBlock, JITCompilationCanFail);
+ LinkBuffer linkBuffer(jit, codeBlock, LinkBuffer::Profile::InlineCache, JITCompilationCanFail);
if (!linkBuffer.didFailToAllocate()) {
linkBuffer.link(generationState.slowPathJumps, slowPathStartLocation());
linkBuffer.link(jumpToDone, doneLocation());
@@ -196,7 +196,7 @@
return;
endJumpList.append(jit.jump());
- LinkBuffer linkBuffer(jit, codeBlock, JITCompilationCanFail);
+ LinkBuffer linkBuffer(jit, codeBlock, LinkBuffer::Profile::InlineCache, JITCompilationCanFail);
if (linkBuffer.didFailToAllocate())
return;
Modified: trunk/Source/_javascript_Core/jit/JITOpcodes.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/jit/JITOpcodes.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1433,7 +1433,7 @@
move(TrustedImm64(JSValue::encode(jsBoolean(true))), regT0);
Jump done = jump();
- LinkBuffer patchBuffer(*this, m_codeBlock);
+ LinkBuffer patchBuffer(*this, m_codeBlock, LinkBuffer::Profile::InlineCache);
patchBuffer.link(badType, byValInfo->slowPathTarget);
patchBuffer.link(slowCases, byValInfo->slowPathTarget);
Modified: trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1187,7 +1187,7 @@
move(TrustedImm32(1), regT0);
Jump done = jump();
- LinkBuffer patchBuffer(*this, m_codeBlock);
+ LinkBuffer patchBuffer(*this, m_codeBlock, LinkBuffer::Profile::InlineCache);
patchBuffer.link(badType, byValInfo->slowPathTarget);
patchBuffer.link(slowCases, byValInfo->slowPathTarget);
Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1579,7 +1579,7 @@
Jump done = jump();
- LinkBuffer patchBuffer(*this, m_codeBlock);
+ LinkBuffer patchBuffer(*this, m_codeBlock, LinkBuffer::Profile::InlineCache);
patchBuffer.link(badType, byValInfo->slowPathTarget);
patchBuffer.link(slowCases, byValInfo->slowPathTarget);
patchBuffer.link(done, byValInfo->doneTarget);
@@ -1618,7 +1618,7 @@
JITPutByIdGenerator gen = emitPutPrivateNameWithCachedId(bytecode, propertyName, doneCases, slowCases);
ConcurrentJSLocker locker(m_codeBlock->m_lock);
- LinkBuffer patchBuffer(*this, m_codeBlock);
+ LinkBuffer patchBuffer(*this, m_codeBlock, LinkBuffer::Profile::InlineCache);
patchBuffer.link(slowCases, byValInfo->slowPathTarget);
patchBuffer.link(doneCases, byValInfo->doneTarget);
if (!m_exceptionChecks.empty())
@@ -1656,7 +1656,7 @@
JITPutByIdGenerator gen = emitPutByValWithCachedId(bytecode, putKind, propertyName, doneCases, slowCases);
ConcurrentJSLocker locker(m_codeBlock->m_lock);
- LinkBuffer patchBuffer(*this, m_codeBlock);
+ LinkBuffer patchBuffer(*this, m_codeBlock, LinkBuffer::Profile::InlineCache);
patchBuffer.link(slowCases, byValInfo->slowPathTarget);
patchBuffer.link(doneCases, byValInfo->doneTarget);
if (!m_exceptionChecks.empty())
Modified: trunk/Source/_javascript_Core/jit/Repatch.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/jit/Repatch.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/jit/Repatch.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -1585,7 +1585,7 @@
stubJit.restoreReturnAddressBeforeReturn(GPRInfo::regT4);
AssemblyHelpers::Jump slow = stubJit.jump();
- LinkBuffer patchBuffer(stubJit, owner, JITCompilationCanFail);
+ LinkBuffer patchBuffer(stubJit, owner, LinkBuffer::Profile::InlineCache, JITCompilationCanFail);
if (patchBuffer.didFailToAllocate()) {
linkVirtualFor(vm, callFrame, callLinkInfo);
return;
Modified: trunk/Source/_javascript_Core/jit/SpecializedThunkJIT.h (277304 => 277305)
--- trunk/Source/_javascript_Core/jit/SpecializedThunkJIT.h 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/jit/SpecializedThunkJIT.h 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -155,7 +155,7 @@
MacroAssemblerCodeRef<JITThunkPtrTag> finalize(MacroAssemblerCodePtr<JITThunkPtrTag> fallback, const char* thunkKind)
{
- LinkBuffer patchBuffer(*this, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(*this, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
patchBuffer.link(m_failures, CodeLocationLabel<JITThunkPtrTag>(fallback));
for (unsigned i = 0; i < m_calls.size(); i++)
patchBuffer.link(m_calls[i].first, m_calls[i].second);
Modified: trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -75,7 +75,7 @@
jit.call(GPRInfo::nonArgGPR0, OperationPtrTag);
jit.jumpToExceptionHandler(vm);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Throw exception from call slow path thunk");
}
@@ -145,7 +145,7 @@
slowPathFor(jit, vm, operationLinkCall);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Link call slow path thunk");
}
@@ -157,7 +157,7 @@
slowPathFor(jit, vm, operationLinkPolymorphicCall);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "Link polymorphic call slow path thunk");
}
@@ -235,7 +235,7 @@
// Here we don't know anything, so revert to the full slow path.
slowPathFor(jit, vm, operationVirtualCall);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
return FINALIZE_CODE(
patchBuffer, JITStubRoutinePtrTag,
"Virtual %s slow path thunk",
@@ -357,7 +357,7 @@
jit.jumpToExceptionHandler(vm);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "%s %s%s trampoline", thunkFunctionType == ThunkFunctionType::JSFunction ? "native" : "internal", entryType == EnterViaJumpWithSavedTags ? "Tail With Saved Tags " : entryType == EnterViaJumpWithoutSavedTags ? "Tail Without Saved Tags " : "", toCString(kind).data());
}
@@ -536,7 +536,7 @@
jit.ret();
#endif // End of USE(JSVALUE32_64) section.
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "fixup arity");
}
@@ -546,7 +546,7 @@
jit.breakpoint();
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "unreachable thunk");
}
@@ -597,7 +597,7 @@
jit.move(JSInterfaceJIT::TrustedImm32(0), stringGPR);
jit.ret();
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "String get_by_val stub");
}
@@ -1274,7 +1274,7 @@
jit.emitFunctionEpilogue();
jit.ret();
- LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
linkBuffer.link(noCode, CodeLocationLabel<JITThunkPtrTag>(vm.jitStubs->ctiNativeTailCallWithoutSavedTags(vm)));
return FINALIZE_CODE(
linkBuffer, JITThunkPtrTag, "Specialized thunk for bound function calls with no arguments");
Modified: trunk/Source/_javascript_Core/jsc.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/jsc.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/jsc.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -431,6 +431,7 @@
bool m_treatWatchdogExceptionAsSuccess { false };
bool m_alwaysDumpUncaughtException { false };
bool m_dumpMemoryFootprint { false };
+ bool m_dumpLinkBufferStats { false };
bool m_dumpSamplingProfilerData { false };
bool m_enableRemoteDebugging { false };
bool m_canBlockIsFalse { false };
@@ -3360,6 +3361,11 @@
continue;
}
+ if (!strcmp(arg, "--dumpLinkBufferStats")) {
+ m_dumpLinkBufferStats = true;
+ continue;
+ }
+
static const unsigned exceptionStrLength = strlen("--exception=");
if (!strncmp(arg, "--exception=", exceptionStrLength)) {
m_uncaughtExceptionName = String(arg + exceptionStrLength);
@@ -3620,6 +3626,11 @@
printf("Memory Footprint:\n Current Footprint: %" PRIu64 "\n Peak Footprint: %" PRIu64 "\n", footprint.current, footprint.peak);
}
+#if ENABLE(ASSEMBLER)
+ if (mainCommandLine->m_dumpLinkBufferStats)
+ LinkBuffer::dumpProfileStatistics();
+#endif
+
return result;
}
Modified: trunk/Source/_javascript_Core/llint/LLIntThunks.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/llint/LLIntThunks.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/llint/LLIntThunks.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -88,7 +88,7 @@
jit.move(JSInterfaceJIT::TrustedImmPtr(target), scratch);
jit.farJump(scratch, OperationPtrTag);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
return FINALIZE_CODE(patchBuffer, tag, "LLInt %s thunk", thunkKind);
}
@@ -115,7 +115,7 @@
jit.move(JSInterfaceJIT::TrustedImmPtr(target), scratch);
jit.farJump(scratch, OperationPtrTag);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
return FINALIZE_CODE(patchBuffer, tag, "LLInt %s jump to prologue thunk", thunkKind);
}
@@ -125,7 +125,7 @@
JSInterfaceJIT jit;
assertIsTaggedWith<OperationPtrTag>(target);
jit.farJump(CCallHelpers::TrustedImmPtr(target), OperationPtrTag);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
return FINALIZE_CODE(patchBuffer, tag, "LLInt %s return point thunk", thunkKind);
}
@@ -247,7 +247,7 @@
jit.emitFunctionEpilogue();
jit.ret();
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
codeRef.construct(FINALIZE_CODE(patchBuffer, JSEntryPtrTag, "LLInt::getHostCallReturnValue thunk"));
});
return codeRef;
@@ -357,7 +357,7 @@
jit.move(CCallHelpers::TrustedImmPtr(pointer), GPRInfo::regT3);
jit.farJump(GPRInfo::regT3, OperationPtrTag);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
return FINALIZE_CODE(patchBuffer, NativeToJITGatePtrTag, "LLInt %s call gate thunk", name);
}
@@ -369,7 +369,7 @@
jit.move(CCallHelpers::TrustedImmPtr(pointer), GPRInfo::wasmScratchGPR1);
jit.farJump(GPRInfo::wasmScratchGPR1, OperationPtrTag);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
return FINALIZE_CODE(patchBuffer, NativeToJITGatePtrTag, "LLInt %s wasm call gate thunk", name);
}
@@ -381,7 +381,7 @@
jit.validateUntaggedPtr(ARM64Registers::lr, GPRInfo::argumentGPR2);
jit.farJump(GPRInfo::regT0, tag);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
return FINALIZE_CODE(patchBuffer, NativeToJITGatePtrTag, "LLInt tail call gate thunk");
}
@@ -394,7 +394,7 @@
jit.farJump(GPRInfo::argumentGPR0, JSEntryPtrTag);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
codeRef.construct(FINALIZE_CODE(patchBuffer, NativeToJITGatePtrTag, "loop OSR entry thunk"));
});
return codeRef;
@@ -410,7 +410,7 @@
jit.untagReturnAddress();
jit.farJump(GPRInfo::argumentGPR0, JSEntryPtrTag);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
codeRef.construct(FINALIZE_CODE(patchBuffer, NativeToJITGatePtrTag, "entry OSR entry thunk"));
});
return codeRef;
@@ -426,7 +426,7 @@
jit.untagReturnAddress();
jit.farJump(GPRInfo::wasmScratchGPR0, WasmEntryPtrTag);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
codeRef.construct(FINALIZE_CODE(patchBuffer, NativeToJITGatePtrTag, "wasm OSR entry thunk"));
});
return codeRef;
@@ -441,7 +441,7 @@
jit.farJump(GPRInfo::regT0, ExceptionHandlerPtrTag);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
codeRef.construct(FINALIZE_CODE(patchBuffer, NativeToJITGatePtrTag, "exception handler thunk"));
});
return codeRef;
@@ -456,7 +456,7 @@
jit.ret();
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
codeRef.construct(FINALIZE_CODE(patchBuffer, NativeToJITGatePtrTag, "returnFromLLInt thunk"));
});
return codeRef;
@@ -472,7 +472,7 @@
jit.move(CCallHelpers::TrustedImmPtr(pointer), GPRInfo::regT3);
jit.farJump(GPRInfo::regT3, OperationPtrTag);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
return FINALIZE_CODE(patchBuffer, NativeToJITGatePtrTag, "tag thunk");
}
@@ -487,7 +487,7 @@
jit.move(CCallHelpers::TrustedImmPtr(pointer), GPRInfo::regT3);
jit.farJump(GPRInfo::regT3, OperationPtrTag);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
return FINALIZE_CODE(patchBuffer, NativeToJITGatePtrTag, "untag thunk");
}
@@ -502,7 +502,7 @@
std::call_once(onceKey, [&] {
CCallHelpers jit;
JSC_JIT_CAGE_COMPILE_IMPL(jit);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
codeRef.construct(FINALIZE_CODE(patchBuffer, NativeToJITGatePtrTag, "jitCagePtr thunk"));
});
return codeRef;
Modified: trunk/Source/_javascript_Core/tools/JSDollarVM.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/tools/JSDollarVM.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/tools/JSDollarVM.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -40,6 +40,7 @@
#include "JSCInlines.h"
#include "JSONObject.h"
#include "JSString.h"
+#include "LinkBuffer.h"
#include "Options.h"
#include "Parser.h"
#include "ProbeContext.h"
@@ -1937,6 +1938,7 @@
static JSC_DECLARE_HOST_FUNCTION(functionDumpCell);
static JSC_DECLARE_HOST_FUNCTION(functionIndexingMode);
static JSC_DECLARE_HOST_FUNCTION(functionInlineCapacity);
+static JSC_DECLARE_HOST_FUNCTION(functionLinkBufferStats);
static JSC_DECLARE_HOST_FUNCTION(functionValue);
static JSC_DECLARE_HOST_FUNCTION(functionGetPID);
static JSC_DECLARE_HOST_FUNCTION(functionHaveABadTime);
@@ -2536,6 +2538,21 @@
return encodedJSUndefined();
}
+// Dumps the LinkBuffer profile statistics as a string.
+// Usage: $vm.print($vm.linkBufferStats())
+JSC_DEFINE_HOST_FUNCTION(functionLinkBufferStats, (JSGlobalObject* globalObject, CallFrame*))
+{
+ DollarVMAssertScope assertScope;
+#if ENABLE(ASSEMBLER)
+ WTF::StringPrintStream stream;
+ LinkBuffer::dumpProfileStatistics(&stream);
+ return JSValue::encode(jsString(globalObject->vm(), stream.toString()));
+#else
+ UNUSED_PARAM(globalObject);
+ return JSValue::encode(jsUndefined());
+#endif
+}
+
// Gets the dataLog dump of a given JS value as a string.
// Usage: $vm.print("value = " + $vm.value(jsValue))
JSC_DEFINE_HOST_FUNCTION(functionValue, (JSGlobalObject* globalObject, CallFrame* callFrame))
@@ -3633,6 +3650,7 @@
addFunction(vm, "indexingMode", functionIndexingMode, 1);
addFunction(vm, "inlineCapacity", functionInlineCapacity, 1);
+ addFunction(vm, "linkBufferStats", functionLinkBufferStats, 0);
addFunction(vm, "value", functionValue, 1);
addFunction(vm, "getpid", functionGetPID, 0);
Modified: trunk/Source/_javascript_Core/wasm/WasmBBQPlan.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/wasm/WasmBBQPlan.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/wasm/WasmBBQPlan.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -101,7 +101,7 @@
std::unique_ptr<TierUpCount> tierUp = makeUnique<TierUpCount>();
std::unique_ptr<InternalFunction> function = compileFunction(m_functionIndex, context, unlinkedWasmToWasmCalls, tierUp.get());
- LinkBuffer linkBuffer(*context.wasmEntrypointJIT, nullptr, JITCompilationCanFail);
+ LinkBuffer linkBuffer(*context.wasmEntrypointJIT, nullptr, LinkBuffer::Profile::Wasm, JITCompilationCanFail);
if (UNLIKELY(linkBuffer.didFailToAllocate())) {
Base::fail(holdLock(m_lock), makeString("Out of executable memory while tiering up function at index ", String::number(m_functionIndex)));
return;
@@ -220,7 +220,7 @@
const uint32_t functionIndexSpace = functionIndex + m_moduleInformation->importFunctionCount();
ASSERT(functionIndexSpace < m_moduleInformation->functionIndexSpaceSize());
{
- LinkBuffer linkBuffer(*context.wasmEntrypointJIT, nullptr, JITCompilationCanFail);
+ LinkBuffer linkBuffer(*context.wasmEntrypointJIT, nullptr, LinkBuffer::Profile::Wasm, JITCompilationCanFail);
if (UNLIKELY(linkBuffer.didFailToAllocate())) {
Base::fail(locker, makeString("Out of executable memory in function at index ", String::number(functionIndex)));
return;
@@ -232,7 +232,7 @@
}
if (const auto& embedderToWasmInternalFunction = m_embedderToWasmInternalFunctions.get(functionIndex)) {
- LinkBuffer linkBuffer(*context.embedderEntrypointJIT, nullptr, JITCompilationCanFail);
+ LinkBuffer linkBuffer(*context.embedderEntrypointJIT, nullptr, LinkBuffer::Profile::Wasm, JITCompilationCanFail);
if (UNLIKELY(linkBuffer.didFailToAllocate())) {
Base::fail(locker, makeString("Out of executable memory in function entrypoint at index ", String::number(functionIndex)));
return;
Modified: trunk/Source/_javascript_Core/wasm/WasmBinding.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/wasm/WasmBinding.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/wasm/WasmBinding.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -77,7 +77,7 @@
jit.loadPtr(scratch, scratch);
jit.farJump(scratch, WasmEntryPtrTag);
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, JITCompilationCanFail);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk, JITCompilationCanFail);
if (UNLIKELY(patchBuffer.didFailToAllocate()))
return makeUnexpected(BindingFailure::OutOfMemory);
Modified: trunk/Source/_javascript_Core/wasm/WasmLLIntPlan.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/wasm/WasmLLIntPlan.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/wasm/WasmLLIntPlan.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2019-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -127,7 +127,7 @@
jumps[i] = jit.jump();
}
- LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID, JITCompilationCanFail);
+ LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Wasm, JITCompilationCanFail);
if (UNLIKELY(linkBuffer.didFailToAllocate())) {
Base::fail(locker, "Out of executable memory in Wasm LLInt entry thunks");
return;
@@ -154,7 +154,7 @@
MemoryMode mode = MemoryMode::BoundsChecking;
std::unique_ptr<InternalFunction> function = createJSToWasmWrapper(jit, signature, &m_unlinkedWasmToWasmCalls[functionIndex], m_moduleInformation.get(), mode, functionIndex);
- LinkBuffer linkBuffer(jit, nullptr, JITCompilationCanFail);
+ LinkBuffer linkBuffer(jit, nullptr, LinkBuffer::Profile::Wasm, JITCompilationCanFail);
if (UNLIKELY(linkBuffer.didFailToAllocate())) {
Base::fail(locker, makeString("Out of executable memory in function entrypoint at index ", String::number(functionIndex)));
return;
Modified: trunk/Source/_javascript_Core/wasm/WasmOMGForOSREntryPlan.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/wasm/WasmOMGForOSREntryPlan.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/wasm/WasmOMGForOSREntryPlan.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2019-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2019-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -83,7 +83,7 @@
}
Entrypoint omgEntrypoint;
- LinkBuffer linkBuffer(*context.wasmEntrypointJIT, nullptr, JITCompilationCanFail);
+ LinkBuffer linkBuffer(*context.wasmEntrypointJIT, nullptr, LinkBuffer::Profile::Wasm, JITCompilationCanFail);
if (UNLIKELY(linkBuffer.didFailToAllocate())) {
Base::fail(holdLock(m_lock), makeString("Out of executable memory while tiering up function at index ", String::number(m_functionIndex)));
return;
Modified: trunk/Source/_javascript_Core/wasm/WasmOMGPlan.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/wasm/WasmOMGPlan.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/wasm/WasmOMGPlan.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -80,7 +80,7 @@
}
Entrypoint omgEntrypoint;
- LinkBuffer linkBuffer(*context.wasmEntrypointJIT, nullptr, JITCompilationCanFail);
+ LinkBuffer linkBuffer(*context.wasmEntrypointJIT, nullptr, LinkBuffer::Profile::Wasm, JITCompilationCanFail);
if (UNLIKELY(linkBuffer.didFailToAllocate())) {
Base::fail(holdLock(m_lock), makeString("Out of executable memory while tiering up function at index ", String::number(m_functionIndex)));
return;
Modified: trunk/Source/_javascript_Core/wasm/WasmThunks.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/wasm/WasmThunks.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/wasm/WasmThunks.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -53,7 +53,7 @@
jit.farJump(GPRInfo::returnValueGPR, ExceptionHandlerPtrTag);
jit.breakpoint(); // We should not reach this.
- LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
linkBuffer.link(call, FunctionPtr<OperationPtrTag>(operationWasmToJSException));
return FINALIZE_WASM_CODE(linkBuffer, JITThunkPtrTag, "Throw exception from Wasm");
}
@@ -67,7 +67,7 @@
jit.addPtr(CCallHelpers::TrustedImm32(-stackSpace), GPRInfo::callFrameRegister, MacroAssembler::stackPointerRegister);
jit.move(CCallHelpers::TrustedImm32(static_cast<uint32_t>(ExceptionType::StackOverflow)), GPRInfo::argumentGPR1);
auto jumpToExceptionHandler = jit.jump();
- LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
linkBuffer.link(jumpToExceptionHandler, CodeLocationLabel<JITThunkPtrTag>(Thunks::singleton().stub(locker, throwExceptionFromWasmThunkGenerator).code()));
return FINALIZE_WASM_CODE(linkBuffer, JITThunkPtrTag, "Throw stack overflow from Wasm");
}
@@ -93,7 +93,7 @@
jit.emitFunctionEpilogue();
jit.ret();
- LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID);
+ LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk);
return FINALIZE_WASM_CODE(linkBuffer, JITThunkPtrTag, "Trigger OMG entry tier up");
}
#endif
Modified: trunk/Source/_javascript_Core/wasm/js/WasmToJS.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/wasm/js/WasmToJS.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/wasm/js/WasmToJS.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -417,7 +417,7 @@
});
}
- LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, JITCompilationCanFail);
+ LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Thunk, JITCompilationCanFail);
if (UNLIKELY(patchBuffer.didFailToAllocate()))
return makeUnexpected(BindingFailure::OutOfMemory);
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyFunction.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyFunction.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyFunction.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -430,7 +430,7 @@
#endif
auto jumpToHostCallThunk = jit.jump();
- LinkBuffer linkBuffer(jit, nullptr, JITCompilationCanFail);
+ LinkBuffer linkBuffer(jit, nullptr, LinkBuffer::Profile::Wasm, JITCompilationCanFail);
if (UNLIKELY(linkBuffer.didFailToAllocate()))
return nullptr;
Modified: trunk/Source/_javascript_Core/yarr/YarrJIT.cpp (277304 => 277305)
--- trunk/Source/_javascript_Core/yarr/YarrJIT.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/_javascript_Core/yarr/YarrJIT.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -3965,7 +3965,7 @@
if (m_disassembler)
m_disassembler->setEndOfCode(label());
- LinkBuffer linkBuffer(*this, REGEXP_CODE_ID, JITCompilationCanFail);
+ LinkBuffer linkBuffer(*this, REGEXP_CODE_ID, LinkBuffer::Profile::YarrJIT, JITCompilationCanFail);
if (linkBuffer.didFailToAllocate()) {
codeBlock.setFallBackWithFailureReason(JITFailureReason::ExecutableMemoryAllocationFailure);
return;
Modified: trunk/Source/WebCore/ChangeLog (277304 => 277305)
--- trunk/Source/WebCore/ChangeLog 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/WebCore/ChangeLog 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,3 +1,13 @@
+2021-05-10 Mark Lam <mark....@apple.com>
+
+ Add support to collect stats on cumulative LinkBuffer linked sizes based on profiles.
+ https://bugs.webkit.org/show_bug.cgi?id=225617
+
+ Reviewed by Saam Barati.
+
+ * cssjit/SelectorCompiler.cpp:
+ (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
+
2021-05-10 Kate Cheney <katherine_che...@apple.com>
Preflight requests not properly attributed as app-bound
Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.cpp (277304 => 277305)
--- trunk/Source/WebCore/cssjit/SelectorCompiler.cpp 2021-05-10 23:16:00 UTC (rev 277304)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.cpp 2021-05-10 23:21:41 UTC (rev 277305)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
* Copyright (C) 2014 Yusuke Suzuki <utatane....@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -1471,7 +1471,7 @@
return SelectorCompilationStatus::CannotCompile;
}
- JSC::LinkBuffer linkBuffer(m_assembler, CSS_CODE_ID, JSC::JITCompilationCanFail);
+ JSC::LinkBuffer linkBuffer(m_assembler, CSS_CODE_ID, JSC::LinkBuffer::Profile::CSSJIT, JSC::JITCompilationCanFail);
if (!linkBuffer.isValid()) {
// This could be SelectorCompilationStatus::NotCompiled but that would cause us to re-enter
// the CSS JIT every time we evaluate that selector.