AsmJsByteCodeDumper.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 DumpRegReg(RegSlot reg) { DumpReg(reg); }
  32. static void DumpIntConstReg(int val) { DumpI4(val); }
  33. static void DumpLongConstReg(int64 val) { DumpI8(val); }
  34. static void DumpFloatConstReg(float val) { DumpR4(val); }
  35. static void DumpDoubleConstReg(double val) { DumpR8(val); }
  36. #define LAYOUT_TYPE(layout) \
  37. static void Dump##layout(OpCodeAsmJs op, const unaligned OpLayout##layout* data, FunctionBody * dumpFunction, ByteCodeReader& reader);
  38. #define LAYOUT_TYPE_WMS(layout) \
  39. template <class T> static void Dump##layout(OpCodeAsmJs op, const unaligned T* data, FunctionBody * dumpFunction, ByteCodeReader& reader);
  40. #include "LayoutTypesAsmJs.h"
  41. };
  42. #endif
  43. }
  44. #endif