StatementReader.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  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. namespace Js
  7. {
  8. template <typename TStatementMapList>
  9. class StatementReader
  10. {
  11. private:
  12. const byte* m_startLocation = nullptr;
  13. SmallSpanSequence* m_statementMap = nullptr;
  14. SmallSpanSequenceIter m_statementMapIter;
  15. TStatementMapList * m_fullstatementMap = nullptr;
  16. const byte* m_nextStatementBoundary = nullptr;
  17. int m_statementIndex = 0;
  18. bool m_startOfStatement = true;
  19. public:
  20. void Create(FunctionBody* functionRead, uint startOffset = 0);
  21. void Create(FunctionBody* functionRead, uint startOffset, bool useOriginalByteCode);
  22. void Create(
  23. _In_ const byte * byteCodeStart,
  24. uint startOffset,
  25. Js::SmallSpanSequence * statementMap,
  26. TStatementMapList* fullstatementMap);
  27. inline bool AtStatementBoundary(ByteCodeReader * reader) { return m_nextStatementBoundary == reader->GetIP(); }
  28. inline uint32 MoveNextStatementBoundary();
  29. inline uint32 GetStatementIndex() const { return m_statementIndex; }
  30. };
  31. } // namespace Js