Selaa lähdekoodia

JIT: to compile on Linux

Noisy changes to compile native code gen code on Linux with clang.
Most changes are:
    - Fix missing parentheses around `&&` within `||` expressions
    - Fix `char16/_u` issues
    - Fix incorrect `inline`s
Jianchun Xu 9 vuotta sitten
vanhempi
sitoutus
4f93a9d8ce
89 muutettua tiedostoa jossa 609 lisäystä ja 559 poistoa
  1. 2 2
      bin/ChakraCore/TestHooks.cpp
  2. 1 1
      bin/ch/Debugger.cpp
  3. 1 1
      bin/ch/ch.cpp
  4. 2 0
      lib/Backend/Backend.h
  5. 8 8
      lib/Backend/BackwardPass.cpp
  6. 4 4
      lib/Backend/BailOut.cpp
  7. 23 20
      lib/Backend/BailOut.h
  8. 1 1
      lib/Backend/FlowGraph.cpp
  9. 14 14
      lib/Backend/Func.cpp
  10. 4 4
      lib/Backend/Func.h
  11. 3 3
      lib/Backend/FunctionJITTimeInfo.cpp
  12. 2 2
      lib/Backend/FunctionJITTimeInfo.h
  13. 75 73
      lib/Backend/GlobOpt.cpp
  14. 3 3
      lib/Backend/GlobOpt.h
  15. 4 4
      lib/Backend/GlobOptBailOut.cpp
  16. 1 1
      lib/Backend/GlobOptFields.cpp
  17. 2 2
      lib/Backend/GlobOptIntBounds.cpp
  18. 31 25
      lib/Backend/IR.cpp
  19. 5 5
      lib/Backend/IR.h
  20. 4 4
      lib/Backend/IRBuilder.cpp
  21. 1 1
      lib/Backend/IRType.cpp
  22. 2 2
      lib/Backend/InductionVariable.cpp
  23. 31 26
      lib/Backend/Inline.cpp
  24. 1 1
      lib/Backend/Inline.h
  25. 9 9
      lib/Backend/InliningDecider.cpp
  26. 3 1
      lib/Backend/InliningHeuristics.h
  27. 1 1
      lib/Backend/JITObjTypeSpecFldInfo.h
  28. 2 2
      lib/Backend/JITTimeFunctionBody.cpp
  29. 1 1
      lib/Backend/JITTimeFunctionBody.h
  30. 1 1
      lib/Backend/JITTimeProfileInfo.cpp
  31. 2 2
      lib/Backend/JITType.cpp
  32. 2 2
      lib/Backend/JITType.h
  33. 1 1
      lib/Backend/JITTypeHandler.cpp
  34. 2 2
      lib/Backend/LinearScan.cpp
  35. 15 15
      lib/Backend/Lower.cpp
  36. 43 35
      lib/Backend/NativeCodeGenerator.cpp
  37. 1 0
      lib/Backend/NativeCodeGenerator.h
  38. 2 2
      lib/Backend/Opnd.cpp
  39. 2 2
      lib/Backend/SccLiveness.cpp
  40. 5 5
      lib/Backend/ServerScriptContext.cpp
  41. 5 5
      lib/Backend/ServerThreadContext.cpp
  42. 1 1
      lib/Backend/ServerThreadContext.h
  43. 3 3
      lib/Backend/TempTracker.cpp
  44. 2 2
      lib/Backend/amd64/EncoderMD.cpp
  45. 1 1
      lib/Common/BackendApi.h
  46. 1 1
      lib/Common/Common/Jobs.cpp
  47. 9 9
      lib/Common/Common/Jobs.inl
  48. 1 1
      lib/Common/Core/DelayLoadLibrary.cpp
  49. 1 1
      lib/Common/Core/DelayLoadLibrary.h
  50. 13 13
      lib/Common/DataStructures/BaseDictionary.h
  51. 3 2
      lib/Common/DataStructures/List.h
  52. 2 2
      lib/Common/Memory/PageAllocator.h
  53. 3 3
      lib/Common/Memory/Recycler.h
  54. 4 0
      lib/Jsrt/JsrtHelper.cpp
  55. 3 0
      lib/Runtime/Base/Constants.cpp
  56. 2 2
      lib/Runtime/Base/Constants.h
  57. 1 1
      lib/Runtime/Base/Debug.h
  58. 20 20
      lib/Runtime/Base/FunctionBody.h
  59. 2 2
      lib/Runtime/Base/ScriptContext.cpp
  60. 2 2
      lib/Runtime/Base/ScriptContext.h
  61. 10 10
      lib/Runtime/Base/ThreadContext.cpp
  62. 4 4
      lib/Runtime/Base/ThreadContext.h
  63. 2 2
      lib/Runtime/Base/ThreadContextInfo.h
  64. 23 23
      lib/Runtime/ByteCode/AsmJsByteCodeDumper.cpp
  65. 0 21
      lib/Runtime/ByteCode/ByteCodeReader.cpp
  66. 21 0
      lib/Runtime/ByteCode/ByteCodeReader.h
  67. 3 3
      lib/Runtime/ByteCode/ByteCodeWriter.cpp
  68. 3 3
      lib/Runtime/ByteCode/ByteCodeWriter.h
  69. 7 7
      lib/Runtime/Language/AsmJsByteCodeGenerator.cpp
  70. 5 2
      lib/Runtime/Language/AsmJsByteCodeGenerator.h
  71. 3 3
      lib/Runtime/Language/AsmJsEncoder.inl
  72. 3 3
      lib/Runtime/Language/AsmJsLink.cpp
  73. 18 18
      lib/Runtime/Language/AsmJsModule.cpp
  74. 1 1
      lib/Runtime/Language/AsmJsModule.h
  75. 2 2
      lib/Runtime/Language/AsmJsTypes.cpp
  76. 3 3
      lib/Runtime/Language/AsmJsTypes.h
  77. 16 16
      lib/Runtime/Language/AsmJsUtils.cpp
  78. 10 10
      lib/Runtime/Language/DynamicProfileInfo.cpp
  79. 2 2
      lib/Runtime/Language/DynamicProfileStorage.cpp
  80. 8 1
      lib/Runtime/Language/DynamicProfileStorage.h
  81. 3 3
      lib/Runtime/Language/InterpreterStackFrame.h
  82. 3 3
      lib/Runtime/Language/JavascriptNativeOperators.h
  83. 40 40
      lib/Runtime/Language/ObjTypeSpecFldInfo.cpp
  84. 1 1
      lib/Runtime/Language/ObjTypeSpecFldInfo.h
  85. 3 1
      lib/Runtime/Language/SourceDynamicProfileManager.h
  86. 3 3
      lib/Runtime/Language/ValueType.cpp
  87. 1 1
      lib/Runtime/Library/JavascriptFunction.h
  88. 11 11
      lib/Runtime/Library/amd64/JavascriptFunctionA.asm
  89. 4 3
      lib/Runtime/Runtime.h

+ 2 - 2
bin/ChakraCore/TestHooks.cpp

@@ -48,7 +48,7 @@ void __stdcall ConnectJITServer(HANDLE processHandle, void* serverSecurityDescri
     ThreadContext::SetJITConnectionInfo(processHandle, serverSecurityDescriptor, connectionId);
 }
 #endif
-#endif 
+#endif
 
 void __stdcall NotifyUnhandledException(PEXCEPTION_POINTERS exceptionInfo)
 {
@@ -162,7 +162,7 @@ HRESULT OnChakraCoreLoaded()
 #undef FLAG_NumberSet
 #undef FLAG_NumberPairSet
 #undef FLAG_NumberRange
-#if ENABLE_NATIVE_CODEGEN
+#if ENABLE_NATIVE_CODEGEN && _WIN32
         ConnectJITServer,
 #endif
         NotifyUnhandledException

+ 1 - 1
bin/ch/Debugger.cpp

@@ -473,7 +473,7 @@ bool Debugger::CompareOrWriteBaselineFile(LPCSTR fileName)
         IfJsrtErrorFailLogAndRetFalse(ChakraRTInterface::JsStringToPointerUtf8Copy(result, &baselineData, &baselineDataLength));
 
         char16 baselineFilename[256];
-        swprintf_s(baselineFilename, _countof(baselineFilename), HostConfigFlags::flags.dbgbaselineIsEnabled ? _u("%S.dbg.baseline.rebase") : _u("%S.dbg.baseline"), fileName);
+        swprintf_s(baselineFilename, HostConfigFlags::flags.dbgbaselineIsEnabled ? _u("%S.dbg.baseline.rebase") : _u("%S.dbg.baseline"), fileName);
 
         FILE *file = nullptr;
         if (_wfopen_s(&file, baselineFilename, _u("wt")) != 0)

+ 1 - 1
bin/ch/ch.cpp

@@ -37,7 +37,7 @@ int HostExceptionFilter(int exceptionCode, _EXCEPTION_POINTERS *ep)
 {
     ChakraRTInterface::NotifyUnhandledException(ep);
 
-#if ENABLE_NATIVE_CODEGEN
+#if ENABLE_NATIVE_CODEGEN && _WIN32
     JITProcessManager::TerminateJITServer();
 #endif
     bool crashOnException = false;

+ 2 - 0
lib/Backend/Backend.h

@@ -110,7 +110,9 @@ enum IRDumpFlags
 // BackEnd includes
 //
 
+#ifdef _WIN32
 #include "ChakraJIT.h"
+#endif
 #include "JITTimeProfileInfo.h"
 #include "JITRecyclableObject.h"
 #include "JITTimeFixedField.h"

+ 8 - 8
lib/Backend/BackwardPass.cpp

@@ -3311,13 +3311,13 @@ BackwardPass::ProcessNoImplicitCallDef(IR::Instr *const instr)
     else if(
         !(
             // LdFld or similar
-            dst->IsRegOpnd() && src->IsSymOpnd() && src->AsSymOpnd()->m_sym->IsPropertySym() ||
+            (dst->IsRegOpnd() && src->IsSymOpnd() && src->AsSymOpnd()->m_sym->IsPropertySym()) ||
 
             // StFld or similar. Don't transfer a field opnd from StFld into the reg opnd src unless the field's value type is
             // definitely array or object with array, because only those value types require implicit calls to be disabled as
             // long as they are live. Other definite value types only require implicit calls to be disabled as long as a live
             // field holds the value, which is up to the StFld when going backwards.
-            src->IsRegOpnd() && dst->GetValueType().IsArrayOrObjectWithArray()
+            (src->IsRegOpnd() && dst->GetValueType().IsArrayOrObjectWithArray())
         ) ||
         !GlobOpt::TransferSrcValue(instr))
     {
@@ -3972,8 +3972,8 @@ BackwardPass::UpdateArrayBailOutKind(IR::Instr *const instr)
     Assert(instr);
     Assert(instr->HasBailOutInfo());
 
-    if (instr->m_opcode != Js::OpCode::StElemI_A && instr->m_opcode != Js::OpCode::StElemI_A_Strict &&
-        instr->m_opcode != Js::OpCode::Memcopy && instr->m_opcode != Js::OpCode::Memset ||
+    if ((instr->m_opcode != Js::OpCode::StElemI_A && instr->m_opcode != Js::OpCode::StElemI_A_Strict &&
+        instr->m_opcode != Js::OpCode::Memcopy && instr->m_opcode != Js::OpCode::Memset) ||
         !instr->GetDst()->IsIndirOpnd())
     {
         return;
@@ -5511,7 +5511,7 @@ BackwardPass::TrackIntUsage(IR::Instr *const instr)
 
                 if (instr->ignoreNegativeZero ||
                     (instr->GetSrc1()->IsIntConstOpnd() && instr->GetSrc1()->AsIntConstOpnd()->GetValue() != 0) ||
-                    instr->GetSrc2()->IsIntConstOpnd() && instr->GetSrc2()->AsIntConstOpnd()->GetValue() != 0)
+                    (instr->GetSrc2()->IsIntConstOpnd() && instr->GetSrc2()->AsIntConstOpnd()->GetValue() != 0))
                 {
                     SetNegativeZeroDoesNotMatterIfLastUse(instr->GetSrc1());
                     SetNegativeZeroDoesNotMatterIfLastUse(instr->GetSrc2());
@@ -5567,7 +5567,7 @@ BackwardPass::TrackIntUsage(IR::Instr *const instr)
 
                 if (instr->ignoreNegativeZero ||
                     (instr->GetSrc1()->IsIntConstOpnd() && instr->GetSrc1()->AsIntConstOpnd()->GetValue() != 0) ||
-                    instr->GetSrc2()->IsIntConstOpnd() && instr->GetSrc2()->AsIntConstOpnd()->GetValue() != 0)
+                    (instr->GetSrc2()->IsIntConstOpnd() && instr->GetSrc2()->AsIntConstOpnd()->GetValue() != 0))
                 {
                     SetNegativeZeroDoesNotMatterIfLastUse(instr->GetSrc1());
                     SetNegativeZeroDoesNotMatterIfLastUse(instr->GetSrc2());
@@ -5890,7 +5890,7 @@ BackwardPass::TrackIntUsage(IR::Instr *const instr)
                 !!candidateSymsRequiredToBeLossyInt->Test(srcSymId);
             const bool srcNeedsToBeLossless =
                 !currentBlock->intOverflowDoesNotMatterRange->SymsRequiredToBeLossyInt()->Test(dstSym->m_id) ||
-                srcIncluded && !srcIncludedAsLossy;
+                (srcIncluded && !srcIncludedAsLossy);
             if(srcIncluded)
             {
                 if(srcIncludedAsLossy && srcNeedsToBeLossless)
@@ -6362,7 +6362,7 @@ BackwardPass::TrackFloatSymEquivalence(IR::Instr *const instr)
     // throughout the function and checking just the sym's non-number bailout bit is insufficient.
     FloatSymEquivalenceClass *dstEquivalenceClass;
     if(dst->m_requiresBailOnNotNumber ||
-        floatSymEquivalenceMap->TryGetValue(dst->m_id, &dstEquivalenceClass) && dstEquivalenceClass->RequiresBailOnNotNumber())
+        (floatSymEquivalenceMap->TryGetValue(dst->m_id, &dstEquivalenceClass) && dstEquivalenceClass->RequiresBailOnNotNumber()))
     {
         instr->SetBailOutKind(IR::BailOutNumberOnly);
     }

+ 4 - 4
lib/Backend/BailOut.cpp

@@ -323,8 +323,8 @@ BailOutRecord::BailOutRecord(uint32 bailOutOffset, uint bailOutCacheIndex, IR::B
             Output::Flush(); \
         } \
     }
-char16 * const trueString = _u("true");
-char16 * const falseString = _u("false");
+const char16 * const trueString = _u("true");
+const char16 * const falseString = _u("false");
 #else
 #define REJIT_TESTTRACE(...)
 #define REJIT_KIND_TESTTRACE(...)
@@ -1478,7 +1478,7 @@ BailOutRecord::BailOutHelper(Js::JavascriptCallStackLayout * layout, Js::ScriptF
             // Initialize the interpreter stack frame (constants) but not the param, the bailout record will restore the value
 #if DBG
             // Allocate invalidVar on GC instead of stack since this InterpreterStackFrame will out live the current real frame
-            Js::RecyclableObject* invalidVar = (Js::RecyclableObject*)RecyclerNewPlusLeaf(functionScriptContext->GetRecycler(), sizeof(Js::RecyclableObject), Js::Var);
+            Js::Var invalidVar = (Js::RecyclableObject*)RecyclerNewPlusLeaf(functionScriptContext->GetRecycler(), sizeof(Js::RecyclableObject), Js::Var);
             memset(invalidVar, 0xFE, sizeof(Js::RecyclableObject));
             newInstance = setup.InitializeAllocation(allocation, false, false, loopHeaderArray, stackAddr, invalidVar);
 #else
@@ -1528,7 +1528,7 @@ BailOutRecord::BailOutHelper(Js::JavascriptCallStackLayout * layout, Js::ScriptF
 
         // Initialize the interpreter stack frame (constants) but not the param, the bailout record will restore the value
 #if DBG
-        Js::RecyclableObject * invalidStackVar = (Js::RecyclableObject*)_alloca(sizeof(Js::RecyclableObject));
+        Js::Var invalidStackVar = (Js::RecyclableObject*)_alloca(sizeof(Js::RecyclableObject));
         memset(invalidStackVar, 0xFE, sizeof(Js::RecyclableObject));
         newInstance = setup.InitializeAllocation(allocation, false, false, loopHeaderArray, frameStackAddr, invalidStackVar);
 #else

+ 23 - 20
lib/Backend/BailOut.h

@@ -27,8 +27,8 @@ public:
         bailOutOffset(bailOutOffset), bailOutFunc(bailOutFunc),
         byteCodeUpwardExposedUsed(nullptr), polymorphicCacheIndex((uint)-1), startCallCount(0), startCallInfo(nullptr), bailOutInstr(nullptr),
         totalOutParamCount(0), argOutSyms(nullptr), bailOutRecord(nullptr), wasCloned(false), isInvertedBranch(false), sharedBailOutKind(true), outParamInlinedArgSlot(nullptr),
-        liveVarSyms(nullptr), liveLosslessInt32Syms(nullptr), 
-        liveFloat64Syms(nullptr), liveSimd128F4Syms(nullptr), 
+        liveVarSyms(nullptr), liveLosslessInt32Syms(nullptr),
+        liveFloat64Syms(nullptr), liveSimd128F4Syms(nullptr),
         liveSimd128I4Syms(nullptr), liveSimd128I8Syms(nullptr), liveSimd128I16Syms(nullptr),
         liveSimd128U4Syms(nullptr), liveSimd128U8Syms(nullptr), liveSimd128U16Syms(nullptr),
         liveSimd128B4Syms(nullptr), liveSimd128B8Syms(nullptr), liveSimd128B16Syms(nullptr),
@@ -203,8 +203,8 @@ public:
     template <size_t N>
     void FillNativeRegToByteCodeRegMap(uint (&nativeRegToByteCodeRegMap)[N]);
 
-    void IsOffsetNativeIntOrFloat(uint offsetIndex, int argOutSlotStart, bool * pIsFloat64, bool * pIsInt32, 
-        bool * pIsSimd128F4, bool * pIsSimd128I4, bool * pIsSimd128I8, bool * pIsSimd128I16, 
+    void IsOffsetNativeIntOrFloat(uint offsetIndex, int argOutSlotStart, bool * pIsFloat64, bool * pIsInt32,
+        bool * pIsSimd128F4, bool * pIsSimd128I4, bool * pIsSimd128I8, bool * pIsSimd128I16,
         bool * pIsSimd128U4, bool * pIsSimd128U8, bool * pIsSimd128U16, bool * pIsSimd128B4, bool * pIsSimd128B8, bool * pIsSimd128B16) const;
 
     template <typename Fn>
@@ -263,8 +263,8 @@ protected:
         void * argoutRestoreAddress = nullptr) const;
     void RestoreValue(IR::BailOutKind bailOutKind, Js::JavascriptCallStackLayout * layout, Js::Var * values, Js::ScriptContext * scriptContext,
         bool fromLoopBody, Js::Var * registerSaves, Js::InterpreterStackFrame * newInstance, Js::Var* pArgumentsObject, void * argoutRestoreAddress,
-        uint regSlot, int offset, bool isLocal, bool isFloat64, bool isInt32, 
-        bool isSimd128F4, bool isSimd128I4, bool isSimd128I8, bool isSimd128I16, 
+        uint regSlot, int offset, bool isLocal, bool isFloat64, bool isInt32,
+        bool isSimd128F4, bool isSimd128I4, bool isSimd128I8, bool isSimd128I16,
         bool isSimd128U4, bool isSimd128U8, bool isSimd128U16, bool isSimd128B4, bool isSimd128B8, bool isSimd128B16 ) const;
     void RestoreInlineFrame(InlinedFrameLayout *inlinedFrame, Js::JavascriptCallStackLayout * layout, Js::Var * registerSaves);
 
@@ -274,12 +274,14 @@ protected:
 
     Js::JavascriptCallStackLayout *GetStackLayout() const;
 
+public:
     struct StackLiteralBailOutRecord
     {
         Js::RegSlot regSlot;
         uint initFldCount;
     };
 
+protected:
     struct ArgOutOffsetInfo
     {
         BVFixed * argOutFloat64Syms;        // Used for float-type-specialized ArgOut symbols. Index = [0 .. BailOutInfo::totalOutParamCount].
@@ -305,7 +307,7 @@ protected:
             FixupNativeDataPointer(argOutFloat64Syms, chunkList);
             FixupNativeDataPointer(argOutLosslessInt32Syms, chunkList);
             FixupNativeDataPointer(argOutSimd128F4Syms, chunkList);
-            FixupNativeDataPointer(argOutSimd128I4Syms, chunkList);            
+            FixupNativeDataPointer(argOutSimd128I4Syms, chunkList);
             FixupNativeDataPointer(argOutSimd128I8Syms, chunkList);
             FixupNativeDataPointer(argOutSimd128I16Syms, chunkList);
             FixupNativeDataPointer(argOutSimd128U4Syms, chunkList);
@@ -321,7 +323,7 @@ protected:
 
             int* outParamOffsetsStart = outParamOffsets - argOutSymStart;
             NativeCodeData::AddFixupEntry(outParamOffsets, outParamOffsetsStart, &this->outParamOffsets, this, chunkList);
-            
+
         }
     };
 
@@ -469,8 +471,8 @@ struct GlobalBailOutRecordDataTable
     bool hasNonSimpleParams;
     bool hasStackArgOpt;
     void Finalize(NativeCodeData::Allocator *allocator, JitArenaAllocator *tempAlloc);
-    void AddOrUpdateRow(JitArenaAllocator *allocator, uint32 bailOutRecordId, uint32 regSlot, bool isFloat, bool isInt, 
-        bool isSimd128F4, bool isSimd128I4, bool isSimd128I8, bool isSimd128I16, bool isSimd128U4, bool isSimd128U8, bool isSimd128U16, bool isSimd128B4, bool isSimd128B8, bool isSimd128B16, 
+    void AddOrUpdateRow(JitArenaAllocator *allocator, uint32 bailOutRecordId, uint32 regSlot, bool isFloat, bool isInt,
+        bool isSimd128F4, bool isSimd128I4, bool isSimd128I8, bool isSimd128I16, bool isSimd128U4, bool isSimd128U8, bool isSimd128U16, bool isSimd128B4, bool isSimd128B8, bool isSimd128B16,
         int32 offset, uint *lastUpdatedRowIndex);
 
     template<class Fn>
@@ -522,51 +524,52 @@ struct GlobalBailOutRecordDataTable
     }
 };
 #if DBG
-template<> void NativeCodeData::AllocatorT<BailOutRecord::StackLiteralBailOutRecord>::Fixup(void* pThis, NativeCodeData::DataChunk* chunkList) {}
-template<> void NativeCodeData::AllocatorT<Js::EquivalentPropertyEntry>::Fixup(void* pThis, NativeCodeData::DataChunk* chunkList) {}
-template<> void NativeCodeData::AllocatorT<GlobalBailOutRecordDataRow>::Fixup(void* pThis, NativeCodeData::DataChunk* chunkList) {}
+template<> inline void NativeCodeData::AllocatorT<BailOutRecord::StackLiteralBailOutRecord>::Fixup(void* pThis, NativeCodeData::DataChunk* chunkList) {}
+template<> inline void NativeCodeData::AllocatorT<Js::EquivalentPropertyEntry>::Fixup(void* pThis, NativeCodeData::DataChunk* chunkList) {}
+template<> inline void NativeCodeData::AllocatorT<GlobalBailOutRecordDataRow>::Fixup(void* pThis, NativeCodeData::DataChunk* chunkList) {}
 #else
 template<>
-char*
+inline char*
 NativeCodeData::AllocatorT<BailOutRecord::StackLiteralBailOutRecord>::Alloc(size_t requestedBytes)
 {
     return __super::Alloc(requestedBytes);
 }
 template<>
-char*
+inline char*
 NativeCodeData::AllocatorT<BailOutRecord::StackLiteralBailOutRecord>::AllocZero(size_t requestedBytes)
 {
     return __super::AllocZero(requestedBytes);
 }
 
 template<>
-char*
+inline char*
 NativeCodeData::AllocatorT<Js::EquivalentPropertyEntry>::Alloc(size_t requestedBytes)
 {
     return __super::Alloc(requestedBytes);
 }
 template<>
-char*
+inline char*
 NativeCodeData::AllocatorT<Js::EquivalentPropertyEntry>::AllocZero(size_t requestedBytes)
 {
     return __super::AllocZero(requestedBytes);
 }
 
 template<>
-char*
+inline char*
 NativeCodeData::AllocatorT<GlobalBailOutRecordDataRow>::Alloc(size_t requestedBytes)
 {
     return __super::Alloc(requestedBytes);
 }
 template<>
-char*
+inline char*
 NativeCodeData::AllocatorT<GlobalBailOutRecordDataRow>::AllocZero(size_t requestedBytes)
 {
     return __super::AllocZero(requestedBytes);
 }
 #endif
 
-template<> void NativeCodeData::AllocatorT<GlobalBailOutRecordDataTable*>::Fixup(void* pThis, NativeCodeData::DataChunk* chunkList)
+template<>
+inline void NativeCodeData::AllocatorT<GlobalBailOutRecordDataTable*>::Fixup(void* pThis, NativeCodeData::DataChunk* chunkList)
 {
     // for every pointer needs to update the table
     NativeCodeData::AddFixupEntryForPointerArray(pThis, chunkList);

+ 1 - 1
lib/Backend/FlowGraph.cpp

@@ -35,7 +35,7 @@ FlowGraph::Build(void)
     // (BailOnSimpleJitToFullJitLoopBody). For that purpose, we need the flow from try to catch.
     if (this->func->HasTry() &&
         (this->func->DoOptimizeTryCatch() ||
-        this->func->IsSimpleJit() && this->func->GetJITFunctionBody()->DoJITLoopBody()
+            (this->func->IsSimpleJit() && this->func->GetJITFunctionBody()->DoJITLoopBody())
         )
        )
     {

+ 14 - 14
lib/Backend/Func.cpp

@@ -169,7 +169,7 @@ Func::Func(JitArenaAllocator *alloc, JITTimeWorkItem * workItem,
     }
 
     if (m_workItem->Type() == JsFunctionType &&
-        GetJITFunctionBody()->DoBackendArgumentsOptimization() && 
+        GetJITFunctionBody()->DoBackendArgumentsOptimization() &&
         !GetJITFunctionBody()->HasTry())
     {
         // doBackendArgumentsOptimization bit is set when there is no eval inside a function
@@ -184,7 +184,7 @@ Func::Func(JitArenaAllocator *alloc, JITTimeWorkItem * workItem,
         this->GetTopFunc()->hasAnyStackNestedFunc = true;
     }
 
-    if (GetJITFunctionBody()->HasOrParentHasArguments() || parentFunc && parentFunc->thisOrParentInlinerHasArguments)
+    if (GetJITFunctionBody()->HasOrParentHasArguments() || (parentFunc && parentFunc->thisOrParentInlinerHasArguments))
     {
         thisOrParentInlinerHasArguments = true;
     }
@@ -622,7 +622,7 @@ Func::TryCodegen()
 #if DBG
             if (PHASE_TRACE1(Js::NativeCodeDataPhase))
             {
-                Output::Print(L"NativeCodeData Server Buffer: %p, len: %x, chunk head: %p\n", jitOutputData->buffer->data, jitOutputData->buffer->len, chunk);
+                Output::Print(_u("NativeCodeData Server Buffer: %p, len: %x, chunk head: %p\n"), jitOutputData->buffer->data, jitOutputData->buffer->len, chunk);
             }
 #endif
         }
@@ -1553,14 +1553,14 @@ Func::IsFormalsArraySym(SymID symId)
     return stackArgWithFormalsTracker->GetFormalsArraySyms()->Test(symId);
 }
 
-void 
+void
 Func::TrackFormalsArraySym(SymID symId)
 {
     EnsureStackArgWithFormalsTracker();
     stackArgWithFormalsTracker->SetFormalsArraySyms(symId);
 }
 
-void 
+void
 Func::TrackStackSymForFormalIndex(Js::ArgSlot formalsIndex, StackSym * sym)
 {
     EnsureStackArgWithFormalsTracker();
@@ -1568,7 +1568,7 @@ Func::TrackStackSymForFormalIndex(Js::ArgSlot formalsIndex, StackSym * sym)
     stackArgWithFormalsTracker->SetStackSymInFormalsIndexMap(sym, formalsIndex, formalsCount);
 }
 
-StackSym * 
+StackSym *
 Func::GetStackSymForFormal(Js::ArgSlot formalsIndex)
 {
     if (stackArgWithFormalsTracker == nullptr || stackArgWithFormalsTracker->GetFormalsIndexToStackSymMap() == nullptr)
@@ -1613,7 +1613,7 @@ Func::SetNativeCodeDataSym(StackSym * opnd)
     m_nativeCodeDataSym = opnd;
 }
 
-StackSym* 
+StackSym*
 Func::GetScopeObjSym()
 {
     if (stackArgWithFormalsTracker == nullptr)
@@ -1623,7 +1623,7 @@ Func::GetScopeObjSym()
     return stackArgWithFormalsTracker->GetScopeObjSym();
 }
 
-BVSparse<JitArenaAllocator> * 
+BVSparse<JitArenaAllocator> *
 StackArgWithFormalsTracker::GetFormalsArraySyms()
 {
     return formalsArraySyms;
@@ -1639,13 +1639,13 @@ StackArgWithFormalsTracker::SetFormalsArraySyms(SymID symId)
     formalsArraySyms->Set(symId);
 }
 
-StackSym ** 
+StackSym **
 StackArgWithFormalsTracker::GetFormalsIndexToStackSymMap()
 {
     return formalsIndexToStackSymMap;
 }
 
-void 
+void
 StackArgWithFormalsTracker::SetStackSymInFormalsIndexMap(StackSym * sym, Js::ArgSlot formalsIndex, Js::ArgSlot formalsCount)
 {
     if(formalsIndexToStackSymMap == nullptr)
@@ -1656,13 +1656,13 @@ StackArgWithFormalsTracker::SetStackSymInFormalsIndexMap(StackSym * sym, Js::Arg
     formalsIndexToStackSymMap[formalsIndex] = sym;
 }
 
-void 
+void
 StackArgWithFormalsTracker::SetScopeObjSym(StackSym * sym)
 {
     m_scopeObjSym = sym;
 }
 
-StackSym * 
+StackSym *
 StackArgWithFormalsTracker::GetScopeObjSym()
 {
     return m_scopeObjSym;
@@ -1830,9 +1830,9 @@ Func::AllocateNumber(double value)
 void
 Func::DumpFullFunctionName()
 {
-    wchar_t debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+    char16 debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
 
-    Output::Print(L"Function %s (%s)", GetJITFunctionBody()->GetDisplayName(), GetDebugNumberSet(debugStringBuffer));
+    Output::Print(_u("Function %s (%s)"), GetJITFunctionBody()->GetDisplayName(), GetDebugNumberSet(debugStringBuffer));
 }
 #endif
 

+ 4 - 4
lib/Backend/Func.h

@@ -65,11 +65,11 @@ private:
 
 public:
     StackArgWithFormalsTracker(JitArenaAllocator *alloc):
-        formalsArraySyms(nullptr), 
-        formalsIndexToStackSymMap(nullptr), 
+        formalsArraySyms(nullptr),
+        formalsIndexToStackSymMap(nullptr),
         m_scopeObjSym(nullptr),
         alloc(alloc)
-    {    
+    {
     }
 
     BVSparse<JitArenaAllocator> * GetFormalsArraySyms();
@@ -246,7 +246,7 @@ public:
         return m_entryPointInfo;
     }
 
-    wchar_t* GetDebugNumberSet(wchar(&bufferToWriteTo)[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE]) const
+    char16* GetDebugNumberSet(wchar(&bufferToWriteTo)[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE]) const
     {
         return m_workItem->GetJITTimeInfo()->GetDebugNumberSet(bufferToWriteTo);
     }

+ 3 - 3
lib/Backend/FunctionJITTimeInfo.cpp

@@ -372,17 +372,17 @@ FunctionJITTimeInfo::ForceJITLoopBody() const
 }
 
 
-wchar_t*
+char16*
 FunctionJITTimeInfo::GetDisplayName() const
 {
     return GetBody()->GetDisplayName();
 }
 
-wchar_t*
+char16*
 FunctionJITTimeInfo::GetDebugNumberSet(wchar(&bufferToWriteTo)[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE]) const
 {
     // (#%u.%u), #%u --> (source file Id . function Id) , function Number
-    int len = swprintf_s(bufferToWriteTo, MAX_FUNCTION_BODY_DEBUG_STRING_SIZE, L" (#%d.%u), #%u",
+    int len = swprintf_s(bufferToWriteTo, MAX_FUNCTION_BODY_DEBUG_STRING_SIZE, _u(" (#%d.%u), #%u"),
         (int)GetSourceContextId(), GetLocalFunctionId(), GetBody()->GetFunctionNumber());
     Assert(len > 8);
     return bufferToWriteTo;

+ 2 - 2
lib/Backend/FunctionJITTimeInfo.h

@@ -44,8 +44,8 @@ public:
     bool HasSharedPropertyGuards() const;
     bool HasSharedPropertyGuard(Js::PropertyId id) const;
 
-    wchar_t* GetDisplayName() const;
-    wchar_t* GetDebugNumberSet(wchar(&bufferToWriteTo)[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE]) const;
+    char16* GetDisplayName() const;
+    char16* GetDebugNumberSet(wchar(&bufferToWriteTo)[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE]) const;
 private:
     FunctionJITTimeDataIDL m_data;
 };

+ 75 - 73
lib/Backend/GlobOpt.cpp

@@ -1837,8 +1837,8 @@ GlobOpt::MergeCapturedValues(
     SListBase<CapturedList> * fromList,
     CapturedItemsAreEqual itemsAreEqual)
 {
-    SListBase<CapturedList>::Iterator iterTo(toList);
-    SListBase<CapturedList>::Iterator iterFrom(fromList);
+    typename SListBase<CapturedList>::Iterator iterTo(toList);
+    typename SListBase<CapturedList>::Iterator iterFrom(fromList);
     bool hasTo = iterTo.Next();
     bool hasFrom = fromList == nullptr ? false : iterFrom.Next();
 
@@ -1849,7 +1849,7 @@ GlobOpt::MergeCapturedValues(
         Sym * symFrom = iterFrom.Data().Key();
         Sym * symTo = iterTo.Data().Key();
 
-        if (symFrom->m_id < symTo->m_id) 
+        if (symFrom->m_id < symTo->m_id)
         {
             toData->changedSyms->Set(symFrom->m_id);
             hasFrom = iterFrom.Next();
@@ -1873,7 +1873,7 @@ GlobOpt::MergeCapturedValues(
     bool hasRemain = hasFrom || hasTo;
     if (hasRemain)
     {
-        SListBase<CapturedList>::Iterator iterRemain(hasFrom ? iterFrom : iterTo);
+        typename SListBase<CapturedList>::Iterator iterRemain(hasFrom ? iterFrom : iterTo);
         do
         {
             Sym * symRemain = iterRemain.Data().Key();
@@ -2173,7 +2173,7 @@ GlobOpt::MergeBlockData(
                 if(value)
                 {
                     ValueInfo *const valueInfo = value->GetValueInfo();
-                    if(valueInfo->IsInt() || valueInfo->IsLikelyInt() && DoAggressiveIntTypeSpec())
+                    if(valueInfo->IsInt() || (valueInfo->IsLikelyInt() && DoAggressiveIntTypeSpec()))
                     {
                         toData->liveVarSyms->Set(id);
                     }
@@ -4049,8 +4049,8 @@ GlobOpt::OptArguments(IR::Instr *instr)
     if (!TrackArgumentsObject())
     {
         return;
-    }   
-    
+    }
+
     if (instr->HasAnyLoadHeapArgsOpCode())
     {
         if (instr->m_func->IsStackArgsEnabled())
@@ -4381,7 +4381,7 @@ GlobOpt::IsAllowedForMemOpt(IR::Instr* instr, bool isMemset, IR::RegOpnd *baseOp
             );
         if (!hasBoundChecksRemoved)
         {
-            TRACE_MEMOP_VERBOSE(loop, instr, L"Missing bounds check optimization");
+            TRACE_MEMOP_VERBOSE(loop, instr, _u("Missing bounds check optimization"));
             return false;
         }
     }
@@ -4925,7 +4925,7 @@ GlobOpt::OptInstr(IR::Instr *&instr, bool* isInstrRemoved)
     this->OptArguments(instr);
 
     //StackArguments Optimization - We bail out if the index is out of range of actuals.
-    if ((instr->m_opcode == Js::OpCode::LdElemI_A || instr->m_opcode == Js::OpCode::TypeofElem) && 
+    if ((instr->m_opcode == Js::OpCode::LdElemI_A || instr->m_opcode == Js::OpCode::TypeofElem) &&
         instr->DoStackArgsOpt(this->func) && !this->IsLoopPrePass())
     {
         GenerateBailAtOperation(&instr, IR::BailOnStackArgsOutOfActualsRange);
@@ -5517,8 +5517,8 @@ GlobOpt::OptDst(
                         if(!prevDst ||
                             !src->IsEqualInternal(prevDst) ||
                             !(
-                                prevInstr->GetSrc1() && dst->IsEqual(prevInstr->GetSrc1()) ||
-                                prevInstr->GetSrc2() && dst->IsEqual(prevInstr->GetSrc2())
+                                (prevInstr->GetSrc1() && dst->IsEqual(prevInstr->GetSrc1())) ||
+                                (prevInstr->GetSrc2() && dst->IsEqual(prevInstr->GetSrc2()))
                             ))
                         {
                             break;
@@ -5983,7 +5983,7 @@ GlobOpt::OptSrc(IR::Opnd *opnd, IR::Instr * *pInstr, Value **indirIndexValRef, I
             }
             if(profiledArrayType.IsLikelyObject() &&
                 profiledArrayType.GetObjectType() == valueType.GetObjectType() &&
-                (profiledArrayType.HasVarElements() || valueType.HasIntElements() && profiledArrayType.HasFloatElements()))
+                (profiledArrayType.HasVarElements() || (valueType.HasIntElements() && profiledArrayType.HasFloatElements())))
             {
                 // Merge array type we pulled from profile with type propagated by dataflow.
                 valueType = valueType.Merge(profiledArrayType).SetHasNoMissingValues(valueType.HasNoMissingValues());
@@ -6344,9 +6344,9 @@ GlobOpt::CopyProp(IR::Opnd *opnd, IR::Instr *instr, Value *val, IR::IndirOpnd *p
 
     // Don't copy-prop operand of SIMD instr with ExtendedArg operands. Each instr should have its exclusive EA sequence.
     if (
-            Js::IsSimd128Opcode(instr->m_opcode) && 
-            instr->GetSrc1() != nullptr && 
-            instr->GetSrc1()->IsRegOpnd() && 
+            Js::IsSimd128Opcode(instr->m_opcode) &&
+            instr->GetSrc1() != nullptr &&
+            instr->GetSrc1()->IsRegOpnd() &&
             instr->GetSrc2() == nullptr
        )
     {
@@ -6634,7 +6634,7 @@ GlobOpt::CopyPropReplaceOpnd(IR::Instr * instr, IR::Opnd * opnd, StackSym * copy
                 if (this->currentBlock->loop && !this->IsLoopPrePass())
                 {
                     // Try hoisting this checkObjType.
-                    // But since this isn't the current instr being optimized, we need to play tricks with 
+                    // But since this isn't the current instr being optimized, we need to play tricks with
                     // the byteCodeUse fields...
                     BVSparse<JitArenaAllocator> *currentBytecodeUses = this->byteCodeUses;
                     PropertySym * currentPropertySymUse = this->propertySymUse;
@@ -6871,7 +6871,7 @@ GlobOpt::NewIntConstantValue(const int32 intConst, IR::Instr * instr, bool isTag
         // This gets in the way of CSE.
         value = HoistConstantLoadAndPropagateValueBackward(Js::TaggedInt::ToVarUnchecked(intConst), instr, value);
         if (!value->GetValueInfo()->GetSymStore() &&
-            instr->m_opcode == Js::OpCode::LdC_A_I4 || instr->m_opcode == Js::OpCode::Ld_I4)
+            (instr->m_opcode == Js::OpCode::LdC_A_I4 || instr->m_opcode == Js::OpCode::Ld_I4))
         {
             StackSym * sym = instr->GetDst()->GetStackSym();
             Assert(sym);
@@ -7442,8 +7442,8 @@ GlobOpt::ValueNumberDst(IR::Instr **pInstr, Value *src1Val, Value *src2Val)
             if(!(
                     profiledValueType.IsLikelyInt() &&
                     (
-                        dst->IsRegOpnd() && dst->AsRegOpnd()->m_sym->m_isNotInt ||
-                        instr->GetSrc1()->IsRegOpnd() && instr->GetSrc1()->AsRegOpnd()->m_sym->m_isNotInt
+                        (dst->IsRegOpnd() && dst->AsRegOpnd()->m_sym->m_isNotInt) ||
+                        (instr->GetSrc1()->IsRegOpnd() && instr->GetSrc1()->AsRegOpnd()->m_sym->m_isNotInt)
                     )
                 ))
             {
@@ -7669,8 +7669,8 @@ GlobOpt::ValueNumberDst(IR::Instr **pInstr, Value *src1Val, Value *src2Val)
             min1 < 0 &&
             IntConstantBounds(min2, max2).And_0x1f().Contains(0))
         {
-            // Src1 may be too large to represent as a signed int32, and src2 may be zero. 
-            // Since the result can therefore be too large to represent as a signed int32, 
+            // Src1 may be too large to represent as a signed int32, and src2 may be zero.
+            // Since the result can therefore be too large to represent as a signed int32,
             // include Number in the value type.
             return CreateDstUntransferredValue(
                 ValueType::AnyNumber.SetCanBeTaggedValue(true), instr, src1Val, src2Val);
@@ -7991,7 +7991,7 @@ GlobOpt::ValueNumberLdElemDst(IR::Instr **pInstr, Value *srcVal)
     if (instr->DoStackArgsOpt(this->func) ||
         !(
             baseValueType.IsLikelyOptimizedTypedArray() ||
-            baseValueType.IsLikelyNativeArray() && instr->IsProfiledInstr() // Specialized native array lowering for LdElem requires that it is profiled.
+            (baseValueType.IsLikelyNativeArray() && instr->IsProfiledInstr()) // Specialized native array lowering for LdElem requires that it is profiled.
         ) ||
         (!this->DoTypedArrayTypeSpec() && baseValueType.IsLikelyOptimizedTypedArray()) ||
 
@@ -8211,8 +8211,8 @@ GlobOpt::GetPrepassValueTypeForDst(
         return desiredValueType;
     }
 
-    if(instr->GetSrc1() && !IsPrepassSrcValueInfoPrecise(instr->GetSrc1(), src1Value) ||
-        instr->GetSrc2() && !IsPrepassSrcValueInfoPrecise(instr->GetSrc2(), src2Value))
+    if((instr->GetSrc1() && !IsPrepassSrcValueInfoPrecise(instr->GetSrc1(), src1Value)) ||
+       (instr->GetSrc2() && !IsPrepassSrcValueInfoPrecise(instr->GetSrc2(), src2Value)))
     {
         // If the desired value type is not precise, the value type of the destination is derived from the value types of the
         // sources. Since the value type of a source sym is not definite, the destination value type also cannot be definite.
@@ -8453,7 +8453,7 @@ GlobOpt::ValueNumberTransferDstInPrepass(IR::Instr *const instr, Value *const sr
     // In prepass we are going to copy the value but with a different value number
     // for aggressive int type spec.
     const ValueType valueType(GetPrepassValueTypeForDst(src1ValueInfo->Type(), instr, src1Val, nullptr, &isValueInfoPrecise));
-    if(isValueInfoPrecise || valueType == src1ValueInfo->Type() && src1ValueInfo->IsGeneric())
+    if(isValueInfoPrecise || (valueType == src1ValueInfo->Type() && src1ValueInfo->IsGeneric()))
     {
         Assert(valueType == src1ValueInfo->Type());
         dstVal = CopyValue(src1Val);
@@ -9660,7 +9660,7 @@ GlobOpt::IsWorthSpecializingToInt32DueToSrc(IR::Opnd *const src, Value *const va
         !src->GetIsDead() ||
         !src->IsRegOpnd() ||
         this->IsInt32TypeSpecialized(src->AsRegOpnd()->m_sym, this->currentBlock) ||
-        this->currentBlock->loop && this->IsLive(src->AsRegOpnd()->m_sym, this->currentBlock->loop->landingPad);
+        (this->currentBlock->loop && this->IsLive(src->AsRegOpnd()->m_sym, this->currentBlock->loop->landingPad));
 }
 
 bool
@@ -9671,7 +9671,7 @@ GlobOpt::IsWorthSpecializingToInt32DueToDst(IR::Opnd *const dst)
     const auto sym = dst->AsRegOpnd()->m_sym;
     return
         this->IsInt32TypeSpecialized(sym, this->currentBlock) ||
-        this->currentBlock->loop && this->IsLive(sym, this->currentBlock->loop->landingPad);
+        (this->currentBlock->loop && this->IsLive(sym, this->currentBlock->loop->landingPad));
 }
 
 bool
@@ -9685,7 +9685,7 @@ GlobOpt::IsWorthSpecializingToInt32(IR::Instr *const instr, Value *const src1Val
     // In addition to checking each operand and the destination, if for any reason we only have to do a maximum of two
     // conversions instead of the worst-case 3 conversions, it's probably worth specializing.
     if (IsWorthSpecializingToInt32DueToSrc(src1, src1Val) ||
-        src2Val && IsWorthSpecializingToInt32DueToSrc(src2, src2Val))
+        (src2Val && IsWorthSpecializingToInt32DueToSrc(src2, src2Val)))
     {
         return true;
     }
@@ -9696,7 +9696,7 @@ GlobOpt::IsWorthSpecializingToInt32(IR::Instr *const instr, Value *const src1Val
         return true;
     }
 
-    if (dst->IsEqual(src1) || src2Val && (dst->IsEqual(src2) || src1->IsEqual(src2)))
+    if (dst->IsEqual(src1) || (src2Val && (dst->IsEqual(src2) || src1->IsEqual(src2))))
     {
         return true;
     }
@@ -11370,19 +11370,19 @@ GlobOpt::TypeSpecializeBinary(IR::Instr **pInstr, Value **pSrc1Val, Value **pSrc
     default:
         {
             const bool involesLargeInt32 =
-                src1Val && src1Val->GetValueInfo()->IsLikelyUntaggedInt() ||
-                src2Val && src2Val->GetValueInfo()->IsLikelyUntaggedInt();
+                (src1Val && src1Val->GetValueInfo()->IsLikelyUntaggedInt()) ||
+                (src2Val && src2Val->GetValueInfo()->IsLikelyUntaggedInt());
             const auto trySpecializeToFloat =
                 [&](const bool mayOverflow) -> bool
             {
                 // It has been determined that this instruction cannot be int-specialized. Need to determine whether to attempt
                 // to float-specialize the instruction, or leave it unspecialized.
-                if(involesLargeInt32
+                if((involesLargeInt32
 #if INT32VAR
                     && mayOverflow
 #endif
-                    || (instr->m_opcode == Js::OpCode::Mul_A && !this->DoAggressiveMulIntTypeSpec())
-                    )
+                   ) || (instr->m_opcode == Js::OpCode::Mul_A && !this->DoAggressiveMulIntTypeSpec())
+                  )
                 {
                     // An input range is completely outside the range of an int31 and the operation is likely to overflow.
                     // Additionally, on 32-bit platforms, the value is untaggable and will be a JavascriptNumber, which is
@@ -11416,8 +11416,8 @@ GlobOpt::TypeSpecializeBinary(IR::Instr **pInstr, Value **pSrc1Val, Value **pSrc
                             !src2Val->GetValueInfo()->IsInt()
                         )
                     ) ||
-                    instr->GetSrc1()->IsRegOpnd() && instr->GetSrc1()->AsRegOpnd()->m_sym->m_isNotInt ||
-                    instr->GetSrc2()->IsRegOpnd() && instr->GetSrc2()->AsRegOpnd()->m_sym->m_isNotInt)
+                    (instr->GetSrc1()->IsRegOpnd() && instr->GetSrc1()->AsRegOpnd()->m_sym->m_isNotInt) ||
+                    (instr->GetSrc2()->IsRegOpnd() && instr->GetSrc2()->AsRegOpnd()->m_sym->m_isNotInt))
                 {
                     return trySpecializeToFloat(true);
                 }
@@ -11425,8 +11425,8 @@ GlobOpt::TypeSpecializeBinary(IR::Instr **pInstr, Value **pSrc1Val, Value **pSrc
 
             // Try to type specialize to int32
 
-            // If one of the values is a float constant with a value that fits in a uint32 but not an int32, 
-            // and the instruction can ignore int overflow, the source value for the purposes of int specialization 
+            // If one of the values is a float constant with a value that fits in a uint32 but not an int32,
+            // and the instruction can ignore int overflow, the source value for the purposes of int specialization
             // would have been changed to an int constant value by ignoring overflow. But, the conversion is still lossy.
             if (!(src1OriginalVal && src1OriginalVal->GetValueInfo()->IsFloatConstant() && src1Val && src1Val->GetValueInfo()->HasIntConstantValue()))
             {
@@ -11817,7 +11817,7 @@ GlobOpt::TypeSpecializeBinary(IR::Instr **pInstr, Value **pSrc1Val, Value **pSrc
                             // May result in -0
                             return trySpecializeToFloat(false);
                         }
-                        if ((min1 == 0 && max1 == 0 || min2 == 0 && max2 == 0) && (max1 < 0 || max2 < 0))
+                        if (((min1 == 0 && max1 == 0) || (min2 == 0 && max2 == 0)) && (max1 < 0 || max2 < 0))
                         {
                             // Always results in -0
                             return trySpecializeToFloat(false);
@@ -14178,7 +14178,7 @@ GlobOpt::ToTypeSpecUse(IR::Instr *instr, IR::Opnd *opnd, BasicBlock *block, Valu
 
         if (opcode == Js::OpCode::FromVar)
         {
-            
+
             if (toType == TyInt32)
             {
                 Assert(valueInfo);
@@ -14595,7 +14595,7 @@ GlobOpt::ToTypeSpecUse(IR::Instr *instr, IR::Opnd *opnd, BasicBlock *block, Valu
                 // Src is always invariant, but check if the dst is, and then hoist.
                 if (block->loop &&
                     (
-                        newFloatSym && block->loop->CanHoistInvariants() ||
+                        (newFloatSym && block->loop->CanHoistInvariants()) ||
                         this->OptIsInvariant(floatReg, block, block->loop, val, false, false)
                     ))
                 {
@@ -15717,7 +15717,7 @@ GlobOpt::ProcessValueKills(BasicBlock *const block, GlobOptBlockData *const bloc
     if(IsLoopPrePass() && block->loop == rootLoopPrePass)
     {
         AnalysisAssert(rootLoopPrePass);
-        
+
         for (Loop * loop = rootLoopPrePass; loop != nullptr; loop = loop->parent)
         {
             loop->jsArrayKills.SetKillsAllArrays();
@@ -16020,7 +16020,7 @@ GlobOpt::OptArraySrc(IR::Instr * *const instrRef)
     baseOpnd->SetValueType(baseValueType);
     if(!baseValueType.IsLikelyAnyOptimizedArray() ||
         !DoArrayCheckHoist(baseValueType, currentBlock->loop, instr) ||
-        baseOwnerIndir && !ShouldExpectConventionalArrayIndexValue(baseOwnerIndir))
+        (baseOwnerIndir && !ShouldExpectConventionalArrayIndexValue(baseOwnerIndir)))
     {
         return;
     }
@@ -16131,7 +16131,7 @@ GlobOpt::OptArraySrc(IR::Instr * *const instrRef)
     const bool headSegmentLengthIsAvailable = baseArrayValueInfo && baseArrayValueInfo->HeadSegmentLengthSym();
     const bool doHeadSegmentLengthLoad =
         doArraySegmentLengthHoist &&
-        (needsHeadSegmentLength || !isLikelyJsArray && needsLength) &&
+        (needsHeadSegmentLength || (!isLikelyJsArray && needsLength)) &&
         !headSegmentLengthIsAvailable;
     const bool lengthIsAvailable = baseArrayValueInfo && baseArrayValueInfo->LengthSym();
     const bool doLengthLoad =
@@ -16150,7 +16150,7 @@ GlobOpt::OptArraySrc(IR::Instr * *const instrRef)
     {
         // SIMD_JS
         // simd load/store never call helper
-        canBailOutOnArrayAccessHelperCall = true; 
+        canBailOutOnArrayAccessHelperCall = true;
     }
     else
     {
@@ -16172,7 +16172,7 @@ GlobOpt::OptArraySrc(IR::Instr * *const instrRef)
     IntConstantBounds indexConstantBounds;
     Value *headSegmentLengthValue = nullptr;
     IntConstantBounds headSegmentLengthConstantBounds;
-    
+
     if (baseValueType.IsLikelyOptimizedVirtualTypedArray() && !Js::IsSimd128LoadStore(instr->m_opcode) /*Always extract bounds for SIMD */)
     {
         if (isProfilableStElem ||
@@ -16328,7 +16328,7 @@ GlobOpt::OptArraySrc(IR::Instr * *const instrRef)
             {
                 const JsArrayKills loopKills(loop->jsArrayKills);
                 Value *baseValueInLoopLandingPad;
-                if(isLikelyJsArray && loopKills.KillsValueType(newBaseValueType) ||
+                if((isLikelyJsArray && loopKills.KillsValueType(newBaseValueType)) ||
                     !OptIsInvariant(baseOpnd->m_sym, currentBlock, loop, baseValue, true, true, &baseValueInLoopLandingPad) ||
                     !(doArrayChecks || baseValueInLoopLandingPad->GetValueInfo()->IsObject()))
                 {
@@ -17514,7 +17514,7 @@ GlobOpt::OptArraySrc(IR::Instr * *const instrRef)
             baseArrayValueInfo->CreateOpnd(
                 baseOpnd,
                 needsHeadSegment,
-                needsHeadSegmentLength || !isLikelyJsArray && needsLength,
+                needsHeadSegmentLength || (!isLikelyJsArray && needsLength),
                 needsLength,
                 eliminatedLowerBoundCheck,
                 eliminatedUpperBoundCheck,
@@ -17768,7 +17768,7 @@ GlobOpt::CheckJsArrayKills(IR::Instr *const instr)
         case Js::OpCode::DeleteElemIStrict_A:
             Assert(instr->GetSrc1());
             if(!instr->GetSrc1()->IsIndirOpnd() ||
-                useValueTypes && instr->GetSrc1()->AsIndirOpnd()->GetBaseOpnd()->GetValueType().IsNotArrayOrObjectWithArray())
+                (useValueTypes && instr->GetSrc1()->AsIndirOpnd()->GetBaseOpnd()->GetValueType().IsNotArrayOrObjectWithArray()))
             {
                 break;
             }
@@ -17830,7 +17830,7 @@ GlobOpt::CheckJsArrayKills(IR::Instr *const instr)
 
             const ValueType arrayValueType(arrayOpnd->GetValueType());
 
-            if(!arrayOpnd->IsRegOpnd() || useValueTypes && arrayValueType.IsNotArrayOrObjectWithArray())
+            if(!arrayOpnd->IsRegOpnd() || (useValueTypes && arrayValueType.IsNotArrayOrObjectWithArray()))
             {
                 break;
             }
@@ -17852,10 +17852,12 @@ GlobOpt::CheckJsArrayKills(IR::Instr *const instr)
             }
 
             // Don't kill NativeArray, if there is no mismatch between array's type and element's type.
-            if(doNativeArrayTypeSpec && !(useValueTypes && arrayValueType.IsNativeArray() &&
-                (arrayValueType.IsLikelyNativeIntArray() && instr->GetSrc2()->IsInt32()) ||
-                (arrayValueType.IsLikelyNativeFloatArray() && instr->GetSrc2()->IsFloat()))
-                && !(useValueTypes && arrayValueType.IsNotNativeArray()))
+            if(doNativeArrayTypeSpec &&
+               !(useValueTypes && arrayValueType.IsNativeArray() &&
+                    ((arrayValueType.IsLikelyNativeIntArray() && instr->GetSrc2()->IsInt32()) ||
+                     (arrayValueType.IsLikelyNativeFloatArray() && instr->GetSrc2()->IsFloat()))
+                ) &&
+               !(useValueTypes && arrayValueType.IsNotNativeArray()))
             {
                 kills.SetKillsNativeArrays();
             }
@@ -17869,7 +17871,7 @@ GlobOpt::CheckJsArrayKills(IR::Instr *const instr)
             Assert(arrayOpnd);
 
             const ValueType arrayValueType(arrayOpnd->GetValueType());
-            if(!arrayOpnd->IsRegOpnd() || useValueTypes && arrayValueType.IsNotArrayOrObjectWithArray())
+            if(!arrayOpnd->IsRegOpnd() || (useValueTypes && arrayValueType.IsNotArrayOrObjectWithArray()))
             {
                 break;
             }
@@ -17894,7 +17896,7 @@ GlobOpt::CheckJsArrayKills(IR::Instr *const instr)
             IR::Opnd *const arrayOpnd = instr->FindCallArgumentOpnd(1);
             Assert(arrayOpnd);
             const ValueType arrayValueType(arrayOpnd->GetValueType());
-            if(!arrayOpnd->IsRegOpnd() || useValueTypes && arrayValueType.IsNotArrayOrObjectWithArray())
+            if(!arrayOpnd->IsRegOpnd() || (useValueTypes && arrayValueType.IsNotArrayOrObjectWithArray()))
             {
                 break;
             }
@@ -18251,10 +18253,10 @@ GlobOpt::VerifyIntSpecForIgnoringIntOverflow(IR::Instr *const instr)
     // doesn't generate bailouts or cause ignoring int overflow to be invalid.
     // MULs are allowed to start a region and have BailOutInfo since they will bailout on non-32 bit overflow.
     if(instr->m_opcode == Js::OpCode::Ld_A ||
-        (!instr->HasBailOutInfo() || instr->m_opcode == Js::OpCode::Mul_I4) &&
+       ((!instr->HasBailOutInfo() || instr->m_opcode == Js::OpCode::Mul_I4) &&
         (!instr->GetDst() || instr->GetDst()->IsInt32()) &&
         (!instr->GetSrc1() || instr->GetSrc1()->IsInt32()) &&
-        (!instr->GetSrc2() || instr->GetSrc2()->IsInt32()))
+        (!instr->GetSrc2() || instr->GetSrc2()->IsInt32())))
     {
         return;
     }
@@ -18681,8 +18683,8 @@ GlobOpt::OptIsInvariant(Sym *sym, BasicBlock *block, Loop *loop, Value *srcVal,
             {
                 Assert(block->globOptData.liveInt32Syms->Test(varSym->m_id));
                 if (!loop->landingPad->globOptData.liveInt32Syms->Test(varSym->m_id) ||
-                    loop->landingPad->globOptData.liveLossyInt32Syms->Test(varSym->m_id) &&
-                    !block->globOptData.liveLossyInt32Syms->Test(varSym->m_id))
+                    (loop->landingPad->globOptData.liveLossyInt32Syms->Test(varSym->m_id) &&
+                    !block->globOptData.liveLossyInt32Syms->Test(varSym->m_id)))
                 {
                     // Either the int32 sym is not live in the landing pad, or it's lossy in the landing pad and the
                     // instruction's block is using the lossless version. In either case, the instruction cannot be hoisted
@@ -18830,7 +18832,7 @@ GlobOpt::OptIsInvariant(
     case Js::OpCode::LdLen_A:
         return false;
 
-        //Can't Hoist BailOnNotStackArgs, as it is necessary as InlineArgsOptimization relies on this opcode 
+        //Can't Hoist BailOnNotStackArgs, as it is necessary as InlineArgsOptimization relies on this opcode
         //to decide whether to throw rejit exception or not.
     case Js::OpCode::BailOnNotStackArgs:
         return false;
@@ -18971,7 +18973,7 @@ GlobOpt::OptHoistInvariant(
                 ValueInfo *src1ValueInfo = src1Val->GetValueInfo();
                 ValueInfo *landingPadSrc1ValueInfo = landingPadSrc1val->GetValueInfo();
                 IRType dstType = dst->GetType();
-                
+
                 const auto AddBailOutToFromVar = [&]()
                 {
                     instr->GetSrc1()->SetValueType(landingPadSrc1val->GetValueInfo()->Type());
@@ -19751,7 +19753,7 @@ GlobOpt::DoArrayCheckHoist() const
 bool
 GlobOpt::DoArrayCheckHoist(const ValueType baseValueType, Loop* loop, IR::Instr *const instr) const
 {
-    if(!DoArrayCheckHoist() || instr && !IsLoopPrePass() && instr->DoStackArgsOpt(func))
+    if(!DoArrayCheckHoist() || (instr && !IsLoopPrePass() && instr->DoStackArgsOpt(func)))
     {
         return false;
     }
@@ -19877,7 +19879,7 @@ GlobOpt::DoLdLenIntSpec(IR::Instr *const instr, const ValueType baseValueType) c
     if(PHASE_OFF(Js::LdLenIntSpecPhase, func) ||
         IsTypeSpecPhaseOff(func) ||
         (func->HasProfileInfo() && func->GetReadOnlyProfileInfo()->IsLdLenIntSpecDisabled()) ||
-        instr && !IsLoopPrePass() && instr->DoStackArgsOpt(func))
+        (instr && !IsLoopPrePass() && instr->DoStackArgsOpt(func)))
     {
         return false;
     }
@@ -19895,7 +19897,7 @@ GlobOpt::DoLdLenIntSpec(IR::Instr *const instr, const ValueType baseValueType) c
     Assert(!instr || baseValueType == instr->GetSrc1()->GetValueType());
     return
         baseValueType.HasBeenString() ||
-        baseValueType.IsLikelyAnyOptimizedArray() && baseValueType.GetObjectType() != ObjectType::ObjectWithArray;
+        (baseValueType.IsLikelyAnyOptimizedArray() && baseValueType.GetObjectType() != ObjectType::ObjectWithArray);
 }
 
 bool
@@ -20785,7 +20787,7 @@ GlobOpt::TraceSettings()
     Output::Print(_u("    FloatTypeSpec: %s\r\n"), this->DoFloatTypeSpec() ? _u("enabled") : _u("disabled"));
     Output::Print(_u("    AggressiveIntTypeSpec: %s\r\n"), this->DoAggressiveIntTypeSpec() ? _u("enabled") : _u("disabled"));
     Output::Print(_u("    LossyIntTypeSpec: %s\r\n"), this->DoLossyIntTypeSpec() ? _u("enabled") : _u("disabled"));
-    Output::Print(_u("    ArrayCheckHoist: %s\r\n"),  (this->func->HasProfileInfo() && this->func->GetReadOnlyProfileInfo()->IsArrayCheckHoistDisabled(func->IsLoopBody())) ? L"disabled" : L"enabled");
+    Output::Print(_u("    ArrayCheckHoist: %s\r\n"),  (this->func->HasProfileInfo() && this->func->GetReadOnlyProfileInfo()->IsArrayCheckHoistDisabled(func->IsLoopBody())) ? _u("disabled") : _u("enabled"));
     Output::Print(_u("    ImplicitCallFlags: %s\r\n"), Js::DynamicProfileInfo::GetImplicitCallFlagsString(this->func->m_fg->implicitCallFlags));
     for (Loop * loop = this->func->m_fg->loopList; loop != NULL; loop = loop->next)
     {
@@ -21486,11 +21488,11 @@ GlobOpt::EmitMemop(Loop * loop, LoopCount *loopCount, const MemOpEmitData* emitD
         char16 loopCountBuf[loopCountBufSize];
         if (loopCount->LoopCountMinusOneSym())
         {
-            _snwprintf_s(loopCountBuf, loopCountBufSize, _u("s%u"), loopCount->LoopCountMinusOneSym()->m_id);
+            swprintf_s(loopCountBuf, _u("s%u"), loopCount->LoopCountMinusOneSym()->m_id);
         }
         else
         {
-            _snwprintf_s(loopCountBuf, loopCountBufSize, _u("%u"), loopCount->LoopCountMinusOneConstantValue() + 1);
+            swprintf_s(loopCountBuf, _u("%u"), loopCount->LoopCountMinusOneConstantValue() + 1);
         }
         if (isMemset)
         {
@@ -21499,7 +21501,7 @@ GlobOpt::EmitMemop(Loop * loop, LoopCount *loopCount, const MemOpEmitData* emitD
             char16 constBuf[constBufSize];
             if (candidate->srcSym)
             {
-                _snwprintf_s(constBuf, constBufSize, _u("s%u"), candidate->srcSym->m_id);
+                swprintf_s(constBuf, _u("s%u"), candidate->srcSym->m_id);
             }
             else
             {
@@ -21509,18 +21511,18 @@ GlobOpt::EmitMemop(Loop * loop, LoopCount *loopCount, const MemOpEmitData* emitD
                 case TyInt16:
                 case TyInt32:
                 case TyInt64:
-                    _snwprintf_s(constBuf, constBufSize, sizeof(IntConstType) == 8 ? _u("%lld") : _u("%d"), candidate->constant.u.intConst.value);
+                    swprintf_s(constBuf, sizeof(IntConstType) == 8 ? _u("%lld") : _u("%d"), candidate->constant.u.intConst.value);
                     break;
                 case TyFloat32:
                 case TyFloat64:
-                    _snwprintf_s(constBuf, constBufSize, _u("%.4f"), candidate->constant.u.floatConst.value);
+                    swprintf_s(constBuf, _u("%.4f"), candidate->constant.u.floatConst.value);
                     break;
                 case TyVar:
-                    _snwprintf_s(constBuf, constBufSize, sizeof(Js::Var) == 8 ? _u("0x%.16llX") : _u("0x%.8X"), candidate->constant.u.varConst.value);
+                    swprintf_s(constBuf, sizeof(Js::Var) == 8 ? _u("0x%.16llX") : _u("0x%.8X"), candidate->constant.u.varConst.value);
                     break;
                 default:
                     AssertMsg(false, "Unsupported constant type");
-                    _snwprintf_s(constBuf, constBufSize, _u("Unknown"));
+                    swprintf_s(constBuf, _u("Unknown"));
                     break;
                 }
             }

+ 3 - 3
lib/Backend/GlobOpt.h

@@ -623,7 +623,7 @@ public:
         Assert(allocator);
 
         return
-            copyHeadSegment && headSegmentSym || copyHeadSegmentLength && headSegmentLengthSym || copyLength && lengthSym
+            (copyHeadSegment && headSegmentSym) || (copyHeadSegmentLength && headSegmentLengthSym) || (copyLength && lengthSym)
                 ? New(
                     allocator,
                     Type(),
@@ -1140,8 +1140,8 @@ public:
 
         return
             killsAllArrays ||
-            killsArraysWithNoMissingValues && valueType.HasNoMissingValues() ||
-            killsNativeArrays && !valueType.HasVarElements();
+            (killsArraysWithNoMissingValues && valueType.HasNoMissingValues()) ||
+            (killsNativeArrays && !valueType.HasVarElements());
     }
 
     bool AreSubsetOf(const JsArrayKills &other) const

+ 4 - 4
lib/Backend/GlobOptBailOut.cpp

@@ -986,7 +986,7 @@ GlobOpt::FillBailOutInfo(BasicBlock *block, BailOutInfo * bailOutInfo)
 #ifdef _M_IX86
                 if (this->currentRegion && this->currentRegion->GetType() == RegionTypeTry)
                 {
-                    // For a bailout in argument evaluation from an EH region, the esp is offset by the TryCatch helpers frame. So, the argouts are not actually pushed at the
+                    // For a bailout in argument evaluation from an EH region, the esp is offset by the TryCatch helper�s frame. So, the argouts are not actually pushed at the
                     // offsets stored in the bailout record, which are relative to ebp. Need to restore the argouts from the actual value of esp before calling the Bailout helper.
                     // For nested calls, argouts for the outer call need to be restored from an offset of stack-adjustment-done-by-the-inner-call from esp.
                     if (startCallNumber + 1 == bailOutInfo->startCallCount)
@@ -1250,8 +1250,8 @@ GlobOpt::MayNeedBailOnImplicitCall(const IR::Instr * instr, Value *src1Val, Valu
         return
             !(
                 baseValueType.IsString() ||
-                baseValueType.IsAnyArray() && baseValueType.GetObjectType() != ObjectType::ObjectWithArray ||
-                instr->HasBailOutInfo() && instr->GetBailOutKindNoBits() == IR::BailOutOnIrregularLength // guarantees no implicit calls
+                (baseValueType.IsAnyArray() && baseValueType.GetObjectType() != ObjectType::ObjectWithArray) ||
+                (instr->HasBailOutInfo() && instr->GetBailOutKindNoBits() == IR::BailOutOnIrregularLength) // guarantees no implicit calls
             );
     }
 
@@ -1277,7 +1277,7 @@ GlobOpt::MayNeedBailOnImplicitCall(const IR::Instr * instr, Value *src1Val, Valu
             !(
                 (bailOutKind & ~IR::BailOutKindBits) == IR::BailOutConventionalTypedArrayAccessOnly ||
                 bailOutKind & IR::BailOutOnArrayAccessHelperCall ||
-                isLdElem && bailOutKind & IR::BailOutConventionalNativeArrayAccessOnly
+                (isLdElem && bailOutKind & IR::BailOutConventionalNativeArrayAccessOnly)
             );
     }
 

+ 1 - 1
lib/Backend/GlobOptFields.cpp

@@ -373,7 +373,7 @@ GlobOpt::KillLiveElems(IR::IndirOpnd * indirOpnd, BVSparse<JitArenaAllocator> *
             indexOpnd &&
             (
                 indexOpnd->m_sym->m_isNotInt ||
-                inGlobOpt && !indexOpnd->GetValueType().IsNumber() && !IsTypeSpecialized(indexOpnd->m_sym, &blockData)
+                (inGlobOpt && !indexOpnd->GetValueType().IsNumber() && !IsTypeSpecialized(indexOpnd->m_sym, &blockData))
             )
         ))
     {

+ 2 - 2
lib/Backend/GlobOptIntBounds.cpp

@@ -538,7 +538,7 @@ void GlobOpt::UpdateIntBoundsForEqualBranch(
 {
     Assert(src1Value);
 
-    if(!DoPathDependentValues() || src2Value && src1Value->GetValueNumber() == src2Value->GetValueNumber())
+    if(!DoPathDependentValues() || (src2Value && src1Value->GetValueNumber() == src2Value->GetValueNumber()))
     {
         return;
     }
@@ -591,7 +591,7 @@ void GlobOpt::UpdateIntBoundsForNotEqualBranch(
 {
     Assert(src1Value);
 
-    if(!DoPathDependentValues() || src2Value && src1Value->GetValueNumber() == src2Value->GetValueNumber())
+    if(!DoPathDependentValues() || (src2Value && src1Value->GetValueNumber() == src2Value->GetValueNumber()))
     {
         return;
     }

+ 31 - 25
lib/Backend/IR.cpp

@@ -145,7 +145,7 @@ Instr::TryOptimizeInstrWithFixedDataProperty(IR::Instr **pInstr, GlobOpt * globo
 bool
 Instr::IsEqual(IR::Instr *compareInstr) const
 {
-    Assert(this && compareInstr);
+    Assert(compareInstr);
     if (this->GetKind() == compareInstr->GetKind()
         && this->m_opcode == compareInstr->m_opcode)
     {
@@ -3221,8 +3221,8 @@ bool Instr::HasAnyImplicitCalls() const
     }
     if (OpCodeAttr::OpndHasImplicitCall(this->m_opcode))
     {
-        if (this->m_dst && 
-            ((this->m_dst->IsSymOpnd() && this->m_dst->AsSymOpnd()->m_sym->IsPropertySym()) || 
+        if (this->m_dst &&
+            ((this->m_dst->IsSymOpnd() && this->m_dst->AsSymOpnd()->m_sym->IsPropertySym()) ||
              this->m_dst->IsIndirOpnd()))
         {
             return true;
@@ -3438,7 +3438,7 @@ IR::Instr* IR::Instr::NewConstantLoad(IR::RegOpnd* dstOpnd, intptr_t varConst, V
             }
             else if(type.IsNumber())
             {
-                // TODO (michhol): OOP JIT. we may need to unbox before sending over const table                
+                // TODO (michhol): OOP JIT. we may need to unbox before sending over const table
 
                 if (!func->IsOOPJIT())
                 {
@@ -3447,7 +3447,7 @@ IR::Instr* IR::Instr::NewConstantLoad(IR::RegOpnd* dstOpnd, intptr_t varConst, V
                 else
                 {
                     srcOpnd = IR::FloatConstOpnd::New((Js::Var)varConst, TyFloat64, func
-#if !FLOATVAR               
+#if !FLOATVAR
                         ,varLocal
 #endif
                     );
@@ -3466,7 +3466,7 @@ IR::Instr* IR::Instr::NewConstantLoad(IR::RegOpnd* dstOpnd, intptr_t varConst, V
                     // treated as int32s for the purposes of int specialization.
                     dstOpnd->m_sym->m_isNotInt = !Js::JavascriptNumber::IsInt32OrUInt32(((IR::FloatConstOpnd*)srcOpnd)->m_value);
 
-                    
+
 #endif
                 }
             }
@@ -4029,6 +4029,9 @@ Instr::Dump(IRDumpFlags flags)
         Output::SkipToColumn(38);
     };
 
+    // forward decl before goto statement
+    Opnd * dst = nullptr;
+
     if(m_opcode == Js::OpCode::BoundCheck || m_opcode == Js::OpCode::UnsignedBoundCheck)
     {
         PrintOpCodeName();
@@ -4094,7 +4097,7 @@ Instr::Dump(IRDumpFlags flags)
 
     Output::SkipToColumn(4);
 
-    Opnd * dst = this->GetDst();
+    dst = this->GetDst();
 
     if (dst)
     {
@@ -4182,7 +4185,7 @@ Instr::Dump(IRDumpFlags flags)
             if(branchInstr->m_isMultiBranch && branchInstr->IsMultiBranch())
             {
                 IR::MultiBranchInstr * multiBranchInstr = branchInstr->AsMultiBrInstr();
-                
+
                 // If this MultiBranchInstr has been lowered to a machine instruction, which means
                 // its opcode is not Js::OpCode::MultiBr, there is no need to print the labels.
                 if (this->m_opcode == Js::OpCode::MultiBr)
@@ -4216,27 +4219,30 @@ Instr::Dump(IRDumpFlags flags)
         Output::Print(_u("#%d"), this->AsPragmaInstr()->m_statementIndex);
     }
 
-    Opnd * src1 = this->GetSrc1();
-    if (this->m_opcode == Js::OpCode::NewScFunc || this->m_opcode == Js::OpCode::NewScGenFunc)
+    // scope
     {
-        Assert(src1->IsIntConstOpnd());
-        Js::ParseableFunctionInfo * function = nullptr;
-        if (!m_func->IsOOPJIT())
+        Opnd * src1 = this->GetSrc1();
+        if (this->m_opcode == Js::OpCode::NewScFunc || this->m_opcode == Js::OpCode::NewScGenFunc)
         {
-            function = ((Js::ParseableFunctionInfo *)m_func->GetJITFunctionBody()->GetAddr())->GetNestedFunctionForExecution((uint)src1->AsIntConstOpnd()->GetValue())->GetParseableFunctionInfo();
+            Assert(src1->IsIntConstOpnd());
+            Js::ParseableFunctionInfo * function = nullptr;
+            if (!m_func->IsOOPJIT())
+            {
+                function = ((Js::ParseableFunctionInfo *)m_func->GetJITFunctionBody()->GetAddr())->GetNestedFunctionForExecution((uint)src1->AsIntConstOpnd()->GetValue())->GetParseableFunctionInfo();
+            }
+            Output::Print(_u("func:%s()"), function ? function->GetDisplayName() : _u("???"));
+            Output::Print(_u(", env:"));
+            this->GetSrc2()->AsRegOpnd()->m_sym->Dump(flags);
         }
-        Output::Print(_u("func:%s()"), function ? function->GetDisplayName() : _u("???"));
-        Output::Print(_u(", env:"));
-        this->GetSrc2()->AsRegOpnd()->m_sym->Dump(flags);
-    }
-    else if (src1)
-    {
-        src1->Dump(flags, this->m_func);
-        Opnd * src2 = this->GetSrc2();
-        if (src2)
+        else if (src1)
         {
-            Output::Print(_u(", "));
-            src2->Dump(flags, this->m_func);
+            src1->Dump(flags, this->m_func);
+            Opnd * src2 = this->GetSrc2();
+            if (src2)
+            {
+                Output::Print(_u(", "));
+                src2->Dump(flags, this->m_func);
+            }
         }
     }
 

+ 5 - 5
lib/Backend/IR.h

@@ -435,13 +435,13 @@ public:
 private:
     void            ClearNumber() { this->m_number = 0; }
     void            SetNumber(uint32 number);
-    friend class Func;
-    friend class Lowerer;
+    friend class ::Func;
+    friend class ::Lowerer;
 
     void            SetByteCodeOffset(uint32 number);
-    friend class IRBuilder;
-    friend class IRBuilderAsmJs;
-    friend class FlowGraph;
+    friend class ::IRBuilder;
+    friend class ::IRBuilderAsmJs;
+    friend class ::FlowGraph;
 
     void            SetBailOutKind_NoAssert(const IR::BailOutKind bailOutKind);
 

+ 4 - 4
lib/Backend/IRBuilder.cpp

@@ -791,8 +791,8 @@ IRBuilder::Build()
         {
             bool needBailoutForHelper = CONFIG_FLAG(EnableContinueAfterExceptionWrappersForHelpers) &&
                 (OpCodeAttr::NeedsPostOpDbgBailOut(newOpcode) ||
-                    m_lastInstr->m_opcode == Js::OpCode::CallHelper && m_lastInstr->GetSrc1() &&
-                    HelperMethodAttributes::CanThrow(m_lastInstr->GetSrc1()->AsHelperCallOpnd()->m_fnHelper));
+                    (m_lastInstr->m_opcode == Js::OpCode::CallHelper && m_lastInstr->GetSrc1() &&
+                    HelperMethodAttributes::CanThrow(m_lastInstr->GetSrc1()->AsHelperCallOpnd()->m_fnHelper)));
 
             if (needBailoutForHelper)
             {
@@ -2002,7 +2002,7 @@ IRBuilder::BuildProfiledReg2(Js::OpCode newOpcode, uint32 offset, Js::RegSlot ds
             ValueType arrayType(ldElemInfo->GetArrayType());
             if(arrayType.IsLikelyNativeArray() &&
                 (
-                    !(m_func->GetTopFunc()->HasTry() && !m_func->GetTopFunc()->DoOptimizeTryCatch()) && m_func->GetWeakFuncRef() && !m_func->HasArrayInfo() ||
+                    (!(m_func->GetTopFunc()->HasTry() && !m_func->GetTopFunc()->DoOptimizeTryCatch()) && m_func->GetWeakFuncRef() && !m_func->HasArrayInfo()) ||
                     m_func->IsJitInDebugMode()
                 ))
             {
@@ -5282,7 +5282,7 @@ IRBuilder::BuildElementI(Js::OpCode newOpcode, uint32 offset, Js::RegSlot baseRe
     {
         if(arrayType.IsLikelyNativeArray() &&
             (
-                !(m_func->GetTopFunc()->HasTry() && !m_func->GetTopFunc()->DoOptimizeTryCatch()) && m_func->GetWeakFuncRef() && !m_func->HasArrayInfo() ||
+                (!(m_func->GetTopFunc()->HasTry() && !m_func->GetTopFunc()->DoOptimizeTryCatch()) && m_func->GetWeakFuncRef() && !m_func->HasArrayInfo()) ||
                 m_func->IsJitInDebugMode()
             ))
         {

+ 1 - 1
lib/Backend/IRType.cpp

@@ -28,7 +28,7 @@ int const TyBaseType[] = {
 #undef IRTYPE
 };
 
-char16 * const TyDumpName[] = {
+const char16 * const TyDumpName[] = {
 #define IRTYPE(ucname, baseType, size, bitSize, enRegOk, dname) _u(#dname),
 #include "IRTypeList.h"
 #undef IRTYPE

+ 2 - 2
lib/Backend/InductionVariable.cpp

@@ -70,8 +70,8 @@ const IntConstantBounds &InductionVariable::ChangeBounds() const
 bool InductionVariable::IsChangeUnidirectional() const
 {
     return
-        ChangeBounds().LowerBound() >= 0 && ChangeBounds().UpperBound() != 0 ||
-        ChangeBounds().UpperBound() <= 0 && ChangeBounds().LowerBound() != 0;
+        (ChangeBounds().LowerBound() >= 0 && ChangeBounds().UpperBound() != 0) ||
+        (ChangeBounds().UpperBound() <= 0 && ChangeBounds().LowerBound() != 0);
 }
 
 bool InductionVariable::Add(const int n)

+ 31 - 26
lib/Backend/Inline.cpp

@@ -1287,8 +1287,13 @@ Inline::TryOptimizeCallInstrWithFixedMethod(IR::Instr *callInstr, const Function
     char16 debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
     char16 debugStringBuffer2[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
     bool printFixedFieldsTrace =
-        ((PHASE_TRACE(Js::FixedMethodsPhase, callInstr->m_func) || PHASE_TESTTRACE(Js::FixedMethodsPhase, callInstr->m_func) ||
-        (isCtor && PHASE_TRACE(Js::FixedNewObjPhase, callInstr->m_func) || PHASE_TESTTRACE(Js::FixedNewObjPhase, callInstr->m_func))) && !dontOptimizeJustCheck);
+        (
+            PHASE_TRACE(Js::FixedMethodsPhase, callInstr->m_func) ||
+            PHASE_TESTTRACE(Js::FixedMethodsPhase, callInstr->m_func) ||
+            (isCtor && (
+                PHASE_TRACE(Js::FixedNewObjPhase, callInstr->m_func) ||
+                PHASE_TESTTRACE(Js::FixedNewObjPhase, callInstr->m_func)))
+        ) && !dontOptimizeJustCheck;
 
     if (printFixedFieldsTrace)
     {
@@ -1297,7 +1302,7 @@ Inline::TryOptimizeCallInstrWithFixedMethod(IR::Instr *callInstr, const Function
 
         Output::Print(_u("FixedFields: function %s (%s): considering method <unknown> (%s %s): polymorphic = %d, built-in = %d, ctor = %d, inlined = %d, functionInfo = %p.\n"),
             callInstr->m_func->GetJITFunctionBody()->GetDisplayName(), callInstr->m_func->GetDebugNumberSet(debugStringBuffer), calleeName,
-            calleeFunctionBody ? inlineeInfo->GetDebugNumberSet(debugStringBuffer2) : L"(null)",
+            calleeFunctionBody ? inlineeInfo->GetDebugNumberSet(debugStringBuffer2) : _u("(null)"),
             isPolymorphic, isBuiltIn, isCtor, isInlined, inlineeInfo ? inlineeInfo->GetFunctionInfoAddr() : 0);
         Output::Flush();
     }
@@ -1319,8 +1324,8 @@ Inline::TryOptimizeCallInstrWithFixedMethod(IR::Instr *callInstr, const Function
 
             Output::Print(_u("FixedFields: function %s (%s): %s non-fixed method <unknown> (%s %s), because callee is not single def.\n"),
                 callInstr->m_func->GetJITFunctionBody()->GetDisplayName(), callInstr->m_func->GetDebugNumberSet(debugStringBuffer),
-                inlineeInfo != nullptr ? L"inlining" : L"calling", calleeName,
-                calleeFunctionBody ? inlineeInfo->GetDebugNumberSet(debugStringBuffer2) : L"(null)");
+                inlineeInfo != nullptr ? _u("inlining") : _u("calling"), calleeName,
+                calleeFunctionBody ? inlineeInfo->GetDebugNumberSet(debugStringBuffer2) : _u("(null)"));
             Output::Flush();
         }
 #endif
@@ -1344,8 +1349,8 @@ Inline::TryOptimizeCallInstrWithFixedMethod(IR::Instr *callInstr, const Function
 
             Output::Print(_u("FixedFields: function %s (%s): %s non-fixed method <unknown> (%s %s), because callee does not come from LdMethodFld.\n"),
                 callInstr->m_func->GetJITFunctionBody()->GetDisplayName(), callInstr->m_func->GetDebugNumberSet(debugStringBuffer),
-                inlineeInfo != nullptr ? L"inlining" : L"calling", calleeName,
-                calleeFunctionBody ? inlineeInfo->GetDebugNumberSet(debugStringBuffer2) : L"(null)");
+                inlineeInfo != nullptr ? _u("inlining") : _u("calling"), calleeName,
+                calleeFunctionBody ? inlineeInfo->GetDebugNumberSet(debugStringBuffer2) : _u("(null)"));
             Output::Flush();
         }
 #endif
@@ -1378,8 +1383,8 @@ Inline::TryOptimizeCallInstrWithFixedMethod(IR::Instr *callInstr, const Function
 
             Output::Print(_u("FixedFields: function %s (#%u): %s non-fixed method %s (%s #%u) (cache id: %d), because %s fixed %s %s is disabled.\n"),
                 callInstr->m_func->GetJITFunctionBody()->GetDisplayName(), callInstr->m_func->GetDebugNumberSet(debugStringBuffer),
-                inlineeInfo != nullptr ? L"inlining" : L"calling", methodPropertyRecord->GetBuffer(), calleeName,
-                calleeFunctionBody ? inlineeInfo->GetDebugNumberSet(debugStringBuffer2) : L"(null)",
+                inlineeInfo != nullptr ? _u("inlining") : _u("calling"), methodPropertyRecord->GetBuffer(), calleeName,
+                calleeFunctionBody ? inlineeInfo->GetDebugNumberSet(debugStringBuffer2) : _u("(null)"),
                 methodPropertyOpnd->m_inlineCacheIndex, isInlined ? _u("inlining") : _u("calling"), isBuiltIn ? _u("built-in") : _u("script"),
                 isCtor ? _u("ctors") : _u("methods"));
             Output::Flush();
@@ -1482,7 +1487,7 @@ Inline::TryOptimizeCallInstrWithFixedMethod(IR::Instr *callInstr, const Function
             const char16* fixedFunctionNumbers   = fixedFunctionBody ? fixedFunctionBody->GetDebugNumberSet(debugStringBuffer2) : _u("(null)");
             JITTimeFunctionBody* profileFunctionBody = inlineeInfo->GetBody();
             const char16* profileFunctionName    = profileFunctionBody != nullptr ? profileFunctionBody->GetDisplayName() : _u("<unknown>");
-            const wchar_t* profileFunctionNumbers = profileFunctionBody ? inlineeInfo->GetDebugNumberSet(debugStringBuffer3) : L"(null)";
+            const char16* profileFunctionNumbers = profileFunctionBody ? inlineeInfo->GetDebugNumberSet(debugStringBuffer3) : _u("(null)");
 
             if (PHASE_TRACE(Js::FixedMethodsPhase, callInstr->m_func))
             {
@@ -1579,9 +1584,9 @@ Inline::TryOptimizeCallInstrWithFixedMethod(IR::Instr *callInstr, const Function
 
                 Output::Print(_u("FixedNewObj: function %s (%s): fixed new object for %s with %s ctor %s (%s %s)%s\n"),
                     callInstr->m_func->GetJITFunctionBody()->GetDisplayName(), callInstr->m_func->GetDebugNumberSet(debugStringBuffer), Js::OpCodeUtil::GetOpCodeName(callInstr->m_opcode),
-                    inlineeInfo != nullptr ? L"inlined" : L"called",
+                    inlineeInfo != nullptr ? _u("inlined") : _u("called"),
                     methodPropertyRecord->GetBuffer(), fixedFunctionName, fixedFunctionNumbers,
-                    constructorCache->SkipNewScObject() ? L" skip default object" : L"");
+                    constructorCache->SkipNewScObject() ? _u(" skip default object") : _u(""));
                 Output::Flush();
             }
 #endif
@@ -2560,7 +2565,7 @@ bool Inline::InlineApplyTarget(IR::Instr *callInstr, const FunctionJITTimeInfo*
         {
             safeThis = false;
         }
-    }   
+    }
 
     IR::Instr* argObjByteCodeArgoutCapture = argumentsObjArgOut->GetBytecodeArgOutCapture();
     argObjByteCodeArgoutCapture->GetDst()->GetStackSym()->m_nonEscapingArgObjAlias = true;
@@ -3641,10 +3646,10 @@ Inline::InlineScriptFunction(IR::Instr *callInstr, const FunctionJITTimeInfo *co
 
     Func *funcCaller = callInstr->m_func;
     JITTimeFunctionBody *funcBody = inlineeData->GetBody();
-    
-    // We don't do stack args optimization in jitted loop body (because of lack of information about the code before and after the loop) 
+
+    // We don't do stack args optimization in jitted loop body (because of lack of information about the code before and after the loop)
     // and we turn off stack arg optimization for the whole inline chain if we can't do it for one of the functionss.
-    // Inlining a function that uses arguments object could potentially hurt perf because we'll have to create arguments object on the 
+    // Inlining a function that uses arguments object could potentially hurt perf because we'll have to create arguments object on the
     // heap for that function (versus otherwise the function will be jitted and have its arguments object creation optimized).
     // TODO: Allow arguments object creation to be optimized on a function level instead of an all-or-nothing approach.
     if (callInstr->m_func->IsLoopBody() && funcBody->UsesArgumentsObject())
@@ -5158,7 +5163,7 @@ Inline::GetInlineeHasArgumentObject(Func * inlinee)
                         if (builtInOpnd->IsAddrOpnd())
                         {
                             Assert(builtInOpnd->AsAddrOpnd()->m_isFunction);
-                            
+
                             Js::BuiltinFunction builtinFunction = Js::JavascriptLibrary::GetBuiltInForFuncInfo(((JITTimeFixedField*)builtInOpnd->AsAddrOpnd()->m_metadata)->GetFuncInfoAddr(), this->topFunc->GetThreadContextInfo());
                             if (builtinFunction == Js::BuiltinFunction::JavascriptFunction_Apply)
                             {
@@ -5437,20 +5442,20 @@ Inline::Simd128FixLoadStoreInstr(Js::BuiltinFunction builtInId, IR::Instr * call
 
 #if defined(ENABLE_DEBUG_CONFIG_OPTIONS)
 // static
-void Inline::TraceInlining(const FunctionJITTimeInfo *const inliner, const wchar_t* inlineeName, const wchar_t* inlineeFunctionIdandNumberString, uint inlineeByteCodeCount,
+void Inline::TraceInlining(const FunctionJITTimeInfo *const inliner, const char16* inlineeName, const char16* inlineeFunctionIdandNumberString, uint inlineeByteCodeCount,
     const FunctionJITTimeInfo* topFunc, uint inlinedByteCodeCount, const FunctionJITTimeInfo *const inlinee, uint callSiteId, bool inLoopBody, uint builtIn)
 {
-    wchar_t debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
-    wchar_t debugStringBuffer2[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
-    wchar_t debugStringBuffer3[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+    char16 debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+    char16 debugStringBuffer2[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+    char16 debugStringBuffer3[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
     if (inlineeName == nullptr)
     {
 
-        int len = swprintf_s(debugStringBuffer3, MAX_FUNCTION_BODY_DEBUG_STRING_SIZE, L"built In Id: %u", builtIn);
+        int len = swprintf_s(debugStringBuffer3, MAX_FUNCTION_BODY_DEBUG_STRING_SIZE, _u("built In Id: %u"), builtIn);
         Assert(len > 14);
         inlineeName = debugStringBuffer3;
     }
-    INLINE_TESTTRACE(L"INLINING %s: Inlinee: %s (%s)\tSize: %d\tCaller: %s (%s)\tSize: %d\tInlineCount: %d\tRoot: %s (%s)\tSize: %d\tCallSiteId: %d\n",
+    INLINE_TESTTRACE(_u("INLINING %s: Inlinee: %s (%s)\tSize: %d\tCaller: %s (%s)\tSize: %d\tInlineCount: %d\tRoot: %s (%s)\tSize: %d\tCallSiteId: %d\n"),
         inLoopBody ? _u("IN LOOP BODY") : _u(""),
         inlineeName, inlineeFunctionIdandNumberString, inlineeByteCodeCount,
         inliner->GetBody()->GetDisplayName(), inliner->GetDebugNumberSet(debugStringBuffer), inliner->GetBody()->GetByteCodeCount(), inlinedByteCodeCount,
@@ -5459,7 +5464,7 @@ void Inline::TraceInlining(const FunctionJITTimeInfo *const inliner, const wchar
         callSiteId
     );
 
-    INLINE_TRACE(L"INLINING %s: Inlinee: %s (%s)\tSize: %d\tCaller: %s (%s)\tSize: %d\tInlineCount: %d\tRoot: %s (%s)\tSize: %d\tCallSiteId: %d\n",
+    INLINE_TRACE(_u("INLINING %s: Inlinee: %s (%s)\tSize: %d\tCaller: %s (%s)\tSize: %d\tInlineCount: %d\tRoot: %s (%s)\tSize: %d\tCallSiteId: %d\n"),
         inLoopBody ? _u("IN LOOP BODY") : _u(""),
         inlineeName, inlineeFunctionIdandNumberString, inlineeByteCodeCount,
         inliner->GetBody()->GetDisplayName(), inliner->GetDebugNumberSet(debugStringBuffer), inliner->GetBody()->GetByteCodeCount(), inlinedByteCodeCount,
@@ -5479,13 +5484,13 @@ void Inline::TraceInlining(const FunctionJITTimeInfo *const inliner, const wchar
 
     if (inliner->GetSourceContextId() != inlinee->GetSourceContextId())
     {
-        INLINE_TESTTRACE(L"INLINING_ACROSS_FILES: Inlinee: %s (%s)\tSize: %d\tCaller: %s (%s)\tSize: %d\tInlineCount: %d\tRoot: %s (%s)\tSize: %d\n",
+        INLINE_TESTTRACE(_u("INLINING_ACROSS_FILES: Inlinee: %s (%s)\tSize: %d\tCaller: %s (%s)\tSize: %d\tInlineCount: %d\tRoot: %s (%s)\tSize: %d\n"),
             inlinee->GetDisplayName(), inlinee->GetDebugNumberSet(debugStringBuffer), inlinee->GetBody()->GetByteCodeCount(),
             inliner->GetDisplayName(), inliner->GetDebugNumberSet(debugStringBuffer2), inliner->GetBody()->GetByteCodeCount(), inlinedByteCodeCount,
             topFunc->GetBody()->GetDisplayName(), topFunc->GetDebugNumberSet(debugStringBuffer3), topFunc->GetBody()->GetByteCodeCount()
         );
 
-        INLINE_TRACE(L"INLINING_ACROSS_FILES: Inlinee: %s (%s)\tSize: %d\tCaller: %s (%s)\tSize: %d\tInlineCount: %d\tRoot: %s (%s)\tSize: %d\n",
+        INLINE_TRACE(_u("INLINING_ACROSS_FILES: Inlinee: %s (%s)\tSize: %d\tCaller: %s (%s)\tSize: %d\tInlineCount: %d\tRoot: %s (%s)\tSize: %d\n"),
             inlinee->GetDisplayName(), inlinee->GetDebugNumberSet(debugStringBuffer), inlinee->GetBody()->GetByteCodeCount(),
             inliner->GetDisplayName(), inliner->GetDebugNumberSet(debugStringBuffer2), inliner->GetBody()->GetByteCodeCount(), inlinedByteCodeCount,
             topFunc->GetBody()->GetDisplayName(), topFunc->GetDebugNumberSet(debugStringBuffer3), topFunc->GetBody()->GetByteCodeCount()

+ 1 - 1
lib/Backend/Inline.h

@@ -138,7 +138,7 @@ private:
     void    SetIsInInlinedApplyCall(bool inInlinedApplyCall) { this->isInInlinedApplyCall = inInlinedApplyCall; }
 
 #if defined(ENABLE_DEBUG_CONFIG_OPTIONS)
-    static void TraceInlining(const FunctionJITTimeInfo *const inliner, const wchar_t* inlineeName, const wchar_t* inlineeFunctionIdandNumberString, uint inlineeByteCodeCount,
+    static void TraceInlining(const FunctionJITTimeInfo *const inliner, const char16* inlineeName, const char16* inlineeFunctionIdandNumberString, uint inlineeByteCodeCount,
         const FunctionJITTimeInfo* topFunc, uint inlinedByteCodeCount, const FunctionJITTimeInfo *const inlinee, uint callSiteId, bool inLoopBody, uint builtIn = -1);
 #endif
 };

+ 9 - 9
lib/Backend/InliningDecider.cpp

@@ -649,8 +649,8 @@ bool InliningDecider::GetBuiltInInfoCommon(
 bool InliningDecider::CanRecursivelyInline(Js::FunctionBody * inlinee, Js::FunctionBody *inliner, bool allowRecursiveInlining, uint recursiveInlineDepth)
 {
 #if defined(DBG_DUMP) || defined(ENABLE_DEBUG_CONFIG_OPTIONS)
-    wchar_t debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
-    wchar_t debugStringBuffer2[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+    char16 debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+    char16 debugStringBuffer2[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
 #endif
 
 
@@ -659,7 +659,7 @@ bool InliningDecider::CanRecursivelyInline(Js::FunctionBody * inlinee, Js::Funct
         &&  inlinee == inliner
         &&  inlinee->CanInlineRecursively(recursiveInlineDepth))
     {
-        INLINE_TESTTRACE(L"INLINING: Inlined recursively\tInlinee: %s (%s)\tCaller: %s (%s)\tDepth: %d\n",
+        INLINE_TESTTRACE(_u("INLINING: Inlined recursively\tInlinee: %s (%s)\tCaller: %s (%s)\tDepth: %d\n"),
             inlinee->GetDisplayName(), inlinee->GetDebugNumberSet(debugStringBuffer),
             inliner->GetDisplayName(), inliner->GetDebugNumberSet(debugStringBuffer2), recursiveInlineDepth);
         return true;
@@ -667,7 +667,7 @@ bool InliningDecider::CanRecursivelyInline(Js::FunctionBody * inlinee, Js::Funct
 
     if (!inlinee->CanInlineAgain())
     {
-        INLINE_TESTTRACE(L"INLINING: Skip Inline: Do not inline recursive functions\tInlinee: %s (%s)\tCaller: %s (%s)\n",
+        INLINE_TESTTRACE(_u("INLINING: Skip Inline: Do not inline recursive functions\tInlinee: %s (%s)\tCaller: %s (%s)\n"),
             inlinee->GetDisplayName(), inlinee->GetDebugNumberSet(debugStringBuffer),
             inliner->GetDisplayName(), inliner->GetDebugNumberSet(debugStringBuffer2));
         return false;
@@ -759,9 +759,9 @@ bool InliningDecider::DeciderInlineIntoInliner(Js::FunctionBody * inlinee, Js::F
     }
 
 #if ENABLE_DEBUG_CONFIG_OPTIONS
-    wchar_t debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
-    wchar_t debugStringBuffer2[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
-    wchar_t debugStringBuffer3[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+    char16 debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+    char16 debugStringBuffer2[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+    char16 debugStringBuffer3[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
 #endif
 
     if (inlinee->GetHasLoops())
@@ -874,14 +874,14 @@ bool InliningDecider::DeciderInlineIntoInliner(Js::FunctionBody * inlinee, Js::F
 bool InliningDecider::ContinueInliningUserDefinedFunctions(uint32 bytecodeInlinedCount) const
 {
 #if ENABLE_DEBUG_CONFIG_OPTIONS
-    wchar_t debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+    char16 debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
 #endif
     if (PHASE_FORCE(Js::InlinePhase, this->topFunc) || bytecodeInlinedCount <= (uint)this->threshold.inlineCountMax)
     {
         return true;
     }
 
-    INLINE_TESTTRACE(L"INLINING: Skip Inline: InlineCountMax threshold %d, reached: %s (#%s)\n",
+    INLINE_TESTTRACE(_u("INLINING: Skip Inline: InlineCountMax threshold %d, reached: %s (#%s)\n"),
         (uint)this->threshold.inlineCountMax,
         this->topFunc->GetDisplayName(), this->topFunc->GetDebugNumberSet(debugStringBuffer));
 

+ 3 - 1
lib/Backend/InliningHeuristics.h

@@ -4,6 +4,8 @@
 //-------------------------------------------------------------------------------------------------------
 #pragma once
 
+class InliningDecider;
+
 struct InliningThreshold
 {
     uint nonLoadByteCodeCount;
@@ -26,7 +28,7 @@ struct InliningThreshold
 
 class InliningHeuristics
 {
-    friend class InliningDecider;
+    friend class ::InliningDecider;
 
     const FunctionJITTimeInfo * topFunc;
     InliningThreshold threshold;

+ 1 - 1
lib/Backend/JITObjTypeSpecFldInfo.h

@@ -61,7 +61,7 @@ public:
         _Inout_updates_(arrayLength) ObjTypeSpecFldIDL * jitData);
 
     // TODO: OOP JIT, implement this
-    wchar_t* GetCacheLayoutString() { __debugbreak(); return nullptr; }
+    char16* GetCacheLayoutString() { __debugbreak(); return nullptr; }
 
 private:
     Js::ObjTypeSpecFldInfoFlags GetFlags() const;

+ 2 - 2
lib/Backend/JITTimeFunctionBody.cpp

@@ -232,7 +232,7 @@ JITTimeFunctionBody::InitializeJITFunctionData(
     jitBody->hasFinally = functionBody->GetHasFinally();
 
     jitBody->nameLength = functionBody->GetDisplayNameLength() + 1; // +1 for null terminator
-    jitBody->displayName = (wchar_t *)functionBody->GetDisplayName();
+    jitBody->displayName = (char16 *)functionBody->GetDisplayName();
     jitBody->objectLiteralTypesAddr = (intptr_t)functionBody->GetObjectLiteralTypes();
     jitBody->literalRegexCount = functionBody->GetLiteralRegexCount();
     jitBody->literalRegexes = (intptr_t*)functionBody->GetLiteralRegexes();
@@ -1085,7 +1085,7 @@ JITTimeFunctionBody::InitializeStatementMap(Js::SmallSpanSequence * statementMap
     return true;
 }
 
-wchar_t*
+char16*
 JITTimeFunctionBody::GetDisplayName() const
 {
     return m_bodyData.displayName;

+ 1 - 1
lib/Backend/JITTimeFunctionBody.h

@@ -174,7 +174,7 @@ public:
 
     static bool LoopContains(const JITLoopHeaderIDL * loop1, const JITLoopHeaderIDL * loop2);
 
-    wchar_t* GetDisplayName() const;
+    char16* GetDisplayName() const;
 
     intptr_t GetAuxDataAddr(uint offset) const;
     const Js::PropertyIdArray * ReadPropertyIdArrayFromAuxData(uint offset) const;

+ 1 - 1
lib/Backend/JITTimeProfileInfo.cpp

@@ -3,7 +3,7 @@
 // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 //-------------------------------------------------------------------------------------------------------
 
-#include "BackEnd.h"
+#include "Backend.h"
 
 JITTimeProfileInfo::JITTimeProfileInfo(ProfileDataIDL * profileData) :
     m_profileData(*profileData)

+ 2 - 2
lib/Backend/JITType.cpp

@@ -111,13 +111,13 @@ JITTypeHolder::operator!=(const JITTypeHolder& p) const
 }
 
 bool
-JITTypeHolder::operator==(const nullptr_t &p) const
+JITTypeHolder::operator==(const std::nullptr_t &p) const
 {
     return this->t == nullptr;
 }
 
 bool
-JITTypeHolder::operator!=(const nullptr_t &p) const
+JITTypeHolder::operator!=(const std::nullptr_t &p) const
 {
     return this->t != nullptr;
 }

+ 2 - 2
lib/Backend/JITType.h

@@ -44,8 +44,8 @@ public:
     bool operator< (const JITTypeHolder& p) const;
     bool operator<= (const JITTypeHolder& p) const;
     void operator =(const JITTypeHolder &p);
-    bool operator== (const nullptr_t &p) const;
-    bool operator!= (const nullptr_t &p) const;
+    bool operator== (const std::nullptr_t &p) const;
+    bool operator!= (const std::nullptr_t &p) const;
 
 private:
     // prevent implicit conversion

+ 1 - 1
lib/Backend/JITTypeHandler.cpp

@@ -3,7 +3,7 @@
 // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
 //-------------------------------------------------------------------------------------------------------
 
-#include "BackEnd.h"
+#include "Backend.h"
 
 JITTypeHandler::JITTypeHandler(TypeHandlerIDL * data)
 {

+ 2 - 2
lib/Backend/LinearScan.cpp

@@ -3241,7 +3241,7 @@ LinearScan::InsertStores(Lifetime *lifetime, RegNum reg, IR::Instr *insertionIns
     if (sym->m_isSingleDef)
     {
         IR::Instr * defInstr = sym->m_instrDef;
-        if (!sym->IsConst() && defInstr->GetDst()->AsRegOpnd()->GetReg() == RegNOREG
+        if ((!sym->IsConst() && defInstr->GetDst()->AsRegOpnd()->GetReg() == RegNOREG)
             || this->secondChanceRegs.Test(reg))
         {
             // This can happen if we were trying to allocate this lifetime,
@@ -4014,7 +4014,7 @@ LinearScan::InsertSecondChanceCompensation(Lifetime ** branchRegContent, Lifetim
                                            IR::BranchInstr *branchInstr, IR::LabelInstr *labelInstr)
 {
     IR::Instr *prevInstr = branchInstr->GetPrevRealInstrOrLabel();
-    bool needsAirlock = branchInstr->IsConditional() || (prevInstr->IsBranchInstr() && prevInstr->AsBranchInstr()->IsConditional() || branchInstr->IsMultiBranch());
+    bool needsAirlock = branchInstr->IsConditional() || (prevInstr->IsBranchInstr() && prevInstr->AsBranchInstr()->IsConditional()) || branchInstr->IsMultiBranch();
     bool hasAirlock = false;
     IR::Instr *insertionInstr = branchInstr;
     IR::Instr *insertionStartInstr = branchInstr->m_prev;

+ 15 - 15
lib/Backend/Lower.cpp

@@ -156,7 +156,7 @@ Lowerer::LowerRange(IR::Instr *instrStart, IR::Instr *instrEnd, bool defaultDoFa
         // The instr can have just debugger bailout, or debugger bailout + other shared bailout.
         // Note that by the time we get here, we should not have aux-only bailout (in globopt we promote it to normal bailout).
         if (m_func->IsJitInDebugMode() && instr->HasBailOutInfo() &&
-            ((instr->GetBailOutKind() & IR::BailOutForDebuggerBits) && instr->m_opcode != Js::OpCode::BailForDebugger ||
+            (((instr->GetBailOutKind() & IR::BailOutForDebuggerBits) && instr->m_opcode != Js::OpCode::BailForDebugger) ||
             instr->HasAuxBailOut()))
         {
             instr = this->SplitBailForDebugger(instr);  // Change instr, as returned is the one we need to lower next.
@@ -3349,7 +3349,7 @@ Lowerer::TryGenerateFastBrEq(IR::Instr * instr)
 
     // Fast path for == null or == undefined
     // if (src == null || src == undefined)
-    if (isConst || srcReg2 && this->IsNullOrUndefRegOpnd(srcReg2))
+    if (isConst || (srcReg2 && this->IsNullOrUndefRegOpnd(srcReg2)))
     {
         IR::BranchInstr *newBranch;
         newBranch = this->GenerateFastBrConst(instr->AsBranchInstr(),
@@ -7036,7 +7036,7 @@ Lowerer::PinTypeRef(JITTypeHolder type, void* typeRef, IR::Instr* instr, Js::Pro
         Output::Print(_u("PinnedTypes: function %s(%s) instr %s property %s(#%u) pinned %s reference 0x%p to type 0x%p.\n"),
             this->m_func->GetJITFunctionBody()->GetDisplayName(), this->m_func->GetDebugNumberSet(debugStringBuffer),
             Js::OpCodeUtil::GetOpCodeName(instr->m_opcode), m_func->GetThreadContextInfo()->GetPropertyRecord(propertyId)->GetBuffer(), propertyId,
-            typeRef == type.t ? L"strong" : L"weak", typeRef, type.t);
+            typeRef == type.t ? _u("strong") : _u("weak"), typeRef, type.t);
         Output::Flush();
     }
 }
@@ -13479,8 +13479,8 @@ bool Lowerer::ShouldGenerateArrayFastPath(
         return true;
     }
 
-    if( !supportsObjectsWithArrays && arrayValueType.GetObjectType() == ObjectType::ObjectWithArray ||
-        !supportsTypedArrays && arrayValueType.IsLikelyTypedArray())
+    if( (!supportsObjectsWithArrays && arrayValueType.GetObjectType() == ObjectType::ObjectWithArray) ||
+        (!supportsTypedArrays && arrayValueType.IsLikelyTypedArray()) )
     {
         // The fast path likely would not hit
         return false;
@@ -13935,8 +13935,8 @@ IR::BranchInstr *Lowerer::InsertCompareBranch(
             // Check for compare with zero, to prefer using Test instead of Cmp
             if( !compareSrc1->IsRegOpnd() ||
                 !(
-                    compareSrc2->IsIntConstOpnd() && compareSrc2->AsIntConstOpnd()->GetValue() == 0 ||
-                    compareSrc2->IsAddrOpnd() && !compareSrc2->AsAddrOpnd()->m_address
+                    (compareSrc2->IsIntConstOpnd() && compareSrc2->AsIntConstOpnd()->GetValue() == 0) ||
+                    (compareSrc2->IsAddrOpnd() && !compareSrc2->AsAddrOpnd()->m_address)
                 ) ||
                 branchOpCode == Js::OpCode::BrGt_A || branchOpCode == Js::OpCode::BrLe_A)
             {
@@ -14793,9 +14793,9 @@ Lowerer::GenerateFastElemIIntIndexCommon(
         {
             if(pLabelSegmentLengthIncreased &&
                 !(
-                    baseValueType.IsArrayOrObjectWithArray() && baseValueType.HasNoMissingValues() ||
-                    (instr->m_opcode == Js::OpCode::StElemI_A || instr->m_opcode == Js::OpCode::StElemI_A_Strict) &&
-                        instr->IsProfiledInstr() && !instr->AsProfiledInstr()->u.stElemInfo->LikelyFillsMissingValue()
+                    (baseValueType.IsArrayOrObjectWithArray() && baseValueType.HasNoMissingValues()) ||
+                    ((instr->m_opcode == Js::OpCode::StElemI_A || instr->m_opcode == Js::OpCode::StElemI_A_Strict) &&
+                        instr->IsProfiledInstr() && !instr->AsProfiledInstr()->u.stElemInfo->LikelyFillsMissingValue())
                 ))
             {
                 // For arrays that are not guaranteed to have no missing values, before storing to an element where
@@ -15485,10 +15485,10 @@ Lowerer::GenerateFastLdElemI(IR::Instr *& ldElem, bool *instrIsInHelperBlockRef)
         const IR::AutoReuseOpnd autoReuseIndirOpnd(indirOpnd, m_func);
         const ValueType baseValueType(src1->AsIndirOpnd()->GetBaseOpnd()->GetValueType());
 
-        if (ldElem->HasBailOutInfo() &&
-            ldElem->GetByteCodeOffset() != Js::Constants::NoByteCodeOffset &&
-            ldElem->GetBailOutInfo()->bailOutOffset <= ldElem->GetByteCodeOffset() &&
-            dst->IsEqual(src1->AsIndirOpnd()->GetBaseOpnd()) ||
+        if ((ldElem->HasBailOutInfo() &&
+                ldElem->GetByteCodeOffset() != Js::Constants::NoByteCodeOffset &&
+                ldElem->GetBailOutInfo()->bailOutOffset <= ldElem->GetByteCodeOffset() &&
+                dst->IsEqual(src1->AsIndirOpnd()->GetBaseOpnd())) ||
             (src1->AsIndirOpnd()->GetIndexOpnd() && dst->IsEqual(src1->AsIndirOpnd()->GetIndexOpnd())))
         {
             // This is a pre-op bailout where the dst is the same as one of the srcs. The dst may be trashed before bailing out,
@@ -16331,7 +16331,7 @@ Lowerer::GenerateFastStElemI(IR::Instr *& stElem, bool *instrIsInHelperBlockRef)
             InsertBranch(Js::OpCode::Br, labelFallThru, insertBeforeInstr);
         }
 
-        if (!(isStringIndex || baseValueType.IsArrayOrObjectWithArray() && baseValueType.HasNoMissingValues()))
+        if (!(isStringIndex || (baseValueType.IsArrayOrObjectWithArray() && baseValueType.HasNoMissingValues())))
         {
             if(!stElem->IsProfiledInstr() || stElem->AsProfiledInstr()->u.stElemInfo->LikelyFillsMissingValue())
             {

+ 43 - 35
lib/Backend/NativeCodeGenerator.cpp

@@ -864,12 +864,12 @@ NativeCodeGenerator::CodeGen(PageAllocator * pageAllocator, CodeGenWorkItem* wor
     workItem->GetJITData()->nativeDataAddr = (__int3264)workItem->GetEntryPoint()->GetNativeDataBufferRef();
 
     // TODO: oop jit can we be more efficient here?
-    ArenaAllocator alloc(L"JitData", pageAllocator, Js::Throw::OutOfMemory);
+    ArenaAllocator alloc(_u("JitData"), pageAllocator, Js::Throw::OutOfMemory);
 
     auto& jitData = workItem->GetJITData()->jitData;
     jitData = AnewStructZ(&alloc, FunctionJITTimeDataIDL);
     FunctionJITTimeInfo::BuildJITTimeData(&alloc, workItem->RecyclableData()->JitTimeData(), nullptr, workItem->GetJITData()->jitData, false);
-    
+
     Js::EntryPointInfo * epInfo = workItem->GetEntryPoint();
     if (workItem->Type() == JsFunctionType)
     {
@@ -880,7 +880,7 @@ NativeCodeGenerator::CodeGen(PageAllocator * pageAllocator, CodeGenWorkItem* wor
     {
         workItem->GetJITData()->jittedLoopIterationsSinceLastBailoutAddr = (intptr_t)Js::FunctionBody::GetJittedLoopIterationsSinceLastBailoutAddress(epInfo);
     }
-    
+
     jitData->sharedPropertyGuards = epInfo->GetSharedPropertyGuardsWithLock(&alloc, jitData->sharedPropGuardCount);
 
     JITOutputIDL jitWriteData = {0};
@@ -917,7 +917,7 @@ NativeCodeGenerator::CodeGen(PageAllocator * pageAllocator, CodeGenWorkItem* wor
     {
         CodeGenAllocators *const allocators =
             foreground ? EnsureForegroundAllocators(pageAllocator) : GetBackgroundAllocator(pageAllocator); // okay to do outside lock since the respective function is called only from one thread
-        NoRecoverMemoryJitArenaAllocator jitArena(L"JITArena", pageAllocator, Js::Throw::OutOfMemory);
+        NoRecoverMemoryJitArenaAllocator jitArena(_u("JITArena"), pageAllocator, Js::Throw::OutOfMemory);
 
         JITTimeWorkItem * jitWorkItem = Anew(&jitArena, JITTimeWorkItem, workItem->GetJITData());
 
@@ -953,7 +953,7 @@ NativeCodeGenerator::CodeGen(PageAllocator * pageAllocator, CodeGenWorkItem* wor
         QueryPerformanceFrequency(&freq);
 
         Output::Print(
-            L"BackendMarshalOut - function: %s time:%8.6f mSec\r\n",
+            _u("BackendMarshalOut - function: %s time:%8.6f mSec\r\n"),
             workItem->GetFunctionBody()->GetDisplayName(),
             (((double)((end_time.QuadPart - jitWriteData.startTime)* (double)1000.0 / (double)freq.QuadPart))) / (1));
         Output::Flush();
@@ -1000,7 +1000,7 @@ NativeCodeGenerator::CodeGen(PageAllocator * pageAllocator, CodeGenWorkItem* wor
 
                 if (PHASE_TRACE1(Js::NativeCodeDataPhase))
                 {
-                    Output::Print(L"NativeCodeData Fixup: allocIndex:%d, len:%x, totalOffset:%x, startAddress:%p\n",
+                    Output::Print(_u("NativeCodeData Fixup: allocIndex:%d, len:%x, totalOffset:%x, startAddress:%p\n"),
                         record.index, record.length, record.startOffset, jitWriteData.buffer->data + record.startOffset);
                 }
 
@@ -1011,7 +1011,7 @@ NativeCodeGenerator::CodeGen(PageAllocator * pageAllocator, CodeGenWorkItem* wor
 
                     if (PHASE_TRACE1(Js::NativeCodeDataPhase))
                     {
-                        Output::Print(L"\tEntry: +%x %p(%p) ==> %p\n", updateList->addrOffset, addrToFixup, *(void**)(addrToFixup), targetAddr);
+                        Output::Print(_u("\tEntry: +%x %p(%p) ==> %p\n"), updateList->addrOffset, addrToFixup, *(void**)(addrToFixup), targetAddr);
                     }
 
                     *(void**)(addrToFixup) = targetAddr;
@@ -1029,7 +1029,7 @@ NativeCodeGenerator::CodeGen(PageAllocator * pageAllocator, CodeGenWorkItem* wor
 #if DBG
             if (PHASE_TRACE1(Js::NativeCodeDataPhase))
             {
-                Output::Print(L"NativeCodeData Client Buffer: %p, len: %x\n", jitWriteData.buffer->data, jitWriteData.buffer->len);
+                Output::Print(_u("NativeCodeData Client Buffer: %p, len: %x\n"), jitWriteData.buffer->data, jitWriteData.buffer->len);
             }
 #endif
         }
@@ -1208,17 +1208,17 @@ void NativeCodeGenerator::LogCodeGenStart(CodeGenWorkItem * workItem, LARGE_INTE
     {
         if (workItem->GetEntryPoint()->IsLoopBody())
         {
-            Output::Print(L"---BeginBackEnd: function: %s, loop:%d---\r\n", body->GetDisplayName(), ((JsLoopBodyCodeGen*)workItem)->GetLoopNumber());
+            Output::Print(_u("---BeginBackEnd: function: %s, loop:%d---\r\n"), body->GetDisplayName(), ((JsLoopBodyCodeGen*)workItem)->GetLoopNumber());
         }
         else
         {
-            Output::Print(L"---BeginBackEnd: function: %s---\r\n", body->GetDisplayName());
+            Output::Print(_u("---BeginBackEnd: function: %s---\r\n"), body->GetDisplayName());
         }
         Output::Flush();
     }
 #endif
 
-    wchar_t debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+    char16 debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
 
     if (PHASE_TRACE(Js::BackEndPhase, body))
     {
@@ -1226,7 +1226,7 @@ void NativeCodeGenerator::LogCodeGenStart(CodeGenWorkItem * workItem, LARGE_INTE
         if (workItem->GetEntryPoint()->IsLoopBody())
         {
             Output::Print(
-                L"BeginBackEnd - function: %s (%s, line %u), loop: %u, mode: %S",
+                _u("BeginBackEnd - function: %s (%s, line %u), loop: %u, mode: %S"),
                 body->GetDisplayName(),
                 body->GetDebugNumberSet(debugStringBuffer),
                 body->GetLineNumber(),
@@ -1234,17 +1234,17 @@ void NativeCodeGenerator::LogCodeGenStart(CodeGenWorkItem * workItem, LARGE_INTE
                 ExecutionModeName(workItem->GetJitMode()));
             if (body->GetIsAsmjsMode())
             {
-                Output::Print(L" (Asmjs)\n");
+                Output::Print(_u(" (Asmjs)\n"));
             }
             else
             {
-                Output::Print(L"\n");
+                Output::Print(_u("\n"));
             }
         }
         else
         {
             Output::Print(
-                L"BeginBackEnd - function: %s (%s, line %u), mode: %S",
+                _u("BeginBackEnd - function: %s (%s, line %u), mode: %S"),
                 body->GetDisplayName(),
                 body->GetDebugNumberSet(debugStringBuffer),
                 body->GetLineNumber(),
@@ -1252,11 +1252,11 @@ void NativeCodeGenerator::LogCodeGenStart(CodeGenWorkItem * workItem, LARGE_INTE
 
             if (body->GetIsAsmjsMode())
             {
-                Output::Print(L" (Asmjs)\n");
+                Output::Print(_u(" (Asmjs)\n"));
             }
             else
             {
-                Output::Print(L"\n");
+                Output::Print(_u("\n"));
             }
         }
         Output::Flush();
@@ -1268,18 +1268,18 @@ void NativeCodeGenerator::LogCodeGenStart(CodeGenWorkItem * workItem, LARGE_INTE
         if (workItem->RecyclableData()->JitTimeData()->inlineCacheStats)
         {
             auto stats = workItem->RecyclableData()->JitTimeData()->inlineCacheStats;
-            Output::Print(L"ObjTypeSpec: jitting function %s (#%s): inline cache stats:\n", body->GetDisplayName(), body->GetDebugNumberSet(debugStringBuffer));
-            Output::Print(L"    overall: total %u, no profile info %u\n", stats->totalInlineCacheCount, stats->noInfoInlineCacheCount);
-            Output::Print(L"    mono: total %u, empty %u, cloned %u\n",
+            Output::Print(_u("ObjTypeSpec: jitting function %s (#%s): inline cache stats:\n"), body->GetDisplayName(), body->GetDebugNumberSet(debugStringBuffer));
+            Output::Print(_u("    overall: total %u, no profile info %u\n"), stats->totalInlineCacheCount, stats->noInfoInlineCacheCount);
+            Output::Print(_u("    mono: total %u, empty %u, cloned %u\n"),
                 stats->monoInlineCacheCount, stats->emptyMonoInlineCacheCount, stats->clonedMonoInlineCacheCount);
-            Output::Print(L"    poly: total %u (high %u, low %u), null %u, empty %u, ignored %u, disabled %u, equivalent %u, non-equivalent %u, cloned %u\n",
+            Output::Print(_u("    poly: total %u (high %u, low %u), null %u, empty %u, ignored %u, disabled %u, equivalent %u, non-equivalent %u, cloned %u\n"),
                 stats->polyInlineCacheCount, stats->highUtilPolyInlineCacheCount, stats->lowUtilPolyInlineCacheCount,
                 stats->nullPolyInlineCacheCount, stats->emptyPolyInlineCacheCount, stats->ignoredPolyInlineCacheCount, stats->disabledPolyInlineCacheCount,
                 stats->equivPolyInlineCacheCount, stats->nonEquivPolyInlineCacheCount, stats->clonedPolyInlineCacheCount);
         }
         else
         {
-            Output::Print(L"EquivObjTypeSpec: function %s (%s): inline cache stats unavailable\n", body->GetDisplayName(), body->GetDebugNumberSet(debugStringBuffer));
+            Output::Print(_u("EquivObjTypeSpec: function %s (%s): inline cache stats unavailable\n"), body->GetDisplayName(), body->GetDebugNumberSet(debugStringBuffer));
         }
         Output::Flush();
     }
@@ -1290,7 +1290,7 @@ void NativeCodeGenerator::LogCodeGenStart(CodeGenWorkItem * workItem, LARGE_INTE
 void NativeCodeGenerator::LogCodeGenDone(CodeGenWorkItem * workItem, LARGE_INTEGER * start_time)
 {
     Js::FunctionBody * body = workItem->GetFunctionBody();
-    wchar_t debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+    char16 debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
 
     {
         if (IS_JS_ETW(EventEnabledJSCRIPT_FUNCTION_JIT_STOP()))
@@ -1324,7 +1324,7 @@ void NativeCodeGenerator::LogCodeGenDone(CodeGenWorkItem * workItem, LARGE_INTEG
 #if DBG_DUMP
     if (Js::Configuration::Global.flags.TestTrace.IsEnabled(Js::BackEndPhase))
     {
-        Output::Print(L"---EndBackEnd---\r\n");
+        Output::Print(_u("---EndBackEnd---\r\n"));
         Output::Flush();
     }
 #endif
@@ -1338,7 +1338,7 @@ void NativeCodeGenerator::LogCodeGenDone(CodeGenWorkItem * workItem, LARGE_INTEG
         if (workItem->GetEntryPoint()->IsLoopBody())
         {
             Output::Print(
-                L"EndBackEnd - function: %s (%s, line %u), loop: %u, mode: %S, time:%8.6f mSec",
+                _u("EndBackEnd - function: %s (%s, line %u), loop: %u, mode: %S, time:%8.6f mSec"),
                 body->GetDisplayName(),
                 body->GetDebugNumberSet(debugStringBuffer),
                 body->GetLineNumber(),
@@ -1348,17 +1348,17 @@ void NativeCodeGenerator::LogCodeGenDone(CodeGenWorkItem * workItem, LARGE_INTEG
 
             if (body->GetIsAsmjsMode())
             {
-                Output::Print(L" (Asmjs)\n");
+                Output::Print(_u(" (Asmjs)\n"));
             }
             else
             {
-                Output::Print(L"\n");
+                Output::Print(_u("\n"));
             }
         }
         else
         {
             Output::Print(
-                L"EndBackEnd - function: %s (%s, line %u), mode: %S time:%8.6f mSec",
+                _u("EndBackEnd - function: %s (%s, line %u), mode: %S time:%8.6f mSec"),
                 body->GetDisplayName(),
                 body->GetDebugNumberSet(debugStringBuffer),
                 body->GetLineNumber(),
@@ -1367,11 +1367,11 @@ void NativeCodeGenerator::LogCodeGenDone(CodeGenWorkItem * workItem, LARGE_INTEG
 
             if (body->GetIsAsmjsMode())
             {
-                Output::Print(L" (Asmjs)\n");
+                Output::Print(_u(" (Asmjs)\n"));
             }
             else
             {
-                Output::Print(L"\n");
+                Output::Print(_u("\n"));
             }
         }
         Output::Flush();
@@ -1496,15 +1496,16 @@ NativeCodeGenerator::CheckAsmJsCodeGen(Js::ScriptFunction * function)
         {
             Output::Print(_u("Codegen not done yet for function: %s, Entrypoint is CheckAsmJsCodeGenThunk\n"), function->GetFunctionBody()->GetDisplayName());
         }
-        return reinterpret_cast<Js::JavascriptMethod>(entryPoint->GetNativeAddress());
+        return reinterpret_cast<Js::Var>(entryPoint->GetNativeAddress());
     }
     if (PHASE_TRACE1(Js::AsmjsEntryPointInfoPhase))
     {
         Output::Print(_u("CodeGen Done for function: %s, Changing Entrypoint to Full JIT\n"), function->GetFunctionBody()->GetDisplayName());
     }
     // we will need to set the functionbody external and asmjs entrypoint to the fulljit entrypoint
-    return CheckCodeGenDone(functionBody, entryPoint, function);
+    return reinterpret_cast<Js::Var>(CheckCodeGenDone(functionBody, entryPoint, function));
 }
+
 Js::JavascriptMethod
 NativeCodeGenerator::CheckCodeGen(Js::ScriptFunction * function)
 {
@@ -1548,6 +1549,13 @@ NativeCodeGenerator::CheckCodeGen(Js::ScriptFunction * function)
 
     if(!nativeCodeGen->Processor()->PrioritizeJob(nativeCodeGen, entryPoint, function))
     {
+#ifdef ENABLE_SCRIPT_PROFILING
+#define originalEntryPoint_IS_ProfileDeferredParsingThunk \
+            (originalEntryPoint == ProfileDeferredParsingThunk)
+#else
+#define originalEntryPoint_IS_ProfileDeferredParsingThunk \
+            false
+#endif
         // Job was not yet processed
         // originalEntryPoint is the last known good entry point for the function body. Here we verify that
         // it either corresponds with this codegen episode (identified by function->entryPointIndex) of the function body
@@ -1557,7 +1565,7 @@ NativeCodeGenerator::CheckCodeGen(Js::ScriptFunction * function)
             (
                 originalEntryPoint == DefaultEntryThunk
              || scriptContext->IsDynamicInterpreterThunk(originalEntryPoint)
-             || originalEntryPoint == ProfileDeferredParsingThunk
+             || originalEntryPoint_IS_ProfileDeferredParsingThunk
              || originalEntryPoint == DefaultDeferredParsingThunk
              || (
                     functionBody->GetSimpleJitEntryPointInfo() &&
@@ -3143,14 +3151,14 @@ NativeCodeGenerator::EnterScriptStart()
 }
 
 void
-FreeNativeCodeGenAllocation(Js::ScriptContext *scriptContext, void * address)
+FreeNativeCodeGenAllocation(Js::ScriptContext *scriptContext, Js::JavascriptMethod address)
 {
     if (!scriptContext->GetNativeCodeGenerator())
     {
         return;
     }
 
-    scriptContext->GetNativeCodeGenerator()->QueueFreeNativeCodeGenAllocation(address);
+    scriptContext->GetNativeCodeGenerator()->QueueFreeNativeCodeGenAllocation((void*)address);
 }
 
 bool TryReleaseNonHiPriWorkItem(Js::ScriptContext* scriptContext, CodeGenWorkItem* workItem)

+ 1 - 0
lib/Backend/NativeCodeGenerator.h

@@ -12,6 +12,7 @@ namespace Js
 {
     class ObjTypeSpecFldInfo;
     class FunctionCodeGenJitTimeData;
+    class RemoteScriptContext;
 };
 
 class NativeCodeGenerator sealed : public JsUtil::WaitableJobManager

+ 2 - 2
lib/Backend/Opnd.cpp

@@ -91,7 +91,7 @@ Opnd::IsWriteBarrierTriggerableValue()
     // If this operand is known address, then it doesn't need a write barrier, the address is either not a GC address or is pinned
     // If its null/boolean/undefined, we don't need a write barrier since the javascript library will keep those guys alive
     return this->IsNotTaggedValue() &&
-        !((this->IsAddrOpnd() && this->AsAddrOpnd()->GetKind() == AddrOpndKindDynamicVar) ||
+        !((this->IsAddrOpnd() && static_cast<AddrOpndKind>(this->AsAddrOpnd()->GetKind()) == AddrOpndKindDynamicVar) ||
           (this->GetValueType().IsBoolean() || this->GetValueType().IsNull() || this->GetValueType().IsUndefined()));
 }
 
@@ -3141,7 +3141,7 @@ Opnd::DumpOpndKindMemRef(bool AsmDumpMode, Func *func)
 void
 Opnd::WriteToBuffer(_Outptr_result_buffer_(*count) char16 **buffer, size_t *count, const char16 *fmt, ...)
 {
-    va_list argptr = nullptr;
+    va_list argptr;
     va_start(argptr, fmt);
 
     int len = _vsnwprintf_s(*buffer, *count, _TRUNCATE, fmt, argptr);

+ 2 - 2
lib/Backend/SccLiveness.cpp

@@ -769,8 +769,8 @@ SCCLiveness::FoldIndir(IR::Instr *instr, IR::Opnd *opnd)
 
         // offset = indir.offset + (index << scale)
         int32 offset = index->m_sym->GetIntConstValue();
-        if(indir->GetScale() != 0 && Int32Math::Shl(offset, indir->GetScale(), &offset) ||
-            indir->GetOffset() != 0 && Int32Math::Add(indir->GetOffset(), offset, &offset))
+        if((indir->GetScale() != 0 && Int32Math::Shl(offset, indir->GetScale(), &offset)) ||
+           (indir->GetOffset() != 0 && Int32Math::Add(indir->GetOffset(), offset, &offset)))
         {
             return false;
         }

+ 5 - 5
lib/Backend/ServerScriptContext.cpp

@@ -281,13 +281,13 @@ ServerScriptContext::Close()
 void
 ServerScriptContext::BeginJIT()
 {
-    InterlockedExchangeAdd(&m_activeJITCount, 1);
+    InterlockedExchangeAdd(&m_activeJITCount, 1u);
 }
 
 void
 ServerScriptContext::EndJIT()
 {
-    InterlockedExchangeSubtract(&m_activeJITCount, 1);
+    InterlockedExchangeSubtract(&m_activeJITCount, 1u);
 }
 
 bool
@@ -296,8 +296,8 @@ ServerScriptContext::IsJITActive()
     return m_activeJITCount != 0;
 }
 
-Js::Var* 
-ServerScriptContext::GetModuleExportSlotArrayAddress(uint moduleIndex, uint slotIndex) 
+Js::Var*
+ServerScriptContext::GetModuleExportSlotArrayAddress(uint moduleIndex, uint slotIndex)
 {
     Assert(m_moduleRecords.ContainsKey(moduleIndex));
     auto record = m_moduleRecords.Item(moduleIndex);
@@ -310,7 +310,7 @@ ServerScriptContext::SetIsPRNGSeeded(bool value)
     m_isPRNGSeeded = value;
 }
 
-void 
+void
 ServerScriptContext::AddModuleRecordInfo(unsigned int moduleId, __int64 localExportSlotsAddr)
 {
     Js::ServerSourceTextModuleRecord* record = HeapNewStructZ(Js::ServerSourceTextModuleRecord);

+ 5 - 5
lib/Backend/ServerThreadContext.cpp

@@ -15,9 +15,9 @@ ServerThreadContext::ServerThreadContext(ThreadContextDataIDL * data) :
     m_codeGenAlloc(&m_policyManager, nullptr, &m_codePageAllocators, (HANDLE)data->processHandle),
     // TODO: OOP JIT, don't hardcode name
 #ifdef NTBUILD
-    m_jitChakraBaseAddress((intptr_t)GetModuleHandle(L"Chakra.dll")),
+    m_jitChakraBaseAddress((intptr_t)GetModuleHandle(_u("Chakra.dll"))),
 #else
-    m_jitChakraBaseAddress((intptr_t)GetModuleHandle(L"ChakraCore.dll")),
+    m_jitChakraBaseAddress((intptr_t)GetModuleHandle(_u("ChakraCore.dll"))),
 #endif
     m_jitCRTBaseAddress((intptr_t)GetModuleHandle(UCrtC99MathApis::LibraryName))
 {
@@ -29,10 +29,10 @@ ServerThreadContext::ServerThreadContext(ThreadContextDataIDL * data) :
 
 ServerThreadContext::~ServerThreadContext()
 {
-    // TODO: OOP JIT, clear out elements of map. maybe should arena alloc?    
+    // TODO: OOP JIT, clear out elements of map. maybe should arena alloc?
     if (this->m_propertyMap != nullptr)
     {
-        this->m_propertyMap->Map([](const Js::PropertyRecord* record) 
+        this->m_propertyMap->Map([](const Js::PropertyRecord* record)
         {
             size_t allocLength = record->byteCount + sizeof(char16) + (record->isNumeric ? sizeof(uint32) : 0);
             HeapDeletePlus(allocLength, const_cast<Js::PropertyRecord*>(record));
@@ -126,7 +126,7 @@ ServerThreadContext::GetImplicitCallFlagsAddr() const
     return static_cast<intptr_t>(m_threadContextData.implicitCallFlagsAddr);
 }
 
-#if defined(_M_IX86) || defined(_M_X64)
+#if defined(ENABLE_SIMDJS) && (defined(_M_IX86) || defined(_M_X64))
 intptr_t
 ServerThreadContext::GetSimdTempAreaAddr(uint8 tempIndex) const
 {

+ 1 - 1
lib/Backend/ServerThreadContext.h

@@ -19,7 +19,7 @@ public:
 
     virtual intptr_t GetThreadStackLimitAddr() const override;
 
-#if defined(_M_IX86) || defined(_M_X64)
+#if defined(ENABLE_SIMDJS) && (defined(_M_IX86) || defined(_M_X64))
     virtual intptr_t GetSimdTempAreaAddr(uint8 tempIndex) const override;
 #endif
 

+ 3 - 3
lib/Backend/TempTracker.cpp

@@ -240,7 +240,7 @@ TempTracker<T>::ProcessUse(StackSym * sym, BackwardPass * backwardPass)
                 {
                     // Record that the usedSymID may propagate to dstSymID and all the symbols
                     // that it may propagate to as well
-                    AddTransferDependencies(usedSymID, dstSymID, this->tempTransferDependencies);
+                    this->AddTransferDependencies(usedSymID, dstSymID, this->tempTransferDependencies);
 #if DBG_DUMP
                     if (T::DoTrace(backwardPass))
                     {
@@ -258,7 +258,7 @@ TempTracker<T>::ProcessUse(StackSym * sym, BackwardPass * backwardPass)
     {
         this->tempTransferredSyms.Set(usedSymID);
         PropertySym * propertySym = instr->GetDst()->AsSymOpnd()->m_sym->AsPropertySym();
-        PropagateTempPropertyTransferStoreDependencies(usedSymID, propertySym, backwardPass);
+        this->PropagateTempPropertyTransferStoreDependencies(usedSymID, propertySym, backwardPass);
 
 #if DBG_DUMP
         if (T::DoTrace(backwardPass) && this->tempTransferDependencies)
@@ -1031,7 +1031,7 @@ ObjectTemp::IsTempUseOpCodeSym(IR::Instr * instr, Js::OpCode opcode, Sym * sym)
     case Js::OpCode::StElemI_A_Strict:
         return instr->GetDst()->AsIndirOpnd()->GetBaseOpnd()->m_sym == sym;
     case Js::OpCode::Memset:
-        return instr->GetDst()->AsIndirOpnd()->GetBaseOpnd()->m_sym == sym || instr->GetSrc1()->IsRegOpnd() && instr->GetSrc1()->AsRegOpnd()->m_sym == sym;
+        return instr->GetDst()->AsIndirOpnd()->GetBaseOpnd()->m_sym == sym || (instr->GetSrc1()->IsRegOpnd() && instr->GetSrc1()->AsRegOpnd()->m_sym == sym);
     case Js::OpCode::Memcopy:
         return instr->GetDst()->AsIndirOpnd()->GetBaseOpnd()->m_sym == sym || instr->GetSrc1()->AsIndirOpnd()->GetBaseOpnd()->m_sym == sym;
 

+ 2 - 2
lib/Backend/amd64/EncoderMD.cpp

@@ -1759,8 +1759,8 @@ bool EncoderMD::TryConstFold(IR::Instr *instr, IR::RegOpnd *regOpnd)
 
             // offset = indir.offset + (index << scale)
             int32 offset = regOpnd->m_sym->GetIntConstValue();
-            if (indir->GetScale() != 0 && Int32Math::Shl(offset, indir->GetScale(), &offset) ||
-                indir->GetOffset() != 0 && Int32Math::Add(indir->GetOffset(), offset, &offset))
+            if ((indir->GetScale() != 0 && Int32Math::Shl(offset, indir->GetScale(), &offset)) ||
+                (indir->GetOffset() != 0 && Int32Math::Add(indir->GetOffset(), offset, &offset)))
             {
                 foldedAllUses = false;
                 continue;

+ 1 - 1
lib/Common/BackendApi.h

@@ -60,7 +60,7 @@ void UpdateNativeCodeGeneratorForDebugMode(NativeCodeGenerator* nativeCodeGen);
 CriticalSection *GetNativeCodeGenCriticalSection(NativeCodeGenerator *pNativeCodeGen);
 bool TryReleaseNonHiPriWorkItem(Js::ScriptContext* scriptContext, CodeGenWorkItem* workItem);
 void NativeCodeGenEnterScriptStart(NativeCodeGenerator * nativeCodeGen);
-void FreeNativeCodeGenAllocation(Js::ScriptContext* scriptContext, void* address);
+void FreeNativeCodeGenAllocation(Js::ScriptContext* scriptContext, Js::JavascriptMethod address);
 CodeGenAllocators* GetForegroundAllocator(NativeCodeGenerator * nativeCodeGen, PageAllocator* pageallocator);
 void GenerateFunction(NativeCodeGenerator * nativeCodeGen, Js::FunctionBody * functionBody, Js::ScriptFunction * function = NULL);
 void GenerateLoopBody(NativeCodeGenerator * nativeCodeGen, Js::FunctionBody * functionBody, Js::LoopHeader * loopHeader, Js::EntryPointInfo* entryPointInfo, uint localCount, Js::Var localSlots[]);

+ 1 - 1
lib/Common/Common/Jobs.cpp

@@ -833,7 +833,7 @@ namespace JsUtil
     {
         Assert(manager);
 
-        ParallelThreadData *threadDataProcessingCurrentJob = nullptr;        
+        ParallelThreadData *threadDataProcessingCurrentJob = nullptr;
         {
             AutoCriticalSection lock(&criticalSection);
             // Managers must remove themselves. Hence, Close does not remove managers. So, not asserting on !IsClosed().

+ 9 - 9
lib/Common/Common/Jobs.inl

@@ -13,7 +13,7 @@ namespace JsUtil
     template<class TJobManager>
     void JobProcessor::PrioritizeManagerAndWait(TJobManager *const manager, const unsigned int milliseconds)
     {
-        TemplateParameter::SameOrDerivedFrom<TJobManager, WaitableJobManager>;
+        TemplateParameter::SameOrDerivedFrom<TJobManager, WaitableJobManager> unused;
         Assert(manager);
         Assert(!isClosed);
 
@@ -31,7 +31,7 @@ namespace JsUtil
     template<class TJobManager, class TJobHolder>
     void JobProcessor::AddJobAndProcessProactively(TJobManager *const manager, const TJobHolder holder)
     {
-        TemplateParameter::SameOrDerivedFrom<TJobManager, JobManager>;
+        TemplateParameter::SameOrDerivedFrom<TJobManager, JobManager> unused;
         Assert(manager);
         Assert(!isClosed);
 
@@ -49,7 +49,7 @@ namespace JsUtil
     template<class TJobManager, class TJobHolder>
     bool JobProcessor::PrioritizeJob(TJobManager *const manager, const TJobHolder holder, void* function)
     {
-        TemplateParameter::SameOrDerivedFrom<TJobManager, JobManager>;
+        TemplateParameter::SameOrDerivedFrom<TJobManager, JobManager> unused;
         Assert(manager);
         Assert(!isClosed);
 
@@ -89,7 +89,7 @@ namespace JsUtil
     template<class TJobManager, class TJobHolder>
     void ForegroundJobProcessor::AddJobAndProcessProactively(TJobManager *const manager, const TJobHolder holder)
     {
-        TemplateParameter::SameOrDerivedFrom<TJobManager, JobManager>;
+        TemplateParameter::SameOrDerivedFrom<TJobManager, JobManager> unused;
         Assert(manager);
         Assert(!IsClosed());
 
@@ -106,7 +106,7 @@ namespace JsUtil
     template<class TJobManager>
     void ForegroundJobProcessor::PrioritizeManagerAndWait(TJobManager *const manager, const unsigned int milliseconds)
     {
-        TemplateParameter::SameOrDerivedFrom<TJobManager, WaitableJobManager>;
+        TemplateParameter::SameOrDerivedFrom<TJobManager, WaitableJobManager> unused;
         Assert(manager);
         Assert(manager->isWaitable);
         Assert(!IsClosed());
@@ -154,7 +154,7 @@ namespace JsUtil
     template<class TJobManager, class TJobHolder>
     bool ForegroundJobProcessor::PrioritizeJob(TJobManager *const manager, const TJobHolder holder, void* function)
     {
-        TemplateParameter::SameOrDerivedFrom<TJobManager, JobManager>;
+        TemplateParameter::SameOrDerivedFrom<TJobManager, JobManager> unused;
         Assert(manager);
         Assert(!IsClosed());
 
@@ -219,7 +219,7 @@ namespace JsUtil
     template<class TJobManager, class TJobHolder>
     void BackgroundJobProcessor::AddJobAndProcessProactively(TJobManager *const manager, const TJobHolder holder)
     {
-        TemplateParameter::SameOrDerivedFrom<TJobManager, JobManager>;
+        TemplateParameter::SameOrDerivedFrom<TJobManager, JobManager> unused;
         Assert(manager);
         Assert(!IsClosed());
 
@@ -231,7 +231,7 @@ namespace JsUtil
     template<class TJobManager>
     void BackgroundJobProcessor::PrioritizeManagerAndWait(TJobManager *const manager, const unsigned int milliseconds)
     {
-        TemplateParameter::SameOrDerivedFrom<TJobManager, WaitableJobManager>;
+        TemplateParameter::SameOrDerivedFrom<TJobManager, WaitableJobManager> unused;
         Assert(manager);
         Assert(manager->isWaitable);
 
@@ -316,7 +316,7 @@ namespace JsUtil
     template<class TJobManager, class TJobHolder>
     bool BackgroundJobProcessor::PrioritizeJob(TJobManager *const manager, const TJobHolder holder, void* function)
     {
-        TemplateParameter::SameOrDerivedFrom<TJobManager, JobManager>;
+        TemplateParameter::SameOrDerivedFrom<TJobManager, JobManager> unused;
         Assert(manager);
         Assert(!IsClosed());
 

+ 1 - 1
lib/Common/Core/DelayLoadLibrary.cpp

@@ -50,7 +50,7 @@ bool DelayLoadLibrary::IsAvailable()
     return m_hModule != nullptr;
 }
 
-#if PDATA_ENABLED
+#if PDATA_ENABLED && _WIN32
 
 static NtdllLibrary NtdllLibraryObject;
 NtdllLibrary* NtdllLibrary::Instance = &NtdllLibraryObject;

+ 1 - 1
lib/Common/Core/DelayLoadLibrary.h

@@ -25,7 +25,7 @@ private:
 
 };
 
-#if PDATA_ENABLED
+#if PDATA_ENABLED && _WIN32
 
 // This needs to be delay loaded because it is available on
 // Win8 only

+ 13 - 13
lib/Common/DataStructures/BaseDictionary.h

@@ -1306,15 +1306,15 @@ namespace JsUtil
             {
                 Assert(dictionary.buckets == buckets);
                 Assert(dictionary.bucketCount == bucketCount);
-                Assert(entryIndex >= -1);
-                Assert(entryIndex < dictionary.count);
+                Assert(this->entryIndex >= -1);
+                Assert(this->entryIndex < dictionary.count);
                 Assert(bucketIndex == 0u - 1 || bucketIndex <= bucketCount);
                 Assert(previousEntryIndexInBucket >= -2);
                 Assert(previousEntryIndexInBucket < dictionary.count);
                 Assert(indexOfEntryAfterRemovedEntry >= -2);
                 Assert(indexOfEntryAfterRemovedEntry < dictionary.count);
 
-                return Base::IsValid() && entryIndex >= 0;
+                return Base::IsValid() && this->entryIndex >= 0;
             }
 
         public:
@@ -1322,13 +1322,13 @@ namespace JsUtil
             {
                 if(IsValid())
                 {
-                    previousEntryIndexInBucket = entryIndex;
-                    entryIndex = Current().next;
+                    previousEntryIndexInBucket = this->entryIndex;
+                    this->entryIndex = this->Current().next;
                 }
                 else
                 {
                     Assert(indexOfEntryAfterRemovedEntry >= -1);
-                    entryIndex = indexOfEntryAfterRemovedEntry;
+                    this->entryIndex = indexOfEntryAfterRemovedEntry;
                 }
 
                 if(!IsValid())
@@ -1344,7 +1344,7 @@ namespace JsUtil
 
                 while(++bucketIndex < bucketCount)
                 {
-                    entryIndex = buckets[bucketIndex];
+                    this->entryIndex = buckets[bucketIndex];
                     if(IsValid())
                     {
                         previousEntryIndexInBucket = -1;
@@ -1358,10 +1358,10 @@ namespace JsUtil
             {
                 Assert(previousEntryIndexInBucket >= -1);
 
-                indexOfEntryAfterRemovedEntry = Current().next;
-                dictionary.RemoveAt(entryIndex, previousEntryIndexInBucket, bucketIndex);
-                OnEntryRemoved();
-                entryIndex = -1;
+                indexOfEntryAfterRemovedEntry = this->Current().next;
+                dictionary.RemoveAt(this->entryIndex, previousEntryIndexInBucket, bucketIndex);
+                this->OnEntryRemoved();
+                this->entryIndex = -1;
             }
         };
 
@@ -1525,12 +1525,12 @@ namespace JsUtil
 
         BaseHashSet *Clone()
         {
-            return AllocatorNew(AllocatorType, alloc, BaseHashSet, *this);
+            return AllocatorNew(AllocatorType, this->alloc, BaseHashSet, *this);
         }
 
         void Copy(const BaseHashSet *const other)
         {
-            DoCopy(other);
+            this->DoCopy(other);
         }
 
         void LockResize()

+ 3 - 2
lib/Common/DataStructures/List.h

@@ -200,6 +200,7 @@ namespace JsUtil
     {
     public:
         typedef ReadOnlyList<T, TAllocator, TComparer> ParentType;
+        typedef typename ParentType::TComparerType TComparerType;
         typedef T TElementType;         // For TRemovePolicy
         static const int DefaultIncrement = 4;
 
@@ -532,7 +533,7 @@ namespace JsUtil
         template<class TMapFunction>
         void MapAddress(TMapFunction map) const
         {
-            for (int i = 0; i < count; i++)
+            for (int i = 0; i < this->count; i++)
             {
                 if (TRemovePolicyType::IsItemValid(this->buffer[i]))
                 {
@@ -556,7 +557,7 @@ namespace JsUtil
         template<class TMapFunction>
         void ReverseMap(TMapFunction map)
         {
-            for (int i = count - 1; i >= 0; i--)
+            for (int i = this->count - 1; i >= 0; i--)
             {
                 if (TRemovePolicyType::IsItemValid(this->buffer[i]))
                 {

+ 2 - 2
lib/Common/Memory/PageAllocator.h

@@ -376,8 +376,8 @@ private:
 template<typename TVirtualAlloc>
 class PageAllocatorBase
 {
-    friend class CodeGenNumberThreadAllocator;
-    friend struct XProcNumberPageSegmentManager;
+    friend class ::CodeGenNumberThreadAllocator;
+    friend struct ::XProcNumberPageSegmentManager;
     // Allowing recycler to report external memory allocation.
     friend class Recycler;
 public:

+ 3 - 3
lib/Common/Memory/Recycler.h

@@ -624,8 +624,8 @@ class Recycler
     friend class ActiveScriptProfilerHeapEnum;
 #endif
     friend class ScriptEngineBase;  // This is for disabling GC for certain Host operations.
-    friend class CodeGenNumberThreadAllocator;
-    friend struct XProcNumberPageSegmentManager;
+    friend class ::CodeGenNumberThreadAllocator;
+    friend struct ::XProcNumberPageSegmentManager;
 public:
     static const uint ConcurrentThreadStackSize = 300000;
     static const bool FakeZeroLengthArray = true;
@@ -2048,7 +2048,7 @@ public:
     void* GetObjectAddress() const { return m_address; }
 
 #ifdef RECYCLER_PAGE_HEAP
-    bool IsPageHeapAlloc() 
+    bool IsPageHeapAlloc()
     {
         return isUsingLargeHeapBlock && ((LargeHeapBlock*)m_heapBlock)->InPageHeapMode();
     }

+ 4 - 0
lib/Jsrt/JsrtHelper.cpp

@@ -6,6 +6,10 @@
 #include "jsrtHelper.h"
 #include "Base/ThreadContextTlsEntry.h"
 
+#ifdef DYNAMIC_PROFILE_STORAGE
+#include "Language/DynamicProfileStorage.h"
+#endif
+
 #ifdef CHAKRA_STATIC_LIBRARY
 #include "Core/ConfigParser.h"
 

+ 3 - 0
lib/Runtime/Base/Constants.cpp

@@ -25,6 +25,9 @@ const char16 Constants::UnknownScriptCode[] = _u("Unknown script code");
 const char16 Constants::StringReplace[] = _u("String.prototype.replace");
 const char16 Constants::StringMatch[] = _u("String.prototype.match");
 
+const uint64 Constants::ExponentMask = 0x3FF0000000000000;
+const uint64 Constants::MantissaMask = 0x000FFFFFFFFFFFFF;
+
 #ifdef _M_AMD64
 const size_t Constants::StackLimitForScriptInterrupt = 0x7fffffffffffffff;
 #else

+ 2 - 2
lib/Runtime/Base/Constants.h

@@ -47,8 +47,8 @@ namespace Js
         static const ArgSlot            InvalidArgSlot              = (ArgSlot)-1;
         static const uint32             InvalidSymID = (uint32)-1;
 
-        static const uint64 ExponentMask = 0x3FF0000000000000;
-        static const uint64 MantissaMask = 0x000FFFFFFFFFFFFF;
+        static const uint64 ExponentMask;
+        static const uint64 MantissaMask;
 
         static const int ReservedTypeIds = 2048;
 

+ 1 - 1
lib/Runtime/Base/Debug.h

@@ -40,7 +40,7 @@ WCHAR* DumpCallStack(uint frameCount = -1);
    if(PHASE_TRACE((Phase), (Func))) \
       { \
         WCHAR prefixValue[512]; \
-        swprintf_s(prefixValue, L"%s (#%d.%u, #%u)", (Func)->GetJITFunctionBody()->GetDisplayName(), \
+        swprintf_s(prefixValue, _u("%s (#%d.%u, #%u)"), (Func)->GetJITFunctionBody()->GetDisplayName(), \
            (int)(Func)->GetJITFunctionBody()->GetSourceContextId(), (Func)->GetWorkItem()->GetJITTimeInfo()->GetLocalFunctionId(), (Func)->GetJITFunctionBody()->GetFunctionNumber()); \
         Output::TraceWithPrefix((Phase), prefixValue, __VA_ARGS__); \
       }

+ 20 - 20
lib/Runtime/Base/FunctionBody.h

@@ -88,11 +88,11 @@ namespace Js
     public:
         static PropertyGuard* New(Recycler* recycler) { return RecyclerNewLeaf(recycler, Js::PropertyGuard); }
         PropertyGuard() : value(GuardValue::Uninitialized) {}
-        PropertyGuard(intptr_t value) : value(value) 
-        { 
+        PropertyGuard(intptr_t value) : value(value)
+        {
             // GuardValue::Invalidated and GuardValue::Invalidated_DuringSweeping can only be set using
             // Invalidate() and InvalidatedDuringSweep() methods respectively.
-            Assert(this->value != GuardValue::Invalidated && this->value != GuardValue::Invalidated_DuringSweep); 
+            Assert(this->value != GuardValue::Invalidated && this->value != GuardValue::Invalidated_DuringSweep);
         }
 
         inline static size_t const GetSizeOfValue() { return sizeof(((PropertyGuard*)0)->value); }
@@ -105,7 +105,7 @@ namespace Js
         }
         bool IsInvalidatedDuringSweep() { return this->value == GuardValue::Invalidated_DuringSweep; }
         void SetValue(intptr_t value)
-        { 
+        {
             // GuardValue::Invalidated and GuardValue::Invalidated_DuringSweeping can only be set using
             // Invalidate() and InvalidatedDuringSweep() methods respectively.
             Assert(value != GuardValue::Invalidated && value != GuardValue::Invalidated_DuringSweep);
@@ -114,7 +114,7 @@ namespace Js
         intptr_t const* GetAddressOfValue() { return &this->value; }
         void Invalidate() { this->value = GuardValue::Invalidated; }
         void InvalidateDuringSweep()
-        { 
+        {
 #if DBG
             wasReincarnated = true;
 #endif
@@ -513,7 +513,7 @@ namespace Js
 #if ENABLE_NATIVE_CODEGEN
         NativeCodeData * inProcJITNaticeCodedata;
         char* nativeDataBuffer;
-        union 
+        union
         {
             Js::JavascriptNumber** numberArray;
             CodeGenNumberChunk* numberChunks;
@@ -588,7 +588,7 @@ namespace Js
         void SetNumberChunks(CodeGenNumberChunk* chunks)
         {
             Assert(numberPageSegments == nullptr);
-            numberChunks = chunks; 
+            numberChunks = chunks;
         }
         void SetNumberArray(Js::JavascriptNumber** array)
         {
@@ -598,9 +598,9 @@ namespace Js
         void SetNumberPageSegment(XProcNumberPageSegment * segments)
         {
             Assert(numberPageSegments == nullptr);
-            numberPageSegments = segments; 
+            numberPageSegments = segments;
         }
-        
+
 #endif
 
     private:
@@ -1106,7 +1106,7 @@ namespace Js
     {
     public:
         LoopHeader* loopHeader;
-        uint jittedLoopIterationsSinceLastBailout; // number of times the loop iterated in the jitted code before bailing out 
+        uint jittedLoopIterationsSinceLastBailout; // number of times the loop iterated in the jitted code before bailing out
         uint totalJittedLoopIterations; // total number of times the loop has iterated in the jitted code for this entry point for a particular invocation of the loop
         LoopEntryPointInfo(LoopHeader* loopHeader, Js::JavascriptLibrary* library, void* validationCookie) :
             EntryPointInfo(nullptr, library, validationCookie, /*threadContext*/ nullptr, /*isLoopBody*/ true),
@@ -1824,6 +1824,12 @@ namespace Js
 
         friend class ByteCodeBufferBuilder;
         friend class ByteCodeBufferReader;
+#ifdef DYNAMIC_PROFILE_MUTATOR
+        friend class ::DynamicProfileMutator;
+        friend class ::DynamicProfileMutatorImpl;
+#endif
+        friend class RemoteFunctionBody;
+
         public:
             // same as MachDouble, used in the Func.h
             static const uint DIAGLOCALSLOTSIZE = 8;
@@ -2165,7 +2171,7 @@ namespace Js
 #endif
         WriteBarrierPtr<FunctionEntryPointInfo> defaultFunctionEntryPointInfo;
 
-#if ENABLE_PROFILE_INFO 
+#if ENABLE_PROFILE_INFO
         WriteBarrierPtr<DynamicProfileInfo> dynamicProfileInfo;
 #endif
 
@@ -2184,7 +2190,7 @@ namespace Js
 #endif
             );
 
-        void SetNativeEntryPoint(FunctionEntryPointInfo* entryPointInfo, JavascriptMethod originalEntryPoint, Var directEntryPoint);
+        void SetNativeEntryPoint(FunctionEntryPointInfo* entryPointInfo, JavascriptMethod originalEntryPoint, JavascriptMethod directEntryPoint);
 #if DYNAMIC_INTERPRETER_THUNK
         void GenerateDynamicInterpreterThunk();
 #endif
@@ -2855,8 +2861,8 @@ namespace Js
                 (GetIsStrictMode() || hasNonSimpleParams)
                 // Neither of the scopes are objects
                 && !HasScopeObject();
-            
-            return 
+
+            return
                 // Regardless of the conditions above, we won't need a scope object if there aren't any formals.
                 (GetInParamsCount() > 1 || GetHasRestParameter())
                 && !dontNeedScopeObject;
@@ -3277,12 +3283,6 @@ namespace Js
 
         void EnsureAuxStatementData();
         StatementAdjustmentRecordList* GetStatementAdjustmentRecords();
-
-#ifdef DYNAMIC_PROFILE_MUTATOR
-        friend class DynamicProfileMutator;
-        friend class DynamicProfileMutatorImpl;
-#endif
-        friend class RemoteFunctionBody;
     };
 
     typedef SynchronizableList<FunctionBody*, JsUtil::List<FunctionBody*, ArenaAllocator, false, Js::FreeListedRemovePolicy> > FunctionBodyList;

+ 2 - 2
lib/Runtime/Base/ScriptContext.cpp

@@ -4824,9 +4824,9 @@ void ScriptContext::RegisterPrototypeChainEnsuredToHaveOnlyWritableDataPropertie
         return (JavascriptMethod)this->interpreterThunkEmitter->GetNextThunk(ppDynamicInterpreterThunk);
     }
 
-    BOOL ScriptContext::IsDynamicInterpreterThunk(void* address)
+    BOOL ScriptContext::IsDynamicInterpreterThunk(JavascriptMethod address)
     {
-        return this->interpreterThunkEmitter->IsInHeap(address);
+        return this->interpreterThunkEmitter->IsInHeap((void*)address);
     }
 
     void ScriptContext::ReleaseDynamicInterpreterThunk(BYTE* address, bool addtoFreeList)

+ 2 - 2
lib/Runtime/Base/ScriptContext.h

@@ -1571,7 +1571,7 @@ private:
         static void SetEntryPointToProfileThunk(JavascriptFunction* function);
         static void RestoreEntryPointFromProfileThunk(JavascriptFunction* function);
 #endif
-        
+
         static void RecyclerEnumClassEnumeratorCallback(void *address, size_t size);
         static void RecyclerFunctionCallbackForDebugger(void *address, size_t size);
 
@@ -1647,7 +1647,7 @@ private:
 #if DYNAMIC_INTERPRETER_THUNK
         JavascriptMethod GetNextDynamicAsmJsInterpreterThunk(PVOID* ppDynamicInterpreterThunk);
         JavascriptMethod GetNextDynamicInterpreterThunk(PVOID* ppDynamicInterpreterThunk);
-        BOOL IsDynamicInterpreterThunk(void* address);
+        BOOL IsDynamicInterpreterThunk(JavascriptMethod address);
         void ReleaseDynamicInterpreterThunk(BYTE* address, bool addtoFreeList);
         void ReleaseDynamicAsmJsInterpreterThunk(BYTE* address, bool addtoFreeList);
 #endif

+ 10 - 10
lib/Runtime/Base/ThreadContext.cpp

@@ -215,7 +215,7 @@ ThreadContext::ThreadContext(AllocationPolicyManager * allocationPolicyManager,
 #ifdef ENABLE_CUSTOM_ENTROPY
     entropy.Initialize();
 #endif
-    
+
 #if ENABLE_NATIVE_CODEGEN
     this->bailOutRegisterSaveSpace = AnewArrayZ(this->GetThreadAlloc(), Js::Var, GetBailOutRegisterSaveSlotCount());
 #endif
@@ -321,7 +321,7 @@ ThreadContext::GetThreadStackLimitAddr() const
     return (intptr_t)GetAddressOfStackLimitForCurrentThread();
 }
 
-#if ENABLE_NATIVE_CODEGEN && (defined(_M_IX86) || defined(_M_X64))
+#if ENABLE_NATIVE_CODEGEN && defined(ENABLE_SIMDJS) && (defined(_M_IX86) || defined(_M_X64))
 intptr_t
 ThreadContext::GetSimdTempAreaAddr(uint8 tempIndex) const
 {
@@ -329,7 +329,7 @@ ThreadContext::GetSimdTempAreaAddr(uint8 tempIndex) const
 }
 #endif
 
-intptr_t 
+intptr_t
 ThreadContext::GetDisableImplicitFlagsAddr() const
 {
     return (intptr_t)&disableImplicitFlags;
@@ -1017,7 +1017,7 @@ ThreadContext::UncheckedAddPropertyId(JsUtil::CharacterBuffer<WCHAR> const& prop
     if(this->TTDLog != nullptr && this->TTDLog->ShouldPerformDebugAction_SymbolCreation())
     {
         //We reload all properties that occour in the trace so they only way we get here in TTD mode is:
-        //(1) if the program is creating a new symbol (which always gets a fresh id) and we should recreate it or 
+        //(1) if the program is creating a new symbol (which always gets a fresh id) and we should recreate it or
         //(2) if it is forcing arguments in debug parse mode (instead of regular which we recorded in)
         if(isSymbol)
         {
@@ -1984,9 +1984,9 @@ ThreadContext::EnsureJITThreadContext(bool allowPrereserveAlloc)
 
     // TODO: OOP JIT, use more generic method for getting name, e.g. in case of ChakraTest.dll
 #ifdef NTBUILD
-    contextData.chakraBaseAddress = (intptr_t)GetModuleHandle(L"Chakra.dll");
+    contextData.chakraBaseAddress = (intptr_t)GetModuleHandle(_u("Chakra.dll"));
 #else
-    contextData.chakraBaseAddress = (intptr_t)GetModuleHandle(L"ChakraCore.dll");
+    contextData.chakraBaseAddress = (intptr_t)GetModuleHandle(_u("ChakraCore.dll"));
 #endif
     contextData.crtBaseAddress = (intptr_t)GetModuleHandle(UCrtC99MathApis::LibraryName);
     contextData.threadStackLimitAddr = reinterpret_cast<intptr_t>(GetAddressOfStackLimitForCurrentThread());
@@ -2000,7 +2000,7 @@ ThreadContext::EnsureJITThreadContext(bool allowPrereserveAlloc)
     contextData.scriptStackLimit = GetScriptStackLimit();
     contextData.isThreadBound = IsThreadBound();
     contextData.allowPrereserveAlloc = allowPrereserveAlloc;
-#if _M_IX86 || _M_AMD64
+#if defined(ENABLE_SIMDJS) && (_M_IX86 || _M_AMD64)
     contextData.simdTempAreaBaseAddr = (intptr_t)GetSimdTempArea();
 #endif
 
@@ -2102,7 +2102,7 @@ ThreadContext::ExecuteRecyclerCollectionFunction(Recycler * recycler, Collection
 
 #if ENABLE_TTD
         //
-        //TODO: We leak any references that are JsReleased by the host in collection callbacks. Later we should defer these events to the end of the 
+        //TODO: We leak any references that are JsReleased by the host in collection callbacks. Later we should defer these events to the end of the
         //      top-level call or the next external call and then append them to the log.
         //
 
@@ -3277,7 +3277,7 @@ ThreadContext::RegisterUniquePropertyGuard(Js::PropertyId propertyId, RecyclerWe
 
     bool foundExistingGuard;
 
-    
+
     PropertyGuardEntry* entry = EnsurePropertyGuardEntry(propertyRecord, foundExistingGuard);
 
     entry->uniqueGuards.Item(guardWeakRef);
@@ -3357,7 +3357,7 @@ ThreadContext::InvalidatePropertyGuardEntry(const Js::PropertyRecord* propertyRe
 
     entry->uniqueGuards.Clear();
 
-    
+
     // Count no. of invalidations done so far. Exclude if this is all property guards invalidation in which case
     // the unique Guards will be cleared anyway.
     if (!isAllPropertyGuardsInvalidation)

+ 4 - 4
lib/Runtime/Base/ThreadContext.h

@@ -475,7 +475,7 @@ public:
     void GetSimdFuncSignatureFromOpcode(Js::OpCode op, SimdFuncSignature &funcSignature);
 
 #if _M_IX86 || _M_AMD64
-    // auxiliary SIMD values in memory to help JIT'ed code. E.g. used for Int8x16 shuffle. 
+    // auxiliary SIMD values in memory to help JIT'ed code. E.g. used for Int8x16 shuffle.
     _x86_SIMDValue X86_TEMP_SIMD[SIMD_TEMP_SIZE];
     _x86_SIMDValue * GetSimdTempArea() { return X86_TEMP_SIMD; }
 #endif
@@ -927,7 +927,7 @@ public:
         JITTelemetry.Reset();
     }
 #endif
-    
+
     ParserStats GetParserStats()
     {
         return ParserTelemetry.GetStats();
@@ -1302,7 +1302,7 @@ public:
 
     virtual intptr_t GetThreadStackLimitAddr() const override;
 
-#if ENABLE_NATIVE_CODEGEN && (defined(_M_IX86) || defined(_M_X64))
+#if ENABLE_NATIVE_CODEGEN && defined(ENABLE_SIMDJS) && (defined(_M_IX86) || defined(_M_X64))
     virtual intptr_t GetSimdTempAreaAddr(uint8 tempIndex) const override;
 #endif
 
@@ -1508,7 +1508,7 @@ public:
         return entropy;
     }
 #endif
-    
+
     Js::ImplicitCallFlags * GetAddressOfImplicitCallFlags()
     {
         return &implicitCallFlags;

+ 2 - 2
lib/Runtime/Base/ThreadContextInfo.h

@@ -82,7 +82,7 @@ public:
     virtual intptr_t GetImplicitCallFlagsAddr() const = 0;
 
 #if ENABLE_NATIVE_CODEGEN
-#if defined(_M_IX86) || defined(_M_X64)
+#if defined(ENABLE_SIMDJS) && (defined(_M_IX86) || defined(_M_X64))
     virtual intptr_t GetSimdTempAreaAddr(uint8 tempIndex) const = 0;
 #endif
     virtual intptr_t GetBailOutRegisterSaveSpaceAddr() const = 0;
@@ -114,7 +114,7 @@ private:
 
     uint m_activeJITCount;
     bool m_isAllJITCodeInPreReservedRegion;
-    
+
 };
 
 

+ 23 - 23
lib/Runtime/ByteCode/AsmJsByteCodeDumper.cpp

@@ -259,7 +259,7 @@ namespace Js
                 Output::Print(_u("\tI4(%d, %d, %d, %d),"), simdTable->i32[SIMD_X], simdTable->i32[SIMD_Y], simdTable->i32[SIMD_Z], simdTable->i32[SIMD_W]);
                 Output::Print(_u("\tF4(%.4f, %.4f, %.4f, %.4f),"), simdTable->f32[SIMD_X], simdTable->f32[SIMD_Y], simdTable->f32[SIMD_Z], simdTable->f32[SIMD_W]);
                 Output::Print(_u("\tD2(%.4f, %.4f)\n    "), simdTable->f64[SIMD_X], simdTable->f64[SIMD_Y]);
-                Output::Print(_u("\tI8(%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d )\n    "), 
+                Output::Print(_u("\tI8(%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d )\n    "),
                     simdTable->i8[0], simdTable->i8[1], simdTable->i8[2], simdTable->i8[3], simdTable->i8[4], simdTable->i8[5], simdTable->i8[6], simdTable->i8[7],
                     simdTable->i8[8], simdTable->i8[9], simdTable->i8[10], simdTable->i8[11], simdTable->i8[12], simdTable->i8[13], simdTable->i8[14], simdTable->i8[15]);
                 ++simdTable;
@@ -329,12 +329,12 @@ namespace Js
 
     void AsmJsByteCodeDumper::DumpUint32x4Reg(RegSlot reg)
     {
-        Output::Print(L"U4_%d ", (int)reg);
+        Output::Print(_u("U4_%d "), (int)reg);
     }
 
     void AsmJsByteCodeDumper::DumpInt16x8Reg(RegSlot reg)
     {
-        Output::Print(L"I8_%d ", (int)reg);
+        Output::Print(_u("I8_%d "), (int)reg);
     }
 
     // Int8x16
@@ -350,24 +350,24 @@ namespace Js
 
     void AsmJsByteCodeDumper::DumpUint8x16Reg(RegSlot reg)
     {
-        Output::Print(L"U16_%d ", (int)reg);
+        Output::Print(_u("U16_%d "), (int)reg);
  }
     // Bool32x4
     void AsmJsByteCodeDumper::DumpBool32x4Reg(RegSlot reg)
     {
-        Output::Print(L"B4_%d ", (int)reg);
+        Output::Print(_u("B4_%d "), (int)reg);
     }
 
     // Bool16x8
     void AsmJsByteCodeDumper::DumpBool16x8Reg(RegSlot reg)
     {
-        Output::Print(L"B8_%d ", (int)reg);
+        Output::Print(_u("B8_%d "), (int)reg);
     }
 
     // Bool32x4
     void AsmJsByteCodeDumper::DumpBool8x16Reg(RegSlot reg)
     {
-        Output::Print(L"B16_%d ", (int)reg);
+        Output::Print(_u("B16_%d "), (int)reg);
     }
 
     // Float64x2
@@ -413,13 +413,13 @@ namespace Js
             Output::Print(_u(" I4_%d = R%d[%d] "), data->Value, data->Instance, data->SlotIndex);
             break;
         case OpCodeAsmJs::Simd128_LdSlot_B4:
-            Output::Print(L" B4_%d = R%d[%d] ", data->Value, data->Instance, data->SlotIndex);
+            Output::Print(_u(" B4_%d = R%d[%d] "), data->Value, data->Instance, data->SlotIndex);
             break;
         case OpCodeAsmJs::Simd128_LdSlot_B8:
-            Output::Print(L" B8_%d = R%d[%d] ", data->Value, data->Instance, data->SlotIndex);
+            Output::Print(_u(" B8_%d = R%d[%d] "), data->Value, data->Instance, data->SlotIndex);
             break;
         case OpCodeAsmJs::Simd128_LdSlot_B16:
-            Output::Print(L" B16_%d = R%d[%d] ", data->Value, data->Instance, data->SlotIndex);
+            Output::Print(_u(" B16_%d = R%d[%d] "), data->Value, data->Instance, data->SlotIndex);
             break;
 #if 0
         case OpCodeAsmJs::Simd128_LdSlot_D2:
@@ -435,13 +435,13 @@ namespace Js
             Output::Print(_u(" R%d[%d]  = I4_%d"), data->Instance, data->SlotIndex, data->Value);
             break;
         case OpCodeAsmJs::Simd128_StSlot_B4:
-            Output::Print(L" R%d[%d]  = B4_%d", data->Instance, data->SlotIndex, data->Value);
+            Output::Print(_u(" R%d[%d]  = B4_%d"), data->Instance, data->SlotIndex, data->Value);
             break;
         case OpCodeAsmJs::Simd128_StSlot_B8:
-            Output::Print(L" R%d[%d]  = B8_%d", data->Instance, data->SlotIndex, data->Value);
+            Output::Print(_u(" R%d[%d]  = B8_%d"), data->Instance, data->SlotIndex, data->Value);
             break;
         case OpCodeAsmJs::Simd128_StSlot_B16:
-            Output::Print(L" R%d[%d]  = B16_%d", data->Instance, data->SlotIndex, data->Value);
+            Output::Print(_u(" R%d[%d]  = B16_%d"), data->Instance, data->SlotIndex, data->Value);
             break;
 #if 0
         case OpCodeAsmJs::Simd128_StSlot_D2:
@@ -460,7 +460,7 @@ namespace Js
     template <class T>
     void AsmJsByteCodeDumper::DumpAsmTypedArr(OpCodeAsmJs op, const unaligned T * data, FunctionBody * dumpFunction, ByteCodeReader& reader)
     {
-        char16* heapTag = nullptr;
+        const char16* heapTag = nullptr;
         char16 valueTag = 'I';
         switch (data->ViewType)
         {
@@ -1031,7 +1031,7 @@ namespace Js
         DumpInt32x4Reg(data->I4_1);
         DumpInt32x4Reg(data->I4_2);
     }
-    
+
     template <class T>
     void AsmJsByteCodeDumper::DumpInt32x4_1Bool32x4_1Int32x4_2(OpCodeAsmJs op, const unaligned T * data, FunctionBody * dumpFunction, ByteCodeReader& reader)
     {
@@ -1040,7 +1040,7 @@ namespace Js
         DumpInt32x4Reg(data->I4_2);
         DumpInt32x4Reg(data->I4_3);
     }
-    
+
     template <class T>
     void AsmJsByteCodeDumper::DumpInt32x4_1Int4(OpCodeAsmJs op, const unaligned T * data, FunctionBody * dumpFunction, ByteCodeReader& reader)
     {
@@ -1544,7 +1544,7 @@ namespace Js
         DumpInt8x16Reg(data->I16_0);
         DumpUint8x16Reg(data->U16_1);
     }
-    
+
 // Disabled for now
 #if 0
     // Float64x2
@@ -1748,7 +1748,7 @@ namespace Js
         DumpInt16x8Reg(data->I8_1);
         DumpInt16x8Reg(data->I8_2);
     }
-    
+
     template <class T>
     void AsmJsByteCodeDumper::DumpBool16x8_1Int16x8_2(OpCodeAsmJs op, const unaligned T * data, FunctionBody * dumpFunction, ByteCodeReader& reader)
     {
@@ -1895,7 +1895,7 @@ namespace Js
         DumpUint32x4Reg(data->U4_1);
         DumpUint32x4Reg(data->U4_2);
     }
-    
+
     template <class T>
     void AsmJsByteCodeDumper::DumpBool32x4_1Uint32x4_2(OpCodeAsmJs op, const unaligned T * data, FunctionBody * dumpFunction, ByteCodeReader& reader)
     {
@@ -2054,7 +2054,7 @@ namespace Js
         DumpUint16x8Reg(data->U8_1);
         DumpUint16x8Reg(data->U8_2);
     }
-    
+
     template <class T>
     void AsmJsByteCodeDumper::DumpBool16x8_1Uint16x8_2(OpCodeAsmJs op, const unaligned T * data, FunctionBody * dumpFunction, ByteCodeReader& reader)
     {
@@ -2228,7 +2228,7 @@ namespace Js
         DumpUint8x16Reg(data->U16_1);
         DumpIntReg(data->I2);
         DumpIntReg(data->I3);
-        
+
     }
 
     template <class T>
@@ -2329,11 +2329,11 @@ namespace Js
         DumpBool8x16Reg(data->B16_0);
         DumpIntReg(data->I1);
     }
-    
+
     template <class T>
     void AsmJsByteCodeDumper::DumpAsmSimdTypedArr(OpCodeAsmJs op, const unaligned T * data, FunctionBody * dumpFunction, ByteCodeReader& reader)
     {
-        char16* heapTag = nullptr;
+        const char16* heapTag = nullptr;
 
         switch (data->ViewType)
         {

+ 0 - 21
lib/Runtime/ByteCode/ByteCodeReader.cpp

@@ -49,21 +49,6 @@ namespace Js
 #endif
     }
 
-    template<typename LayoutType>
-    const unaligned LayoutType * ByteCodeReader::GetLayout()
-    {
-        size_t layoutSize = sizeof(LayoutType);
-
-        AssertMsg((layoutSize > 0) && (layoutSize < 100), "Ensure valid layout size");
-
-        const byte * layoutData = m_currentLocation;
-        m_currentLocation += layoutSize;
-
-        Assert(m_currentLocation <= m_endLocation);
-
-        return reinterpret_cast<const unaligned LayoutType *>(layoutData);
-    }
-
     template<typename LayoutType>
     const unaligned LayoutType * ByteCodeReader::GetLayout(const byte*& ip)
     {
@@ -80,12 +65,6 @@ namespace Js
         return reinterpret_cast<const unaligned LayoutType *>(layoutData);
     }
 
-    template<>
-    const unaligned OpLayoutEmpty * ByteCodeReader::GetLayout<OpLayoutEmpty>()
-    {
-        return nullptr;
-    }
-
     template<>
     const unaligned OpLayoutEmpty * ByteCodeReader::GetLayout<OpLayoutEmpty>(const byte*& ip)
     {

+ 21 - 0
lib/Runtime/ByteCode/ByteCodeReader.h

@@ -86,4 +86,25 @@ namespace Js
 #endif
     };
 
+    template<typename LayoutType>
+    inline const unaligned LayoutType * ByteCodeReader::GetLayout()
+    {
+        size_t layoutSize = sizeof(LayoutType);
+
+        AssertMsg((layoutSize > 0) && (layoutSize < 100), "Ensure valid layout size");
+
+        const byte * layoutData = m_currentLocation;
+        m_currentLocation += layoutSize;
+
+        Assert(m_currentLocation <= m_endLocation);
+
+        return reinterpret_cast<const unaligned LayoutType *>(layoutData);
+    }
+
+    template<>
+    inline const unaligned OpLayoutEmpty * ByteCodeReader::GetLayout<OpLayoutEmpty>()
+    {
+        return nullptr;
+    }
+
 } // namespace Js

+ 3 - 3
lib/Runtime/ByteCode/ByteCodeWriter.cpp

@@ -292,7 +292,7 @@ namespace Js
         return this->m_functionWrite->MapRegSlot(reg);
     }
 
-    inline void ByteCodeWriter::CheckOpen()
+    void ByteCodeWriter::CheckOpen()
     {
         AssertMsg(m_functionWrite != nullptr, "Must Begin() a function to write byte-code into");
     }
@@ -306,7 +306,7 @@ namespace Js
         AssertMsg(OpCodeUtil::GetOpCodeLayout(op) == layoutType, "Ensure correct layout for OpCode");
     }
 
-    inline void ByteCodeWriter::CheckLabel(ByteCodeLabel labelID)
+    void ByteCodeWriter::CheckLabel(ByteCodeLabel labelID)
     {
         AssertMsg(labelID < m_labelOffsets->Count(),
             "Label must be previously defined before being marked in the byte-code");
@@ -3276,7 +3276,7 @@ StoreCommon:
         return Write(rawData, byteSize);
     }
 
-    inline uint ByteCodeWriter::Data::Write(__in_bcount(byteSize) const void* data, __in uint byteSize)
+    uint ByteCodeWriter::Data::Write(__in_bcount(byteSize) const void* data, __in uint byteSize)
     {
         // Simple case where the current chunk has enough space.
         uint bytesFree = current->RemainingBytes();

+ 3 - 3
lib/Runtime/ByteCode/ByteCodeWriter.h

@@ -73,7 +73,7 @@ namespace Js
             uint currentOffset;  // The global offset of last byte written to in the linked data structure
             bool fixedGrowthPolicy;
 
-            inline uint Write(__in_bcount(byteSize) const void* data, __in uint byteSize);
+            uint Write(__in_bcount(byteSize) const void* data, __in uint byteSize);
             _NOINLINE void SlowWrite(__in_bcount(byteSize) const void* data, __in uint byteSize);
             void AddChunk(uint byteSize);
 
@@ -201,8 +201,8 @@ namespace Js
 
         RegSlot ConsumeReg(RegSlot reg);
 
-        inline void CheckOpen();
-        inline void CheckLabel(ByteCodeLabel labelID);
+        void CheckOpen();
+        void CheckLabel(ByteCodeLabel labelID);
         inline void CheckOp(OpCode op, OpLayoutType layoutType);
         inline void CheckReg(RegSlot registerID);
 

+ 7 - 7
lib/Runtime/Language/AsmJsByteCodeGenerator.cpp

@@ -20,7 +20,7 @@
 
 namespace Js
 {
-    enum EBinaryMathOpCodes
+    enum EBinaryMathOpCodes: int
     {
         BMO_ADD,
         BMO_SUB,
@@ -31,7 +31,7 @@ namespace Js
         BMO_MAX,
     };
 
-    enum EBinaryMathOpCodesTypes
+    enum EBinaryMathOpCodesTypes: int
     {
         BMOT_Int,
         BMOT_UInt,
@@ -48,7 +48,7 @@ namespace Js
         /*BMO_REM*/{ OpCodeAsmJs::Rem_Int, OpCodeAsmJs::Rem_UInt,OpCodeAsmJs::Nop,     OpCodeAsmJs::Rem_Db }
     };
 
-    enum EBinaryComparatorOpCodes
+    enum EBinaryComparatorOpCodes: int
     {
         /*<, <=, >, >=, ==, !=*/
         BCO_LT,
@@ -586,7 +586,7 @@ namespace Js
         case knopFlt:
             if (ParserWrapper::IsMinInt(pnode))
             {
-                return EmitExpressionInfo(mFunction->GetConstRegister<int>(MININT32), AsmJsType::Signed);
+                return EmitExpressionInfo(mFunction->GetConstRegister<int>(INT32_MIN), AsmJsType::Signed);
             }
             else if (ParserWrapper::IsUnsigned(pnode))
             {
@@ -1749,7 +1749,7 @@ namespace Js
                                      argsInfo[6].location, argsInfo[7].location);
             break;
         case 9:
-            mWriter.AsmReg10(op, dst, argsInfo[0].location, argsInfo[1].location, argsInfo[2].location, argsInfo[3].location, argsInfo[4].location, argsInfo[5].location, 
+            mWriter.AsmReg10(op, dst, argsInfo[0].location, argsInfo[1].location, argsInfo[2].location, argsInfo[3].location, argsInfo[4].location, argsInfo[5].location,
                                       argsInfo[6].location, argsInfo[7].location, argsInfo[8].location);
             break;
         case 10:
@@ -1758,7 +1758,7 @@ namespace Js
             break;
         case 16:
             mWriter.AsmReg17(op, dst, argsInfo[0].location, argsInfo[1].location, argsInfo[2].location, argsInfo[3].location, argsInfo[4].location, argsInfo[5].location,
-                                      argsInfo[6].location, argsInfo[7].location, argsInfo[8].location, argsInfo[9].location, argsInfo[10].location, argsInfo[11].location, 
+                                      argsInfo[6].location, argsInfo[7].location, argsInfo[8].location, argsInfo[9].location, argsInfo[10].location, argsInfo[11].location,
                                       argsInfo[12].location, argsInfo[13].location, argsInfo[14].location, argsInfo[15].location);
             break;
 
@@ -2395,7 +2395,7 @@ namespace Js
                 else if (ParserWrapper::IsMinInt(indexNode))
                 {
                     // this is going to be an error, but we can do this to allow it to get same error message as invalid int
-                    slot = (uint32)MININT32;
+                    slot = (uint32)INT32_MIN;
                 }
                 else if (ParserWrapper::IsUnsigned(indexNode))
                 {

+ 5 - 2
lib/Runtime/Language/AsmJsByteCodeGenerator.h

@@ -7,6 +7,9 @@
 #ifndef TEMP_DISABLE_ASMJS
 namespace Js
 {
+    enum EBinaryMathOpCodes: int;
+    enum EBinaryComparatorOpCodes: int;
+
     // Information about the expression that has been emitted
     struct EmitExpressionInfo
     {
@@ -94,11 +97,11 @@ namespace Js
         EmitExpressionInfo EmitUnaryNeg( ParseNode * pnode );
         EmitExpressionInfo EmitUnaryNot( ParseNode * pnode );
         EmitExpressionInfo EmitUnaryLogNot( ParseNode * pnode );
-        EmitExpressionInfo EmitBinaryMultiType( ParseNode * pnode, enum EBinaryMathOpCodes op );
+        EmitExpressionInfo EmitBinaryMultiType( ParseNode * pnode, EBinaryMathOpCodes op );
         EmitExpressionInfo EmitBinaryInt( ParseNode * pnode, OpCodeAsmJs op );
         EmitExpressionInfo EmitQMark( ParseNode * pnode );
         EmitExpressionInfo EmitSwitch( ParseNode * pnode );
-        EmitExpressionInfo EmitBinaryComparator( ParseNode * pnode, enum EBinaryComparatorOpCodes op);
+        EmitExpressionInfo EmitBinaryComparator( ParseNode * pnode, EBinaryComparatorOpCodes op);
         EmitExpressionInfo EmitLoop( ParseNode *loopNode, ParseNode *cond, ParseNode *body, ParseNode *incr, BOOL doWhile = false );
         EmitExpressionInfo EmitIf( ParseNode * pnode );
         EmitExpressionInfo EmitBooleanExpression( ParseNode* pnodeCond, Js::ByteCodeLabel trueLabel, Js::ByteCodeLabel falseLabel );

+ 3 - 3
lib/Runtime/Language/AsmJsEncoder.inl

@@ -69,7 +69,7 @@ typedef double( *UnaryDoubleFunc )( double );
     { \
         PROCESS_ENCODE_READ_LAYOUT_ASMJS(name, Double2, suffix); \
         int offsets[2] = {CalculateOffset<double>(playout->D0),CalculateOffset<double>(playout->D1)};\
-        AsmJsJitTemplate::Call_Db::ApplyTemplate( this, mPc, 2, offsets, ((UnaryDoubleFunc)(func)),addEsp );\
+        AsmJsJitTemplate::Call_Db::ApplyTemplate( this, mPc, 2, offsets, ((void*)(UnaryDoubleFunc)(func)),addEsp );\
         break; \
     }
 #define PROCESS_ENCODE_CALLDOUBLE2(name,func,layout) PROCESS_ENCODE_CALLDOUBLE2_COMMON(name,func,layout,)
@@ -80,7 +80,7 @@ typedef double( *BinaryDoubleFunc )( double, double );
     { \
         PROCESS_ENCODE_READ_LAYOUT_ASMJS(name, Double3, suffix); \
         int offsets[3] = {CalculateOffset<double>(playout->D0),CalculateOffset<double>(playout->D1),CalculateOffset<double>(playout->D2)};\
-        AsmJsJitTemplate::Call_Db::ApplyTemplate( this, mPc, 3, offsets, ((BinaryDoubleFunc)(func)),addEsp );\
+        AsmJsJitTemplate::Call_Db::ApplyTemplate( this, mPc, 3, offsets, ((void*)(BinaryDoubleFunc)(func)),addEsp );\
         break; \
     }
 #define PROCESS_ENCODE_CALLDOUBLE3(name,func,addEsp) PROCESS_ENCODE_CALLDOUBLE3_COMMON(name,func,addEsp,)
@@ -119,7 +119,7 @@ typedef float(*UnaryFloatFunc)(float);
 { \
     PROCESS_ENCODE_READ_LAYOUT_ASMJS(name, Float2, suffix); \
     int offsets[2] = { CalculateOffset<float>(playout->F0), CalculateOffset<float>(playout->F1) }; \
-    AsmJsJitTemplate::Call_Flt::ApplyTemplate(this, mPc, 2, offsets, ((UnaryFloatFunc)(func)), addEsp); \
+    AsmJsJitTemplate::Call_Flt::ApplyTemplate(this, mPc, 2, offsets, ((void*)(UnaryFloatFunc)(func)), addEsp); \
     break; \
 }
 #define PROCESS_ENCODE_CALLFLOAT2(name,func,layout) PROCESS_ENCODE_CALLFLOAT2_COMMON(name,func,layout,)

+ 3 - 3
lib/Runtime/Language/AsmJsLink.cpp

@@ -158,7 +158,7 @@ namespace Js{
                 AsmJsSIMDBuiltinFunction simdBuiltinFunc = (AsmJsSIMDBuiltinFunction)i;
                 if (!CheckSimdLibraryMethod(scriptContext, asmSimdObject, simdBuiltinFunc))
                 {
-                    AsmJSCompiler::OutputError(scriptContext, L"Asm.js Runtime Error : SIMD builtin function is invalid");
+                    AsmJSCompiler::OutputError(scriptContext, _u("Asm.js Runtime Error : SIMD builtin function is invalid"));
                     return false;
                 }
             }
@@ -620,8 +620,8 @@ namespace Js{
     }
 #endif
 
-    
-        
+
+
 
     bool ASMLink::CheckParams(ScriptContext* scriptContext, AsmJsModuleInfo* info, const Var stdlib, const Var foreign, const Var bufferView)
     {

+ 18 - 18
lib/Runtime/Language/AsmJsModule.cpp

@@ -874,7 +874,7 @@ namespace Js
                 mathFunc = nullptr;
                 simdFunc = nullptr;
 
-                if (!pnodeInit) 
+                if (!pnodeInit)
                 {
                     return Fail(decl, _u("The righthand side of a var declaration missing an initialization (empty)"));
                 }
@@ -947,8 +947,8 @@ namespace Js
                 {
                     var->SetVarType(AsmJsVarType::Int);
                     var->SetLocation(func->AcquireRegister<int>());
-                    var->SetConstInitialiser(MININT);
-                    loc = func->GetConstRegister<int>(MININT);
+                    var->SetConstInitialiser(INT_MIN);
+                    loc = func->GetConstRegister<int>(INT_MIN);
                 }
                 else if (ParserWrapper::IsUnsigned(pnodeInit))
                 {
@@ -1615,13 +1615,13 @@ namespace Js
         simdFunctions[AsmJsSIMDBuiltin_float64x2_store1]            = SIMDFunc(PropertyIds::store1, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 3, AsmJsSIMDBuiltin_float64x2_store1, OpCodeAsmJs::Simd128_StArr_D2, AsmJsRetType::Float64x2, AsmJsType::Void, AsmJsType::Int, AsmJsType::Float64x2));
 #endif
         /* Int16x8 */
-        simdFunctions[AsmJsSIMDBuiltin_Int16x8]                     = SIMDFunc(PropertyIds::Int16x8, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 8, AsmJsSIMDBuiltin_Int16x8, OpCodeAsmJs::Simd128_IntsToI8, AsmJsRetType::Int16x8, 
+        simdFunctions[AsmJsSIMDBuiltin_Int16x8]                     = SIMDFunc(PropertyIds::Int16x8, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 8, AsmJsSIMDBuiltin_Int16x8, OpCodeAsmJs::Simd128_IntsToI8, AsmJsRetType::Int16x8,
                                                                                AsmJsType::Intish, AsmJsType::Intish, AsmJsType::Intish, AsmJsType::Intish, AsmJsType::Intish, AsmJsType::Intish, AsmJsType::Intish, AsmJsType::Intish));
         simdFunctions[AsmJsSIMDBuiltin_int16x8_check]               = SIMDFunc(PropertyIds::check, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 1, AsmJsSIMDBuiltin_int16x8_check, OpCodeAsmJs::Simd128_Ld_I8 /*no dynamic checks*/, AsmJsRetType::Int16x8, AsmJsType::Int16x8));
         simdFunctions[AsmJsSIMDBuiltin_int16x8_extractLane]         = SIMDFunc(PropertyIds::extractLane, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_int16x8_extractLane, OpCodeAsmJs::Simd128_ExtractLane_I8, AsmJsRetType::Signed, AsmJsType::Int16x8, AsmJsType::Int));
-        simdFunctions[AsmJsSIMDBuiltin_int16x8_swizzle]             = SIMDFunc(PropertyIds::swizzle, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 9, AsmJsSIMDBuiltin_int16x8_swizzle, OpCodeAsmJs::Simd128_Swizzle_I8, AsmJsRetType::Int16x8, AsmJsType::Int16x8, AsmJsType::Int, 
+        simdFunctions[AsmJsSIMDBuiltin_int16x8_swizzle]             = SIMDFunc(PropertyIds::swizzle, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 9, AsmJsSIMDBuiltin_int16x8_swizzle, OpCodeAsmJs::Simd128_Swizzle_I8, AsmJsRetType::Int16x8, AsmJsType::Int16x8, AsmJsType::Int,
                                                                               AsmJsType::Int, AsmJsType::Int, AsmJsType::Int, AsmJsType::Int, AsmJsType::Int, AsmJsType::Int, AsmJsType::Int));
-        simdFunctions[AsmJsSIMDBuiltin_int16x8_shuffle]             = SIMDFunc(PropertyIds::shuffle, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 10, AsmJsSIMDBuiltin_int16x8_shuffle, OpCodeAsmJs::Simd128_Shuffle_I8, AsmJsRetType::Int16x8, AsmJsType::Int16x8, AsmJsType::Int16x8, 
+        simdFunctions[AsmJsSIMDBuiltin_int16x8_shuffle]             = SIMDFunc(PropertyIds::shuffle, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 10, AsmJsSIMDBuiltin_int16x8_shuffle, OpCodeAsmJs::Simd128_Shuffle_I8, AsmJsRetType::Int16x8, AsmJsType::Int16x8, AsmJsType::Int16x8,
                                                                                AsmJsType::Int, AsmJsType::Int, AsmJsType::Int, AsmJsType::Int, AsmJsType::Int, AsmJsType::Int, AsmJsType::Int, AsmJsType::Int));
         simdFunctions[AsmJsSIMDBuiltin_int16x8_splat]               = SIMDFunc(PropertyIds::splat, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 1, AsmJsSIMDBuiltin_int16x8_splat, OpCodeAsmJs::Simd128_Splat_I8, AsmJsRetType::Int16x8, AsmJsType::Intish));
         simdFunctions[AsmJsSIMDBuiltin_int16x8_replaceLane]         = SIMDFunc(PropertyIds::replaceLane, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 3, AsmJsSIMDBuiltin_int16x8_replaceLane, OpCodeAsmJs::Simd128_ReplaceLane_I8, AsmJsRetType::Int16x8, AsmJsType::Int16x8, AsmJsType::Int, AsmJsType::Intish));
@@ -1643,7 +1643,7 @@ namespace Js
         simdFunctions[AsmJsSIMDBuiltin_int16x8_greaterThan]         = SIMDFunc(PropertyIds::greaterThan, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_int16x8_greaterThan, OpCodeAsmJs::Simd128_Gt_I8, AsmJsRetType::Bool16x8, AsmJsType::Int16x8, AsmJsType::Int16x8));
         simdFunctions[AsmJsSIMDBuiltin_int16x8_greaterThanOrEqual]  = SIMDFunc(PropertyIds::greaterThanOrEqual, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_int16x8_greaterThanOrEqual, OpCodeAsmJs::Simd128_GtEq_I8, AsmJsRetType::Bool16x8, AsmJsType::Int16x8, AsmJsType::Int16x8));
         simdFunctions[AsmJsSIMDBuiltin_int16x8_select]              = SIMDFunc(PropertyIds::select, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 3, AsmJsSIMDBuiltin_int16x8_select, OpCodeAsmJs::Simd128_Select_I8, AsmJsRetType::Int16x8, AsmJsType::Bool16x8, AsmJsType::Int16x8, AsmJsType::Int16x8));
-        
+
         simdFunctions[AsmJsSIMDBuiltin_int16x8_addSaturate]         = SIMDFunc(PropertyIds::addSaturate, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_int16x8_addSaturate, OpCodeAsmJs::Simd128_AddSaturate_I8, AsmJsRetType::Int16x8, AsmJsType::Int16x8, AsmJsType::Int16x8));
         simdFunctions[AsmJsSIMDBuiltin_int16x8_subSaturate]        = SIMDFunc(PropertyIds::subSaturate, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_int16x8_subSaturate, OpCodeAsmJs::Simd128_SubSaturate_I8, AsmJsRetType::Int16x8, AsmJsType::Int16x8, AsmJsType::Int16x8));
         simdFunctions[AsmJsSIMDBuiltin_int16x8_load]                = SIMDFunc(PropertyIds::load, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_int16x8_load, OpCodeAsmJs::Simd128_LdArr_I8, AsmJsRetType::Int16x8, AsmJsType::Void, AsmJsType::Int));
@@ -1671,7 +1671,7 @@ namespace Js
         simdFunctions[AsmJsSIMDBuiltin_int8x16_not]                 = SIMDFunc(PropertyIds::not_, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 1, AsmJsSIMDBuiltin_int8x16_not, OpCodeAsmJs::Simd128_Not_I16, AsmJsRetType::Int8x16, AsmJsType::Int8x16));
         simdFunctions[AsmJsSIMDBuiltin_int8x16_shiftLeftByScalar]   = SIMDFunc(PropertyIds::shiftLeftByScalar, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_int8x16_shiftLeftByScalar, OpCodeAsmJs::Simd128_ShLtByScalar_I16, AsmJsRetType::Int8x16, AsmJsType::Int8x16, AsmJsType::Int));
         simdFunctions[AsmJsSIMDBuiltin_int8x16_shiftRightByScalar]  = SIMDFunc(PropertyIds::shiftRightByScalar, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_int8x16_shiftRightByScalar, OpCodeAsmJs::Simd128_ShRtByScalar_I16, AsmJsRetType::Int8x16, AsmJsType::Int8x16, AsmJsType::Int));
-        
+
         simdFunctions[AsmJsSIMDBuiltin_int8x16_lessThan]            = SIMDFunc(PropertyIds::lessThan, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_int8x16_lessThan, OpCodeAsmJs::Simd128_Lt_I16, AsmJsRetType::Bool8x16, AsmJsType::Int8x16, AsmJsType::Int8x16));
         simdFunctions[AsmJsSIMDBuiltin_int8x16_lessThanOrEqual]     = SIMDFunc(PropertyIds::lessThanOrEqual, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_int8x16_lessThanOrEqual, OpCodeAsmJs::Simd128_LtEq_I16, AsmJsRetType::Bool8x16, AsmJsType::Int8x16, AsmJsType::Int8x16));
         simdFunctions[AsmJsSIMDBuiltin_int8x16_equal]               = SIMDFunc(PropertyIds::equal, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_int8x16_equal, OpCodeAsmJs::Simd128_Eq_I16, AsmJsRetType::Bool8x16, AsmJsType::Int8x16, AsmJsType::Int8x16));
@@ -1685,7 +1685,7 @@ namespace Js
         simdFunctions[AsmJsSIMDBuiltin_int8x16_subSaturate]        = SIMDFunc(PropertyIds::subSaturate, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_int8x16_subSaturate, OpCodeAsmJs::Simd128_SubSaturate_I16, AsmJsRetType::Int8x16, AsmJsType::Int8x16, AsmJsType::Int8x16));
         simdFunctions[AsmJsSIMDBuiltin_int8x16_load]                = SIMDFunc(PropertyIds::load, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_int8x16_load, OpCodeAsmJs::Simd128_LdArr_I16, AsmJsRetType::Int8x16, AsmJsType::Void, AsmJsType::Int));
         simdFunctions[AsmJsSIMDBuiltin_int8x16_store]               = SIMDFunc(PropertyIds::store, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 3, AsmJsSIMDBuiltin_int8x16_store, OpCodeAsmJs::Simd128_StArr_I16, AsmJsRetType::Int8x16, AsmJsType::Void, AsmJsType::Int, AsmJsType::Int8x16));
-        
+
         simdFunctions[AsmJsSIMDBuiltin_int8x16_extractLane]         = SIMDFunc(PropertyIds::extractLane, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_int8x16_extractLane, OpCodeAsmJs::Simd128_ExtractLane_I16, AsmJsRetType::Signed, AsmJsType::Int8x16, AsmJsType::Int));
         simdFunctions[AsmJsSIMDBuiltin_int8x16_replaceLane]         = SIMDFunc(PropertyIds::replaceLane, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 3, AsmJsSIMDBuiltin_int8x16_replaceLane, OpCodeAsmJs::Simd128_ReplaceLane_I16, AsmJsRetType::Int8x16, AsmJsType::Int8x16, AsmJsType::Int, AsmJsType::Intish));
         simdFunctions[AsmJsSIMDBuiltin_int8x16_swizzle]             = SIMDFunc(PropertyIds::swizzle, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 17, AsmJsSIMDBuiltin_int8x16_swizzle, OpCodeAsmJs::Simd128_Swizzle_I16, AsmJsRetType::Int8x16, AsmJsType::Int8x16,
@@ -1720,7 +1720,7 @@ namespace Js
         simdFunctions[AsmJsSIMDBuiltin_uint32x4_mul                 ]= SIMDFunc(PropertyIds::mul, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_uint32x4_mul, OpCodeAsmJs::Simd128_Mul_U4, AsmJsRetType::Uint32x4, AsmJsType::Uint32x4, AsmJsType::Uint32x4));
         simdFunctions[AsmJsSIMDBuiltin_uint32x4_shiftLeftByScalar   ]= SIMDFunc(PropertyIds::shiftLeftByScalar, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_uint32x4_shiftLeftByScalar, OpCodeAsmJs::Simd128_ShLtByScalar_U4, AsmJsRetType::Uint32x4, AsmJsType::Uint32x4, AsmJsType::Int));
         simdFunctions[AsmJsSIMDBuiltin_uint32x4_shiftRightByScalar  ]= SIMDFunc(PropertyIds::shiftRightByScalar, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_uint32x4_shiftRightByScalar, OpCodeAsmJs::Simd128_ShRtByScalar_U4, AsmJsRetType::Uint32x4, AsmJsType::Uint32x4, AsmJsType::Int));
-        
+
         simdFunctions[AsmJsSIMDBuiltin_uint32x4_lessThan]            = SIMDFunc(PropertyIds::lessThan, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_uint32x4_lessThan, OpCodeAsmJs::Simd128_Lt_U4, AsmJsRetType::Bool32x4, AsmJsType::Uint32x4, AsmJsType::Uint32x4));
         simdFunctions[AsmJsSIMDBuiltin_uint32x4_lessThanOrEqual]     = SIMDFunc(PropertyIds::lessThanOrEqual, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_uint32x4_lessThanOrEqual, OpCodeAsmJs::Simd128_LtEq_U4, AsmJsRetType::Bool32x4, AsmJsType::Uint32x4, AsmJsType::Uint32x4));
         simdFunctions[AsmJsSIMDBuiltin_uint32x4_equal]               = SIMDFunc(PropertyIds::equal, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_uint32x4_equal, OpCodeAsmJs::Simd128_Eq_U4, AsmJsRetType::Bool32x4, AsmJsType::Uint32x4, AsmJsType::Uint32x4));
@@ -1752,7 +1752,7 @@ namespace Js
         simdFunctions[AsmJsSIMDBuiltin_uint16x8_extractLane         ]= SIMDFunc(PropertyIds::extractLane, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 2, AsmJsSIMDBuiltin_uint16x8_extractLane, OpCodeAsmJs::Simd128_ExtractLane_U8, AsmJsRetType::Unsigned, AsmJsType::Uint16x8, AsmJsType::Int));
         simdFunctions[AsmJsSIMDBuiltin_uint16x8_swizzle             ]= SIMDFunc(PropertyIds::swizzle, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 9, AsmJsSIMDBuiltin_uint16x8_swizzle, OpCodeAsmJs::Simd128_Swizzle_U8, AsmJsRetType::Uint16x8, AsmJsType::Uint16x8,
                                                                                 AsmJsType::Int, AsmJsType::Int, AsmJsType::Int, AsmJsType::Int, AsmJsType::Int, AsmJsType::Int, AsmJsType::Int, AsmJsType::Int));
-        simdFunctions[AsmJsSIMDBuiltin_uint16x8_shuffle             ]= SIMDFunc(PropertyIds::shuffle, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 10, AsmJsSIMDBuiltin_uint16x8_shuffle, OpCodeAsmJs::Simd128_Shuffle_U8, AsmJsRetType::Uint16x8, AsmJsType::Uint16x8, AsmJsType::Uint16x8, 
+        simdFunctions[AsmJsSIMDBuiltin_uint16x8_shuffle             ]= SIMDFunc(PropertyIds::shuffle, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 10, AsmJsSIMDBuiltin_uint16x8_shuffle, OpCodeAsmJs::Simd128_Shuffle_U8, AsmJsRetType::Uint16x8, AsmJsType::Uint16x8, AsmJsType::Uint16x8,
                                                                                 AsmJsType::Int, AsmJsType::Int, AsmJsType::Int, AsmJsType::Int, AsmJsType::Int, AsmJsType::Int, AsmJsType::Int, AsmJsType::Int));
         simdFunctions[AsmJsSIMDBuiltin_uint16x8_splat               ]= SIMDFunc(PropertyIds::splat, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 1, AsmJsSIMDBuiltin_uint16x8_splat, OpCodeAsmJs::Simd128_Splat_U8, AsmJsRetType::Uint16x8, AsmJsType::Intish));
         simdFunctions[AsmJsSIMDBuiltin_uint16x8_replaceLane         ]= SIMDFunc(PropertyIds::replaceLane, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 3, AsmJsSIMDBuiltin_uint16x8_replaceLane, OpCodeAsmJs::Simd128_ReplaceLane_U8, AsmJsRetType::Uint16x8, AsmJsType::Uint16x8, AsmJsType::Int, AsmJsType::Intish));
@@ -1860,7 +1860,7 @@ namespace Js
         simdFunctions[AsmJsSIMDBuiltin_bool16x8_not]                = SIMDFunc(PropertyIds::not_, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 1, AsmJsSIMDBuiltin_bool16x8_not, OpCodeAsmJs::Simd128_Not_B8, AsmJsRetType::Bool16x8, AsmJsType::Bool16x8));
         simdFunctions[AsmJsSIMDBuiltin_bool16x8_anyTrue]            = SIMDFunc(PropertyIds::anyTrue, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 1, AsmJsSIMDBuiltin_bool16x8_anyTrue, OpCodeAsmJs::Simd128_AnyTrue_B8, AsmJsRetType::Signed, AsmJsType::Bool16x8));
         simdFunctions[AsmJsSIMDBuiltin_bool16x8_allTrue]            = SIMDFunc(PropertyIds::allTrue, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 1, AsmJsSIMDBuiltin_bool16x8_allTrue, OpCodeAsmJs::Simd128_AllTrue_B8, AsmJsRetType::Signed, AsmJsType::Bool16x8));
-        
+
         /* Bool8x16 builtins*/
         //-------------------
         simdFunctions[AsmJsSIMDBuiltin_Bool8x16]                    = SIMDFunc(PropertyIds::Bool8x16, Anew(&mAllocator, AsmJsSIMDFunction, nullptr, &mAllocator, 16, AsmJsSIMDBuiltin_Bool8x16, OpCodeAsmJs::Simd128_IntsToB16, AsmJsRetType::Bool8x16, AsmJsType::Intish, AsmJsType::Intish, AsmJsType::Intish, AsmJsType::Intish, AsmJsType::Intish, AsmJsType::Intish, AsmJsType::Intish, AsmJsType::Intish, AsmJsType::Intish, AsmJsType::Intish, AsmJsType::Intish, AsmJsType::Intish, AsmJsType::Intish, AsmJsType::Intish, AsmJsType::Intish, AsmJsType::Intish));
@@ -1913,7 +1913,7 @@ namespace Js
                     map = &mStdLibSIMDBool8x16Map;
                     break;
                 }
-                
+
                 if (simdFunctions[i].id && simdFunctions[i].val)
                 {
                     if (!AddStandardLibrarySIMDNameInMap(simdFunctions[i].id, simdFunctions[i].val, map))
@@ -1968,7 +1968,7 @@ namespace Js
         , mStdLibSIMDBool8x16Map(&mAllocator)
         , mStdLibSIMDFloat32x4Map(&mAllocator)
         , mStdLibSIMDFloat64x2Map(&mAllocator)
-        
+
     {
         InitModuleNode( parser );
     }
@@ -2125,7 +2125,7 @@ namespace Js
             {
                 var->SetVarType(AsmJsVarType::Int);
                 var->SetLocation(mIntVarSpace.AcquireRegister());
-                var->SetConstInitialiser(MININT);
+                var->SetConstInitialiser(INT_MIN);
             }
             else if (ParserWrapper::IsUnsigned(pnode))
             {
@@ -2420,7 +2420,7 @@ namespace Js
             {
                 mModuleMemory.mMemorySize = (int)((mModuleMemory.mSimdOffset + mSimdVarSpace.GetTotalVarCount()) * SIMD_SLOTS_SPACE);
             }
-            
+
         }
     }
 
@@ -2866,7 +2866,7 @@ namespace Js
             return LookupStdLibSIMDNameInMap(fieldName, simdFunc, &mStdLibSIMDUint16x8Map);
         case PropertyIds::Uint8x16:
             return LookupStdLibSIMDNameInMap(fieldName, simdFunc, &mStdLibSIMDUint8x16Map);
-        
+
         default:
             AssertMsg(false, "Invalid SIMD type");
             return false;
@@ -3077,7 +3077,7 @@ namespace Js
                     default:
                         Assert(UNREACHED);
                     }
-                    
+
                 }
                 else if (nop == (uint)knopFlt)
                 {

+ 1 - 1
lib/Runtime/Language/AsmJsModule.h

@@ -72,7 +72,7 @@ namespace Js {
     typedef Js::Tick AsmJsCompileTime;
     namespace AsmJsLookupSource
     {
-        enum Source
+        enum Source: int
         {
             AsmJsModule, AsmJsFunction
         };

+ 2 - 2
lib/Runtime/Language/AsmJsTypes.cpp

@@ -800,7 +800,7 @@ namespace Js
         va_start( arguments, retType );
         for(ArgSlot iArg = 0; iArg < argCount; iArg++)
         {
-            SetArgType(va_arg(arguments, AsmJsType), iArg);
+            SetArgType(static_cast<AsmJsType::Which>(va_arg(arguments, int)), iArg);
         }
         va_end(arguments);
     }
@@ -1192,7 +1192,7 @@ namespace Js
         va_start(arguments, retType);
         for (ArgSlot iArg = 0; iArg < argCount; iArg++)
         {
-            SetArgType(va_arg(arguments, AsmJsType), iArg);
+            SetArgType(static_cast<AsmJsType::Which>(va_arg(arguments, int)), iArg);
         }
         va_end(arguments);
     }

+ 3 - 3
lib/Runtime/Language/AsmJsTypes.h

@@ -51,7 +51,7 @@ namespace Js
 
     namespace ArrayBufferView
     {
-        enum ViewType
+        enum ViewType: int
         {
             TYPE_INT8 = 0,
             TYPE_UINT8,
@@ -66,7 +66,7 @@ namespace Js
 
     } /* namespace ArrayBufferView */
     // The asm.js spec recognizes this set of builtin Math functions.
-    enum AsmJSMathBuiltinFunction
+    enum AsmJSMathBuiltinFunction: int
     {
 #define ASMJS_MATH_FUNC_NAMES(name, propertyName) AsmJSMathBuiltin_##name,
 #include "AsmJsBuiltInNames.h"
@@ -699,7 +699,7 @@ namespace Js
         {
             if( !mConstMap.ContainsKey( val ) )
             {
-                mConstMap.Add( val, AcquireConstRegister() );
+                mConstMap.Add( val, this->AcquireConstRegister() );
             }
         }
 

+ 16 - 16
lib/Runtime/Language/AsmJsUtils.cpp

@@ -287,21 +287,21 @@ namespace Js
                 case AsmJsType::Bool32x4:
                     if (!JavascriptSIMDBool32x4::Is(*origArgs))
                     {
-                        JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdBool32x4TypeMismatch, L"Bool32x4");
+                        JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdBool32x4TypeMismatch, _u("Bool32x4"));
                     }
                     simdVal = ((JavascriptSIMDBool32x4*)(*origArgs))->GetValue();
                     break;
                 case AsmJsType::Bool16x8:
                     if (!JavascriptSIMDBool16x8::Is(*origArgs))
                         {
-                        JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdBool16x8TypeMismatch, L"Bool16x8");
+                        JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdBool16x8TypeMismatch, _u("Bool16x8"));
                     }
                     simdVal = ((JavascriptSIMDBool16x8*)(*origArgs))->GetValue();
                     break;
                 case AsmJsType::Bool8x16:
                     if (!JavascriptSIMDBool8x16::Is(*origArgs))
                     {
-                        JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdBool8x16TypeMismatch, L"Bool8x16");
+                        JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdBool8x16TypeMismatch, _u("Bool8x16"));
                     }
                     simdVal = ((JavascriptSIMDBool8x16*)(*origArgs))->GetValue();
                     break;
@@ -322,35 +322,35 @@ namespace Js
                 case AsmJsType::Int16x8:
                     if (!JavascriptSIMDInt16x8::Is(*origArgs))
                     {
-                        JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdInt16x8TypeMismatch, L"Int16x8");
+                        JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdInt16x8TypeMismatch, _u("Int16x8"));
                     }
                     simdVal = ((JavascriptSIMDInt16x8*)(*origArgs))->GetValue();
                     break;
                 case AsmJsType::Int8x16:
                     if (!JavascriptSIMDInt8x16::Is(*origArgs))
                     {
-                        JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdInt8x16TypeMismatch, L"Int8x16");
+                        JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdInt8x16TypeMismatch, _u("Int8x16"));
                     }
                     simdVal = ((JavascriptSIMDInt8x16*)(*origArgs))->GetValue();
                     break;
                 case AsmJsType::Uint32x4:
                     if (!JavascriptSIMDUint32x4::Is(*origArgs))
                     {
-                        JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdUint32x4TypeMismatch, L"Uint32x4");
+                        JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdUint32x4TypeMismatch, _u("Uint32x4"));
                     }
                     simdVal = ((JavascriptSIMDUint32x4*)(*origArgs))->GetValue();
                     break;
                 case AsmJsType::Uint16x8:
                     if (!JavascriptSIMDUint16x8::Is(*origArgs))
                     {
-                        JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdUint16x8TypeMismatch, L"Uint16x8");
+                        JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdUint16x8TypeMismatch, _u("Uint16x8"));
                     }
                     simdVal = ((JavascriptSIMDUint16x8*)(*origArgs))->GetValue();
                     break;
                 case AsmJsType::Uint8x16:
                     if (!JavascriptSIMDUint8x16::Is(*origArgs))
                     {
-                        JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdUint8x16TypeMismatch, L"Uint8x16");
+                        JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdUint8x16TypeMismatch, _u("Uint8x16"));
                     }
                     simdVal = ((JavascriptSIMDUint8x16*)(*origArgs))->GetValue();
                     break;
@@ -560,21 +560,21 @@ namespace Js
                     case AsmJsType::Bool32x4:
                         if (i >= argInCount || !JavascriptSIMDBool32x4::Is(args.Values[i + 1]))
                         {
-                            JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdBool32x4TypeMismatch, L"Bool32x4");
+                            JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdBool32x4TypeMismatch, _u("Bool32x4"));
                         }
                         simdVal = ((JavascriptSIMDBool32x4*)(args.Values[i + 1]))->GetValue();
                         break;
                     case AsmJsType::Bool16x8:
                         if (i >= argInCount || !JavascriptSIMDBool16x8::Is(args.Values[i + 1]))
                         {
-                            JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdBool16x8TypeMismatch, L"Bool16x8");
+                            JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdBool16x8TypeMismatch, _u("Bool16x8"));
                         }
                         simdVal = ((JavascriptSIMDBool16x8*)(args.Values[i + 1]))->GetValue();
                         break;
                     case AsmJsType::Bool8x16:
                         if (i >= argInCount || !JavascriptSIMDBool8x16::Is(args.Values[i + 1]))
                         {
-                            JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdBool8x16TypeMismatch, L"Bool8x16");
+                            JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdBool8x16TypeMismatch, _u("Bool8x16"));
                         }
                         simdVal = ((JavascriptSIMDBool8x16*)(args.Values[i + 1]))->GetValue();
                         break;
@@ -595,35 +595,35 @@ namespace Js
                     case AsmJsType::Int16x8:
                         if (i >= argInCount || !JavascriptSIMDInt16x8::Is(args.Values[i + 1]))
                         {
-                            JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdInt16x8TypeMismatch, L"Int16x8");
+                            JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdInt16x8TypeMismatch, _u("Int16x8"));
                         }
                         simdVal = ((JavascriptSIMDInt16x8*)(args.Values[i + 1]))->GetValue();
                         break;
                     case AsmJsType::Int8x16:
                         if (i >= argInCount || !JavascriptSIMDInt8x16::Is(args.Values[i + 1]))
                         {
-                            JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdInt8x16TypeMismatch, L"Int8x16");
+                            JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdInt8x16TypeMismatch, _u("Int8x16"));
                         }
                         simdVal = ((JavascriptSIMDInt8x16*)(args.Values[i + 1]))->GetValue();
                         break;
                     case AsmJsType::Uint32x4:
                         if (i >= argInCount || !JavascriptSIMDUint32x4::Is(args.Values[i + 1]))
                         {
-                            JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdUint32x4TypeMismatch, L"Uint32x4");
+                            JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdUint32x4TypeMismatch, _u("Uint32x4"));
                         }
                         simdVal = ((JavascriptSIMDUint32x4*)(args.Values[i + 1]))->GetValue();
                         break;
                     case AsmJsType::Uint16x8:
                         if (i >= argInCount || !JavascriptSIMDUint16x8::Is(args.Values[i + 1]))
                         {
-                            JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdUint16x8TypeMismatch, L"Uint16x8");
+                            JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdUint16x8TypeMismatch, _u("Uint16x8"));
                         }
                         simdVal = ((JavascriptSIMDUint16x8*)(args.Values[i + 1]))->GetValue();
                         break;
                     case AsmJsType::Uint8x16:
                         if (i >= argInCount || !JavascriptSIMDUint8x16::Is(args.Values[i + 1]))
                         {
-                            JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdUint8x16TypeMismatch, L"Uint8x16");
+                            JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdUint8x16TypeMismatch, _u("Uint8x16"));
                         }
                         simdVal = ((JavascriptSIMDUint8x16*)(args.Values[i + 1]))->GetValue();
                         break;

+ 10 - 10
lib/Runtime/Language/DynamicProfileInfo.cpp

@@ -338,7 +338,7 @@ namespace Js
         }
         else
         {
-            Assert(directEntryPoint == ProfileEntryThunk || functionBody->GetScriptContext()->IsNativeAddress(directEntryPoint));
+            Assert(directEntryPoint == ProfileEntryThunk || functionBody->GetScriptContext()->IsNativeAddress((void*)directEntryPoint));
             Assert(functionBody->HasExecutionDynamicProfileInfo());
         }
 
@@ -841,7 +841,7 @@ namespace Js
         return &arrayCallSiteInfo[index];
     }
 
-    inline void DynamicProfileInfo::RecordFieldAccess(FunctionBody* functionBody, uint fieldAccessId, Var object, FldInfoFlags flags)
+    void DynamicProfileInfo::RecordFieldAccess(FunctionBody* functionBody, uint fieldAccessId, Var object, FldInfoFlags flags)
     {
         Assert(fieldAccessId < functionBody->GetProfiledFldCount());
         FldInfoFlags oldFlags = fldInfo[fieldAccessId].flags;
@@ -881,7 +881,7 @@ namespace Js
         }
     }
 
-    inline void DynamicProfileInfo::RecordDivideResultType(FunctionBody* body, ProfileId divideId, Var object)
+    void DynamicProfileInfo::RecordDivideResultType(FunctionBody* body, ProfileId divideId, Var object)
     {
         Assert(divideId < body->GetProfiledDivOrRemCount());
         divideTypeInfo[divideId] = divideTypeInfo[divideId].Merge(object);
@@ -922,7 +922,7 @@ namespace Js
         return divideTypeInfo[divideId];
     }
 
-    inline void DynamicProfileInfo::RecordSwitchType(FunctionBody* body, ProfileId switchId, Var object)
+    void DynamicProfileInfo::RecordSwitchType(FunctionBody* body, ProfileId switchId, Var object)
     {
         Assert(switchId < body->GetProfiledSwitchCount());
         switchTypeInfo[switchId] = switchTypeInfo[switchId].Merge(object);
@@ -943,12 +943,12 @@ namespace Js
             _u("New profile cache state: %d\n"), this->polymorphicCacheState);
     }
 
-    inline void DynamicProfileInfo::RecordPolymorphicFieldAccess(FunctionBody* functionBody, uint fieldAccessId)
+    void DynamicProfileInfo::RecordPolymorphicFieldAccess(FunctionBody* functionBody, uint fieldAccessId)
     {
         this->RecordFieldAccess(functionBody, fieldAccessId, nullptr, FldInfo_Polymorphic);
     }
 
-    inline void DynamicProfileInfo::RecordSlotLoad(FunctionBody* functionBody, ProfileId slotLoadId, Var object)
+    void DynamicProfileInfo::RecordSlotLoad(FunctionBody* functionBody, ProfileId slotLoadId, Var object)
     {
         Assert(slotLoadId < functionBody->GetProfiledSlotCount());
         slotInfo[slotLoadId] = slotInfo[slotLoadId].Merge(object);
@@ -959,7 +959,7 @@ namespace Js
         return static_cast<FldInfoFlags>(oldFlags | newFlags);
     }
 
-    inline void DynamicProfileInfo::RecordParameterInfo(FunctionBody *functionBody, ArgSlot index, Var object)
+    void DynamicProfileInfo::RecordParameterInfo(FunctionBody *functionBody, ArgSlot index, Var object)
     {
         Assert(this->parameterInfo != nullptr);
         Assert(index < functionBody->GetProfiledInParamsCount());
@@ -973,13 +973,13 @@ namespace Js
         return parameterInfo[index];
     }
 
-    inline void DynamicProfileInfo::RecordReturnTypeOnCallSiteInfo(FunctionBody* functionBody, ProfileId callSiteId, Var object)
+    void DynamicProfileInfo::RecordReturnTypeOnCallSiteInfo(FunctionBody* functionBody, ProfileId callSiteId, Var object)
     {
         Assert(callSiteId < functionBody->GetProfiledCallSiteCount());
         this->callSiteInfo[callSiteId].returnType = this->callSiteInfo[callSiteId].returnType.Merge(object);
     }
 
-    inline void DynamicProfileInfo::RecordReturnType(FunctionBody* functionBody, ProfileId callSiteId, Var object)
+    void DynamicProfileInfo::RecordReturnType(FunctionBody* functionBody, ProfileId callSiteId, Var object)
     {
         Assert(callSiteId < functionBody->GetProfiledReturnTypeCount());
         this->returnTypeInfo[callSiteId] = this->returnTypeInfo[callSiteId].Merge(object);
@@ -998,7 +998,7 @@ namespace Js
         return this->returnTypeInfo[callSiteId];
     }
 
-    inline void DynamicProfileInfo::RecordThisInfo(Var object, ThisType thisType)
+    void DynamicProfileInfo::RecordThisInfo(Var object, ThisType thisType)
     {
         this->thisInfo.valueType = this->thisInfo.valueType.Merge(object);
         this->thisInfo.thisType = max(this->thisInfo.thisType, thisType);

+ 2 - 2
lib/Runtime/Language/DynamicProfileStorage.cpp

@@ -17,7 +17,7 @@ char16 DynamicProfileStorage::cacheDir[_MAX_DIR];
 char16 DynamicProfileStorage::catalogFilename[_MAX_PATH];
 CriticalSection DynamicProfileStorage::cs;
 DynamicProfileStorage::InfoMap DynamicProfileStorage::infoMap(&NoCheckHeapAllocator::Instance);
-DWORD DynamicProfileStorage::creationTime = 0;
+DynamicProfileStorage::TimeType DynamicProfileStorage::creationTime = DynamicProfileStorage::TimeType();
 int32 DynamicProfileStorage::lastOffset = 0;
 DWORD const DynamicProfileStorage::MagicNumber = 20100526;
 DWORD const DynamicProfileStorage::FileFormatVersion = 2;
@@ -796,7 +796,7 @@ bool DynamicProfileStorage::CreateCacheCatalog()
     Assert(useCacheDir);
     Assert(locked);
     nextFileId = 0;
-    creationTime = _time32(NULL);
+    creationTime = GetCreationTime();
     DynamicProfileStorageReaderWriter catalogFile;
     if (!catalogFile.Init(catalogFilename, _u("wb"), true)
         || !catalogFile.Write(MagicNumber)

+ 8 - 1
lib/Runtime/Language/DynamicProfileStorage.h

@@ -50,7 +50,14 @@ private:
     static char16 catalogFilename[_MAX_PATH];
     static DWORD const MagicNumber;
     static DWORD const FileFormatVersion;
-    static DWORD creationTime;
+#ifdef _WIN32
+    typedef DWORD TimeType;
+	static inline TimeType GetCreationTime() { return _time32(NULL); }
+#else
+    typedef time_t TimeType;
+    static inline TimeType GetCreationTime() { return time(NULL); }
+#endif
+    static TimeType creationTime;
     static int32 lastOffset;
     static HANDLE mutex;
     static CriticalSection cs;

+ 3 - 3
lib/Runtime/Language/InterpreterStackFrame.h

@@ -32,7 +32,7 @@ namespace Js
     {
         PREVENT_COPY(InterpreterStackFrame)
 
-        friend class BailOutRecord;
+        friend class ::BailOutRecord;
         friend class JavascriptGeneratorFunction;
         friend class JavascriptGenerator;
 
@@ -231,7 +231,7 @@ namespace Js
         UINT16 GetFlags() const { return m_flags; }
         void OrFlags(UINT16 addTo) { m_flags |= addTo; }
         bool IsInCatchOrFinallyBlock();
-        static bool IsDelayDynamicInterpreterThunk(void* entryPoint);
+        static bool IsDelayDynamicInterpreterThunk(JavascriptMethod entryPoint);
 
         Var LdEnv() const;
         void SetEnv(FrameDisplay *frameDisplay);
@@ -614,7 +614,7 @@ namespace Js
         inline void OP_StModuleSlot(Var instance, int32 slotIndex1, int32 slotIndex2);
         inline void* OP_LdArgCnt();
         template <bool letArgs> Var LdHeapArgumentsImpl(Var argsArray, ScriptContext* scriptContext);
-        inline Var OP_LdHeapArguments(ScriptContext* scriptContext);
+        Var OP_LdHeapArguments(ScriptContext* scriptContext);
         inline Var OP_LdLetHeapArguments(ScriptContext* scriptContext);
         inline Var OP_LdHeapArgsCached(ScriptContext* scriptContext);
         inline Var OP_LdLetHeapArgsCached(ScriptContext* scriptContext);

+ 3 - 3
lib/Runtime/Language/JavascriptNativeOperators.h

@@ -20,7 +20,7 @@ namespace Js
                 chunk->dataType = "BranchDictionary::Bucket";
                 if (PHASE_TRACE1(Js::NativeCodeDataPhase))
                 {
-                    Output::Print(L"NativeCodeData BranchDictionary::Bucket: chunk: %p, data: %p, index: %d, len: %x, totalOffset: %x, type: %S\n",
+                    Output::Print(_u("NativeCodeData BranchDictionary::Bucket: chunk: %p, data: %p, index: %d, len: %x, totalOffset: %x, type: %S\n"),
                         chunk, (void*)dataBlock, chunk->allocIndex, chunk->len, chunk->offset, chunk->dataType);
                 }
 #endif
@@ -35,7 +35,7 @@ namespace Js
                 chunk->dataType = "BranchDictionary::Entries";
                 if (PHASE_TRACE1(Js::NativeCodeDataPhase))
                 {
-                    Output::Print(L"NativeCodeData BranchDictionary::Entries: chunk: %p, data: %p, index: %d, len: %x, totalOffset: %x, type: %S\n",
+                    Output::Print(_u("NativeCodeData BranchDictionary::Entries: chunk: %p, data: %p, index: %d, len: %x, totalOffset: %x, type: %S\n"),
                         chunk, (void*)dataBlock, chunk->allocIndex, chunk->len, chunk->offset, chunk->dataType);
                 }
 #endif
@@ -52,7 +52,7 @@ namespace Js
             {
                 this->key = (TKey)remoteKey;
             }
-        };       
+        };
 
         typedef JsUtil::BaseDictionary<T, void*, DictAllocator, PowerOf2SizePolicy, DefaultComparer, SimpleDictionaryEntryWithFixUp> BranchBaseDictionary;
 

+ 40 - 40
lib/Runtime/Language/ObjTypeSpecFldInfo.cpp

@@ -166,27 +166,27 @@ namespace Js
                     functionObject = (Js::JavascriptFunction *)fixedProperty;
                     if (PHASE_VERBOSE_TRACE(Js::FixedMethodsPhase, functionBody))
                     {
-                        wchar_t debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
-                        wchar_t debugStringBuffer2[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+                        char16 debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+                        char16 debugStringBuffer2[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
 
                         Js::DynamicObject* protoObject = isProto ? prototypeObject : nullptr;
-                        Output::Print(L"FixedFields: function %s (%s) cloning cache with fixed method: %s (%s), function: 0x%p, body: 0x%p (cache id: %d, layout: %s, type: 0x%p, proto: 0x%p, proto type: 0x%p)\n",
+                        Output::Print(_u("FixedFields: function %s (%s) cloning cache with fixed method: %s (%s), function: 0x%p, body: 0x%p (cache id: %d, layout: %s, type: 0x%p, proto: 0x%p, proto type: 0x%p)\n"),
                             functionBody->GetDisplayName(), functionBody->GetDebugNumberSet(debugStringBuffer),
                             fixedPropertyRecord->GetBuffer(), functionObject->GetFunctionInfo()->GetFunctionProxy() ?
-                            functionObject->GetFunctionInfo()->GetFunctionProxy()->GetDebugNumberSet(debugStringBuffer2) : L"(null)", functionObject, functionObject->GetFunctionInfo(),
-                            cacheId, isProto ? L"proto" : L"local", type, protoObject, protoObject != nullptr ? protoObject->GetType() : nullptr);
+                            functionObject->GetFunctionInfo()->GetFunctionProxy()->GetDebugNumberSet(debugStringBuffer2) : _u("(null)"), functionObject, functionObject->GetFunctionInfo(),
+                            cacheId, isProto ? _u("proto") : _u("local"), type, protoObject, protoObject != nullptr ? protoObject->GetType() : nullptr);
                         Output::Flush();
                     }
 
                     if (PHASE_VERBOSE_TESTTRACE(Js::FixedMethodsPhase, functionBody))
                     {
-                        wchar_t debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
-                        wchar_t debugStringBuffer2[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+                        char16 debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+                        char16 debugStringBuffer2[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
 
-                        Output::Print(L"FixedFields: function %s (%s) cloning cache with fixed method: %s (%s) (cache id: %d, layout: %s)\n",
+                        Output::Print(_u("FixedFields: function %s (%s) cloning cache with fixed method: %s (%s) (cache id: %d, layout: %s)\n"),
                             functionBody->GetDisplayName(), functionBody->GetDebugNumberSet(debugStringBuffer), fixedPropertyRecord->GetBuffer(), functionObject->GetFunctionInfo()->GetFunctionProxy() ?
-                            functionObject->GetFunctionInfo()->GetFunctionProxy()->GetDebugNumberSet(debugStringBuffer2) : L"(null)", functionObject, functionObject->GetFunctionInfo(),
-                            cacheId, isProto ? L"proto" : L"local");
+                            functionObject->GetFunctionInfo()->GetFunctionProxy()->GetDebugNumberSet(debugStringBuffer2) : _u("(null)"), functionObject, functionObject->GetFunctionInfo(),
+                            cacheId, isProto ? _u("proto") : _u("local"));
                         Output::Flush();
                     }
 
@@ -217,12 +217,12 @@ namespace Js
                             {
                                 if (PHASE_TRACE(Js::FixedNewObjPhase, functionBody))
                                 {
-                                    wchar_t debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
-                                    wchar_t debugStringBuffer2[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+                                    char16 debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+                                    char16 debugStringBuffer2[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
 
-                                    Output::Print(L"FixedNewObj: function %s (%s) ctor cache for %s (%s) about to be cloned has unlocked inline slot count: guard value = 0x%p, type = 0x%p, slots = %d, inline slots = %d\n",
+                                    Output::Print(_u("FixedNewObj: function %s (%s) ctor cache for %s (%s) about to be cloned has unlocked inline slot count: guard value = 0x%p, type = 0x%p, slots = %d, inline slots = %d\n"),
                                         functionBody->GetDisplayName(), functionBody->GetDebugNumberSet(debugStringBuffer), fixedPropertyRecord->GetBuffer(), functionObject->GetFunctionInfo()->GetFunctionBody() ?
-                                        functionObject->GetFunctionInfo()->GetFunctionBody()->GetDebugNumberSet(debugStringBuffer2) : L"(null)",
+                                        functionObject->GetFunctionInfo()->GetFunctionBody()->GetDebugNumberSet(debugStringBuffer2) : _u("(null)"),
                                         runtimeConstructorCache->GetRawGuardValue(), runtimeConstructorCache->GetType(),
                                         runtimeConstructorCache->GetSlotCount(), runtimeConstructorCache->GetInlineSlotCount());
                                     Output::Flush();
@@ -239,12 +239,12 @@ namespace Js
 
                         if (PHASE_TRACE(Js::FixedNewObjPhase, functionBody))
                         {
-                            wchar_t debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
-                            wchar_t debugStringBuffer2[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+                            char16 debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+                            char16 debugStringBuffer2[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
 
-                            Output::Print(L"FixedNewObj: function %s (%s) cloning ctor cache for %s (%s): guard value = 0x%p, type = 0x%p, slots = %d, inline slots = %d\n",
+                            Output::Print(_u("FixedNewObj: function %s (%s) cloning ctor cache for %s (%s): guard value = 0x%p, type = 0x%p, slots = %d, inline slots = %d\n"),
                                 functionBody->GetDisplayName(), functionBody->GetDebugNumberSet(debugStringBuffer), fixedPropertyRecord->GetBuffer(), functionObject->GetFunctionInfo()->GetFunctionBody() ?
-                                functionObject->GetFunctionInfo()->GetFunctionBody()->GetDebugNumberSet(debugStringBuffer2) : L"(null)", functionObject, functionObject->GetFunctionInfo(),
+                                functionObject->GetFunctionInfo()->GetFunctionBody()->GetDebugNumberSet(debugStringBuffer2) : _u("(null)"), functionObject, functionObject->GetFunctionInfo(),
                                 runtimeConstructorCache->GetRawGuardValue(), runtimeConstructorCache->IsNormal() ? runtimeConstructorCache->GetType() : nullptr,
                                 runtimeConstructorCache->GetSlotCount(), runtimeConstructorCache->GetInlineSlotCount());
                             Output::Flush();
@@ -256,19 +256,19 @@ namespace Js
                         {
                             if (PHASE_TRACE(Js::FixedNewObjPhase, functionBody))
                             {
-                                wchar_t debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
-                                wchar_t debugStringBuffer2[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+                                char16 debugStringBuffer[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
+                                char16 debugStringBuffer2[MAX_FUNCTION_BODY_DEBUG_STRING_SIZE];
 
-                                Output::Print(L"FixedNewObj: function %s (%s) skipping ctor cache for %s (%s), because %s (guard value = 0x%p, script context = %p).\n",
+                                Output::Print(_u("FixedNewObj: function %s (%s) skipping ctor cache for %s (%s), because %s (guard value = 0x%p, script context = %p).\n"),
                                     functionBody->GetDisplayName(), functionBody->GetDebugNumberSet(debugStringBuffer), fixedPropertyRecord->GetBuffer(), functionObject->GetFunctionInfo()->GetFunctionBody() ?
-                                    functionObject->GetFunctionInfo()->GetFunctionBody()->GetDebugNumberSet(debugStringBuffer2) : L"(null)", functionObject, functionObject->GetFunctionInfo(),
-                                    runtimeConstructorCache->IsEmpty() ? L"cache is empty (or has been cleared)" :
-                                    runtimeConstructorCache->IsInvalidated() ? L"cache is invalidated" :
-                                    runtimeConstructorCache->SkipDefaultNewObject() ? L"default new object isn't needed" :
-                                    runtimeConstructorCache->NeedsTypeUpdate() ? L"cache needs to be updated" :
-                                    runtimeConstructorCache->NeedsUpdateAfterCtor() ? L"cache needs update after ctor" :
-                                    runtimeConstructorCache->IsPolymorphic() ? L"cache is polymorphic" :
-                                    runtimeConstructorCache->GetScriptContext() != functionBody->GetScriptContext() ? L"script context mismatch" : L"of an unexpected situation",
+                                    functionObject->GetFunctionInfo()->GetFunctionBody()->GetDebugNumberSet(debugStringBuffer2) : _u("(null)"), functionObject, functionObject->GetFunctionInfo(),
+                                    runtimeConstructorCache->IsEmpty() ? _u("cache is empty (or has been cleared)") :
+                                    runtimeConstructorCache->IsInvalidated() ? _u("cache is invalidated") :
+                                    runtimeConstructorCache->SkipDefaultNewObject() ? _u("default new object isn't needed") :
+                                    runtimeConstructorCache->NeedsTypeUpdate() ? _u("cache needs to be updated") :
+                                    runtimeConstructorCache->NeedsUpdateAfterCtor() ? _u("cache needs update after ctor") :
+                                    runtimeConstructorCache->IsPolymorphic() ? _u("cache is polymorphic") :
+                                    runtimeConstructorCache->GetScriptContext() != functionBody->GetScriptContext() ? _u("script context mismatch") : _u("of an unexpected situation"),
                                     runtimeConstructorCache->GetRawGuardValue(), runtimeConstructorCache->GetScriptContext());
                                 Output::Flush();
                             }
@@ -338,7 +338,7 @@ namespace Js
             if (PHASE_TRACE(Js::ObjTypeSpecPhase, topFunctionBody) || PHASE_TRACE(Js::EquivObjTypeSpecPhase, topFunctionBody))
             {
                 const PropertyRecord* propertyRecord = scriptContext->GetPropertyName(propertyId);
-                Output::Print(L"Created ObjTypeSpecFldInfo: id %u, property %s(#%u), slot %u, type set: 0x%p\n",
+                Output::Print(_u("Created ObjTypeSpecFldInfo: id %u, property %s(#%u), slot %u, type set: 0x%p\n"),
                     id, propertyRecord->GetBuffer(), propertyId, slotIndex, type);
                 Output::Flush();
             }
@@ -352,7 +352,7 @@ namespace Js
             if (PHASE_TRACE(Js::ObjTypeSpecPhase, topFunctionBody) || PHASE_TRACE(Js::EquivObjTypeSpecPhase, topFunctionBody))
             {
                 const PropertyRecord* propertyRecord = scriptContext->GetPropertyName(propertyId);
-                Output::Print(L"Created ObjTypeSpecFldInfo: id %u, property %s(#%u), slot %u, type: 0x%p\n",
+                Output::Print(_u("Created ObjTypeSpecFldInfo: id %u, property %s(#%u), slot %u, type: 0x%p\n"),
                     id, propertyRecord->GetBuffer(), propertyId, slotIndex, type);
                 Output::Flush();
             }
@@ -384,13 +384,13 @@ namespace Js
             }
         }
 
-        Assert(cache->GetSize() < MAXUINT16);
+        Assert(cache->GetSize() < UINT16_MAX);
         Js::InlineCache* inlineCaches = cache->GetInlineCaches();
         Js::DynamicObject* prototypeObject = nullptr;
         Js::DynamicObject* accessorOwnerObject = nullptr;
         Js::TypeId typeId = TypeIds_Limit;
         uint16 polyCacheSize = (uint16)cache->GetSize();
-        uint16 firstNonEmptyCacheIndex = MAXUINT16;
+        uint16 firstNonEmptyCacheIndex = UINT16_MAX;
         uint16 slotIndex = 0;
         bool areEquivalent = true;
         bool usesAuxSlot = false;
@@ -408,7 +408,7 @@ namespace Js
             InlineCache& inlineCache = inlineCaches[i];
             if (inlineCache.IsEmpty()) continue;
 
-            if (firstNonEmptyCacheIndex == MAXUINT16)
+            if (firstNonEmptyCacheIndex == UINT16_MAX)
             {
                 if (inlineCache.IsLocal())
                 {
@@ -494,7 +494,7 @@ namespace Js
             typeCount++;
         }
 
-        if (firstNonEmptyCacheIndex == MAXUINT16)
+        if (firstNonEmptyCacheIndex == UINT16_MAX)
         {
             IncInlineCacheCount(emptyPolyInlineCacheCount);
             return nullptr;
@@ -679,13 +679,13 @@ namespace Js
                 if (typeSet)
                 {
                     const PropertyRecord* propertyRecord = scriptContext->GetPropertyName(propertyId);
-                    Output::Print(L"Created ObjTypeSpecFldInfo: id %u, property %s(#%u), slot %u, type set: ",
+                    Output::Print(_u("Created ObjTypeSpecFldInfo: id %u, property %s(#%u), slot %u, type set: "),
                         id, propertyRecord->GetBuffer(), propertyId, slotIndex);
                     for (uint16 ti = 0; ti < typeCount - 1; ti++)
                     {
-                        Output::Print(L"0x%p, ", typeSet->GetType(ti));
+                        Output::Print(_u("0x%p, "), typeSet->GetType(ti));
                     }
-                    Output::Print(L"0x%p\n", typeSet->GetType(typeCount - 1));
+                    Output::Print(_u("0x%p\n"), typeSet->GetType(typeCount - 1));
                     Output::Flush();
                 }
             }
@@ -763,9 +763,9 @@ namespace Js
     }
 
 #ifdef ENABLE_DEBUG_CONFIG_OPTIONS
-    const wchar_t* ObjTypeSpecFldInfo::GetCacheLayoutString() const
+    const char16* ObjTypeSpecFldInfo::GetCacheLayoutString() const
     {
-        return IsLoadedFromProto() ? L"proto" : UsesAccessor() ? L"flags" : L"local";
+        return IsLoadedFromProto() ? _u("proto") : UsesAccessor() ? _u("flags") : _u("local");
     }
 #endif
 

+ 1 - 1
lib/Runtime/Language/ObjTypeSpecFldInfo.h

@@ -363,7 +363,7 @@ namespace Js
         }
 
 #ifdef ENABLE_DEBUG_CONFIG_OPTIONS
-        const wchar_t *GetCacheLayoutString() const;
+        const char16 *GetCacheLayoutString() const;
 #endif
     };
 

+ 3 - 1
lib/Runtime/Language/SourceDynamicProfileManager.h

@@ -65,6 +65,7 @@ namespace Js
 
         static const uint MAX_FUNCTION_COUNT = 10000;  // Consider data corrupt if there are more functions than this
 
+#ifdef ENABLE_WININET_PROFILE_DATA_CACHE
         //
         // Simple read-only wrapper around IStream - templatized and returns boolean result to indicate errors
         //
@@ -148,6 +149,7 @@ namespace Js
 
             IStream* stream;
         };
+#endif  // ENABLE_WININET_PROFILE_DATA_CACHE
     };
 };
-#endif
+#endif  // ENABLE_PROFILE_INFO

+ 3 - 3
lib/Runtime/Language/ValueType.cpp

@@ -59,7 +59,7 @@ ValueType ValueType::GetNumberAndLikelyInt(const bool isLikelyTagged)
     return Verify(GetInt(isLikelyTagged).bits | Bits::Number);
 }
 
-inline ValueType ValueType::GetObject(const ObjectType objectType)
+ValueType ValueType::GetObject(const ObjectType objectType)
 {
     ValueType valueType(UninitializedObject);
     valueType.SetObjectType(objectType);
@@ -1483,7 +1483,7 @@ ValueType ValueType::FromObjectWithArray(Js::DynamicObject *const object)
     return FromObjectArray(JavascriptArray::FromVar(objectArray));
 }
 
-inline ValueType ValueType::FromObjectArray(Js::JavascriptArray *const objectArray)
+ValueType ValueType::FromObjectArray(Js::JavascriptArray *const objectArray)
 {
     using namespace Js;
     Assert(objectArray);
@@ -1491,7 +1491,7 @@ inline ValueType ValueType::FromObjectArray(Js::JavascriptArray *const objectArr
     return FromArray(ObjectType::ObjectWithArray, objectArray, TypeIds_Array); // objects with native arrays are currently not supported
 }
 
-inline ValueType ValueType::FromArray(
+ValueType ValueType::FromArray(
     const ObjectType objectType,
     Js::JavascriptArray *const array,
     const Js::TypeId arrayTypeId)

+ 1 - 1
lib/Runtime/Library/JavascriptFunction.h

@@ -90,7 +90,7 @@ namespace Js
         Var CallRootFunction(Arguments args, ScriptContext * scriptContext, bool inScript);
         Var CallRootFunctionInternal(Arguments args, ScriptContext * scriptContext, bool inScript);
         template <typename T>
-        static T CallAsmJsFunction(RecyclableObject * function, void* entryPoint, uint argc, Var * argv);
+        static T CallAsmJsFunction(RecyclableObject * function, JavascriptMethod entryPoint, uint argc, Var * argv);
         template <bool isConstruct>
         static Var CalloutHelper(RecyclableObject* function, Var thisArg, Var overridingNewTarget, Var argArray, ScriptContext* scriptContext);
 

+ 11 - 11
lib/Runtime/Library/amd64/JavascriptFunctionA.asm

@@ -227,33 +227,33 @@ extrn ?GetArgsSizesArray@Js@@YAPEAIPEAVScriptFunction@1@@Z : PROC
 
 ; float CallAsmJsFunction<float>(RecyclableObject *function, JavascriptMethod entryPoint, uint argc, Var *argv);
 align 16
-??$CallAsmJsFunction@M@JavascriptFunction@Js@@SAMPEAVRecyclableObject@1@PEAXIPEAPEAX@Z PROC FRAME
+??$CallAsmJsFunction@M@JavascriptFunction@Js@@SAMPEAVRecyclableObject@1@P6APEAX0UCallInfo@1@ZZIPEAPEAX@Z PROC FRAME
     .setframe rbp, 0
     .endprolog
-    rex_jmp_reg ??$CallAsmJsFunction@H@JavascriptFunction@Js@@SAHPEAVRecyclableObject@1@PEAXIPEAPEAX@Z
-??$CallAsmJsFunction@M@JavascriptFunction@Js@@SAMPEAVRecyclableObject@1@PEAXIPEAPEAX@Z ENDP
+    rex_jmp_reg ??$CallAsmJsFunction@H@JavascriptFunction@Js@@SAHPEAVRecyclableObject@1@P6APEAX0UCallInfo@1@ZZIPEAPEAX@Z
+??$CallAsmJsFunction@M@JavascriptFunction@Js@@SAMPEAVRecyclableObject@1@P6APEAX0UCallInfo@1@ZZIPEAPEAX@Z ENDP
 
 ; double CallAsmJsFunction<double>(RecyclableObject *function, JavascriptMethod entryPoint, uint argc, Var *argv);
 align 16
-??$CallAsmJsFunction@N@JavascriptFunction@Js@@SANPEAVRecyclableObject@1@PEAXIPEAPEAX@Z PROC FRAME
+??$CallAsmJsFunction@N@JavascriptFunction@Js@@SANPEAVRecyclableObject@1@P6APEAX0UCallInfo@1@ZZIPEAPEAX@Z PROC FRAME
     .setframe rbp, 0
     .endprolog
-    rex_jmp_reg ??$CallAsmJsFunction@H@JavascriptFunction@Js@@SAHPEAVRecyclableObject@1@PEAXIPEAPEAX@Z
-??$CallAsmJsFunction@N@JavascriptFunction@Js@@SANPEAVRecyclableObject@1@PEAXIPEAPEAX@Z ENDP
+    rex_jmp_reg ??$CallAsmJsFunction@H@JavascriptFunction@Js@@SAHPEAVRecyclableObject@1@P6APEAX0UCallInfo@1@ZZIPEAPEAX@Z
+??$CallAsmJsFunction@N@JavascriptFunction@Js@@SANPEAVRecyclableObject@1@P6APEAX0UCallInfo@1@ZZIPEAPEAX@Z ENDP
 
 ; __m128 JavascriptFunction::CallAsmJsFunction(RecyclableObject * function, void* entryPoint, uint argc, Var * argv);
 align 16
-??$CallAsmJsFunction@T__m128@@@JavascriptFunction@Js@@SA?AT__m128@@PEAVRecyclableObject@1@PEAXIPEAPEAX@Z PROC FRAME
+??$CallAsmJsFunction@T__m128@@@JavascriptFunction@Js@@SA?AT__m128@@PEAVRecyclableObject@1@P6APEAX0UCallInfo@1@ZZIPEAPEAX@Z PROC FRAME
     .setframe rbp, 0
     .endprolog
-    rex_jmp_reg ??$CallAsmJsFunction@H@JavascriptFunction@Js@@SAHPEAVRecyclableObject@1@PEAXIPEAPEAX@Z
-??$CallAsmJsFunction@T__m128@@@JavascriptFunction@Js@@SA?AT__m128@@PEAVRecyclableObject@1@PEAXIPEAPEAX@Z ENDP
+    rex_jmp_reg ??$CallAsmJsFunction@H@JavascriptFunction@Js@@SAHPEAVRecyclableObject@1@P6APEAX0UCallInfo@1@ZZIPEAPEAX@Z
+??$CallAsmJsFunction@T__m128@@@JavascriptFunction@Js@@SA?AT__m128@@PEAVRecyclableObject@1@P6APEAX0UCallInfo@1@ZZIPEAPEAX@Z ENDP
 
 
 
 ; int CallAsmJsFunction<int>(RecyclableObject *function, JavascriptMethod entryPoint, uint argc, Var *argv);
 align 16
-??$CallAsmJsFunction@H@JavascriptFunction@Js@@SAHPEAVRecyclableObject@1@PEAXIPEAPEAX@Z PROC FRAME
+??$CallAsmJsFunction@H@JavascriptFunction@Js@@SAHPEAVRecyclableObject@1@P6APEAX0UCallInfo@1@ZZIPEAPEAX@Z PROC FRAME
 
         ; save these to stack for interpreter
         mov qword ptr [rsp + 8h],  rcx
@@ -408,7 +408,7 @@ done:
         pop rbx
         ret
 
-??$CallAsmJsFunction@H@JavascriptFunction@Js@@SAHPEAVRecyclableObject@1@PEAXIPEAPEAX@Z ENDP
+??$CallAsmJsFunction@H@JavascriptFunction@Js@@SAHPEAVRecyclableObject@1@P6APEAX0UCallInfo@1@ZZIPEAPEAX@Z ENDP
 
 endif ;; _ENABLE_ASM_JS
 

+ 4 - 3
lib/Runtime/Runtime.h

@@ -147,12 +147,12 @@ namespace Js
     class ActivationObject;
     class JavascriptNumber;
     class JavascriptNumberObject;
-    
+
     class ScriptContextProfiler;
 
     struct RestrictedErrorStrings;
     class JavascriptError;
-    
+
 //SIMD_JS
     // SIMD
     class JavascriptSIMDObject;
@@ -372,6 +372,7 @@ enum tagDEBUG_EVENT_INFO_TYPE
 #include "JITClient.h"
 #else
 #include "JITTypes.h"
+#include "../JITClient/JITManager.h"
 #endif
 
 #include "Base/SourceHolder.h"
@@ -453,7 +454,7 @@ enum tagDEBUG_EVENT_INFO_TYPE
 
 #include "Library/MathLibrary.h"
 
-// xplat-todo: We should get rid of this altogether and move the functionality it 
+// xplat-todo: We should get rid of this altogether and move the functionality it
 // encapsulates to the Platform Agnostic Interface
 #ifdef _WIN32
 #if defined(ENABLE_GLOBALIZATION) || ENABLE_UNICODE_API