Don't allocate value profiles when the JIT is disabled
authorsbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 May 2018 07:57:21 +0000 (07:57 +0000)
committersbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 May 2018 07:57:21 +0000 (07:57 +0000)
commitb9450f00c286c42f576a7671f4a3239710ae2590
tree950bf2cea370b015cb5bf46db2f9accfc1bc4e9d
parent8787021a57a556af53f10b0aa08830fc81b0cf92
Don't allocate value profiles when the JIT is disabled
https://bugs.webkit.org/show_bug.cgi?id=185525

Reviewed by Michael Saboff.

Source/JavaScriptCore:

There are many JSC API clients that run with the JIT disabled. We were
still allocating a ton of value profiles in this use case even though
these clients get no benefit from doing value profiling. This patch makes
it so that we don't allocate value profiles or argument value profiles
when we're not using the JIT. We now just make all value profiles in
the instruction stream point to a global value profile that the VM owns.
And we make the argument value profile array have zero length and teach
the LLInt how to handle that. Heap clears the global value profile on each GC.

In an app that I'm testing this against, this saves ~1MB of memory.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::finishCreation):
(JSC::CodeBlock::setNumParameters):
* bytecode/CodeBlock.h:
(JSC::CodeBlock::numberOfArgumentValueProfiles):
(JSC::CodeBlock::valueProfileForArgument):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitProfiledOpcode):
* heap/Heap.cpp:
(JSC::Heap::runEndPhase):
* llint/LowLevelInterpreter.asm:
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:

Source/WTF:

* wtf/RefCountedArray.h:
(WTF::RefCountedArray::RefCountedArray):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231695 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/CodeBlock.cpp
Source/JavaScriptCore/bytecode/CodeBlock.h
Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
Source/JavaScriptCore/heap/Heap.cpp
Source/JavaScriptCore/llint/LowLevelInterpreter.asm
Source/JavaScriptCore/runtime/VM.cpp
Source/JavaScriptCore/runtime/VM.h
Source/WTF/ChangeLog
Source/WTF/wtf/RefCountedArray.h