StackTraceArguments.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  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. namespace Js {
  6. class StackTraceArguments
  7. {
  8. private:
  9. static const uint64 MaxNumberOfDisplayedArgumentsInStack = 20; // 1 << (3*MaxNumberOfDisplayedArgumentsInStack + 1) must fit in uint64 (or you have to change it's type)
  10. static const uint64 fCallerIsGlobal = 1ull << (3*MaxNumberOfDisplayedArgumentsInStack + 1);
  11. static const uint64 fTooManyArgs = 1ull << (3*MaxNumberOfDisplayedArgumentsInStack);
  12. static uint64 ObjectToTypeCode(Js::Var object);
  13. static JavascriptString *TypeCodeToTypeName(unsigned typeCode, ScriptContext *scriptContext);
  14. // We use 3 bits to store the value type. If we add another type, we need to use more bits.
  15. enum valueTypes
  16. {
  17. nullValue = 0,
  18. undefinedValue = 1,
  19. booleanValue = 2,
  20. stringValue = 3,
  21. nanValue = 4,
  22. numberValue = 5,
  23. symbolValue = 6,
  24. objectValue = 7
  25. };
  26. uint64 types;
  27. public:
  28. HRESULT ToString(LPCWSTR functionName, Js::ScriptContext *scriptContext, _In_ LPCWSTR* outResult) const;
  29. void Init(const JavascriptStackWalker &walker);
  30. StackTraceArguments() : types(fCallerIsGlobal) {}
  31. };
  32. }