FunctionExecutionTest.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. // This file contains stubs needed to make FunctionExecutionTest successfully compile and link as well
  6. // as a means to emulate behavior of objects that interact with FunctionExecutionStateMachine
  7. #include "..\..\lib\Common\Warnings.h"
  8. #include "..\..\lib\Common\Core\CommonMinMax.h"
  9. #define ENUM_CLASS_HELPERS(x, y)
  10. #include "..\..\lib\Runtime\Language\ExecutionMode.h"
  11. #define FieldWithBarrier(type) type
  12. #define CONFIG_FLAG(flag) 10
  13. #define PHASE_OFF(foo, bar) FunctionExecutionTest::PhaseOff(foo, bar)
  14. #define PHASE_FORCE(foo, bar) false
  15. #define NewSimpleJit 1
  16. #define FullJitPhase 2
  17. #undef DEFAULT_CONFIG_MinSimpleJitIterations
  18. #define DEFAULT_CONFIG_MinSimpleJitIterations 0
  19. namespace FunctionExecutionTest
  20. {
  21. static bool FullJitPhaseOffFlag = false;
  22. bool PhaseOff(int phase, void*)
  23. {
  24. if (phase == FullJitPhase)
  25. {
  26. return FullJitPhaseOffFlag;
  27. }
  28. else
  29. {
  30. Assert(!"Unknown Phase");
  31. return false;
  32. }
  33. }
  34. }
  35. namespace Js
  36. {
  37. class ConfigFlagsTable
  38. {
  39. public:
  40. uint16 AutoProfilingInterpreter0Limit;
  41. uint16 AutoProfilingInterpreter1Limit;
  42. uint16 ProfilingInterpreter0Limit;
  43. uint16 ProfilingInterpreter1Limit;
  44. uint16 SimpleJitLimit;
  45. bool EnforceExecutionModeLimits;
  46. void SetDefaults()
  47. {
  48. AutoProfilingInterpreter0Limit = 0xc;
  49. ProfilingInterpreter0Limit = 0x4;
  50. AutoProfilingInterpreter1Limit = 0x44;
  51. ProfilingInterpreter1Limit = 0;
  52. SimpleJitLimit = 0x15;
  53. EnforceExecutionModeLimits = false;
  54. }
  55. void SetInterpretedValues()
  56. {
  57. AutoProfilingInterpreter0Limit = 0;
  58. AutoProfilingInterpreter1Limit = 0;
  59. ProfilingInterpreter0Limit = 1;
  60. ProfilingInterpreter1Limit = 0;
  61. SimpleJitLimit = 1;
  62. EnforceExecutionModeLimits = true;
  63. }
  64. void SetDynaPogoValues()
  65. {
  66. AutoProfilingInterpreter0Limit = 0;
  67. AutoProfilingInterpreter1Limit = 0;
  68. ProfilingInterpreter0Limit = 0;
  69. ProfilingInterpreter1Limit = 0;
  70. SimpleJitLimit = 0;
  71. EnforceExecutionModeLimits = true;
  72. }
  73. };
  74. enum Phase
  75. {
  76. SimpleJitPhase
  77. };
  78. class Configuration
  79. {
  80. public:
  81. Configuration() {}
  82. ConfigFlagsTable flags;
  83. static Configuration Global;
  84. };
  85. Configuration Configuration::Global;
  86. class FunctionEntryPointInfo
  87. {
  88. public:
  89. FunctionEntryPointInfo() : callsCount(0) {}
  90. int callsCount;
  91. };
  92. class Output
  93. {
  94. public:
  95. static size_t Print(const char16 *form, ...) { UNREFERENCED_PARAMETER(form); return 0; }
  96. };
  97. enum DebuggerMode : unsigned int
  98. {
  99. NotDebugging
  100. };
  101. class FunctionBody
  102. {
  103. public:
  104. bool DoInterpreterProfile() const { return doInterpreterProfile; }
  105. bool DoInterpreterAutoProfile() const { return doInterpreterAutoProfile; }
  106. bool DoSimpleJit() const { return doSimpleJit; }
  107. uint GetByteCodeCount() const { return 0; }
  108. uint GetByteCodeInLoopCount() const { return 0; }
  109. uint GetByteCodeWithoutLDACount() const { return 0; }
  110. Js::DebuggerMode GetDebuggerMode() { return (Js::DebuggerMode)0; }
  111. FunctionEntryPointInfo* GetDefaultFunctionEntryPointInfo() { return &defaultInfo; }
  112. FunctionEntryPointInfo *GetSimpleJitEntryPointInfo() { return &simpleInfo; }
  113. void TraceExecutionMode(const char *const eventDescription = nullptr) const { UNREFERENCED_PARAMETER(eventDescription); }
  114. FunctionBody(bool interpreterProfile, bool interpreterAutoProfile, bool simpleJit):
  115. doInterpreterProfile(interpreterProfile),
  116. doInterpreterAutoProfile(interpreterAutoProfile),
  117. doSimpleJit(simpleJit)
  118. {}
  119. private:
  120. bool doInterpreterProfile;
  121. bool doInterpreterAutoProfile;
  122. bool doSimpleJit;
  123. FunctionEntryPointInfo defaultInfo;
  124. FunctionEntryPointInfo simpleInfo;
  125. };
  126. }
  127. #include "..\..\lib\Runtime\Base\FunctionExecutionStateMachine.h"
  128. #include "..\..\lib\Runtime\Base\FunctionExecutionStateMachine.cpp"