ffi.WASM_RELEASE_SYNC.js 5.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.QuickJSFFI = void 0;
  4. /**
  5. * Low-level FFI bindings to QuickJS's Emscripten module.
  6. * See instead [[QuickJSContext]], the public Javascript interface exposed by this
  7. * library.
  8. *
  9. * @unstable The FFI interface is considered private and may change.
  10. */
  11. class QuickJSFFI {
  12. constructor(module) {
  13. this.module = module;
  14. /** Set at compile time. */
  15. this.DEBUG = false;
  16. this.QTS_Throw = this.module.cwrap("QTS_Throw", "number", ["number", "number"]);
  17. this.QTS_NewError = this.module.cwrap("QTS_NewError", "number", ["number"]);
  18. this.QTS_RuntimeSetMemoryLimit = this.module.cwrap("QTS_RuntimeSetMemoryLimit", null, ["number", "number"]);
  19. this.QTS_RuntimeComputeMemoryUsage = this.module.cwrap("QTS_RuntimeComputeMemoryUsage", "number", ["number", "number"]);
  20. this.QTS_RuntimeDumpMemoryUsage = this.module.cwrap("QTS_RuntimeDumpMemoryUsage", "number", ["number"]);
  21. this.QTS_RecoverableLeakCheck = this.module.cwrap("QTS_RecoverableLeakCheck", "number", []);
  22. this.QTS_BuildIsSanitizeLeak = this.module.cwrap("QTS_BuildIsSanitizeLeak", "number", []);
  23. this.QTS_RuntimeSetMaxStackSize = this.module.cwrap("QTS_RuntimeSetMaxStackSize", null, ["number", "number"]);
  24. this.QTS_GetUndefined = this.module.cwrap("QTS_GetUndefined", "number", []);
  25. this.QTS_GetNull = this.module.cwrap("QTS_GetNull", "number", []);
  26. this.QTS_GetFalse = this.module.cwrap("QTS_GetFalse", "number", []);
  27. this.QTS_GetTrue = this.module.cwrap("QTS_GetTrue", "number", []);
  28. this.QTS_NewRuntime = this.module.cwrap("QTS_NewRuntime", "number", []);
  29. this.QTS_FreeRuntime = this.module.cwrap("QTS_FreeRuntime", null, ["number"]);
  30. this.QTS_NewContext = this.module.cwrap("QTS_NewContext", "number", ["number"]);
  31. this.QTS_FreeContext = this.module.cwrap("QTS_FreeContext", null, ["number"]);
  32. this.QTS_FreeValuePointer = this.module.cwrap("QTS_FreeValuePointer", null, ["number", "number"]);
  33. this.QTS_FreeValuePointerRuntime = this.module.cwrap("QTS_FreeValuePointerRuntime", null, ["number", "number"]);
  34. this.QTS_FreeVoidPointer = this.module.cwrap("QTS_FreeVoidPointer", null, ["number", "number"]);
  35. this.QTS_FreeCString = this.module.cwrap("QTS_FreeCString", null, ["number", "number"]);
  36. this.QTS_DupValuePointer = this.module.cwrap("QTS_DupValuePointer", "number", ["number", "number"]);
  37. this.QTS_NewObject = this.module.cwrap("QTS_NewObject", "number", ["number"]);
  38. this.QTS_NewObjectProto = this.module.cwrap("QTS_NewObjectProto", "number", ["number", "number"]);
  39. this.QTS_NewArray = this.module.cwrap("QTS_NewArray", "number", ["number"]);
  40. this.QTS_NewFloat64 = this.module.cwrap("QTS_NewFloat64", "number", ["number", "number"]);
  41. this.QTS_GetFloat64 = this.module.cwrap("QTS_GetFloat64", "number", ["number", "number"]);
  42. this.QTS_NewString = this.module.cwrap("QTS_NewString", "number", ["number", "number"]);
  43. this.QTS_GetString = this.module.cwrap("QTS_GetString", "number", ["number", "number"]);
  44. this.QTS_NewSymbol = this.module.cwrap("QTS_NewSymbol", "number", ["number", "number", "number"]);
  45. this.QTS_GetSymbolDescriptionOrKey = this.module.cwrap("QTS_GetSymbolDescriptionOrKey", "number", ["number", "number"]);
  46. this.QTS_IsGlobalSymbol = this.module.cwrap("QTS_IsGlobalSymbol", "number", ["number", "number"]);
  47. this.QTS_IsJobPending = this.module.cwrap("QTS_IsJobPending", "number", ["number"]);
  48. this.QTS_ExecutePendingJob = this.module.cwrap("QTS_ExecutePendingJob", "number", ["number", "number", "number"]);
  49. this.QTS_GetProp = this.module.cwrap("QTS_GetProp", "number", ["number", "number", "number"]);
  50. this.QTS_SetProp = this.module.cwrap("QTS_SetProp", null, ["number", "number", "number", "number"]);
  51. this.QTS_DefineProp = this.module.cwrap("QTS_DefineProp", null, ["number", "number", "number", "number", "number", "number", "boolean", "boolean", "boolean"]);
  52. this.QTS_Call = this.module.cwrap("QTS_Call", "number", ["number", "number", "number", "number", "number"]);
  53. this.QTS_ResolveException = this.module.cwrap("QTS_ResolveException", "number", ["number", "number"]);
  54. this.QTS_Dump = this.module.cwrap("QTS_Dump", "number", ["number", "number"]);
  55. this.QTS_Eval = this.module.cwrap("QTS_Eval", "number", ["number", "number", "string", "number", "number"]);
  56. this.QTS_Typeof = this.module.cwrap("QTS_Typeof", "number", ["number", "number"]);
  57. this.QTS_GetGlobalObject = this.module.cwrap("QTS_GetGlobalObject", "number", ["number"]);
  58. this.QTS_NewPromiseCapability = this.module.cwrap("QTS_NewPromiseCapability", "number", ["number", "number"]);
  59. this.QTS_TestStringArg = this.module.cwrap("QTS_TestStringArg", null, ["string"]);
  60. this.QTS_BuildIsDebug = this.module.cwrap("QTS_BuildIsDebug", "number", []);
  61. this.QTS_BuildIsAsyncify = this.module.cwrap("QTS_BuildIsAsyncify", "number", []);
  62. this.QTS_NewFunction = this.module.cwrap("QTS_NewFunction", "number", ["number", "number", "string"]);
  63. this.QTS_ArgvGetJSValueConstPointer = this.module.cwrap("QTS_ArgvGetJSValueConstPointer", "number", ["number", "number"]);
  64. this.QTS_RuntimeEnableInterruptHandler = this.module.cwrap("QTS_RuntimeEnableInterruptHandler", null, ["number"]);
  65. this.QTS_RuntimeDisableInterruptHandler = this.module.cwrap("QTS_RuntimeDisableInterruptHandler", null, ["number"]);
  66. this.QTS_RuntimeEnableModuleLoader = this.module.cwrap("QTS_RuntimeEnableModuleLoader", null, ["number", "number"]);
  67. this.QTS_RuntimeDisableModuleLoader = this.module.cwrap("QTS_RuntimeDisableModuleLoader", null, ["number"]);
  68. }
  69. }
  70. exports.QuickJSFFI = QuickJSFFI;
  71. //# sourceMappingURL=ffi.WASM_RELEASE_SYNC.js.map