AsmJsByteCodeDumper.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft Corporation and contributors. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #pragma once
  6. #ifdef ASMJS_PLAT
  7. namespace Js {
  8. #if DBG_DUMP
  9. class AsmJsByteCodeDumper : public ByteCodeDumper
  10. {
  11. public:
  12. static void Dump(FunctionBody* body, const WAsmJs::TypedRegisterAllocator* typedRegister, AsmJsFunc* asmFunc);
  13. static void DumpConstants(AsmJsFunc* func, FunctionBody* body);
  14. static void DumpOp(OpCodeAsmJs op, LayoutSize layoutSize, ByteCodeReader& reader, FunctionBody* dumpFunction);
  15. static void DumpIntReg(RegSlot reg);
  16. static void DumpLongReg(RegSlot reg);
  17. static void DumpDoubleReg(RegSlot reg);
  18. static void DumpFloatReg(RegSlot reg);
  19. static void DumpR8Float(float value);
  20. static void DumpFloat32x4Reg(RegSlot reg);
  21. static void DumpInt32x4Reg(RegSlot reg);
  22. static void DumpUint32x4Reg(RegSlot reg);
  23. static void DumpInt16x8Reg(RegSlot reg);
  24. static void DumpUint16x8Reg(RegSlot reg);
  25. static void DumpInt8x16Reg(RegSlot reg);
  26. static void DumpUint8x16Reg(RegSlot reg);
  27. static void DumpBool32x4Reg(RegSlot reg);
  28. static void DumpBool16x8Reg(RegSlot reg);
  29. static void DumpBool8x16Reg(RegSlot reg);
  30. static void DumpFloat64x2Reg(RegSlot reg);
  31. static void DumpInt64x2Reg(RegSlot reg);
  32. static void DumpRegReg(RegSlot reg) { DumpReg(reg); }
  33. static void DumpIntConstReg(int val) { DumpI4(val); }
  34. static void DumpLongConstReg(int64 val) { DumpI8(val); }
  35. static void DumpFloatConstReg(float val) { DumpR4(val); }
  36. static void DumpDoubleConstReg(double val) { DumpR8(val); }
  37. #define LAYOUT_TYPE(layout) \
  38. static void Dump##layout(OpCodeAsmJs op, const unaligned OpLayout##layout* data, FunctionBody * dumpFunction, ByteCodeReader& reader);
  39. #define LAYOUT_TYPE_WMS(layout) \
  40. template <class T> static void Dump##layout(OpCodeAsmJs op, const unaligned T* data, FunctionBody * dumpFunction, ByteCodeReader& reader);
  41. #include "LayoutTypesAsmJs.h"
  42. private:
  43. struct WAsmJsMemTag
  44. {
  45. char16 valueTag;
  46. const char16 * heapTag;
  47. };
  48. static void InitializeWAsmJsMemTag(ArrayBufferView::ViewType type, _Out_ WAsmJsMemTag * tag);
  49. };
  50. #endif
  51. }
  52. #endif