ServerScriptContext.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. virtual bool IsSIMDEnabled() const override;
  48. virtual bool IsPRNGSeeded() const override;
  49. virtual bool IsClosed() const override;
  50. virtual intptr_t GetBuiltinFunctionsBaseAddr() const override;
  51. virtual intptr_t GetDebuggingFlagsAddr() const override;
  52. virtual intptr_t GetDebugStepTypeAddr() const override;
  53. virtual intptr_t GetDebugFrameAddressAddr() const override;
  54. virtual intptr_t GetDebugScriptIdWhenSetAddr() const override;
  55. virtual intptr_t GetAddr() const override;
  56. virtual intptr_t GetVTableAddress(VTableValue vtableType) const override;
  57. virtual bool IsRecyclerVerifyEnabled() const override;
  58. virtual uint GetRecyclerVerifyPad() const override;
  59. virtual void AddToDOMFastPathHelperMap(intptr_t funcInfoAddr, IR::JnHelperMethod helper) override;
  60. virtual IR::JnHelperMethod GetDOMFastPathHelper(intptr_t funcInfoAddr) override;
  61. typedef JsUtil::BaseDictionary<uint, Js::ServerSourceTextModuleRecord*, Memory::HeapAllocator> ServerModuleRecords;
  62. ServerModuleRecords m_moduleRecords;
  63. virtual Field(Js::Var)* GetModuleExportSlotArrayAddress(uint moduleIndex, uint slotIndex) override;
  64. void SetIsPRNGSeeded(bool value);
  65. void AddModuleRecordInfo(unsigned int moduleId, __int64 localExportSlotsAddr);
  66. void UpdateGlobalObjectThisAddr(intptr_t globalThis);
  67. OOPEmitBufferManager * GetEmitBufferManager(bool asmJsManager);
  68. void DecommitEmitBufferManager(bool asmJsManager);
  69. Js::ScriptContextProfiler * GetCodeGenProfiler() const;
  70. ServerThreadContext* GetThreadContext() { return threadContextHolder.threadContextInfo; }
  71. ArenaAllocator * GetSourceCodeArena();
  72. void Close();
  73. void AddRef();
  74. void Release();
  75. private:
  76. JITDOMFastPathHelperMap * m_domFastPathHelperMap;
  77. #ifdef PROFILE_EXEC
  78. Js::ScriptContextProfiler * m_codeGenProfiler;
  79. #endif
  80. ArenaAllocator m_sourceCodeArena;
  81. OOPEmitBufferManager m_interpreterThunkBufferManager;
  82. OOPEmitBufferManager m_asmJsInterpreterThunkBufferManager;
  83. ScriptContextDataIDL m_contextData;
  84. intptr_t m_globalThisAddr;
  85. uint m_refCount;
  86. bool m_isPRNGSeeded;
  87. bool m_isClosed;
  88. #endif
  89. };