diff --git a/ClearScript/Util/MiscHelpers.cs b/ClearScript/Util/MiscHelpers.cs
index e2b6842a..6ea6a96e 100644
--- a/ClearScript/Util/MiscHelpers.cs
+++ b/ClearScript/Util/MiscHelpers.cs
@@ -239,6 +239,11 @@ public static UIntPtr GetDigest(this string code)
return (UIntPtr.Size == 4) ? (UIntPtr)code.GetDigestAsUInt32() : (UIntPtr)code.GetDigestAsUInt64();
}
+ public static UIntPtr GetDigestFromUtf8(IntPtr pCode, int codeLength)
+ {
+ return (UIntPtr.Size == 4) ? (UIntPtr)GetDigestFromUtf8AsUInt32(pCode, codeLength) : (UIntPtr)GetDigestFromUtf8AsUInt64(pCode, codeLength);
+ }
+
public static uint GetDigestAsUInt32(this string code)
{
var digest = 2166136261U;
@@ -269,6 +274,72 @@ public static ulong GetDigestAsUInt64(this string code)
digest *= prime;
}
+ return digest;
+ }
+
+ public static uint GetDigestFromUtf8AsUInt32(IntPtr pCode, int codeLength)
+ {
+ uint digest = 2166136261U;
+ const uint prime = 16777619U;
+ const int bufferSize = 128;
+
+ Decoder decoder = Encoding.Unicode.GetDecoder();
+
+ unsafe
+ {
+ byte* utf8bytes = (byte*)pCode;
+ char* chars = stackalloc char[bufferSize];
+
+ while (codeLength > 0)
+ {
+ decoder.Convert(utf8bytes, codeLength, chars, bufferSize, false, out int bytesUsed, out int charsUsed, out bool completed);
+ utf8bytes += bytesUsed;
+ codeLength -= bytesUsed;
+
+ byte* utf16bytes = (byte*)chars;
+ int utf16byteCount = charsUsed * sizeof(char);
+
+ for (var index = 0; index < utf16byteCount; index++)
+ {
+ digest ^= utf16bytes[index];
+ digest *= prime;
+ }
+ }
+ }
+
+ return digest;
+ }
+
+ public static ulong GetDigestFromUtf8AsUInt64(IntPtr pCode, int codeLength)
+ {
+ ulong digest = 14695981039346656037UL;
+ const ulong prime = 1099511628211UL;
+ const int bufferSize = 128;
+
+ Decoder decoder = Encoding.Unicode.GetDecoder();
+
+ unsafe
+ {
+ byte* utf8bytes = (byte*)pCode;
+ char* chars = stackalloc char[bufferSize];
+
+ while (codeLength > 0)
+ {
+ decoder.Convert(utf8bytes, codeLength, chars, bufferSize, false, out int bytesUsed, out int charsUsed, out bool completed);
+ utf8bytes += bytesUsed;
+ codeLength -= bytesUsed;
+
+ byte* utf16bytes = (byte*)chars;
+ int utf16byteCount = charsUsed * sizeof(char);
+
+ for (var index = 0; index < utf16byteCount; index++)
+ {
+ digest ^= utf16bytes[index];
+ digest *= prime;
+ }
+ }
+ }
+
return digest;
}
diff --git a/ClearScript/V8/SplitProxy/IV8SplitProxyNative.cs b/ClearScript/V8/SplitProxy/IV8SplitProxyNative.cs
index 165dd25e..ed1b14fb 100644
--- a/ClearScript/V8/SplitProxy/IV8SplitProxyNative.cs
+++ b/ClearScript/V8/SplitProxy/IV8SplitProxyNative.cs
@@ -180,7 +180,9 @@ internal interface IV8SplitProxyNative
void V8Context_AwaitDebuggerAndPause(V8Context.Handle hContext);
void V8Context_CancelAwaitDebugger(V8Context.Handle hContext);
object V8Context_ExecuteCode(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code, bool evaluate);
+ object V8Context_ExecuteScriptFromUtf8(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, IntPtr pCode, int codeLength, UIntPtr codeDigest, bool evaluate);
V8Script.Handle V8Context_Compile(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code);
+ V8Script.Handle V8Context_CompileScriptFromUtf8(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, IntPtr pCode, int codeLength, UIntPtr codeDigest);
V8Script.Handle V8Context_CompileProducingCache(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code, V8CacheKind cacheKind, out byte[] cacheBytes);
V8Script.Handle V8Context_CompileConsumingCache(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code, V8CacheKind cacheKind, byte[] cacheBytes, out bool cacheAccepted);
V8Script.Handle V8Context_CompileUpdatingCache(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code, V8CacheKind cacheKind, ref byte[] cacheBytes, out V8CacheResult cacheResult);
diff --git a/ClearScript/V8/SplitProxy/V8ContextProxyImpl.cs b/ClearScript/V8/SplitProxy/V8ContextProxyImpl.cs
index 5a75a89b..112a3e8b 100644
--- a/ClearScript/V8/SplitProxy/V8ContextProxyImpl.cs
+++ b/ClearScript/V8/SplitProxy/V8ContextProxyImpl.cs
@@ -103,6 +103,27 @@ public override object Execute(UniqueDocumentInfo documentInfo, string code, boo
);
}
+ public override object ExecuteScriptFromUtf8(UniqueDocumentInfo documentInfo, IntPtr pCode, int codeLength, bool evaluate)
+ {
+ UIntPtr codeDigest = MiscHelpers.GetDigestFromUtf8(pCode, codeLength);
+
+ return V8SplitProxyNative.Invoke(
+ static (instance, ctx) => instance.V8Context_ExecuteScriptFromUtf8(
+ ctx.Handle,
+ MiscHelpers.GetUrlOrPath(ctx.documentInfo.Uri, ctx.documentInfo.UniqueName),
+ MiscHelpers.GetUrlOrPath(ctx.documentInfo.SourceMapUri, string.Empty),
+ ctx.documentInfo.UniqueId,
+ ctx.documentInfo.Category.Kind,
+ V8ProxyHelpers.AddRefHostObject(ctx.documentInfo),
+ ctx.pCode,
+ ctx.codeLength,
+ ctx.codeDigest,
+ ctx.evaluate
+ ),
+ (Handle, documentInfo, pCode, codeLength, codeDigest, evaluate)
+ );
+ }
+
public override V8.V8Script Compile(UniqueDocumentInfo documentInfo, string code)
{
return new V8ScriptImpl(documentInfo, code.GetDigest(), V8SplitProxyNative.Invoke(
@@ -119,6 +140,26 @@ public override V8.V8Script Compile(UniqueDocumentInfo documentInfo, string code
));
}
+ public override V8.V8Script CompileScriptFromUtf8(UniqueDocumentInfo documentInfo, IntPtr pCode, int codeLength)
+ {
+ UIntPtr codeDigest = MiscHelpers.GetDigestFromUtf8(pCode, codeLength);
+
+ return new V8ScriptImpl(documentInfo, codeDigest, V8SplitProxyNative.Invoke(
+ static (instance, ctx) => instance.V8Context_CompileScriptFromUtf8(
+ ctx.Handle,
+ MiscHelpers.GetUrlOrPath(ctx.documentInfo.Uri, ctx.documentInfo.UniqueName),
+ MiscHelpers.GetUrlOrPath(ctx.documentInfo.SourceMapUri, string.Empty),
+ ctx.documentInfo.UniqueId,
+ ctx.documentInfo.Category.Kind,
+ V8ProxyHelpers.AddRefHostObject(ctx.documentInfo),
+ ctx.pCode,
+ ctx.codeLength,
+ ctx.codeDigest
+ ),
+ (Handle, documentInfo, pCode, codeLength, codeDigest)
+ ));
+ }
+
public override V8.V8Script Compile(UniqueDocumentInfo documentInfo, string code, V8CacheKind cacheKind, out byte[] cacheBytes)
{
if (cacheKind == V8CacheKind.None)
diff --git a/ClearScript/V8/SplitProxy/V8SplitProxyNative.Common.tt b/ClearScript/V8/SplitProxy/V8SplitProxyNative.Common.tt
index 0e914d70..80864f5b 100644
--- a/ClearScript/V8/SplitProxy/V8SplitProxyNative.Common.tt
+++ b/ClearScript/V8/SplitProxy/V8SplitProxyNative.Common.tt
@@ -768,6 +768,21 @@ namespace Microsoft.ClearScript.V8.SplitProxy
}
}
+ object IV8SplitProxyNative.V8Context_ExecuteScriptFromUtf8(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, IntPtr pCode, int codeLength, UIntPtr codeDigest, bool evaluate)
+ {
+ using (var resourceNameScope = StdString.CreateScope(resourceName))
+ {
+ using (var sourceMapUrlScope = StdString.CreateScope(sourceMapUrl))
+ {
+ using (var resultScope = V8Value.CreateScope())
+ {
+ V8Context_ExecuteScriptFromUtf8(hContext, resourceNameScope.Value, sourceMapUrlScope.Value, uniqueId, documentKind, pDocumentInfo, pCode, codeLength, codeDigest, evaluate, resultScope.Value);
+ return V8Value.Get(resultScope.Value);
+ }
+ }
+ }
+ }
+
V8Script.Handle IV8SplitProxyNative.V8Context_Compile(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code)
{
using (var resourceNameScope = StdString.CreateScope(resourceName))
@@ -782,6 +797,17 @@ namespace Microsoft.ClearScript.V8.SplitProxy
}
}
+ V8Script.Handle IV8SplitProxyNative.V8Context_CompileScriptFromUtf8(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, IntPtr pCode, int codeLength, UIntPtr codeDigest)
+ {
+ using (var resourceNameScope = StdString.CreateScope(resourceName))
+ {
+ using (var sourceMapUrlScope = StdString.CreateScope(sourceMapUrl))
+ {
+ return V8Context_CompileScriptFromUtf8(hContext, resourceNameScope.Value, sourceMapUrlScope.Value, uniqueId, documentKind, pDocumentInfo, pCode, codeLength, codeDigest);
+ }
+ }
+ }
+
V8Script.Handle IV8SplitProxyNative.V8Context_CompileProducingCache(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code, V8CacheKind cacheKind, out byte[] cacheBytes)
{
using (var resourceNameScope = StdString.CreateScope(resourceName))
@@ -1889,6 +1915,21 @@ namespace Microsoft.ClearScript.V8.SplitProxy
[In] V8Value.Ptr pResult
);
+ [DllImport("<#= fileName #>", CallingConvention = CallingConvention.StdCall)]
+ private static extern void V8Context_ExecuteScriptFromUtf8(
+ [In] V8Context.Handle hContext,
+ [In] StdString.Ptr pResourceName,
+ [In] StdString.Ptr pSourceMapUrl,
+ [In] ulong uniqueId,
+ [In] DocumentKind documentKind,
+ [In] IntPtr pDocumentInfo,
+ [In] IntPtr pCode,
+ [In] int codeLength,
+ [In] UIntPtr codeDigest,
+ [In] [MarshalAs(UnmanagedType.I1)] bool evaluate,
+ [In] V8Value.Ptr pResult
+ );
+
[DllImport("<#= fileName #>", CallingConvention = CallingConvention.StdCall)]
private static extern V8Script.Handle V8Context_Compile(
[In] V8Context.Handle hContext,
@@ -1900,6 +1941,19 @@ namespace Microsoft.ClearScript.V8.SplitProxy
[In] StdString.Ptr pCode
);
+ [DllImport("<#= fileName #>", CallingConvention = CallingConvention.StdCall)]
+ private static extern V8Script.Handle V8Context_CompileScriptFromUtf8(
+ [In] V8Context.Handle hContext,
+ [In] StdString.Ptr pResourceName,
+ [In] StdString.Ptr pSourceMapUrl,
+ [In] ulong uniqueId,
+ [In] DocumentKind documentKind,
+ [In] IntPtr pDocumentInfo,
+ [In] IntPtr pCode,
+ [In] int codeLength,
+ [In] UIntPtr codeDigest
+ );
+
[DllImport("<#= fileName #>", CallingConvention = CallingConvention.StdCall)]
private static extern V8Script.Handle V8Context_CompileProducingCache(
[In] V8Context.Handle hContext,
diff --git a/ClearScript/V8/SplitProxy/V8SplitProxyNative.Generated.cs b/ClearScript/V8/SplitProxy/V8SplitProxyNative.Generated.cs
index 5d542578..af088b64 100644
--- a/ClearScript/V8/SplitProxy/V8SplitProxyNative.Generated.cs
+++ b/ClearScript/V8/SplitProxy/V8SplitProxyNative.Generated.cs
@@ -4,6 +4,11 @@
+
+
+
+
+
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
@@ -19,79 +24,95 @@ private static IV8SplitProxyNative CreateInstance()
var architecture = RuntimeInformation.ProcessArchitecture;
+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
+
if (architecture == Architecture.X86)
{
return new Impl_Windows_X86();
}
+
if (architecture == Architecture.X64)
{
return new Impl_Windows_X64();
}
+
if (architecture == Architecture.Arm64)
{
return new Impl_Windows_Arm64();
}
+
throw new PlatformNotSupportedException("Unsupported process architecture");
}
+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
+
if (architecture == Architecture.X64)
{
return new Impl_Linux_X64();
}
+
if (architecture == Architecture.Arm64)
{
return new Impl_Linux_Arm64();
}
+
if (architecture == Architecture.Arm)
{
return new Impl_Linux_Arm();
}
+
throw new PlatformNotSupportedException("Unsupported process architecture");
}
+
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
+
if (architecture == Architecture.X64)
{
return new Impl_OSX_X64();
}
+
if (architecture == Architecture.Arm64)
{
return new Impl_OSX_Arm64();
}
+
throw new PlatformNotSupportedException("Unsupported process architecture");
}
+
throw new PlatformNotSupportedException("Unsupported operating system");
}
+
#region Nested type: Impl_Windows_X86
private sealed class Impl_Windows_X86 : IV8SplitProxyNative
@@ -810,6 +831,21 @@ object IV8SplitProxyNative.V8Context_ExecuteCode(V8Context.Handle hContext, stri
}
}
+ object IV8SplitProxyNative.V8Context_ExecuteScriptFromUtf8(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, IntPtr pCode, int codeLength, UIntPtr codeDigest, bool evaluate)
+ {
+ using (var resourceNameScope = StdString.CreateScope(resourceName))
+ {
+ using (var sourceMapUrlScope = StdString.CreateScope(sourceMapUrl))
+ {
+ using (var resultScope = V8Value.CreateScope())
+ {
+ V8Context_ExecuteScriptFromUtf8(hContext, resourceNameScope.Value, sourceMapUrlScope.Value, uniqueId, documentKind, pDocumentInfo, pCode, codeLength, codeDigest, evaluate, resultScope.Value);
+ return V8Value.Get(resultScope.Value);
+ }
+ }
+ }
+ }
+
V8Script.Handle IV8SplitProxyNative.V8Context_Compile(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code)
{
using (var resourceNameScope = StdString.CreateScope(resourceName))
@@ -824,6 +860,17 @@ V8Script.Handle IV8SplitProxyNative.V8Context_Compile(V8Context.Handle hContext,
}
}
+ V8Script.Handle IV8SplitProxyNative.V8Context_CompileScriptFromUtf8(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, IntPtr pCode, int codeLength, UIntPtr codeDigest)
+ {
+ using (var resourceNameScope = StdString.CreateScope(resourceName))
+ {
+ using (var sourceMapUrlScope = StdString.CreateScope(sourceMapUrl))
+ {
+ return V8Context_CompileScriptFromUtf8(hContext, resourceNameScope.Value, sourceMapUrlScope.Value, uniqueId, documentKind, pDocumentInfo, pCode, codeLength, codeDigest);
+ }
+ }
+ }
+
V8Script.Handle IV8SplitProxyNative.V8Context_CompileProducingCache(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code, V8CacheKind cacheKind, out byte[] cacheBytes)
{
using (var resourceNameScope = StdString.CreateScope(resourceName))
@@ -1931,6 +1978,21 @@ [In] [MarshalAs(UnmanagedType.I1)] bool evaluate,
[In] V8Value.Ptr pResult
);
+ [DllImport("ClearScriptV8.win-x86.dll", CallingConvention = CallingConvention.StdCall)]
+ private static extern void V8Context_ExecuteScriptFromUtf8(
+ [In] V8Context.Handle hContext,
+ [In] StdString.Ptr pResourceName,
+ [In] StdString.Ptr pSourceMapUrl,
+ [In] ulong uniqueId,
+ [In] DocumentKind documentKind,
+ [In] IntPtr pDocumentInfo,
+ [In] IntPtr pCode,
+ [In] int codeLength,
+ [In] UIntPtr codeDigest,
+ [In] [MarshalAs(UnmanagedType.I1)] bool evaluate,
+ [In] V8Value.Ptr pResult
+ );
+
[DllImport("ClearScriptV8.win-x86.dll", CallingConvention = CallingConvention.StdCall)]
private static extern V8Script.Handle V8Context_Compile(
[In] V8Context.Handle hContext,
@@ -1942,6 +2004,19 @@ private static extern V8Script.Handle V8Context_Compile(
[In] StdString.Ptr pCode
);
+ [DllImport("ClearScriptV8.win-x86.dll", CallingConvention = CallingConvention.StdCall)]
+ private static extern V8Script.Handle V8Context_CompileScriptFromUtf8(
+ [In] V8Context.Handle hContext,
+ [In] StdString.Ptr pResourceName,
+ [In] StdString.Ptr pSourceMapUrl,
+ [In] ulong uniqueId,
+ [In] DocumentKind documentKind,
+ [In] IntPtr pDocumentInfo,
+ [In] IntPtr pCode,
+ [In] int codeLength,
+ [In] UIntPtr codeDigest
+ );
+
[DllImport("ClearScriptV8.win-x86.dll", CallingConvention = CallingConvention.StdCall)]
private static extern V8Script.Handle V8Context_CompileProducingCache(
[In] V8Context.Handle hContext,
@@ -2289,6 +2364,7 @@ [Out] out ulong contextCount
#endregion
+
#region Nested type: Impl_Windows_X64
private sealed class Impl_Windows_X64 : IV8SplitProxyNative
@@ -3007,6 +3083,21 @@ object IV8SplitProxyNative.V8Context_ExecuteCode(V8Context.Handle hContext, stri
}
}
+ object IV8SplitProxyNative.V8Context_ExecuteScriptFromUtf8(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, IntPtr pCode, int codeLength, UIntPtr codeDigest, bool evaluate)
+ {
+ using (var resourceNameScope = StdString.CreateScope(resourceName))
+ {
+ using (var sourceMapUrlScope = StdString.CreateScope(sourceMapUrl))
+ {
+ using (var resultScope = V8Value.CreateScope())
+ {
+ V8Context_ExecuteScriptFromUtf8(hContext, resourceNameScope.Value, sourceMapUrlScope.Value, uniqueId, documentKind, pDocumentInfo, pCode, codeLength, codeDigest, evaluate, resultScope.Value);
+ return V8Value.Get(resultScope.Value);
+ }
+ }
+ }
+ }
+
V8Script.Handle IV8SplitProxyNative.V8Context_Compile(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code)
{
using (var resourceNameScope = StdString.CreateScope(resourceName))
@@ -3021,6 +3112,17 @@ V8Script.Handle IV8SplitProxyNative.V8Context_Compile(V8Context.Handle hContext,
}
}
+ V8Script.Handle IV8SplitProxyNative.V8Context_CompileScriptFromUtf8(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, IntPtr pCode, int codeLength, UIntPtr codeDigest)
+ {
+ using (var resourceNameScope = StdString.CreateScope(resourceName))
+ {
+ using (var sourceMapUrlScope = StdString.CreateScope(sourceMapUrl))
+ {
+ return V8Context_CompileScriptFromUtf8(hContext, resourceNameScope.Value, sourceMapUrlScope.Value, uniqueId, documentKind, pDocumentInfo, pCode, codeLength, codeDigest);
+ }
+ }
+ }
+
V8Script.Handle IV8SplitProxyNative.V8Context_CompileProducingCache(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code, V8CacheKind cacheKind, out byte[] cacheBytes)
{
using (var resourceNameScope = StdString.CreateScope(resourceName))
@@ -4128,6 +4230,21 @@ [In] [MarshalAs(UnmanagedType.I1)] bool evaluate,
[In] V8Value.Ptr pResult
);
+ [DllImport("ClearScriptV8.win-x64.dll", CallingConvention = CallingConvention.StdCall)]
+ private static extern void V8Context_ExecuteScriptFromUtf8(
+ [In] V8Context.Handle hContext,
+ [In] StdString.Ptr pResourceName,
+ [In] StdString.Ptr pSourceMapUrl,
+ [In] ulong uniqueId,
+ [In] DocumentKind documentKind,
+ [In] IntPtr pDocumentInfo,
+ [In] IntPtr pCode,
+ [In] int codeLength,
+ [In] UIntPtr codeDigest,
+ [In] [MarshalAs(UnmanagedType.I1)] bool evaluate,
+ [In] V8Value.Ptr pResult
+ );
+
[DllImport("ClearScriptV8.win-x64.dll", CallingConvention = CallingConvention.StdCall)]
private static extern V8Script.Handle V8Context_Compile(
[In] V8Context.Handle hContext,
@@ -4139,6 +4256,19 @@ private static extern V8Script.Handle V8Context_Compile(
[In] StdString.Ptr pCode
);
+ [DllImport("ClearScriptV8.win-x64.dll", CallingConvention = CallingConvention.StdCall)]
+ private static extern V8Script.Handle V8Context_CompileScriptFromUtf8(
+ [In] V8Context.Handle hContext,
+ [In] StdString.Ptr pResourceName,
+ [In] StdString.Ptr pSourceMapUrl,
+ [In] ulong uniqueId,
+ [In] DocumentKind documentKind,
+ [In] IntPtr pDocumentInfo,
+ [In] IntPtr pCode,
+ [In] int codeLength,
+ [In] UIntPtr codeDigest
+ );
+
[DllImport("ClearScriptV8.win-x64.dll", CallingConvention = CallingConvention.StdCall)]
private static extern V8Script.Handle V8Context_CompileProducingCache(
[In] V8Context.Handle hContext,
@@ -4486,6 +4616,7 @@ [Out] out ulong contextCount
#endregion
+
#region Nested type: Impl_Windows_Arm64
private sealed class Impl_Windows_Arm64 : IV8SplitProxyNative
@@ -5204,6 +5335,21 @@ object IV8SplitProxyNative.V8Context_ExecuteCode(V8Context.Handle hContext, stri
}
}
+ object IV8SplitProxyNative.V8Context_ExecuteScriptFromUtf8(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, IntPtr pCode, int codeLength, UIntPtr codeDigest, bool evaluate)
+ {
+ using (var resourceNameScope = StdString.CreateScope(resourceName))
+ {
+ using (var sourceMapUrlScope = StdString.CreateScope(sourceMapUrl))
+ {
+ using (var resultScope = V8Value.CreateScope())
+ {
+ V8Context_ExecuteScriptFromUtf8(hContext, resourceNameScope.Value, sourceMapUrlScope.Value, uniqueId, documentKind, pDocumentInfo, pCode, codeLength, codeDigest, evaluate, resultScope.Value);
+ return V8Value.Get(resultScope.Value);
+ }
+ }
+ }
+ }
+
V8Script.Handle IV8SplitProxyNative.V8Context_Compile(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code)
{
using (var resourceNameScope = StdString.CreateScope(resourceName))
@@ -5218,6 +5364,17 @@ V8Script.Handle IV8SplitProxyNative.V8Context_Compile(V8Context.Handle hContext,
}
}
+ V8Script.Handle IV8SplitProxyNative.V8Context_CompileScriptFromUtf8(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, IntPtr pCode, int codeLength, UIntPtr codeDigest)
+ {
+ using (var resourceNameScope = StdString.CreateScope(resourceName))
+ {
+ using (var sourceMapUrlScope = StdString.CreateScope(sourceMapUrl))
+ {
+ return V8Context_CompileScriptFromUtf8(hContext, resourceNameScope.Value, sourceMapUrlScope.Value, uniqueId, documentKind, pDocumentInfo, pCode, codeLength, codeDigest);
+ }
+ }
+ }
+
V8Script.Handle IV8SplitProxyNative.V8Context_CompileProducingCache(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code, V8CacheKind cacheKind, out byte[] cacheBytes)
{
using (var resourceNameScope = StdString.CreateScope(resourceName))
@@ -6325,6 +6482,21 @@ [In] [MarshalAs(UnmanagedType.I1)] bool evaluate,
[In] V8Value.Ptr pResult
);
+ [DllImport("ClearScriptV8.win-arm64.dll", CallingConvention = CallingConvention.StdCall)]
+ private static extern void V8Context_ExecuteScriptFromUtf8(
+ [In] V8Context.Handle hContext,
+ [In] StdString.Ptr pResourceName,
+ [In] StdString.Ptr pSourceMapUrl,
+ [In] ulong uniqueId,
+ [In] DocumentKind documentKind,
+ [In] IntPtr pDocumentInfo,
+ [In] IntPtr pCode,
+ [In] int codeLength,
+ [In] UIntPtr codeDigest,
+ [In] [MarshalAs(UnmanagedType.I1)] bool evaluate,
+ [In] V8Value.Ptr pResult
+ );
+
[DllImport("ClearScriptV8.win-arm64.dll", CallingConvention = CallingConvention.StdCall)]
private static extern V8Script.Handle V8Context_Compile(
[In] V8Context.Handle hContext,
@@ -6336,6 +6508,19 @@ private static extern V8Script.Handle V8Context_Compile(
[In] StdString.Ptr pCode
);
+ [DllImport("ClearScriptV8.win-arm64.dll", CallingConvention = CallingConvention.StdCall)]
+ private static extern V8Script.Handle V8Context_CompileScriptFromUtf8(
+ [In] V8Context.Handle hContext,
+ [In] StdString.Ptr pResourceName,
+ [In] StdString.Ptr pSourceMapUrl,
+ [In] ulong uniqueId,
+ [In] DocumentKind documentKind,
+ [In] IntPtr pDocumentInfo,
+ [In] IntPtr pCode,
+ [In] int codeLength,
+ [In] UIntPtr codeDigest
+ );
+
[DllImport("ClearScriptV8.win-arm64.dll", CallingConvention = CallingConvention.StdCall)]
private static extern V8Script.Handle V8Context_CompileProducingCache(
[In] V8Context.Handle hContext,
@@ -6683,6 +6868,7 @@ [Out] out ulong contextCount
#endregion
+
#region Nested type: Impl_Linux_X64
private sealed class Impl_Linux_X64 : IV8SplitProxyNative
@@ -7401,6 +7587,21 @@ object IV8SplitProxyNative.V8Context_ExecuteCode(V8Context.Handle hContext, stri
}
}
+ object IV8SplitProxyNative.V8Context_ExecuteScriptFromUtf8(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, IntPtr pCode, int codeLength, UIntPtr codeDigest, bool evaluate)
+ {
+ using (var resourceNameScope = StdString.CreateScope(resourceName))
+ {
+ using (var sourceMapUrlScope = StdString.CreateScope(sourceMapUrl))
+ {
+ using (var resultScope = V8Value.CreateScope())
+ {
+ V8Context_ExecuteScriptFromUtf8(hContext, resourceNameScope.Value, sourceMapUrlScope.Value, uniqueId, documentKind, pDocumentInfo, pCode, codeLength, codeDigest, evaluate, resultScope.Value);
+ return V8Value.Get(resultScope.Value);
+ }
+ }
+ }
+ }
+
V8Script.Handle IV8SplitProxyNative.V8Context_Compile(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code)
{
using (var resourceNameScope = StdString.CreateScope(resourceName))
@@ -7415,6 +7616,17 @@ V8Script.Handle IV8SplitProxyNative.V8Context_Compile(V8Context.Handle hContext,
}
}
+ V8Script.Handle IV8SplitProxyNative.V8Context_CompileScriptFromUtf8(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, IntPtr pCode, int codeLength, UIntPtr codeDigest)
+ {
+ using (var resourceNameScope = StdString.CreateScope(resourceName))
+ {
+ using (var sourceMapUrlScope = StdString.CreateScope(sourceMapUrl))
+ {
+ return V8Context_CompileScriptFromUtf8(hContext, resourceNameScope.Value, sourceMapUrlScope.Value, uniqueId, documentKind, pDocumentInfo, pCode, codeLength, codeDigest);
+ }
+ }
+ }
+
V8Script.Handle IV8SplitProxyNative.V8Context_CompileProducingCache(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code, V8CacheKind cacheKind, out byte[] cacheBytes)
{
using (var resourceNameScope = StdString.CreateScope(resourceName))
@@ -8522,6 +8734,21 @@ [In] [MarshalAs(UnmanagedType.I1)] bool evaluate,
[In] V8Value.Ptr pResult
);
+ [DllImport("ClearScriptV8.linux-x64.so", CallingConvention = CallingConvention.StdCall)]
+ private static extern void V8Context_ExecuteScriptFromUtf8(
+ [In] V8Context.Handle hContext,
+ [In] StdString.Ptr pResourceName,
+ [In] StdString.Ptr pSourceMapUrl,
+ [In] ulong uniqueId,
+ [In] DocumentKind documentKind,
+ [In] IntPtr pDocumentInfo,
+ [In] IntPtr pCode,
+ [In] int codeLength,
+ [In] UIntPtr codeDigest,
+ [In] [MarshalAs(UnmanagedType.I1)] bool evaluate,
+ [In] V8Value.Ptr pResult
+ );
+
[DllImport("ClearScriptV8.linux-x64.so", CallingConvention = CallingConvention.StdCall)]
private static extern V8Script.Handle V8Context_Compile(
[In] V8Context.Handle hContext,
@@ -8533,6 +8760,19 @@ private static extern V8Script.Handle V8Context_Compile(
[In] StdString.Ptr pCode
);
+ [DllImport("ClearScriptV8.linux-x64.so", CallingConvention = CallingConvention.StdCall)]
+ private static extern V8Script.Handle V8Context_CompileScriptFromUtf8(
+ [In] V8Context.Handle hContext,
+ [In] StdString.Ptr pResourceName,
+ [In] StdString.Ptr pSourceMapUrl,
+ [In] ulong uniqueId,
+ [In] DocumentKind documentKind,
+ [In] IntPtr pDocumentInfo,
+ [In] IntPtr pCode,
+ [In] int codeLength,
+ [In] UIntPtr codeDigest
+ );
+
[DllImport("ClearScriptV8.linux-x64.so", CallingConvention = CallingConvention.StdCall)]
private static extern V8Script.Handle V8Context_CompileProducingCache(
[In] V8Context.Handle hContext,
@@ -8880,6 +9120,7 @@ [Out] out ulong contextCount
#endregion
+
#region Nested type: Impl_Linux_Arm64
private sealed class Impl_Linux_Arm64 : IV8SplitProxyNative
@@ -9598,6 +9839,21 @@ object IV8SplitProxyNative.V8Context_ExecuteCode(V8Context.Handle hContext, stri
}
}
+ object IV8SplitProxyNative.V8Context_ExecuteScriptFromUtf8(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, IntPtr pCode, int codeLength, UIntPtr codeDigest, bool evaluate)
+ {
+ using (var resourceNameScope = StdString.CreateScope(resourceName))
+ {
+ using (var sourceMapUrlScope = StdString.CreateScope(sourceMapUrl))
+ {
+ using (var resultScope = V8Value.CreateScope())
+ {
+ V8Context_ExecuteScriptFromUtf8(hContext, resourceNameScope.Value, sourceMapUrlScope.Value, uniqueId, documentKind, pDocumentInfo, pCode, codeLength, codeDigest, evaluate, resultScope.Value);
+ return V8Value.Get(resultScope.Value);
+ }
+ }
+ }
+ }
+
V8Script.Handle IV8SplitProxyNative.V8Context_Compile(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code)
{
using (var resourceNameScope = StdString.CreateScope(resourceName))
@@ -9612,6 +9868,17 @@ V8Script.Handle IV8SplitProxyNative.V8Context_Compile(V8Context.Handle hContext,
}
}
+ V8Script.Handle IV8SplitProxyNative.V8Context_CompileScriptFromUtf8(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, IntPtr pCode, int codeLength, UIntPtr codeDigest)
+ {
+ using (var resourceNameScope = StdString.CreateScope(resourceName))
+ {
+ using (var sourceMapUrlScope = StdString.CreateScope(sourceMapUrl))
+ {
+ return V8Context_CompileScriptFromUtf8(hContext, resourceNameScope.Value, sourceMapUrlScope.Value, uniqueId, documentKind, pDocumentInfo, pCode, codeLength, codeDigest);
+ }
+ }
+ }
+
V8Script.Handle IV8SplitProxyNative.V8Context_CompileProducingCache(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code, V8CacheKind cacheKind, out byte[] cacheBytes)
{
using (var resourceNameScope = StdString.CreateScope(resourceName))
@@ -10719,6 +10986,21 @@ [In] [MarshalAs(UnmanagedType.I1)] bool evaluate,
[In] V8Value.Ptr pResult
);
+ [DllImport("ClearScriptV8.linux-arm64.so", CallingConvention = CallingConvention.StdCall)]
+ private static extern void V8Context_ExecuteScriptFromUtf8(
+ [In] V8Context.Handle hContext,
+ [In] StdString.Ptr pResourceName,
+ [In] StdString.Ptr pSourceMapUrl,
+ [In] ulong uniqueId,
+ [In] DocumentKind documentKind,
+ [In] IntPtr pDocumentInfo,
+ [In] IntPtr pCode,
+ [In] int codeLength,
+ [In] UIntPtr codeDigest,
+ [In] [MarshalAs(UnmanagedType.I1)] bool evaluate,
+ [In] V8Value.Ptr pResult
+ );
+
[DllImport("ClearScriptV8.linux-arm64.so", CallingConvention = CallingConvention.StdCall)]
private static extern V8Script.Handle V8Context_Compile(
[In] V8Context.Handle hContext,
@@ -10730,6 +11012,19 @@ private static extern V8Script.Handle V8Context_Compile(
[In] StdString.Ptr pCode
);
+ [DllImport("ClearScriptV8.linux-arm64.so", CallingConvention = CallingConvention.StdCall)]
+ private static extern V8Script.Handle V8Context_CompileScriptFromUtf8(
+ [In] V8Context.Handle hContext,
+ [In] StdString.Ptr pResourceName,
+ [In] StdString.Ptr pSourceMapUrl,
+ [In] ulong uniqueId,
+ [In] DocumentKind documentKind,
+ [In] IntPtr pDocumentInfo,
+ [In] IntPtr pCode,
+ [In] int codeLength,
+ [In] UIntPtr codeDigest
+ );
+
[DllImport("ClearScriptV8.linux-arm64.so", CallingConvention = CallingConvention.StdCall)]
private static extern V8Script.Handle V8Context_CompileProducingCache(
[In] V8Context.Handle hContext,
@@ -11077,6 +11372,7 @@ [Out] out ulong contextCount
#endregion
+
#region Nested type: Impl_Linux_Arm
private sealed class Impl_Linux_Arm : IV8SplitProxyNative
@@ -11795,6 +12091,21 @@ object IV8SplitProxyNative.V8Context_ExecuteCode(V8Context.Handle hContext, stri
}
}
+ object IV8SplitProxyNative.V8Context_ExecuteScriptFromUtf8(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, IntPtr pCode, int codeLength, UIntPtr codeDigest, bool evaluate)
+ {
+ using (var resourceNameScope = StdString.CreateScope(resourceName))
+ {
+ using (var sourceMapUrlScope = StdString.CreateScope(sourceMapUrl))
+ {
+ using (var resultScope = V8Value.CreateScope())
+ {
+ V8Context_ExecuteScriptFromUtf8(hContext, resourceNameScope.Value, sourceMapUrlScope.Value, uniqueId, documentKind, pDocumentInfo, pCode, codeLength, codeDigest, evaluate, resultScope.Value);
+ return V8Value.Get(resultScope.Value);
+ }
+ }
+ }
+ }
+
V8Script.Handle IV8SplitProxyNative.V8Context_Compile(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code)
{
using (var resourceNameScope = StdString.CreateScope(resourceName))
@@ -11809,6 +12120,17 @@ V8Script.Handle IV8SplitProxyNative.V8Context_Compile(V8Context.Handle hContext,
}
}
+ V8Script.Handle IV8SplitProxyNative.V8Context_CompileScriptFromUtf8(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, IntPtr pCode, int codeLength, UIntPtr codeDigest)
+ {
+ using (var resourceNameScope = StdString.CreateScope(resourceName))
+ {
+ using (var sourceMapUrlScope = StdString.CreateScope(sourceMapUrl))
+ {
+ return V8Context_CompileScriptFromUtf8(hContext, resourceNameScope.Value, sourceMapUrlScope.Value, uniqueId, documentKind, pDocumentInfo, pCode, codeLength, codeDigest);
+ }
+ }
+ }
+
V8Script.Handle IV8SplitProxyNative.V8Context_CompileProducingCache(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code, V8CacheKind cacheKind, out byte[] cacheBytes)
{
using (var resourceNameScope = StdString.CreateScope(resourceName))
@@ -12916,6 +13238,21 @@ [In] [MarshalAs(UnmanagedType.I1)] bool evaluate,
[In] V8Value.Ptr pResult
);
+ [DllImport("ClearScriptV8.linux-arm.so", CallingConvention = CallingConvention.StdCall)]
+ private static extern void V8Context_ExecuteScriptFromUtf8(
+ [In] V8Context.Handle hContext,
+ [In] StdString.Ptr pResourceName,
+ [In] StdString.Ptr pSourceMapUrl,
+ [In] ulong uniqueId,
+ [In] DocumentKind documentKind,
+ [In] IntPtr pDocumentInfo,
+ [In] IntPtr pCode,
+ [In] int codeLength,
+ [In] UIntPtr codeDigest,
+ [In] [MarshalAs(UnmanagedType.I1)] bool evaluate,
+ [In] V8Value.Ptr pResult
+ );
+
[DllImport("ClearScriptV8.linux-arm.so", CallingConvention = CallingConvention.StdCall)]
private static extern V8Script.Handle V8Context_Compile(
[In] V8Context.Handle hContext,
@@ -12927,6 +13264,19 @@ private static extern V8Script.Handle V8Context_Compile(
[In] StdString.Ptr pCode
);
+ [DllImport("ClearScriptV8.linux-arm.so", CallingConvention = CallingConvention.StdCall)]
+ private static extern V8Script.Handle V8Context_CompileScriptFromUtf8(
+ [In] V8Context.Handle hContext,
+ [In] StdString.Ptr pResourceName,
+ [In] StdString.Ptr pSourceMapUrl,
+ [In] ulong uniqueId,
+ [In] DocumentKind documentKind,
+ [In] IntPtr pDocumentInfo,
+ [In] IntPtr pCode,
+ [In] int codeLength,
+ [In] UIntPtr codeDigest
+ );
+
[DllImport("ClearScriptV8.linux-arm.so", CallingConvention = CallingConvention.StdCall)]
private static extern V8Script.Handle V8Context_CompileProducingCache(
[In] V8Context.Handle hContext,
@@ -13274,6 +13624,7 @@ [Out] out ulong contextCount
#endregion
+
#region Nested type: Impl_OSX_X64
private sealed class Impl_OSX_X64 : IV8SplitProxyNative
@@ -13992,6 +14343,21 @@ object IV8SplitProxyNative.V8Context_ExecuteCode(V8Context.Handle hContext, stri
}
}
+ object IV8SplitProxyNative.V8Context_ExecuteScriptFromUtf8(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, IntPtr pCode, int codeLength, UIntPtr codeDigest, bool evaluate)
+ {
+ using (var resourceNameScope = StdString.CreateScope(resourceName))
+ {
+ using (var sourceMapUrlScope = StdString.CreateScope(sourceMapUrl))
+ {
+ using (var resultScope = V8Value.CreateScope())
+ {
+ V8Context_ExecuteScriptFromUtf8(hContext, resourceNameScope.Value, sourceMapUrlScope.Value, uniqueId, documentKind, pDocumentInfo, pCode, codeLength, codeDigest, evaluate, resultScope.Value);
+ return V8Value.Get(resultScope.Value);
+ }
+ }
+ }
+ }
+
V8Script.Handle IV8SplitProxyNative.V8Context_Compile(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code)
{
using (var resourceNameScope = StdString.CreateScope(resourceName))
@@ -14006,6 +14372,17 @@ V8Script.Handle IV8SplitProxyNative.V8Context_Compile(V8Context.Handle hContext,
}
}
+ V8Script.Handle IV8SplitProxyNative.V8Context_CompileScriptFromUtf8(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, IntPtr pCode, int codeLength, UIntPtr codeDigest)
+ {
+ using (var resourceNameScope = StdString.CreateScope(resourceName))
+ {
+ using (var sourceMapUrlScope = StdString.CreateScope(sourceMapUrl))
+ {
+ return V8Context_CompileScriptFromUtf8(hContext, resourceNameScope.Value, sourceMapUrlScope.Value, uniqueId, documentKind, pDocumentInfo, pCode, codeLength, codeDigest);
+ }
+ }
+ }
+
V8Script.Handle IV8SplitProxyNative.V8Context_CompileProducingCache(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code, V8CacheKind cacheKind, out byte[] cacheBytes)
{
using (var resourceNameScope = StdString.CreateScope(resourceName))
@@ -15113,6 +15490,21 @@ [In] [MarshalAs(UnmanagedType.I1)] bool evaluate,
[In] V8Value.Ptr pResult
);
+ [DllImport("ClearScriptV8.osx-x64.dylib", CallingConvention = CallingConvention.StdCall)]
+ private static extern void V8Context_ExecuteScriptFromUtf8(
+ [In] V8Context.Handle hContext,
+ [In] StdString.Ptr pResourceName,
+ [In] StdString.Ptr pSourceMapUrl,
+ [In] ulong uniqueId,
+ [In] DocumentKind documentKind,
+ [In] IntPtr pDocumentInfo,
+ [In] IntPtr pCode,
+ [In] int codeLength,
+ [In] UIntPtr codeDigest,
+ [In] [MarshalAs(UnmanagedType.I1)] bool evaluate,
+ [In] V8Value.Ptr pResult
+ );
+
[DllImport("ClearScriptV8.osx-x64.dylib", CallingConvention = CallingConvention.StdCall)]
private static extern V8Script.Handle V8Context_Compile(
[In] V8Context.Handle hContext,
@@ -15124,6 +15516,19 @@ private static extern V8Script.Handle V8Context_Compile(
[In] StdString.Ptr pCode
);
+ [DllImport("ClearScriptV8.osx-x64.dylib", CallingConvention = CallingConvention.StdCall)]
+ private static extern V8Script.Handle V8Context_CompileScriptFromUtf8(
+ [In] V8Context.Handle hContext,
+ [In] StdString.Ptr pResourceName,
+ [In] StdString.Ptr pSourceMapUrl,
+ [In] ulong uniqueId,
+ [In] DocumentKind documentKind,
+ [In] IntPtr pDocumentInfo,
+ [In] IntPtr pCode,
+ [In] int codeLength,
+ [In] UIntPtr codeDigest
+ );
+
[DllImport("ClearScriptV8.osx-x64.dylib", CallingConvention = CallingConvention.StdCall)]
private static extern V8Script.Handle V8Context_CompileProducingCache(
[In] V8Context.Handle hContext,
@@ -15471,6 +15876,7 @@ [Out] out ulong contextCount
#endregion
+
#region Nested type: Impl_OSX_Arm64
private sealed class Impl_OSX_Arm64 : IV8SplitProxyNative
@@ -16189,6 +16595,21 @@ object IV8SplitProxyNative.V8Context_ExecuteCode(V8Context.Handle hContext, stri
}
}
+ object IV8SplitProxyNative.V8Context_ExecuteScriptFromUtf8(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, IntPtr pCode, int codeLength, UIntPtr codeDigest, bool evaluate)
+ {
+ using (var resourceNameScope = StdString.CreateScope(resourceName))
+ {
+ using (var sourceMapUrlScope = StdString.CreateScope(sourceMapUrl))
+ {
+ using (var resultScope = V8Value.CreateScope())
+ {
+ V8Context_ExecuteScriptFromUtf8(hContext, resourceNameScope.Value, sourceMapUrlScope.Value, uniqueId, documentKind, pDocumentInfo, pCode, codeLength, codeDigest, evaluate, resultScope.Value);
+ return V8Value.Get(resultScope.Value);
+ }
+ }
+ }
+ }
+
V8Script.Handle IV8SplitProxyNative.V8Context_Compile(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code)
{
using (var resourceNameScope = StdString.CreateScope(resourceName))
@@ -16203,6 +16624,17 @@ V8Script.Handle IV8SplitProxyNative.V8Context_Compile(V8Context.Handle hContext,
}
}
+ V8Script.Handle IV8SplitProxyNative.V8Context_CompileScriptFromUtf8(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, IntPtr pCode, int codeLength, UIntPtr codeDigest)
+ {
+ using (var resourceNameScope = StdString.CreateScope(resourceName))
+ {
+ using (var sourceMapUrlScope = StdString.CreateScope(sourceMapUrl))
+ {
+ return V8Context_CompileScriptFromUtf8(hContext, resourceNameScope.Value, sourceMapUrlScope.Value, uniqueId, documentKind, pDocumentInfo, pCode, codeLength, codeDigest);
+ }
+ }
+ }
+
V8Script.Handle IV8SplitProxyNative.V8Context_CompileProducingCache(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, DocumentKind documentKind, IntPtr pDocumentInfo, string code, V8CacheKind cacheKind, out byte[] cacheBytes)
{
using (var resourceNameScope = StdString.CreateScope(resourceName))
@@ -17310,6 +17742,21 @@ [In] [MarshalAs(UnmanagedType.I1)] bool evaluate,
[In] V8Value.Ptr pResult
);
+ [DllImport("ClearScriptV8.osx-arm64.dylib", CallingConvention = CallingConvention.StdCall)]
+ private static extern void V8Context_ExecuteScriptFromUtf8(
+ [In] V8Context.Handle hContext,
+ [In] StdString.Ptr pResourceName,
+ [In] StdString.Ptr pSourceMapUrl,
+ [In] ulong uniqueId,
+ [In] DocumentKind documentKind,
+ [In] IntPtr pDocumentInfo,
+ [In] IntPtr pCode,
+ [In] int codeLength,
+ [In] UIntPtr codeDigest,
+ [In] [MarshalAs(UnmanagedType.I1)] bool evaluate,
+ [In] V8Value.Ptr pResult
+ );
+
[DllImport("ClearScriptV8.osx-arm64.dylib", CallingConvention = CallingConvention.StdCall)]
private static extern V8Script.Handle V8Context_Compile(
[In] V8Context.Handle hContext,
@@ -17321,6 +17768,19 @@ private static extern V8Script.Handle V8Context_Compile(
[In] StdString.Ptr pCode
);
+ [DllImport("ClearScriptV8.osx-arm64.dylib", CallingConvention = CallingConvention.StdCall)]
+ private static extern V8Script.Handle V8Context_CompileScriptFromUtf8(
+ [In] V8Context.Handle hContext,
+ [In] StdString.Ptr pResourceName,
+ [In] StdString.Ptr pSourceMapUrl,
+ [In] ulong uniqueId,
+ [In] DocumentKind documentKind,
+ [In] IntPtr pDocumentInfo,
+ [In] IntPtr pCode,
+ [In] int codeLength,
+ [In] UIntPtr codeDigest
+ );
+
[DllImport("ClearScriptV8.osx-arm64.dylib", CallingConvention = CallingConvention.StdCall)]
private static extern V8Script.Handle V8Context_CompileProducingCache(
[In] V8Context.Handle hContext,
@@ -17668,6 +18128,7 @@ [Out] out ulong contextCount
#endregion
+
}
}
diff --git a/ClearScript/V8/V8ContextProxy.cs b/ClearScript/V8/V8ContextProxy.cs
index ebeae064..eab1e3cf 100644
--- a/ClearScript/V8/V8ContextProxy.cs
+++ b/ClearScript/V8/V8ContextProxy.cs
@@ -34,8 +34,12 @@ public static V8ContextProxy Create(V8IsolateProxy isolateProxy, string name, V8
public abstract object Execute(UniqueDocumentInfo documentInfo, string code, bool evaluate);
+ public abstract object ExecuteScriptFromUtf8(UniqueDocumentInfo documentInfo, IntPtr pCode, int codeLength, bool evaluate);
+
public abstract V8Script Compile(UniqueDocumentInfo documentInfo, string code);
+ public abstract V8Script CompileScriptFromUtf8(UniqueDocumentInfo documentInfo, IntPtr pCode, int codeLength);
+
public abstract V8Script Compile(UniqueDocumentInfo documentInfo, string code, V8CacheKind cacheKind, out byte[] cacheBytes);
public abstract V8Script Compile(UniqueDocumentInfo documentInfo, string code, V8CacheKind cacheKind, byte[] cacheBytes, out bool cacheAccepted);
diff --git a/ClearScript/V8/V8ScriptEngine.cs b/ClearScript/V8/V8ScriptEngine.cs
index 7a0089f4..2d5f3069 100644
--- a/ClearScript/V8/V8ScriptEngine.cs
+++ b/ClearScript/V8/V8ScriptEngine.cs
@@ -472,6 +472,16 @@ public V8Script Compile(string code)
return Compile(null, code);
}
+ ///
+ /// Creates a compiled script.
+ ///
+ /// The script code to compile.
+ /// A compiled script that can be executed multiple times without recompilation.
+ public V8Script CompileScriptFromUtf8(ReadOnlySpan code)
+ {
+ return CompileScriptFromUtf8(null, code);
+ }
+
///
/// Creates a compiled script with an associated document name.
///
@@ -483,6 +493,17 @@ public V8Script Compile(string documentName, string code)
return Compile(new DocumentInfo(documentName), code);
}
+ ///
+ /// Creates a compiled script with an associated document name.
+ ///
+ /// A document name for the compiled script. Currently, this name is used only as a label in presentation contexts such as debugger user interfaces.
+ /// The script code to compile.
+ /// A compiled script that can be executed multiple times without recompilation.
+ public V8Script CompileScriptFromUtf8(string documentName, ReadOnlySpan code)
+ {
+ return CompileScriptFromUtf8(new DocumentInfo(documentName), code);
+ }
+
///
/// Creates a compiled script with the specified document meta-information.
///
@@ -493,6 +514,37 @@ public V8Script Compile(DocumentInfo documentInfo, string code)
{
VerifyNotDisposed();
return ScriptInvoke(static ctx => ctx.self.CompileInternal(ctx.documentInfo.MakeUnique(ctx.self), ctx.code), (self: this, documentInfo, code));
+ }
+
+ ///
+ /// Creates a compiled script with the specified document meta-information.
+ ///
+ /// A structure containing meta-information for the script document. This method only supports .
+ /// The script code to compile.
+ /// A compiled script that can be executed multiple times without recompilation.
+ /// When is True or documentInfo.Category.Kind is not .
+ public V8Script CompileScriptFromUtf8(DocumentInfo documentInfo, ReadOnlySpan code)
+ {
+ if (FormatCode)
+ {
+ throw new NotSupportedException("Cannot reformat code without allocating");
+ }
+
+ if (documentInfo.Category != DocumentCategory.Script)
+ {
+ throw new NotSupportedException("Cannot compile a module without allocating");
+ }
+
+ VerifyNotDisposed();
+
+ unsafe
+ {
+ fixed (byte* pCode = code)
+ {
+ return ScriptInvoke(static ctx => ctx.proxy.CompileScriptFromUtf8(ctx.documentInfo, ctx.pCode, ctx.codeLength),
+ (proxy, documentInfo: documentInfo.MakeUnique(this), pCode: (IntPtr)pCode, codeLength: code.Length));
+ }
+ }
}
///
@@ -938,6 +990,51 @@ public object Evaluate(V8Script script)
return Execute(script, true);
}
+ ///
+ /// Evaluates script code.
+ ///
+ /// The script code to evaluate.
+ /// The result value.
+ public object EvaluateScriptFromUtf8(ReadOnlySpan code)
+ {
+ return EvaluateScriptFromUtf8(null, code);
+ }
+
+ ///
+ /// Evaluates script code with an associated document name.
+ ///
+ /// A document name for the script code. Currently, this name is used only as a label in presentation contexts such as debugger user interfaces.
+ /// The script code to evaluate.
+ /// The result value.
+ public object EvaluateScriptFromUtf8(string documentName, ReadOnlySpan code)
+ {
+ return EvaluateScriptFromUtf8(null, true, code);
+ }
+
+ ///
+ /// Evaluates script code with an associated document name, optionally discarding the document after execution.
+ ///
+ /// A document name for the script code. Currently, this name is used only as a label in presentation contexts such as debugger user interfaces.
+ /// True to discard the script document after execution, false otherwise.
+ /// The script code to evaluate.
+ /// The result value.
+ public object EvaluateScriptFromUtf8(string documentName, bool discard, ReadOnlySpan code)
+ {
+ return EvaluateScriptFromUtf8(new DocumentInfo(documentName) { Flags = discard ? DocumentFlags.IsTransient : DocumentFlags.None }, code);
+ }
+
+ ///
+ /// Evaluates script code with the specified document meta-information.
+ ///
+ /// A structure containing meta-information for the script document. This method only supports .
+ /// The script code to evaluate.
+ /// The result value.
+ /// When is True or documentInfo.Category.Kind is not .
+ public object EvaluateScriptFromUtf8(DocumentInfo documentInfo, ReadOnlySpan code)
+ {
+ return ExecuteScriptFromUtf8(documentInfo, code, true);
+ }
+
///
/// Executes a compiled script.
///
@@ -952,6 +1049,47 @@ public void Execute(V8Script script)
Execute(script, false);
}
+ ///
+ /// Executes script code.
+ ///
+ /// The script code to execute.
+ public void ExecuteScriptFromUtf8(ReadOnlySpan code)
+ {
+ ExecuteScriptFromUtf8(null, code);
+ }
+
+ ///
+ /// Executes script code with an associated document name.
+ ///
+ /// A document name for the script code. Currently, this name is used only as a label in presentation contexts such as debugger user interfaces.
+ /// The script code to execute.
+ public void ExecuteScriptFromUtf8(string documentName, ReadOnlySpan code)
+ {
+ ExecuteScriptFromUtf8(documentName, false, code);
+ }
+
+ ///
+ /// Executes script code with an associated document name, optionally discarding the document after execution.
+ ///
+ /// A document name for the script code. Currently, this name is used only as a label in presentation contexts such as debugger user interfaces.
+ /// True to discard the script document after execution, false otherwise.
+ /// The script code to execute.
+ public void ExecuteScriptFromUtf8(string documentName, bool discard, ReadOnlySpan code)
+ {
+ ExecuteScriptFromUtf8(new DocumentInfo(documentName) { Flags = discard ? DocumentFlags.IsTransient : DocumentFlags.None }, code);
+ }
+
+ ///
+ /// Executes script code with the specified document meta-information.
+ ///
+ /// A structure containing meta-information for the script document. This method only supports .
+ /// The script code to execute.
+ /// When is True or documentInfo.Category.Kind is not .
+ public void ExecuteScriptFromUtf8(DocumentInfo documentInfo, ReadOnlySpan code)
+ {
+ ExecuteScriptFromUtf8(documentInfo, code, false);
+ }
+
// ReSharper restore ParameterHidesMember
///
@@ -1174,6 +1312,69 @@ private object Execute(V8Script script, bool evaluate)
);
}
+ private object ExecuteScriptFromUtf8(DocumentInfo documentInfo, ReadOnlySpan code, bool evaluate)
+ {
+ if (FormatCode)
+ {
+ throw new NotSupportedException("Cannot reformat code without allocating");
+ }
+
+ if (documentInfo.Category != DocumentCategory.Script)
+ {
+ throw new NotSupportedException("Cannot compile a module without allocating");
+ }
+
+ VerifyNotDisposed();
+
+ unsafe
+ {
+ fixed (byte* pCode = code)
+ {
+ return ScriptInvoke(
+ static ctx =>
+ {
+ if ((ctx.self.documentNames is not null) && !ctx.documentInfo.Flags.GetValueOrDefault().HasAllFlags(DocumentFlags.IsTransient))
+ {
+ ctx.self.documentNames.Add(ctx.documentInfo.UniqueName);
+ }
+
+ if (ctx.self.inContinuationTimerScope || (ctx.self.ContinuationCallback is null))
+ {
+ if (ctx.self.ShouldAwaitDebuggerAndPause(ctx.documentInfo.Info))
+ {
+ ctx.self.proxy.AwaitDebuggerAndPause();
+ }
+
+ return ctx.self.proxy.ExecuteScriptFromUtf8(ctx.documentInfo, ctx.pCode, ctx.codeLength, ctx.evaluate);
+ }
+
+ var state = new Timer[] { null };
+ using (state[0] = new Timer(_ => ctx.self.OnContinuationTimer(state[0]), null, Timeout.Infinite, Timeout.Infinite))
+ {
+ ctx.self.inContinuationTimerScope = true;
+ try
+ {
+ state[0].Change(continuationInterval, Timeout.Infinite);
+
+ if (ctx.self.ShouldAwaitDebuggerAndPause(ctx.documentInfo.Info))
+ {
+ ctx.self.proxy.AwaitDebuggerAndPause();
+ }
+
+ return ctx.self.proxy.ExecuteScriptFromUtf8(ctx.documentInfo, ctx.pCode, ctx.codeLength, ctx.evaluate);
+ }
+ finally
+ {
+ ctx.self.inContinuationTimerScope = false;
+ }
+ }
+ },
+ (self: this, documentInfo: documentInfo.MakeUnique(this), pCode: (IntPtr)pCode, codeLength: code.Length, evaluate)
+ );
+ }
+ }
+ }
+
// ReSharper restore ParameterHidesMember
private V8Script CompileInternal(UniqueDocumentInfo documentInfo, string code)
diff --git a/ClearScriptV8/V8Context.h b/ClearScriptV8/V8Context.h
index 949cbca1..bca180d1 100644
--- a/ClearScriptV8/V8Context.h
+++ b/ClearScriptV8/V8Context.h
@@ -71,8 +71,10 @@ class V8Context: public WeakRefTarget, public IV8Entity
virtual void CancelAwaitDebugger() = 0;
virtual V8Value Execute(const V8DocumentInfo& documentInfo, const StdString& code, bool evaluate) = 0;
+ virtual V8Value ExecuteScriptFromUtf8(const V8DocumentInfo& documentInfo, const char* code, int codeLength, size_t codeDigest, bool evaluate) = 0;
virtual V8ScriptHolder* Compile(const V8DocumentInfo& documentInfo, StdString&& code) = 0;
+ virtual V8ScriptHolder* CompileScriptFromUtf8(const V8DocumentInfo& documentInfo, const char* code, int codeLength, size_t codeDigest) = 0;
virtual V8ScriptHolder* Compile(const V8DocumentInfo& documentInfo, StdString&& code, V8CacheKind cacheKind, std::vector& cacheBytes) = 0;
virtual V8ScriptHolder* Compile(const V8DocumentInfo& documentInfo, StdString&& code, V8CacheKind cacheKind, const std::vector& cacheBytes, bool& cacheAccepted) = 0;
virtual V8ScriptHolder* Compile(const V8DocumentInfo& documentInfo, StdString&& code, V8CacheKind cacheKind, std::vector& cacheBytes, V8CacheResult& cacheResult) = 0;
diff --git a/ClearScriptV8/V8ContextImpl.cpp b/ClearScriptV8/V8ContextImpl.cpp
index 0256a53b..122f7d9c 100644
--- a/ClearScriptV8/V8ContextImpl.cpp
+++ b/ClearScriptV8/V8ContextImpl.cpp
@@ -815,6 +815,53 @@ V8Value V8ContextImpl::Execute(const V8DocumentInfo& documentInfo, const StdStri
//-----------------------------------------------------------------------------
+V8Value V8ContextImpl::ExecuteScriptFromUtf8(const V8DocumentInfo& documentInfo, const char* code, int codeLength, size_t codeDigest, bool evaluate)
+{
+ if (documentInfo.IsModule())
+ {
+ throw V8Exception(V8Exception::Type::General, m_Name, StdString(SL("ExecuteScriptFromUtf8 cannot execute modules")), false);
+ }
+
+ BEGIN_CONTEXT_SCOPE
+ BEGIN_DOCUMENT_SCOPE(documentInfo)
+ BEGIN_EXECUTION_SCOPE
+ FROM_MAYBE_TRY
+
+ auto hScript = GetCachedScript(documentInfo.GetUniqueId(), codeDigest);
+ if (hScript.IsEmpty())
+ {
+ v8::ScriptCompiler::Source source(FROM_MAYBE(CreateStringFromUtf8(code, codeLength)), CreateScriptOrigin(documentInfo));
+
+ hScript = VERIFY_MAYBE(CompileUnboundScript(&source));
+ if (hScript.IsEmpty())
+ {
+ throw V8Exception(V8Exception::Type::General, m_Name, StdString(SL("Script compilation failed; no additional information was provided by the V8 runtime")), false);
+ }
+
+ CacheScript(documentInfo, codeDigest, hScript);
+ }
+
+ v8::Local hResult = VERIFY_MAYBE(hScript->BindToCurrentContext()->Run(m_hContext));
+
+ if (!evaluate)
+ {
+ hResult = GetUndefined();
+ }
+
+ return ExportValue(hResult);
+
+ FROM_MAYBE_CATCH
+
+ throw V8Exception(V8Exception::Type::General, m_Name, StdString(SL("The V8 runtime cannot perform the requested operation because a script exception is pending")), EXECUTION_STARTED);
+
+ FROM_MAYBE_END
+ END_EXECUTION_SCOPE
+ END_DOCUMENT_SCOPE
+ END_CONTEXT_SCOPE
+}
+
+//-----------------------------------------------------------------------------
+
V8ScriptHolder* V8ContextImpl::Compile(const V8DocumentInfo& documentInfo, StdString&& code)
{
BEGIN_CONTEXT_SCOPE
@@ -873,6 +920,48 @@ V8ScriptHolder* V8ContextImpl::Compile(const V8DocumentInfo& documentInfo, StdSt
//-----------------------------------------------------------------------------
+V8ScriptHolder* V8ContextImpl::CompileScriptFromUtf8(const V8DocumentInfo& documentInfo, const char* code, int codeLength, size_t codeDigest)
+{
+ if (documentInfo.IsModule())
+ {
+ throw V8Exception(V8Exception::Type::General, m_Name, StdString(SL("CompileScriptFromUtf8 cannot compile modules")), false);
+ }
+
+ BEGIN_CONTEXT_SCOPE
+ BEGIN_DOCUMENT_SCOPE(documentInfo)
+ BEGIN_EXECUTION_SCOPE
+ FROM_MAYBE_TRY
+
+ auto hScript = GetCachedScript(documentInfo.GetUniqueId(), codeDigest);
+ if (hScript.IsEmpty())
+ {
+ v8::ScriptCompiler::Source source(FROM_MAYBE(CreateStringFromUtf8(code, codeLength)), CreateScriptOrigin(documentInfo));
+
+ hScript = VERIFY_MAYBE(CompileUnboundScript(&source));
+ if (hScript.IsEmpty())
+ {
+ throw V8Exception(V8Exception::Type::General, m_Name, StdString(SL("Script compilation failed; no additional information was provided by the V8 runtime")), false);
+ }
+
+ CacheScript(documentInfo, codeDigest, hScript);
+ }
+
+ std::unique_ptr upScriptHolder;
+ upScriptHolder.reset(new V8ScriptHolderImpl(GetWeakBinding(), ::PtrFromHandle(CreatePersistent(hScript)), documentInfo, codeDigest));
+ return upScriptHolder.release();
+
+ FROM_MAYBE_CATCH
+
+ throw V8Exception(V8Exception::Type::General, m_Name, StdString(SL("The V8 runtime cannot perform the requested operation because a script exception is pending")), EXECUTION_STARTED);
+
+ FROM_MAYBE_END
+ END_EXECUTION_SCOPE
+ END_DOCUMENT_SCOPE
+ END_CONTEXT_SCOPE
+}
+
+//-----------------------------------------------------------------------------
+
V8ScriptHolder* V8ContextImpl::Compile(const V8DocumentInfo& documentInfo, StdString&& code, V8CacheKind cacheKind, std::vector& cacheBytes)
{
if (cacheKind == V8CacheKind::None)
diff --git a/ClearScriptV8/V8ContextImpl.h b/ClearScriptV8/V8ContextImpl.h
index fa4efb35..3c23af4a 100644
--- a/ClearScriptV8/V8ContextImpl.h
+++ b/ClearScriptV8/V8ContextImpl.h
@@ -44,8 +44,10 @@ class V8ContextImpl final: public V8Context
virtual void CancelAwaitDebugger() override;
virtual V8Value Execute(const V8DocumentInfo& documentInfo, const StdString& code, bool evaluate) override;
+ virtual V8Value ExecuteScriptFromUtf8(const V8DocumentInfo& documentInfo, const char* code, int codeLength, size_t codeDigest, bool evaluate) override;
virtual V8ScriptHolder* Compile(const V8DocumentInfo& documentInfo, StdString&& code) override;
+ virtual V8ScriptHolder* CompileScriptFromUtf8(const V8DocumentInfo& documentInfo, const char* code, int codeLength, size_t codeDigest) override;
virtual V8ScriptHolder* Compile(const V8DocumentInfo& documentInfo, StdString&& code, V8CacheKind cacheKind, std::vector& cacheBytes) override;
virtual V8ScriptHolder* Compile(const V8DocumentInfo& documentInfo, StdString&& code, V8CacheKind cacheKind, const std::vector& cacheBytes, bool& cacheAccepted) override;
virtual V8ScriptHolder* Compile(const V8DocumentInfo& documentInfo, StdString&& code, V8CacheKind cacheKind, std::vector& cacheBytes, V8CacheResult& cacheResult) override;
@@ -218,6 +220,11 @@ class V8ContextImpl final: public V8Context
return m_spIsolateImpl->CreateString(value, type);
}
+ v8::MaybeLocal CreateStringFromUtf8(const char* data, int length, v8::NewStringType type = v8::NewStringType::kNormal)
+ {
+ return m_spIsolateImpl->CreateStringFromUtf8(data, length, type);
+ }
+
template
v8::Local CreateString(const char (&value)[N], v8::NewStringType type = v8::NewStringType::kNormal)
{
diff --git a/ClearScriptV8/V8IsolateImpl.h b/ClearScriptV8/V8IsolateImpl.h
index b693717b..9560a3a4 100644
--- a/ClearScriptV8/V8IsolateImpl.h
+++ b/ClearScriptV8/V8IsolateImpl.h
@@ -232,6 +232,11 @@ class V8IsolateImpl final: public V8Isolate, public v8_inspector::V8InspectorCli
return value.ToV8String(m_upIsolate.get(), type);
}
+ v8::MaybeLocal CreateStringFromUtf8(const char* data, int length, v8::NewStringType type = v8::NewStringType::kNormal)
+ {
+ return v8::String::NewFromUtf8(m_upIsolate.get(), data, type, length);
+ }
+
template
v8::Local CreateString(const char (&value)[N], v8::NewStringType type = v8::NewStringType::kNormal)
{
diff --git a/ClearScriptV8/V8SplitProxyNative.cpp b/ClearScriptV8/V8SplitProxyNative.cpp
index 5d48014d..a85f473f 100644
--- a/ClearScriptV8/V8SplitProxyNative.cpp
+++ b/ClearScriptV8/V8SplitProxyNative.cpp
@@ -1343,6 +1343,26 @@ NATIVE_ENTRY_POINT(void) V8Context_ExecuteCode(const V8ContextHandle& handle, St
//-----------------------------------------------------------------------------
+NATIVE_ENTRY_POINT(void) V8Context_ExecuteScriptFromUtf8(const V8ContextHandle& handle, StdString&& resourceName, StdString&& sourceMapUrl, uint64_t uniqueId, DocumentKind documentKind, void* pvDocumentInfo, const char* code, int codeLength, size_t codeDigest, StdBool evaluate, V8Value& result) noexcept
+{
+ V8DocumentInfo documentInfo(std::move(resourceName), std::move(sourceMapUrl), uniqueId, documentKind, pvDocumentInfo);
+
+ auto spContext = handle.GetEntity();
+ if (!spContext.IsEmpty())
+ {
+ try
+ {
+ result = spContext->ExecuteScriptFromUtf8(documentInfo, code, codeLength, codeDigest, evaluate);
+ }
+ catch (const V8Exception& exception)
+ {
+ exception.ScheduleScriptEngineException();
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+
NATIVE_ENTRY_POINT(V8ScriptHandle*) V8Context_Compile(const V8ContextHandle& handle, StdString&& resourceName, StdString&& sourceMapUrl, uint64_t uniqueId, DocumentKind documentKind, void* pvDocumentInfo, StdString&& code) noexcept
{
V8DocumentInfo documentInfo(std::move(resourceName), std::move(sourceMapUrl), uniqueId, documentKind, pvDocumentInfo);
@@ -1365,6 +1385,28 @@ NATIVE_ENTRY_POINT(V8ScriptHandle*) V8Context_Compile(const V8ContextHandle& han
//-----------------------------------------------------------------------------
+NATIVE_ENTRY_POINT(V8ScriptHandle*) V8Context_CompileScriptFromUtf8(const V8ContextHandle& handle, StdString&& resourceName, StdString&& sourceMapUrl, uint64_t uniqueId, DocumentKind documentKind, void* pvDocumentInfo, const char* code, int codeLength, size_t codeDigest) noexcept
+{
+ V8DocumentInfo documentInfo(std::move(resourceName), std::move(sourceMapUrl), uniqueId, documentKind, pvDocumentInfo);
+
+ auto spContext = handle.GetEntity();
+ if (!spContext.IsEmpty())
+ {
+ try
+ {
+ return new V8ScriptHandle(spContext->CompileScriptFromUtf8(documentInfo, code, codeLength, codeDigest));
+ }
+ catch (const V8Exception& exception)
+ {
+ exception.ScheduleScriptEngineException();
+ }
+ }
+
+ return nullptr;
+}
+
+//-----------------------------------------------------------------------------
+
NATIVE_ENTRY_POINT(V8ScriptHandle*) V8Context_CompileProducingCache(const V8ContextHandle& handle, StdString&& resourceName, StdString&& sourceMapUrl, uint64_t uniqueId, DocumentKind documentKind, void* pvDocumentInfo, StdString&& code, V8CacheKind cacheKind, std::vector& cacheBytes) noexcept
{
cacheBytes.clear();
diff --git a/ClearScriptV8/V8SplitProxyNative.h b/ClearScriptV8/V8SplitProxyNative.h
index ec7cdb9b..641ef2e9 100644
--- a/ClearScriptV8/V8SplitProxyNative.h
+++ b/ClearScriptV8/V8SplitProxyNative.h
@@ -284,7 +284,9 @@ NATIVE_ENTRY_POINT(void) V8Context_AddGlobalItem(const V8ContextHandle& handle,
NATIVE_ENTRY_POINT(void) V8Context_AwaitDebuggerAndPause(const V8ContextHandle& handle) noexcept;
NATIVE_ENTRY_POINT(void) V8Context_CancelAwaitDebugger(const V8ContextHandle& handle) noexcept;
NATIVE_ENTRY_POINT(void) V8Context_ExecuteCode(const V8ContextHandle& handle, StdString&& resourceName, StdString&& sourceMapUrl, uint64_t uniqueId, DocumentKind documentKind, void* pvDocumentInfo, const StdString& code, StdBool evaluate, V8Value& result) noexcept;
+NATIVE_ENTRY_POINT(void) V8Context_ExecuteScriptFromUtf8(const V8ContextHandle& handle, StdString&& resourceName, StdString&& sourceMapUrl, uint64_t uniqueId, DocumentKind documentKind, void* pvDocumentInfo, const char* code, int codeLength, size_t codeDigest, StdBool evaluate, V8Value& result) noexcept;
NATIVE_ENTRY_POINT(V8ScriptHandle*) V8Context_Compile(const V8ContextHandle& handle, StdString&& resourceName, StdString&& sourceMapUrl, uint64_t uniqueId, DocumentKind documentKind, void* pvDocumentInfo, StdString&& code) noexcept;
+NATIVE_ENTRY_POINT(V8ScriptHandle*) V8Context_CompileScriptFromUtf8(const V8ContextHandle& handle, StdString&& resourceName, StdString&& sourceMapUrl, uint64_t uniqueId, DocumentKind documentKind, void* pvDocumentInfo, const char* code, int codeLength, size_t codeDigest) noexcept;
NATIVE_ENTRY_POINT(V8ScriptHandle*) V8Context_CompileProducingCache(const V8ContextHandle& handle, StdString&& resourceName, StdString&& sourceMapUrl, uint64_t uniqueId, DocumentKind documentKind, void* pvDocumentInfo, StdString&& code, V8CacheKind cacheKind, std::vector& cacheBytes) noexcept;
NATIVE_ENTRY_POINT(V8ScriptHandle*) V8Context_CompileConsumingCache(const V8ContextHandle& handle, StdString&& resourceName, StdString&& sourceMapUrl, uint64_t uniqueId, DocumentKind documentKind, void* pvDocumentInfo, StdString&& code, V8CacheKind cacheKind, const std::vector& cacheBytes, StdBool& cacheAccepted) noexcept;
NATIVE_ENTRY_POINT(V8ScriptHandle*) V8Context_CompileUpdatingCache(const V8ContextHandle& handle, StdString&& resourceName, StdString&& sourceMapUrl, uint64_t uniqueId, DocumentKind documentKind, void* pvDocumentInfo, StdString&& code, V8CacheKind cacheKind, std::vector& cacheBytes, V8CacheResult& cacheResult) noexcept;