Skip to content

Commit

Permalink
[JSC] Attach further more inline capacity to wasm compiler related da…
Browse files Browse the repository at this point in the history
…ta structures

https://bugs.webkit.org/show_bug.cgi?id=278366
rdar://134312057

Reviewed by Yijia Huang.

Avoid unnecessary heap allocation / deallocation more.

* Source/JavaScriptCore/wasm/WasmCallingConvention.h:
(JSC::Wasm::CallInformation::CallInformation):
(JSC::Wasm::WasmCallingConvention::callInformationFor const):
(JSC::Wasm::JSCallingConvention::callInformationFor const):
(JSC::Wasm::CCallingConventionArmThumb2::callInformationFor const):
* Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp:
(JSC::Wasm::LLIntGenerator::addArguments):
(JSC::Wasm::LLIntGenerator::addLoop):

Canonical link: https://commits.webkit.org/282498@main
  • Loading branch information
Constellation committed Aug 20, 2024
1 parent 896f3c7 commit 1aedd1d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 5 additions & 5 deletions Source/JavaScriptCore/wasm/WasmCallingConvention.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ enum class CallRole : uint8_t {
};

struct CallInformation {
CallInformation(ArgumentLocation passedThisArgument, Vector<ArgumentLocation>&& parameters, Vector<ArgumentLocation, 1>&& returnValues, size_t stackOffset)
CallInformation(ArgumentLocation passedThisArgument, Vector<ArgumentLocation, 8>&& parameters, Vector<ArgumentLocation, 1>&& returnValues, size_t stackOffset)
: thisArgument(passedThisArgument)
, params(WTFMove(parameters))
, results(WTFMove(returnValues))
Expand Down Expand Up @@ -111,7 +111,7 @@ struct CallInformation {
bool resultsIncludeI64 : 1 { false };
bool argumentsOrResultsIncludeV128 : 1 { false };
ArgumentLocation thisArgument;
Vector<ArgumentLocation> params;
Vector<ArgumentLocation, 8> params;
Vector<ArgumentLocation, 1> results;
// As a callee this includes CallerFrameAndPC as a caller it does not.
size_t headerAndArgumentStackSizeInBytes;
Expand Down Expand Up @@ -309,7 +309,7 @@ class WasmCallingConvention {
headerSize += sizeof(Register);

size_t argStackOffset = headerSize;
Vector<ArgumentLocation> params(signature.argumentCount());
Vector<ArgumentLocation, 8> params(signature.argumentCount());
for (size_t i = 0; i < signature.argumentCount(); ++i) {
argumentsIncludeI64 |= signature.argumentType(i).isI64();
argumentsOrResultsIncludeV128 |= signature.argumentType(i).isV128();
Expand Down Expand Up @@ -400,7 +400,7 @@ class JSCallingConvention {
ArgumentLocation thisArgument = { role == CallRole::Caller ? ValueLocation::stackArgument(stackOffset) : ValueLocation::stack(stackOffset), widthForBytes(sizeof(void*)) };
stackOffset += sizeof(Register);

Vector<ArgumentLocation> params;
Vector<ArgumentLocation, 8> params;
for (size_t i = 0; i < signature.as<FunctionSignature>()->argumentCount(); ++i)
params.append(marshallLocation(role, signature.as<FunctionSignature>()->argumentType(i), gpArgumentCount, fpArgumentCount, stackOffset));

Expand Down Expand Up @@ -590,7 +590,7 @@ class CCallingConventionArmThumb2 {
headerSize += sizeof(Register);

size_t argStackOffset = headerSize;
Vector<ArgumentLocation> params(signature.argumentCount());
Vector<ArgumentLocation, 8> params(signature.argumentCount());
for (size_t i = 0; i < signature.argumentCount(); ++i) {
argumentsIncludeI64 |= signature.argumentType(i).isI64();
ASSERT(!signature.argumentType(i).isV128());
Expand Down
3 changes: 1 addition & 2 deletions Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ auto LLIntGenerator::addArguments(const TypeDefinition& signature) -> PartialRes
uint32_t fprIndex = maxGPRIndex;
uint32_t stackIndex = 1;

Vector<VirtualRegister> registerArguments(gprCount + fprCount);
Vector<VirtualRegister, 32> registerArguments(gprCount + fprCount);
for (uint32_t i = 0; i < gprCount + fprCount; i++)
registerArguments[i] = push(NoConsistencyCheck);

Expand Down Expand Up @@ -1084,7 +1084,6 @@ auto LLIntGenerator::addLoop(BlockSignature signature, Stack& enclosingStack, Co

block = ControlType::loop(signature, m_stackSize, WTFMove(body), WTFMove(continuation));

Vector<unsigned> unresolvedOffsets;
Vector<VirtualRegister> osrEntryData;
for (uint32_t i = 0; i < m_codeBlock->m_numArguments; i++)
osrEntryData.append(m_normalizedArguments[i]);
Expand Down

0 comments on commit 1aedd1d

Please sign in to comment.