2
0
Эх сурвалжийг харах

Updates from internal branch.

Curtis Man 10 жил өмнө
parent
commit
554beed23e

+ 1 - 1
Build/Common.Build.props

@@ -2,7 +2,7 @@
 <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemDefinitionGroup>
     <ClCompile>
-      <PreprocessorDefinitions>%(PreprocessorDefinitions);NOMINMAX;USE_EDGEMODE_JSRT</PreprocessorDefinitions>
+      <PreprocessorDefinitions>%(PreprocessorDefinitions);_CHAKRACOREBUILD;NOMINMAX;USE_EDGEMODE_JSRT</PreprocessorDefinitions>
       <!-- Some of our STDMETHOD can throw
            TODO: Code review STDMETHOD and separate out API that can throw and those that can't -->
       <PreprocessorDefinitions>%(PreprocessorDefinitions);COM_STDMETHOD_CAN_THROW</PreprocessorDefinitions>

+ 0 - 2
lib/Common/CommonBasic.h

@@ -32,5 +32,3 @@
 #include "Exceptions/Throw.h"
 #include "Exceptions/ExceptionCheck.h"
 #include "Exceptions/ReportError.h"
-
-

+ 1 - 1
lib/Jsrt/Chakra.Jsrt.vcxproj

@@ -44,7 +44,7 @@
       <PrecompiledHeader>Create</PrecompiledHeader>
     </ClCompile>
     <ClCompile Include="$(MSBuildThisFileDirectory)JsrtSourceHolder.cpp" />
-    <ClCompile Include="JsrtHelper.cpp" />
+    <ClCompile Include="$(MSBuildThisFileDirectory)JsrtHelper.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="ChakraCommon.h" />

+ 2 - 2
lib/Jsrt/Core/JsrtContextCore.h

@@ -156,10 +156,10 @@ public:
         return nullptr;
     }
 
-    Js::JavascriptFunction* InitializeHostPromiseContinuationFunction() override
+    HRESULT EnqueuePromiseTask(Js::Var taskVar) override
     {
         AssertMsg(false, "jsrt should have set the promise callback");
-        return GetScriptContext()->GetLibrary()->GetThrowerFunction();
+        return E_NOTIMPL;
     }
 
     HRESULT FetchImportedModule(Js::ModuleRecordBase* referencingModule, LPCOLESTR specifier, Js::ModuleRecordBase** dependentModuleRecord) override

+ 2 - 1
lib/Runtime/Base/EtwTrace.h

@@ -40,7 +40,8 @@ enum MethodType : uint16
 {
     MethodType_Interpreted = 0x1,
     MethodType_Jit = 0x2,
-    MethodType_LoopBody = 0x3
+    MethodType_LoopBody = 0x3,
+    MethodType_HostMethod = 0x4,
 };
 
 #ifdef TEST_ETW_EVENTS

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

@@ -110,7 +110,7 @@ public:
     virtual HRESULT ArrayBufferFromExternalObject(__in Js::RecyclableObject *obj,
         __out Js::ArrayBuffer **ppArrayBuffer) = 0;
     virtual Js::JavascriptError* CreateWinRTError(IErrorInfo* perrinfo, Js::RestrictedErrorStrings * proerrstr) = 0;
-    virtual Js::JavascriptFunction* InitializeHostPromiseContinuationFunction() = 0;
+    virtual HRESULT EnqueuePromiseTask(Js::Var varTask) = 0;
 
     virtual HRESULT FetchImportedModule(Js::ModuleRecordBase* referencingModule, LPCOLESTR specifier, Js::ModuleRecordBase** dependentModuleRecord) = 0;
     virtual HRESULT NotifyHostAboutModuleReady(Js::ModuleRecordBase* referencingModule, Js::Var exceptionVar) = 0;

+ 1 - 0
lib/Runtime/Language/AsmJsUtils.h

@@ -33,6 +33,7 @@ namespace Js {
     static const double SIMD_SLOTS_SPACE = (sizeof(SIMDValue) / sizeof(Var)); // 4 in x86 and 2 in x64
 
     Var AsmJsChangeHeapBuffer(RecyclableObject * function, CallInfo callInfo, ...);
+
 #if _M_X64
     int GetStackSizeForAsmJsUnboxing(ScriptFunction* func);
     void * UnboxAsmJsArguments(ScriptFunction* func, Var * origArgs, char * argDst, CallInfo callInfo);

+ 2 - 2
lib/Runtime/Language/Chakra.Runtime.Language.vcxproj

@@ -167,8 +167,8 @@
       <PrecompiledHeader>Create</PrecompiledHeader>
     </ClCompile>
     <ClCompile Include="$(MSBuildThisFileDirectory)JavascriptNativeOperators.cpp" />
-    <ClCompile Include="ModuleNamespace.cpp" />
-    <ClCompile Include="SourceTextModuleRecord.cpp" />
+    <ClCompile Include="$(MSBuildThisFileDirectory)ModuleNamespace.cpp" />
+    <ClCompile Include="$(MSBuildThisFileDirectory)SourceTextModuleRecord.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="amd64\StackFrame.h">

+ 5 - 18
lib/Runtime/Library/JavascriptLibrary.cpp

@@ -4747,16 +4747,6 @@ namespace Js
     }
 #endif
 
-    JavascriptFunction* JavascriptLibrary::GetHostPromiseContinuationFunction()
-    {
-        if (this->hostPromiseContinuationFunction == nullptr)
-        {
-            this->hostPromiseContinuationFunction = scriptContext->GetHostScriptContext()->InitializeHostPromiseContinuationFunction();
-        }
-
-        return this->hostPromiseContinuationFunction;
-    }
-
     void JavascriptLibrary::SetNativeHostPromiseContinuationFunction(PromiseContinuationCallback function, void *state)
     {
         this->nativeHostPromiseContinuationFunction = function;
@@ -4798,14 +4788,11 @@ namespace Js
         }
         else
         {
-            JavascriptFunction* hostPromiseContinuationFunction = this->GetHostPromiseContinuationFunction();
-
-            hostPromiseContinuationFunction->GetEntryPoint()(
-                hostPromiseContinuationFunction,
-                Js::CallInfo(Js::CallFlags::CallFlags_Value, 3),
-                this->GetUndefined(),
-                taskVar,
-                JavascriptNumber::ToVar(0, scriptContext));
+            HRESULT hr = scriptContext->GetHostScriptContext()->EnqueuePromiseTask(taskVar);
+            if (hr != S_OK)
+            {
+                Js::JavascriptError::MapAndThrowError(scriptContext, hr);
+            }
         }
     }
 

+ 0 - 2
lib/Runtime/Library/JavascriptLibrary.h

@@ -370,7 +370,6 @@ namespace Js
         JavascriptFunction* arrayPrototypeToLocaleStringFunction;
         JavascriptFunction* identityFunction;
         JavascriptFunction* throwerFunction;
-        JavascriptFunction* hostPromiseContinuationFunction;
         JavascriptFunction* promiseResolveFunction;
 
         JavascriptFunction* objectValueOfFunction;
@@ -780,7 +779,6 @@ namespace Js
         JavascriptFunction* GetIdentityFunction() const { return identityFunction; }
         JavascriptFunction* GetThrowerFunction() const { return throwerFunction; }
 
-        JavascriptFunction* GetHostPromiseContinuationFunction();
         void SetNativeHostPromiseContinuationFunction(PromiseContinuationCallback function, void *state);
 
         void PinJsrtContextObject(FinalizableObject* jsrtContext);

+ 4 - 2
lib/Runtime/Library/JavascriptProxy.cpp

@@ -4,6 +4,7 @@
 //-------------------------------------------------------------------------------------------------------
 #include "RuntimeLibraryPch.h"
 
+
 namespace Js
 {
     __inline BOOL JavascriptProxy::Is(Var obj)
@@ -1926,12 +1927,12 @@ namespace Js
 
         if (nullptr == callMethod)
         {
-            // newCount is ushort.
+            // newCount is ushort. If args count is greater than or equal to 65535, an integer
+            // too many arguments
             if (args.Info.Count >= USHORT_MAX) //check against CallInfo::kMaxCountArgs if newCount is ever made int
             {
                 JavascriptError::ThrowRangeError(scriptContext, JSERR_ArgListTooLarge);
             }
-            ushort newCount = (ushort)(args.Info.Count + 1);
 
             // in [[construct]] case, we don't need to check if the function is a constructor: the function should throw there.
             Var newThisObject = nullptr;
@@ -1945,6 +1946,7 @@ namespace Js
                 args.Values[0] = newThisObject;
             }
 
+            ushort newCount = (ushort)(args.Info.Count + 1);
             Var* newValues;
             const unsigned STACK_ARGS_ALLOCA_THRESHOLD = 8; // Number of stack args we allow before using _alloca
             Var stackArgs[STACK_ARGS_ALLOCA_THRESHOLD];

+ 1 - 1
lib/Runtime/Library/JavascriptString.cpp

@@ -1557,7 +1557,7 @@ case_2:
 
         PCWSTR const varName = _u("String.prototype.replace");
 
-        AUTO_TAG_NATIVE_LIBRARY_ENTRY(function, callInfo, _u("String.prototype.replace"));
+        AUTO_TAG_NATIVE_LIBRARY_ENTRY(function, callInfo, varName);
 
         Assert(!(callInfo.Flags & CallFlags_New));
 

+ 1 - 1
test/SIMD.workloads.asmjs/testVectorRotate.baseline

@@ -1,2 +1,2 @@
-Successfully compiled asm.js code
+Successfully compiled asm.js code
 PASS