JavascriptNativeOperators.cpp 1.2 KB

1234567891011121314151617181920212223242526
  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. #include "RuntimeLanguagePch.h"
  6. #include "JavascriptNativeOperators.h"
  7. namespace Js
  8. {
  9. #if ENABLE_NATIVE_CODEGEN
  10. void * JavascriptNativeOperators::Op_SwitchStringLookUp(JavascriptString* str, Js::BranchDictionaryWrapper<JavascriptString*>* branchTargets, uintptr_t funcStart, uintptr_t funcEnd)
  11. {
  12. void* defaultTarget = branchTargets->defaultTarget;
  13. Js::BranchDictionaryWrapper<JavascriptString*>::BranchDictionary& stringDictionary = branchTargets->dictionary;
  14. void* target = stringDictionary.Lookup(str, defaultTarget);
  15. uintptr_t utarget = (uintptr_t)target;
  16. if ((utarget - funcStart) > (funcEnd - funcStart))
  17. {
  18. AssertMsg(false, "Switch string dictionary jump target outside of function");
  19. Throw::FatalInternalError();
  20. }
  21. return target;
  22. }
  23. #endif
  24. };