WasmReader.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. #include "Common.h"
  7. #include "Runtime.h"
  8. #include "Language/WAsmjsUtils.h"
  9. #ifdef ENABLE_WASM
  10. #if ENABLE_DEBUG_CONFIG_OPTIONS
  11. #define TRACE_WASM(condition, ...) \
  12. if (condition)\
  13. {\
  14. Output::Print(__VA_ARGS__); \
  15. Output::Print(_u("\n")); \
  16. Output::Flush(); \
  17. }
  18. // Level of tracing
  19. #define DO_WASM_TRACE_ALL PHASE_TRACE1(Js::WasmPhase)
  20. #define DO_WASM_TRACE_BYTECODE DO_WASM_TRACE_ALL || PHASE_TRACE1(Js::WasmBytecodePhase)
  21. #define DO_WASM_TRACE_DECODER DO_WASM_TRACE_ALL || PHASE_TRACE1(Js::WasmReaderPhase)
  22. #define DO_WASM_TRACE_SECTION DO_WASM_TRACE_DECODER || PHASE_TRACE1(Js::WasmSectionPhase)
  23. #define DO_WASM_TRACE_LEB128 PHASE_TRACE1(Js::WasmLEB128Phase)
  24. #else
  25. #define TRACE_WASM(...)
  26. #define DO_WASM_TRACE_ALL (false)
  27. #define DO_WASM_TRACE_BYTECODE (false)
  28. #define DO_WASM_TRACE_DECODER (false)
  29. #define DO_WASM_TRACE_SECTION (false)
  30. #define DO_WASM_TRACE_LEB128 (false)
  31. #endif
  32. #define TRACE_WASM_BYTECODE(...) TRACE_WASM(DO_WASM_TRACE_BYTECODE, __VA_ARGS__)
  33. #define TRACE_WASM_DECODER(...) TRACE_WASM(DO_WASM_TRACE_DECODER, __VA_ARGS__)
  34. #define TRACE_WASM_SECTION(...) TRACE_WASM(DO_WASM_TRACE_SECTION, __VA_ARGS__)
  35. #define TRACE_WASM_LEB128(...) TRACE_WASM(DO_WASM_TRACE_LEB128, __VA_ARGS__)
  36. namespace Wasm
  37. {
  38. // forward declarations
  39. struct WasmNode;
  40. struct SExprParseContext;
  41. class WasmFunctionInfo;
  42. }
  43. #include "WasmParseTree.h"
  44. namespace Wasm
  45. {
  46. typedef WasmTypes::WasmType Local;
  47. }
  48. #include "WasmReaderBase.h"
  49. #include "WasmSignature.h"
  50. #include "WasmDataSegment.h"
  51. #include "WasmElementSegment.h"
  52. #include "WasmFunctionInfo.h"
  53. #include "WasmSection.h"
  54. #include "WasmBinaryReader.h"
  55. #include "WasmCustomReader.h"
  56. #include "WasmByteCodeGenerator.h"
  57. #include "WasmGlobal.h"
  58. // TODO (michhol): cleanup includes
  59. #include "ByteCode/ByteCodeDumper.h"
  60. #include "ByteCode/AsmJsByteCodeDumper.h"
  61. #include "Language/AsmJsTypes.h"
  62. #endif // ENABLE_WASM