diff --git a/change/react-native-windows-2020-03-05-10-04-59-0.60-stable.json b/change/react-native-windows-2020-03-05-10-04-59-0.60-stable.json
new file mode 100644
index 00000000000..c5b8b234b85
--- /dev/null
+++ b/change/react-native-windows-2020-03-05-10-04-59-0.60-stable.json
@@ -0,0 +1,9 @@
+{
+ "type": "prerelease",
+ "comment": "Enable V8 JSI support",
+ "packageName": "react-native-windows",
+ "email": "tudorm@microsoft.com",
+ "commit": "cd2d2668ded93c00d91c8393c169e8b732958a63",
+ "dependentChangeType": "patch",
+ "date": "2020-03-05T18:04:59.246Z"
+}
\ No newline at end of file
diff --git a/packages/playground/windows/playground.sln b/packages/playground/windows/playground.sln
index 7984392c583..0fb7cddc71b 100644
--- a/packages/playground/windows/playground.sln
+++ b/packages/playground/windows/playground.sln
@@ -22,7 +22,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactWindowsCore", "..\..\.
{A990658C-CE31-4BCC-976F-0FC6B1AF693D} = {A990658C-CE31-4BCC-976F-0FC6B1AF693D}
EndProjectSection
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PropertySheets", "PropertySheets", "{6F24927E-EE45-4DB2-91DA-DCC6E98B0C42}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PropertySheets", "..\..\..\vnext\PropertySheets", "{6F24927E-EE45-4DB2-91DA-DCC6E98B0C42}"
ProjectSection(SolutionItems) = preProject
PropertySheets\ARM.props = PropertySheets\ARM.props
PropertySheets\Debug.props = PropertySheets\Debug.props
diff --git a/packages/playground/windows/playground/HostingPane.xaml b/packages/playground/windows/playground/HostingPane.xaml
index f2c67473c08..0fd894ca4c8 100644
--- a/packages/playground/windows/playground/HostingPane.xaml
+++ b/packages/playground/windows/playground/HostingPane.xaml
@@ -115,6 +115,16 @@
VerticalAlignment="Center"
IsChecked="true"
Content="Reuse Instance"/>
+
+
HostingPane::getInstance() {
settings.UseWebDebugger = x_UseWebDebuggerCheckBox->IsChecked->Value;
settings.UseLiveReload = x_UseLiveReloadCheckBox->IsChecked->Value;
settings.EnableDeveloperMenu = true;
+ settings.jsiEngine = static_cast(x_JsEngine->SelectedIndex);
+
if (params.find("debughost") != params.end()) {
settings.DebugHost = params["debughost"];
}
@@ -435,6 +437,23 @@ void HostingPane::InitComboBoxes() {
x_ReactAppName->IsEditable = true;
x_JavaScriptFilename->IsEditable = true;
}
+
+ m_jsEngineNames = ref new Platform::Collections::Vector();
+ m_jsEngineNames->Append(L"Chakra");
+#if defined(USE_HERMES)
+ m_jsEngineNames->Append(L"Hermes");
+#else
+ m_jsEngineNames->Append(L"NOT AVAILABLE - Hermes");
+#endif
+
+#if defined(USE_V8)
+ m_jsEngineNames->Append(L"V8");
+#else
+ m_jsEngineNames->Append(L"NOT AVAILABLE - V8");
+#endif
+
+ x_JsEngine->ItemsSource = m_jsEngineNames;
+ x_JsEngine->SelectedIndex = 0;
}
void HostingPane::LoadKnownApps() {
diff --git a/packages/playground/windows/playground/HostingPane.xaml.h b/packages/playground/windows/playground/HostingPane.xaml.h
index adf8cfd1110..32cef9bdbb6 100644
--- a/packages/playground/windows/playground/HostingPane.xaml.h
+++ b/packages/playground/windows/playground/HostingPane.xaml.h
@@ -71,6 +71,7 @@ namespace Playground {
Platform::Collections::Vector ^ m_jsFileNames;
Platform::Collections::Vector ^ m_ReactAppNames;
+ Platform::Collections::Vector ^ m_jsEngineNames;
};
} // namespace Playground
diff --git a/packages/playground/windows/playground/Playground.vcxproj b/packages/playground/windows/playground/Playground.vcxproj
index 39d0396d1b4..2035430802c 100644
--- a/packages/playground/windows/playground/Playground.vcxproj
+++ b/packages/playground/windows/playground/Playground.vcxproj
@@ -67,6 +67,7 @@
/await /bigobj /Zc:twoPhase- %(AdditionalOptions)
4453;4800;28204;4146;%(DisableSpecificWarnings)
Use
+ USE_V8;%(PreprocessorDefinitions)
$(ReactNativeWindowsDir)target\$(PlatformTarget)\$(Configuration)\ReactUWP\React.uwp.lib;ChakraRT.lib;%(AdditionalDependencies)
diff --git a/vnext/Desktop.ABITests/React.Windows.Desktop.ABITests.vcxproj b/vnext/Desktop.ABITests/React.Windows.Desktop.ABITests.vcxproj
index 0807e9ac911..a2e34b16238 100644
--- a/vnext/Desktop.ABITests/React.Windows.Desktop.ABITests.vcxproj
+++ b/vnext/Desktop.ABITests/React.Windows.Desktop.ABITests.vcxproj
@@ -52,7 +52,7 @@
true
- $(VCInstallDir)UnitTest\include;$(ReactNativeDir)\ReactCommon;$(JSI_Source);%(AdditionalIncludeDirectories)
+ $(VCInstallDir)UnitTest\include;$(ReactNativeDir)\ReactCommon;%(AdditionalIncludeDirectories)
ProgramDatabase
true
diff --git a/vnext/Desktop.DLL/React.Windows.Desktop.DLL.vcxproj b/vnext/Desktop.DLL/React.Windows.Desktop.DLL.vcxproj
index 638cb5ddb91..dc3cb51c784 100644
--- a/vnext/Desktop.DLL/React.Windows.Desktop.DLL.vcxproj
+++ b/vnext/Desktop.DLL/React.Windows.Desktop.DLL.vcxproj
@@ -68,7 +68,7 @@
we have a better solution for handling the absence of WinRT string and error DLLs on Win7.
-->
WindowsApp_downlevel.lib;%(AdditionalDependencies)
- api-ms-win-core-winrt-error-l1-1-0.dll;api-ms-win-core-winrt-error-l1-1-1.dll;api-ms-win-core-winrt-string-l1-1-0.dll;ChakraCore.Debugger.DLL
+ api-ms-win-core-winrt-error-l1-1-0.dll;api-ms-win-core-winrt-error-l1-1-1.dll;api-ms-win-core-winrt-string-l1-1-0.dll;ChakraCore.Debugger.DLL;%(DelayLoadDLLs)
@@ -133,6 +133,7 @@
+
@@ -142,6 +143,7 @@
+
\ No newline at end of file
diff --git a/vnext/Desktop.IntegrationTests/ChakraRuntimeHolder.h b/vnext/Desktop.IntegrationTests/ChakraRuntimeHolder.h
index 4ba781ccd03..a4f53d22ecb 100644
--- a/vnext/Desktop.IntegrationTests/ChakraRuntimeHolder.h
+++ b/vnext/Desktop.IntegrationTests/ChakraRuntimeHolder.h
@@ -3,7 +3,7 @@
#include
#include
-#include
+#include
#include
diff --git a/vnext/Desktop.IntegrationTests/React.Windows.Desktop.IntegrationTests.vcxproj b/vnext/Desktop.IntegrationTests/React.Windows.Desktop.IntegrationTests.vcxproj
index ff386bfbb70..fd94fdd203a 100644
--- a/vnext/Desktop.IntegrationTests/React.Windows.Desktop.IntegrationTests.vcxproj
+++ b/vnext/Desktop.IntegrationTests/React.Windows.Desktop.IntegrationTests.vcxproj
@@ -40,7 +40,7 @@
- $(ReactNativeWindowsDir);$(ReactNativeWindowsDir)Common;$(ReactNativeWindowsDir)stubs;$(FollyDir);$(ReactNativeDir)\ReactCommon;$(JSI_Source);$(ReactNativeWindowsDir)ReactWindowsCore;$(ReactNativeWindowsDir)include\ReactWindowsCore;$(ReactNativeWindowsDir)Desktop;$(ReactNativeWindowsDir)IntegrationTests;$(MSBuildProjectDirectory);$(IncludePath)
+ $(ReactNativeWindowsDir);$(ReactNativeWindowsDir)Common;$(ReactNativeWindowsDir)stubs;$(FollyDir);$(ReactNativeDir)\ReactCommon;$(JSI_Source);$(ReactNativeWindowsDir)ReactWindowsCore;$(ReactNativeWindowsDir)include\ReactWindowsCore;$(ReactNativeWindowsDir)Desktop;$(ReactNativeWindowsDir)IntegrationTests;$(ReactNativeWindowsDir)JSI\Shared;$(MSBuildProjectDirectory);$(IncludePath)
true
@@ -54,7 +54,7 @@
$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories)
- Shlwapi.lib;Version.lib;%(AdditionalDependencies)
+ Shlwapi.lib;Version.lib;delayimp.lib;%(AdditionalDependencies)
true
@@ -109,6 +109,7 @@
+
@@ -118,6 +119,7 @@
+
diff --git a/vnext/Desktop/React.Windows.Desktop.vcxproj b/vnext/Desktop/React.Windows.Desktop.vcxproj
index 0244d13afc0..973c9880d83 100644
--- a/vnext/Desktop/React.Windows.Desktop.vcxproj
+++ b/vnext/Desktop/React.Windows.Desktop.vcxproj
@@ -47,7 +47,7 @@
- $(ReactNativeWindowsDir);$(ReactNativeWindowsDir)Common;$(FollyDir);$(ReactNativeWindowsDir)stubs;$(MSBuildProjectDirectory);$(ReactNativeWindowsDir)ReactWindowsCore;$(ReactNativeWindowsDir)\ReactWindowsCore\tracing;$(ReactNativeWindowsDir)include\ReactWindowsCore;$(ReactNativeDir)\ReactCommon;$(JSI_Source);$(IncludePath)
+ $(ReactNativeWindowsDir);$(ReactNativeWindowsDir)Common;$(FollyDir);$(ReactNativeWindowsDir)stubs;$(MSBuildProjectDirectory);$(ReactNativeWindowsDir)ReactWindowsCore;$(ReactNativeWindowsDir)\ReactWindowsCore\tracing;$(ReactNativeWindowsDir)include\ReactWindowsCore;$(ReactNativeDir)\ReactCommon;$(ReactNativeWindowsDir)JSI\Shared;$(JSI_Source);$(IncludePath)
true
@@ -168,6 +168,7 @@
+
@@ -179,5 +180,6 @@
+
\ No newline at end of file
diff --git a/vnext/Desktop/packages.config b/vnext/Desktop/packages.config
index a736e102d48..1d22b985f21 100644
--- a/vnext/Desktop/packages.config
+++ b/vnext/Desktop/packages.config
@@ -5,4 +5,5 @@
+
\ No newline at end of file
diff --git a/vnext/JSI.Desktop.UnitTests/ChakraCoreRuntimeUnitTests.cpp b/vnext/JSI.Desktop.UnitTests/ChakraCoreRuntimeUnitTests.cpp
index 9c4de1470ad..2a1029a67dc 100644
--- a/vnext/JSI.Desktop.UnitTests/ChakraCoreRuntimeUnitTests.cpp
+++ b/vnext/JSI.Desktop.UnitTests/ChakraCoreRuntimeUnitTests.cpp
@@ -3,6 +3,9 @@
#include "JSI/Shared/ChakraRuntimeArgs.h"
#include "JSI/Shared/ChakraRuntimeFactory.h"
#include "MemoryTracker.h"
+#if defined(USE_V8)
+#include
+#endif
// TODO (yicyao): #2730 Introduces a vcxitem for shared test code and move this
// there.
@@ -13,6 +16,7 @@
#include
using facebook::jsi::JsiRuntimeUnitTests;
+using facebook::jsi::JsiRuntimeUnitTests_Chakra;
using facebook::jsi::Runtime;
using facebook::jsi::RuntimeFactory;
using facebook::react::CreateMemoryTracker;
@@ -38,4 +42,18 @@ std::vector runtimeGenerators() {
}};
}
-INSTANTIATE_TEST_CASE_P(ChakraRuntimeTest, JsiRuntimeUnitTests, ::testing::ValuesIn(runtimeGenerators()));
+INSTANTIATE_TEST_CASE_P(ChakraRuntimeTest_Base, JsiRuntimeUnitTests, ::testing::ValuesIn(runtimeGenerators()));
+INSTANTIATE_TEST_CASE_P(ChakraRuntimeTest, JsiRuntimeUnitTests_Chakra, ::testing::ValuesIn(runtimeGenerators()));
+
+#if defined(USE_V8)
+
+RuntimeFactory getV8Runtime() {
+ return []() -> std::unique_ptr {
+ v8runtime::V8RuntimeArgs args;
+
+ return v8runtime::makeV8Runtime(std::move(args));
+ };
+}
+
+INSTANTIATE_TEST_CASE_P(V8RuntimeTest, JsiRuntimeUnitTests, ::testing::Values(getV8Runtime()));
+#endif
diff --git a/vnext/JSI.Desktop.UnitTests/JSI.Desktop.UnitTests.vcxproj b/vnext/JSI.Desktop.UnitTests/JSI.Desktop.UnitTests.vcxproj
index 545c55a3c33..affc9a882c4 100644
--- a/vnext/JSI.Desktop.UnitTests/JSI.Desktop.UnitTests.vcxproj
+++ b/vnext/JSI.Desktop.UnitTests/JSI.Desktop.UnitTests.vcxproj
@@ -35,7 +35,7 @@
- $(ReactNativeWindowsDir);$(ReactNativeWindowsDir)Common;$(ReactNativeWindowsDir)stubs;$(FollyDir);$(ReactNativeDir)\ReactCommon;$(JSI_Source);$(ReactNativeWindowsDir)ReactWindowsCore;$(ReactNativeWindowsDir)\ReactWindowsCore\tracing;$(ReactNativeWindowsDir)include\ReactWindowsCore;$(ReactNativeWindowsDir)Desktop;$(ReactNativeWindowsDir)IntegrationTests;$(MSBuildProjectDirectory);$(IncludePath)
+ $(ReactNativeWindowsDir);$(ReactNativeWindowsDir)Common;$(ReactNativeWindowsDir)stubs;$(FollyDir);$(ReactNativeDir)\ReactCommon;$(JSI_Source);$(ReactNativeWindowsDir)ReactWindowsCore;$(ReactNativeWindowsDir)\ReactWindowsCore\tracing;$(ReactNativeWindowsDir)include\ReactWindowsCore;$(ReactNativeWindowsDir)Desktop;$(ReactNativeWindowsDir)IntegrationTests;$(ReactNativeWindowsDir)JSI\Shared;$(MSBuildProjectDirectory);$(IncludePath)
true
@@ -55,7 +55,7 @@
-minpdbpathlen:256
- Shlwapi.lib;%(AdditionalDependencies)
+ Shlwapi.lib;delayimp.lib;%(AdditionalDependencies)
DebugFull
@@ -120,6 +120,7 @@
+
@@ -130,5 +131,6 @@
+
\ No newline at end of file
diff --git a/vnext/JSI.Desktop.UnitTests/JsiRuntimeUnitTests.cpp b/vnext/JSI.Desktop.UnitTests/JsiRuntimeUnitTests.cpp
index 372adb6e7d0..29750b48b18 100644
--- a/vnext/JSI.Desktop.UnitTests/JsiRuntimeUnitTests.cpp
+++ b/vnext/JSI.Desktop.UnitTests/JsiRuntimeUnitTests.cpp
@@ -8,7 +8,6 @@
#include "JsiRuntimeUnitTests.h"
#include
-#include
#include
#include
@@ -159,7 +158,7 @@ TEST_P(JsiRuntimeUnitTests, ObjectTest) {
EXPECT_EQ(names.getValueAtIndex(rt, 0).getString(rt).utf8(rt), "a");
}
-TEST_P(JsiRuntimeUnitTests, HostObjectTest) {
+TEST_P(JsiRuntimeUnitTests_Chakra, HostObjectTest) {
class ConstantHostObject : public HostObject {
Value get(Runtime &, const PropNameID &sym) override {
return 9000;
@@ -329,7 +328,7 @@ TEST_P(JsiRuntimeUnitTests, HostObjectTest) {
EXPECT_FALSE(hasOwnPropertyName.call(rt, howpn, String::createFromAscii(rt, "not_existing")).getBool());
}
-TEST_P(JsiRuntimeUnitTests, ArrayTest) {
+TEST_P(JsiRuntimeUnitTests_Chakra, ArrayTest) {
eval("x = {1:2, '3':4, 5:'six', 'seven':['eight', 'nine']}");
Object x = rt.global().getPropertyAsObject(rt, "x");
@@ -520,7 +519,7 @@ TEST_P(JsiRuntimeUnitTests, InstanceOfTest) {
EXPECT_TRUE(ctor.callAsConstructor(rt, nullptr, 0).getObject(rt).instanceOf(rt, ctor));
}
-TEST_P(JsiRuntimeUnitTests, HostFunctionTest) {
+TEST_P(JsiRuntimeUnitTests_Chakra, HostFunctionTest) {
auto one = std::make_shared(1);
Function plusOne = Function::createFromHostFunction(
rt,
diff --git a/vnext/JSI.Desktop.UnitTests/JsiRuntimeUnitTests.h b/vnext/JSI.Desktop.UnitTests/JsiRuntimeUnitTests.h
index dcc26684058..1e28b4f3545 100644
--- a/vnext/JSI.Desktop.UnitTests/JsiRuntimeUnitTests.h
+++ b/vnext/JSI.Desktop.UnitTests/JsiRuntimeUnitTests.h
@@ -37,4 +37,7 @@ class JsiRuntimeUnitTests : public ::testing::TestWithParam {
Runtime &rt;
};
+// V8 doesn't currently pass all the tests (particularly around hostobjects), move those out into _Chakra for now
+class JsiRuntimeUnitTests_Chakra : public JsiRuntimeUnitTests {};
+
} // namespace facebook::jsi
diff --git a/vnext/JSI/Desktop/JSI.Desktop.vcxproj b/vnext/JSI/Desktop/JSI.Desktop.vcxproj
index d5187399e1f..7e3550d9836 100644
--- a/vnext/JSI/Desktop/JSI.Desktop.vcxproj
+++ b/vnext/JSI/Desktop/JSI.Desktop.vcxproj
@@ -42,7 +42,7 @@
- $(ReactNativeDir)\ReactCommon;$(JSI_Source);$(ReactNativeWindowsDir)Chakra;$(ReactNativeWindowsDir)Common;$(ReactNativeWindowsDir)ReactWindowsCore;$(IncludePath)
+ $(ReactNativeDir)\ReactCommon;$(JSI_SourcePath);$(JSI_Source);$(ReactNativeWindowsDir)Chakra;$(ReactNativeWindowsDir)Common;$(ReactNativeWindowsDir)ReactWindowsCore;$(IncludePath)
true
@@ -82,6 +82,7 @@
+
@@ -89,5 +90,6 @@
+
\ No newline at end of file
diff --git a/vnext/JSI/Shared/ByteArrayBuffer.h b/vnext/JSI/Shared/ByteArrayBuffer.h
index 779575e40a6..c891053c33f 100644
--- a/vnext/JSI/Shared/ByteArrayBuffer.h
+++ b/vnext/JSI/Shared/ByteArrayBuffer.h
@@ -3,7 +3,7 @@
#pragma once
-#include "jsi/jsi.h"
+#include
#include
diff --git a/vnext/JSI/Shared/ChakraObjectRef.cpp b/vnext/JSI/Shared/ChakraObjectRef.cpp
index ebbb0643e56..e23159f6962 100644
--- a/vnext/JSI/Shared/ChakraObjectRef.cpp
+++ b/vnext/JSI/Shared/ChakraObjectRef.cpp
@@ -6,7 +6,7 @@
#include "Unicode.h"
#include "Utilities.h"
-#include "jsi//jsi.h"
+#include
#include
#include
diff --git a/vnext/JSI/Shared/ChakraObjectRef.h b/vnext/JSI/Shared/ChakraObjectRef.h
index 2784f23a99d..e1b04d90c63 100644
--- a/vnext/JSI/Shared/ChakraObjectRef.h
+++ b/vnext/JSI/Shared/ChakraObjectRef.h
@@ -3,7 +3,7 @@
#pragma once
-#include "jsi/jsi.h"
+#include
#ifdef CHAKRACORE
#include "ChakraCore.h"
diff --git a/vnext/JSI/Shared/ChakraRuntime.h b/vnext/JSI/Shared/ChakraRuntime.h
index b39022eda03..ce988dadb52 100644
--- a/vnext/JSI/Shared/ChakraRuntime.h
+++ b/vnext/JSI/Shared/ChakraRuntime.h
@@ -6,7 +6,7 @@
#include "ChakraObjectRef.h"
#include "ChakraRuntimeArgs.h"
-#include "jsi/jsi.h"
+#include
#ifdef CHAKRACORE
#include "ChakraCore.h"
diff --git a/vnext/JSI/Shared/ChakraRuntimeArgs.h b/vnext/JSI/Shared/ChakraRuntimeArgs.h
index 78219c2c71c..0eda8e37409 100644
--- a/vnext/JSI/Shared/ChakraRuntimeArgs.h
+++ b/vnext/JSI/Shared/ChakraRuntimeArgs.h
@@ -2,8 +2,8 @@
// Licensed under the MIT License.
#pragma once
+#include
#include
-#include "ScriptStore.h"
namespace facebook::react {
class MemoryTracker;
diff --git a/vnext/JSI/Shared/ScriptStore.h b/vnext/JSI/Shared/ScriptStore.h
index 57599575d8b..8f3c1391e2a 100644
--- a/vnext/JSI/Shared/ScriptStore.h
+++ b/vnext/JSI/Shared/ScriptStore.h
@@ -1,3 +1,5 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT license.
#pragma once
#include
@@ -31,6 +33,8 @@ struct JSRuntimeSignature {
// (through JSI::Runtime implementation's factory method), to enable persistance of the prepared script and retrieval on
// subsequent evaluation of a script.
struct PreparedScriptStore {
+ virtual ~PreparedScriptStore() = default;
+
// Try to retrieve the prepared javascript for a given combination of script & runtime.
// scriptSignature : Javascript url and version
// RuntimeSignature : Javascript engine type and version
@@ -62,6 +66,8 @@ struct PreparedScriptStore {
// such as usage of pre-prepared javascript script. Alternatively, this entity can be used to directly provide the
// Javascript buffer and rich metadata to the JSI::Runtime instance.
struct ScriptStore {
+ virtual ~ScriptStore() = default;
+
// Return the Javascript buffer and version corresponding to a given url.
virtual VersionedBuffer getVersionedScript(const std::string &url) noexcept = 0;
diff --git a/vnext/JSI/Universal/JSI.Universal.vcxproj b/vnext/JSI/Universal/JSI.Universal.vcxproj
index 88fb4c7f0ed..0398b244f15 100644
--- a/vnext/JSI/Universal/JSI.Universal.vcxproj
+++ b/vnext/JSI/Universal/JSI.Universal.vcxproj
@@ -63,7 +63,7 @@
false
- $(ReactNativeDir)\ReactCommon;$(JSI_Source);$(ReactNativeWindowsDir)Common;$(ReactNativeWindowsDir)ReactWindowsCore;$(IncludePath)
+ $(ReactNativeDir)\ReactCommon;$(JSI_SourcePath);$(JSI_Source);$(ReactNativeWindowsDir)Common;$(ReactNativeWindowsDir)ReactWindowsCore;$(IncludePath)
true
diff --git a/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj b/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj
index bb34541b207..b9e13e9d04c 100644
--- a/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj
+++ b/vnext/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj
@@ -101,6 +101,7 @@
$(ReactNativeWindowsDir)Microsoft.ReactNative\Views;
$(FollyDir);
$(ReactNativeDir)ReactCommon;
+ $(JSI_SourcePath);
$(ReactNativeDir)ReactCommon\jsi;
$(ReactNativeWindowsDir);
$(ReactNativeWindowsDir)Common;
@@ -136,7 +137,7 @@
$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
- ChakraRT.lib;dxguid.lib;%(AdditionalDependencies)
+ ChakraRT.lib;dxguid.lib;dloadhelper.lib;%(AdditionalDependencies)
Console
true
Microsoft.ReactNative.def
@@ -548,6 +549,7 @@
+
@@ -557,6 +559,7 @@
+
diff --git a/vnext/PropertySheets/React.Cpp.props b/vnext/PropertySheets/React.Cpp.props
index e6ba8aa1cdd..d07ebeb0c4b 100644
--- a/vnext/PropertySheets/React.Cpp.props
+++ b/vnext/PropertySheets/React.Cpp.props
@@ -23,9 +23,9 @@
0.1.6
$(SolutionDir)packages\ReactNative.Hermes.Windows.$(HERMES_Version)
- false
- 0.1.6
- $(SolutionDir)packages\ReactNative.V8JSI.Windows.$(V8_Version)
+ true
+ 0.2.3
+ $(SolutionDir)packages\ReactNative.V8Jsi.Windows.$(V8_Version)
true
@@ -46,9 +46,13 @@
+
$(ReactNativeDir)\ReactCommon\jsi
$(HERMES_Package)\installed\x64-windows\include\jsi_ref
- $(V8_Package)\installed\x64-windows\include\jsi_ref
+
+
+ $(ReactNativeDir)\ReactCommon\jsi
+ $(V8_Package)\build\native\include
diff --git a/vnext/ReactCommon/ReactCommon.vcxproj b/vnext/ReactCommon/ReactCommon.vcxproj
index fb3e2ad062a..dd030c1390e 100644
--- a/vnext/ReactCommon/ReactCommon.vcxproj
+++ b/vnext/ReactCommon/ReactCommon.vcxproj
@@ -68,7 +68,7 @@
NotUsing
false
true
- $(ReactNativeDir)\ReactCommon;$(JSI_Source);$(ReactNativeDir)\ReactCommon\jscallinvoker;$(ReactNativeDir)\ReactCommon\jsiexecutor;$(FollyDir);$(ReactNativeWindowsDir)stubs;$(ReactNativeWindowsDir)\ReactWindowsCore\tracing;%(AdditionalIncludeDirectories)
+ $(ReactNativeDir)\ReactCommon;$(JSI_SourcePath);$(JSI_Source);$(ReactNativeDir)\ReactCommon\jscallinvoker;$(ReactNativeDir)\ReactCommon\jsiexecutor;$(FollyDir);$(ReactNativeWindowsDir)stubs;$(ReactNativeWindowsDir)\ReactWindowsCore\tracing;%(AdditionalIncludeDirectories)
_WIN32;_CRT_SECURE_NO_WARNINGS;FOLLY_NO_CONFIG;NOMINMAX;RN_EXPORT=;JSI_EXPORT=;WIN32;_WINDLL;%(PreprocessorDefinitions)
4715;4146;4251;4800;4804;4305;4722;%(DisableSpecificWarnings)
@@ -84,13 +84,9 @@
-
-
-
-
-
-
-
+
+
+
@@ -135,9 +131,8 @@
-
+
-
diff --git a/vnext/ReactCommon/ReactCommon.vcxproj.filters b/vnext/ReactCommon/ReactCommon.vcxproj.filters
index 6538d2ea366..913b1dc0c7e 100644
--- a/vnext/ReactCommon/ReactCommon.vcxproj.filters
+++ b/vnext/ReactCommon/ReactCommon.vcxproj.filters
@@ -102,13 +102,7 @@
yoga
-
- jsi\jsi
-
-
- jsi\jsi
-
-
+
jsi\jsi
@@ -236,25 +230,13 @@
yoga
-
- jsi\jsi
-
-
- jsi\jsi
-
-
- jsi\jsi
-
-
- jsi\jsi
-
-
+
jsi\jsi
-
+
jsi\jsi
-
+
jsi\jsi
diff --git a/vnext/ReactUWP/Base/UwpReactInstance.cpp b/vnext/ReactUWP/Base/UwpReactInstance.cpp
index 4076023b3af..4d54d33bdda 100644
--- a/vnext/ReactUWP/Base/UwpReactInstance.cpp
+++ b/vnext/ReactUWP/Base/UwpReactInstance.cpp
@@ -89,12 +89,9 @@
#include "V8JSIRuntimeHolder.h"
#include
-
-#include
-#include
-#else
-#include "ChakraRuntimeHolder.h"
#endif
+#include "ChakraRuntimeHolder.h"
+
#endif
#include
@@ -384,21 +381,30 @@ void UwpReactInstance::Start(const std::shared_ptr &spThis, cons
std::unique_ptr scriptStore = nullptr;
std::unique_ptr preparedScriptStore = nullptr;
+ switch (settings.jsiEngine) {
+ case JSIEngine::Hermes:
#if defined(USE_HERMES)
- devSettings->jsiRuntimeHolder = std::make_shared();
-#elif defined(USE_V8)
- preparedScriptStore = std::make_unique(getApplicationLocalFolder());
-
- devSettings->jsiRuntimeHolder = std::make_shared(
- devSettings, jsQueue, std::move(scriptStore), std::move(preparedScriptStore));
-#else
- if (settings.EnableByteCodeCaching || !settings.ByteCodeFileUri.empty()) {
- scriptStore = std::make_unique();
- preparedScriptStore = std::make_unique(winrt::to_hstring(settings.ByteCodeFileUri));
- }
- devSettings->jsiRuntimeHolder = std::make_shared(
- devSettings, jsQueue, std::move(scriptStore), std::move(preparedScriptStore));
+ devSettings->jsiRuntimeHolder = std::make_shared();
+ break;
#endif
+ case JSIEngine::V8:
+#if defined(USE_V8)
+ preparedScriptStore =
+ std::make_unique(getApplicationLocalFolder());
+
+ devSettings->jsiRuntimeHolder = std::make_shared(
+ devSettings, jsQueue, std::move(scriptStore), std::move(preparedScriptStore));
+ break;
+#endif
+ case JSIEngine::Chakra:
+ if (settings.EnableByteCodeCaching || !settings.ByteCodeFileUri.empty()) {
+ scriptStore = std::make_unique();
+ preparedScriptStore = std::make_unique(winrt::to_hstring(settings.ByteCodeFileUri));
+ }
+ devSettings->jsiRuntimeHolder = std::make_shared(
+ devSettings, jsQueue, std::move(scriptStore), std::move(preparedScriptStore));
+ break;
+ }
}
#endif
@@ -595,7 +601,7 @@ void UwpReactInstance::CallXamlViewCreatedTestHook(react::uwp::XamlView view) {
std::string UwpReactInstance::getApplicationLocalFolder() {
auto local = winrt::Windows::Storage::ApplicationData::Current().LocalFolder().Path();
- return std::wstring_convert>().to_bytes(std::wstring(local.c_str(), local.size())) + "\\";
+ return Microsoft::Common::Unicode::Utf16ToUtf8(local.c_str(), local.size()) + "\\";
}
#endif
diff --git a/vnext/ReactUWP/ReactUWP.vcxproj b/vnext/ReactUWP/ReactUWP.vcxproj
index 2ea2d757478..297633cd4b3 100644
--- a/vnext/ReactUWP/ReactUWP.vcxproj
+++ b/vnext/ReactUWP/ReactUWP.vcxproj
@@ -98,7 +98,7 @@
_HAS_AUTO_PTR_ETC;
%(PreprocessorDefinitions)
- $(ReactNativeWindowsDir);$(ReactNativeWindowsDir)Common;$(ReactNativeWindowsDir)Pch;$(ReactNativeWindowsDir)ReactUWP\GeneratedWinmdHeader;$(ReactNativeWindowsDir)ReactWindowsCore;$(ReactNativeWindowsDir)include\ReactWindowsCore;$(ReactNativeWindowsDir)include\ReactUWP;$(YogaDir);$(ReactNativeDir)\ReactCommon;$(JSI_Source);$(ReactNativeWindowsDir)include;$(ReactNativeWindowsDir)stubs;$(ReactNativeWindowsDir)Shared;$(ReactNativeWindowsDir)\ReactWindowsCore\tracing;$(FollyDir);%(AdditionalIncludeDirectories)
+ $(ReactNativeWindowsDir);$(ReactNativeWindowsDir)Common;$(ReactNativeWindowsDir)Pch;$(ReactNativeWindowsDir)ReactUWP\GeneratedWinmdHeader;$(ReactNativeWindowsDir)ReactWindowsCore;$(ReactNativeWindowsDir)include\ReactWindowsCore;$(ReactNativeWindowsDir)include\ReactUWP;$(YogaDir);$(ReactNativeDir)\ReactCommon;$(ReactNativeWindowsDir)\JSI\Shared;$(JSI_Source);$(ReactNativeWindowsDir)include;$(ReactNativeWindowsDir)stubs;$(ReactNativeWindowsDir)Shared;$(ReactNativeWindowsDir)\ReactWindowsCore\tracing;$(FollyDir);%(AdditionalIncludeDirectories)
$(ChakraCoreInclude);$(ChakraCoreDebugInclude);%(AdditionalIncludeDirectories)
/await %(AdditionalOptions)
false
@@ -109,7 +109,7 @@
-minpdbpathlen:256
ChakraCore.Debugger.Protocol.lib;ChakraCore.Debugger.ProtocolHandler.lib;ChakraCore.Debugger.Service.lib;ChakraCore.lib;%(AdditionalDependencies)
$(ChakraCoreLibDir);$(ChakraCoreDebugLibDir)
- dxguid.lib;%(AdditionalDependencies)
+ dxguid.lib;dloadhelper.lib;%(AdditionalDependencies)
$(ProjectDir)ABI\idl;$(ProjectDir)Views\cppwinrt
@@ -415,6 +415,7 @@
+
@@ -424,6 +425,7 @@
+
diff --git a/vnext/ReactUWP/Utils/UwpPreparedScriptStore.cpp b/vnext/ReactUWP/Utils/UwpPreparedScriptStore.cpp
index cb80c255653..ba09a028316 100644
--- a/vnext/ReactUWP/Utils/UwpPreparedScriptStore.cpp
+++ b/vnext/ReactUWP/Utils/UwpPreparedScriptStore.cpp
@@ -2,10 +2,10 @@
#include
#include
+#include
#include
#include
#include "Unicode.h"
-#include "jsi/jsi.h"
#if _MSC_VER <= 1913
// VC 19 (2015-2017.6) cannot optimize co_await/cppwinrt usage
diff --git a/vnext/ReactWindows-Universal.sln b/vnext/ReactWindows-Universal.sln
index bae3e3b9dd9..05fb6bffc5b 100644
--- a/vnext/ReactWindows-Universal.sln
+++ b/vnext/ReactWindows-Universal.sln
@@ -116,7 +116,6 @@ Global
include\Include.vcxitems*{ef074ba1-2d54-4d49-a28e-5e040b47cd2e}*SharedItemsImports = 9
Chakra\Chakra.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
JSI\Shared\JSI.Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
- Mso\Mso.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
Shared\Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/vnext/ReactWindowsCore/BaseScriptStoreImpl.h b/vnext/ReactWindowsCore/BaseScriptStoreImpl.h
index 74f8f2c25f9..206bd2ed0cf 100644
--- a/vnext/ReactWindowsCore/BaseScriptStoreImpl.h
+++ b/vnext/ReactWindowsCore/BaseScriptStoreImpl.h
@@ -1,6 +1,6 @@
#pragma once
-#include
+#include
#include
#include
diff --git a/vnext/ReactWindowsCore/ChakraRuntimeHolder.h b/vnext/ReactWindowsCore/ChakraRuntimeHolder.h
index b14ad21eb9b..b1e8c761190 100644
--- a/vnext/ReactWindowsCore/ChakraRuntimeHolder.h
+++ b/vnext/ReactWindowsCore/ChakraRuntimeHolder.h
@@ -2,10 +2,8 @@
#include
-#include
-#include
-
#include
+#include
#include
diff --git a/vnext/ReactWindowsCore/MemoryMappedBuffer.h b/vnext/ReactWindowsCore/MemoryMappedBuffer.h
index 241f66b23cd..bb947694e5b 100644
--- a/vnext/ReactWindowsCore/MemoryMappedBuffer.h
+++ b/vnext/ReactWindowsCore/MemoryMappedBuffer.h
@@ -1,6 +1,6 @@
#pragma once
-#include "jsi/jsi.h"
+#include
#include
diff --git a/vnext/ReactWindowsCore/ReactWindowsCore.vcxproj b/vnext/ReactWindowsCore/ReactWindowsCore.vcxproj
index d94f2172ce7..2572b00aaa3 100644
--- a/vnext/ReactWindowsCore/ReactWindowsCore.vcxproj
+++ b/vnext/ReactWindowsCore/ReactWindowsCore.vcxproj
@@ -78,10 +78,8 @@
-->
REACTWINDOWS_BUILD;NOMINMAX;FOLLY_NO_CONFIG;WIN32=0;RN_EXPORT=;CHAKRACORE;%(PreprocessorDefinitions)
USE_HERMES;%(PreprocessorDefinitions)
- USE_V8;%(PreprocessorDefinitions)
- $(ReactNativeWindowsDir);$(ReactNativeWindowsDir)Common;$(ReactNativeWindowsDir)Shared;$(ReactNativeWindowsDir)include;$(ReactNativeWindowsDir)include\ReactWindowsCore;$(ReactNativeDir)\ReactCommon;$(JSI_Source);$(ReactNativeWindowsDir)stubs;$(FollyDir);$(ReactNativeWindowsDir)\ReactWindowsCore\tracing;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
+ $(ReactNativeWindowsDir);$(ReactNativeWindowsDir)Common;$(ReactNativeWindowsDir)Shared;$(ReactNativeWindowsDir)include;$(ReactNativeWindowsDir)include\ReactWindowsCore;$(ReactNativeDir)\ReactCommon;$(JSI_Source);$(ReactNativeWindowsDir)stubs;$(FollyDir);$(ReactNativeWindowsDir)\ReactWindowsCore\tracing;$(ReactNativeWindowsDir)\JSI\Shared;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
$(HERMES_Package)\installed\$(VcpkgTriplet)\include\;%(AdditionalIncludeDirectories)
- $(V8_Package)\installed\$(VcpkgTriplet)\include\;%(AdditionalIncludeDirectories)
false
@@ -90,9 +88,7 @@
$(HERMES_Package)\installed\$(VcpkgTriplet)\lib;%(AdditionalLibraryDirectories)
- $(V8_Package)\installed\$(VcpkgTriplet)\lib;%(AdditionalLibraryDirectories)
hermes.lib;%(AdditionalDependencies)
- v8jsi.lib;%(AdditionalDependencies)
@@ -191,7 +187,7 @@
-
+
diff --git a/vnext/ReactWindowsCore/V8JSIRuntimeHolder.h b/vnext/ReactWindowsCore/V8JSIRuntimeHolder.h
index a0cdae1623c..a3884e3bdad 100644
--- a/vnext/ReactWindowsCore/V8JSIRuntimeHolder.h
+++ b/vnext/ReactWindowsCore/V8JSIRuntimeHolder.h
@@ -3,7 +3,7 @@
#include
#include
-#include
+#include
#include
diff --git a/vnext/ReactWindowsCore/packages.config b/vnext/ReactWindowsCore/packages.config
index 04d7fd035df..e098e61e253 100644
--- a/vnext/ReactWindowsCore/packages.config
+++ b/vnext/ReactWindowsCore/packages.config
@@ -2,5 +2,5 @@
-
+
\ No newline at end of file
diff --git a/vnext/Shared/OInstance.cpp b/vnext/Shared/OInstance.cpp
index 99e03627f8a..ac1e9a8da06 100644
--- a/vnext/Shared/OInstance.cpp
+++ b/vnext/Shared/OInstance.cpp
@@ -416,14 +416,12 @@ InstanceImpl::InstanceImpl(
#if defined(USE_V8)
std::unique_ptr scriptStore = nullptr;
std::unique_ptr preparedScriptStore = nullptr;
- if (!m_devSettings->bytecodeFileName.empty()) {
- // Take the root path of the bytecode location if provided
- auto lastSepPosition = m_devSettings->bytecodeFileName.find_last_of("/\\");
- if (lastSepPosition != std::string::npos) {
- preparedScriptStore = std::make_unique(
- m_devSettings->bytecodeFileName.substr(0, lastSepPosition + 1));
- }
+
+ char tempPath[MAX_PATH];
+ if (GetTempPathA(MAX_PATH, tempPath)) {
+ preparedScriptStore = std::make_unique(tempPath);
}
+
m_devSettings->jsiRuntimeHolder = std::make_shared(
m_devSettings, m_jsThread, std::move(scriptStore), std::move(preparedScriptStore));
break;
diff --git a/vnext/include/ReactUWP/IReactInstance.h b/vnext/include/ReactUWP/IReactInstance.h
index e1dafaf0e23..e9f313e8f00 100644
--- a/vnext/include/ReactUWP/IReactInstance.h
+++ b/vnext/include/ReactUWP/IReactInstance.h
@@ -28,6 +28,12 @@ typedef unsigned int LiveReloadCallbackCookie;
typedef unsigned int ErrorCallbackCookie;
typedef unsigned int DebuggerAttachCallbackCookie;
+enum class JSIEngine : int32_t {
+ Chakra = 0, // Use the JSIExecutorFactory with ChakraRuntime
+ Hermes = 1, // Use the JSIExecutorFactory with Hermes
+ V8 = 2, // Use the JSIExecutorFactory with V8
+};
+
struct ReactInstanceSettings {
bool UseWebDebugger{false};
bool UseLiveReload{false};
@@ -43,6 +49,7 @@ struct ReactInstanceSettings {
std::string BundleRootPath;
facebook::react::NativeLoggingHook LoggingCallback;
std::function JsExceptionCallback;
+ JSIEngine jsiEngine{JSIEngine::Chakra};
};
struct IReactInstance {
diff --git a/vnext/include/ReactUWP/Utils/UwpPreparedScriptStore.h b/vnext/include/ReactUWP/Utils/UwpPreparedScriptStore.h
index ee5bbfdc4ac..23f5f6034ae 100644
--- a/vnext/include/ReactUWP/Utils/UwpPreparedScriptStore.h
+++ b/vnext/include/ReactUWP/Utils/UwpPreparedScriptStore.h
@@ -1,11 +1,11 @@
#pragma once
-#include
+#include
#include
+#include
#include
#include
#include
#include
-#include "jsi/jsi.h"
namespace react {
namespace uwp {
diff --git a/vnext/include/ReactUWP/Utils/UwpScriptStore.h b/vnext/include/ReactUWP/Utils/UwpScriptStore.h
index 1d9f5d58b7c..f2be0382837 100644
--- a/vnext/include/ReactUWP/Utils/UwpScriptStore.h
+++ b/vnext/include/ReactUWP/Utils/UwpScriptStore.h
@@ -1,5 +1,5 @@
#pragma once
-#include
+#include
#include
namespace react {