ServerScriptContext.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. 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. class ServerScriptContext : public ScriptContextInfo
  7. {
  8. #if ENABLE_OOP_NATIVE_CODEGEN
  9. private:
  10. struct ThreadContextHolder
  11. {
  12. ServerThreadContext* threadContextInfo;
  13. ThreadContextHolder(ServerThreadContext* threadContextInfo);
  14. ~ThreadContextHolder();
  15. };
  16. ThreadContextHolder threadContextHolder;
  17. public:
  18. ServerScriptContext(ScriptContextDataIDL * contextData, ServerThreadContext* threadContextInfo);
  19. ~ServerScriptContext();
  20. virtual intptr_t GetNullAddr() const override;
  21. virtual intptr_t GetUndefinedAddr() const override;
  22. virtual intptr_t GetTrueAddr() const override;
  23. virtual intptr_t GetFalseAddr() const override;
  24. virtual intptr_t GetUndeclBlockVarAddr() const override;
  25. virtual intptr_t GetEmptyStringAddr() const override;
  26. virtual intptr_t GetNegativeZeroAddr() const override;
  27. virtual intptr_t GetNumberTypeStaticAddr() const override;
  28. virtual intptr_t GetStringTypeStaticAddr() const override;
  29. virtual intptr_t GetObjectTypeAddr() const override;
  30. virtual intptr_t GetObjectHeaderInlinedTypeAddr() const override;
  31. virtual intptr_t GetRegexTypeAddr() const override;
  32. virtual intptr_t GetArrayTypeAddr() const override;
  33. virtual intptr_t GetNativeIntArrayTypeAddr() const override;
  34. virtual intptr_t GetNativeFloatArrayTypeAddr() const override;
  35. virtual intptr_t GetArrayConstructorAddr() const override;
  36. virtual intptr_t GetCharStringCacheAddr() const override;
  37. virtual intptr_t GetSideEffectsAddr() const override;
  38. virtual intptr_t GetArraySetElementFastPathVtableAddr() const override;
  39. virtual intptr_t GetIntArraySetElementFastPathVtableAddr() const override;
  40. virtual intptr_t GetFloatArraySetElementFastPathVtableAddr() const override;
  41. virtual intptr_t GetLibraryAddr() const override;
  42. virtual intptr_t GetGlobalObjectAddr() const override;
  43. virtual intptr_t GetGlobalObjectThisAddr() const override;
  44. virtual intptr_t GetNumberAllocatorAddr() const override;
  45. virtual intptr_t GetRecyclerAddr() const override;
  46. virtual bool GetRecyclerAllowNativeCodeBumpAllocation() const override;
  47. #ifdef ENABLE_SIMDJS
  48. virtual bool IsSIMDEnabled() const override;
  49. #endif
  50. virtual bool IsPRNGSeeded() const override;
  51. virtual bool IsClosed() const override;
  52. virtual intptr_t GetBuiltinFunctionsBaseAddr() const override;
  53. virtual intptr_t GetDebuggingFlagsAddr() const override;
  54. virtual intptr_t GetDebugStepTypeAddr() const override;
  55. virtual intptr_t GetDebugFrameAddressAddr() const override;
  56. virtual intptr_t GetDebugScriptIdWhenSetAddr() const override;
  57. virtual intptr_t GetAddr() const override;
  58. virtual intptr_t GetVTableAddress(VTableValue vtableType) const override;
  59. virtual bool IsRecyclerVerifyEnabled() const override;
  60. virtual uint GetRecyclerVerifyPad() const override;
  61. virtual void AddToDOMFastPathHelperMap(intptr_t funcInfoAddr, IR::JnHelperMethod helper) override;
  62. virtual IR::JnHelperMethod GetDOMFastPathHelper(intptr_t funcInfoAddr) override;
  63. typedef JsUtil::BaseDictionary<uint, Js::ServerSourceTextModuleRecord*, Memory::HeapAllocator> ServerModuleRecords;
  64. ServerModuleRecords m_moduleRecords;
  65. virtual Field(Js::Var)* GetModuleExportSlotArrayAddress(uint moduleIndex, uint slotIndex) override;
  66. void SetIsPRNGSeeded(bool value);
  67. void AddModuleRecordInfo(unsigned int moduleId, __int64 localExportSlotsAddr);
  68. void UpdateGlobalObjectThisAddr(intptr_t globalThis);
  69. OOPEmitBufferManager * GetEmitBufferManager(bool asmJsManager);
  70. void DecommitEmitBufferManager(bool asmJsManager);
  71. Js::ScriptContextProfiler * GetCodeGenProfiler() const;
  72. ServerThreadContext* GetThreadContext() { return threadContextHolder.threadContextInfo; }
  73. ArenaAllocator * GetSourceCodeArena();
  74. void Close();
  75. void AddRef();
  76. void Release();
  77. private:
  78. JITDOMFastPathHelperMap * m_domFastPathHelperMap;
  79. #ifdef PROFILE_EXEC
  80. Js::ScriptContextProfiler * m_codeGenProfiler;
  81. #endif
  82. ArenaAllocator m_sourceCodeArena;
  83. OOPEmitBufferManager m_interpreterThunkBufferManager;
  84. OOPEmitBufferManager m_asmJsInterpreterThunkBufferManager;
  85. ScriptContextDataIDL m_contextData;
  86. intptr_t m_globalThisAddr;
  87. uint m_refCount;
  88. bool m_isPRNGSeeded;
  89. bool m_isClosed;
  90. #endif
  91. };