WasmCallingConvention.cpp [plain text]
#include "config.h"
#include "WasmCallingConvention.h"
#if ENABLE(WEBASSEMBLY)
#include <wtf/NeverDestroyed.h>
namespace JSC { namespace Wasm {
const JSCCallingConvention& jscCallingConvention()
{
static LazyNeverDestroyed<JSCCallingConvention> staticJSCCallingConvention;
static std::once_flag staticJSCCallingConventionFlag;
std::call_once(staticJSCCallingConventionFlag, [] () {
staticJSCCallingConvention.construct(Vector<Reg>(), Vector<Reg>(), RegisterSet::calleeSaveRegisters());
});
return staticJSCCallingConvention;
}
const WasmCallingConvention& wasmCallingConvention()
{
static LazyNeverDestroyed<JSCCallingConvention> staticWasmCallingConvention;
static std::once_flag staticWasmCallingConventionFlag;
std::call_once(staticWasmCallingConventionFlag, [] () {
Vector<Reg> gprArgumentRegisters(GPRInfo::numberOfArgumentRegisters);
for (unsigned i = 0; i < GPRInfo::numberOfArgumentRegisters; ++i)
gprArgumentRegisters[i] = GPRInfo::toArgumentRegister(i);
Vector<Reg> fprArgumentRegisters(FPRInfo::numberOfArgumentRegisters);
for (unsigned i = 0; i < FPRInfo::numberOfArgumentRegisters; ++i)
fprArgumentRegisters[i] = FPRInfo::toArgumentRegister(i);
staticWasmCallingConvention.construct(WTFMove(gprArgumentRegisters), WTFMove(fprArgumentRegisters), RegisterSet::calleeSaveRegisters());
});
return staticWasmCallingConvention;
}
} }
#endif // ENABLE(B3_JIT)