| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- //-------------------------------------------------------------------------------------------------------
- // Copyright (C) Microsoft. All rights reserved.
- // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
- //-------------------------------------------------------------------------------------------------------
- #include "Backend.h"
- #ifdef ASMJS_PLAT
- AsmJsJITInfo::AsmJsJITInfo(AsmJsDataIDL * data) :
- m_data(*data)
- {
- CompileAssert(sizeof(AsmJsJITInfo) == sizeof(AsmJsDataIDL));
- }
- WAsmJs::TypedSlotInfo
- AsmJsJITInfo::GetTypedSlotInfo(WAsmJs::Types type) const
- {
- WAsmJs::TypedSlotInfo info;
- if (type >= 0 && type < WAsmJs::LIMIT)
- {
- info.byteOffset = m_data.typedSlotInfos[type].byteOffset;
- info.constCount = m_data.typedSlotInfos[type].constCount;
- info.constSrcByteOffset = m_data.typedSlotInfos[type].constSrcByteOffset;
- info.tmpCount = m_data.typedSlotInfos[type].tmpCount;
- info.varCount = m_data.typedSlotInfos[type].varCount;
- }
- return info;
- }
- int
- AsmJsJITInfo::GetTotalSizeInBytes() const
- {
- return m_data.totalSizeInBytes;
- }
- Js::ArgSlot
- AsmJsJITInfo::GetArgCount() const
- {
- return m_data.argCount;
- }
- Js::ArgSlot
- AsmJsJITInfo::GetArgByteSize() const
- {
- return m_data.argByteSize;
- }
- Js::AsmJsRetType::Which
- AsmJsJITInfo::GetRetType() const
- {
- return static_cast<Js::AsmJsRetType::Which>(m_data.retType);
- }
- Js::AsmJsVarType::Which *
- AsmJsJITInfo::GetArgTypeArray() const
- {
- return reinterpret_cast<Js::AsmJsVarType::Which *>(m_data.argTypeArray);
- }
- Js::AsmJsVarType::Which
- AsmJsJITInfo::GetArgType(Js::ArgSlot argNum) const
- {
- Assert(argNum < GetArgCount());
- return GetArgTypeArray()[argNum];
- }
- #ifdef ENABLE_WASM
- Wasm::WasmSignature *
- AsmJsJITInfo::GetWasmSignature(uint index) const
- {
- Assert(index < m_data.wasmSignatureCount);
- return Wasm::WasmSignature::FromIDL(&m_data.wasmSignatures[index]);
- }
- intptr_t
- AsmJsJITInfo::GetWasmSignatureAddr(uint index) const
- {
- Assert(index < m_data.wasmSignatureCount);
- return m_data.wasmSignaturesBaseAddr + index * sizeof(Wasm::WasmSignature);
- }
- #endif
- bool
- AsmJsJITInfo::IsHeapBufferConst() const
- {
- return m_data.isHeapBufferConst != FALSE;
- }
- bool
- AsmJsJITInfo::UsesHeapBuffer() const
- {
- return m_data.usesHeapBuffer != FALSE;
- }
- bool
- AsmJsJITInfo::AccessNeedsBoundCheck(uint offset) const
- {
- // Normally, heap has min size of 0x10000, but if you use ChangeHeap, min heap size is increased to 0x1000000
- return offset >= 0x1000000 || (IsHeapBufferConst() && offset >= 0x10000);
- }
- #endif
|