JavascriptNativeOperators.h 1.3 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. {
  7. #if ENABLE_NATIVE_CODEGEN
  8. template <typename T>
  9. class BranchDictionaryWrapper
  10. {
  11. public:
  12. typedef JsUtil::BaseDictionary<T, void*, NativeCodeData::Allocator> BranchDictionary;
  13. BranchDictionaryWrapper(NativeCodeData::Allocator * allocator, uint dictionarySize) :
  14. defaultTarget(nullptr), dictionary(allocator)
  15. {
  16. }
  17. BranchDictionary dictionary;
  18. void* defaultTarget;
  19. static BranchDictionaryWrapper* New(NativeCodeData::Allocator * allocator, uint dictionarySize)
  20. {
  21. return NativeCodeDataNew(allocator, BranchDictionaryWrapper, allocator, dictionarySize);
  22. }
  23. };
  24. class JavascriptNativeOperators
  25. {
  26. public:
  27. static void * Op_SwitchStringLookUp(JavascriptString* str, Js::BranchDictionaryWrapper<Js::JavascriptString*>* stringDictionary, uintptr_t funcStart, uintptr_t funcEnd);
  28. };
  29. #endif
  30. };