Skip to content

Commit 91dfb30

Browse files
Version 7.2.1: (V8) Added support for interrupt propagation and cancellation to address GitHub Issue microsoft#324; (V8) eliminated host proxies implemented as immutable prototype exotics (GitHub Issue microsoft#330); added ScriptEngine.Global to facilitate fast non-dynamic access to script resources; added project blog on GitHub Pages; updated build and API documentation. Tested with V8 9.7.106.18.
1 parent d5f5baa commit 91dfb30

File tree

672 files changed

+4098
-1039
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

672 files changed

+4098
-1039
lines changed

ClearScript/Exports/VersionSymbols.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#pragma once
77

8-
#define CLEARSCRIPT_VERSION_STRING "7.2.0"
9-
#define CLEARSCRIPT_VERSION_COMMA_SEPARATED 7,2,0
10-
#define CLEARSCRIPT_VERSION_STRING_INFORMATIONAL "7.2.0"
8+
#define CLEARSCRIPT_VERSION_STRING "7.2.1"
9+
#define CLEARSCRIPT_VERSION_COMMA_SEPARATED 7,2,1
10+
#define CLEARSCRIPT_VERSION_STRING_INFORMATIONAL "7.2.1"
1111
#define CLEARSCRIPT_FILE_FLAGS 0L

ClearScript/Properties/AssemblyInfo.Core.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
[assembly: InternalsVisibleTo("ClearScriptTest")]
1919

2020
[assembly: ComVisible(false)]
21-
[assembly: AssemblyVersion("7.2.0")]
22-
[assembly: AssemblyFileVersion("7.2.0")]
23-
[assembly: AssemblyInformationalVersion("7.2.0")]
21+
[assembly: AssemblyVersion("7.2.1")]
22+
[assembly: AssemblyFileVersion("7.2.1")]
23+
[assembly: AssemblyInformationalVersion("7.2.1")]
2424

2525
namespace Microsoft.ClearScript.Properties
2626
{
2727
internal static class ClearScriptVersion
2828
{
29-
public const string Triad = "7.2.0";
30-
public const string Informational = "7.2.0";
29+
public const string Triad = "7.2.1";
30+
public const string Informational = "7.2.1";
3131
}
3232
}

ClearScript/Properties/AssemblyInfo.V8.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
[assembly: InternalsVisibleTo("ClearScriptTest")]
1616

1717
[assembly: ComVisible(false)]
18-
[assembly: AssemblyVersion("7.2.0")]
19-
[assembly: AssemblyFileVersion("7.2.0")]
20-
[assembly: AssemblyInformationalVersion("7.2.0")]
18+
[assembly: AssemblyVersion("7.2.1")]
19+
[assembly: AssemblyFileVersion("7.2.1")]
20+
[assembly: AssemblyInformationalVersion("7.2.1")]

ClearScript/Properties/AssemblyInfo.Windows.Core.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
[assembly: InternalsVisibleTo("ClearScriptTest")]
1717

1818
[assembly: ComVisible(false)]
19-
[assembly: AssemblyVersion("7.2.0")]
20-
[assembly: AssemblyFileVersion("7.2.0")]
21-
[assembly: AssemblyInformationalVersion("7.2.0")]
19+
[assembly: AssemblyVersion("7.2.1")]
20+
[assembly: AssemblyFileVersion("7.2.1")]
21+
[assembly: AssemblyInformationalVersion("7.2.1")]

ClearScript/Properties/AssemblyInfo.Windows.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
[assembly: InternalsVisibleTo("ClearScriptTest")]
1616

1717
[assembly: ComVisible(false)]
18-
[assembly: AssemblyVersion("7.2.0")]
19-
[assembly: AssemblyFileVersion("7.2.0")]
20-
[assembly: AssemblyInformationalVersion("7.2.0")]
18+
[assembly: AssemblyVersion("7.2.1")]
19+
[assembly: AssemblyFileVersion("7.2.1")]
20+
[assembly: AssemblyInformationalVersion("7.2.1")]

ClearScript/ScriptEngine.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ public bool DisableExtensionMethods
307307
public ContinuationCallback ContinuationCallback { get; set; }
308308

309309
/// <summary>
310-
/// Allows the host to access script resources directly.
310+
/// Allows the host to access script resources dynamically.
311311
/// </summary>
312312
/// <remarks>
313313
/// The value of this property is an object that is bound to the script engine's root
@@ -316,6 +316,17 @@ public bool DisableExtensionMethods
316316
/// </remarks>
317317
public abstract dynamic Script { get; }
318318

319+
/// <summary>
320+
/// Allows the host to access script resources.
321+
/// </summary>
322+
/// <remarks>
323+
/// The value of this property is an object that is bound to the script engine's root
324+
/// namespace. It allows you to access global script resources via the
325+
/// <see cref="ScriptObject"/> class interface. Doing so is likely to perform better than
326+
/// dynamic access via <see cref="Script"/>.
327+
/// </remarks>
328+
public abstract ScriptObject Global { get; }
329+
319330
/// <summary>
320331
/// Gets or sets the script engine's document settings.
321332
/// </summary>

ClearScript/Util/Web/WebSocket.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ private async Task<Frame> ReceiveFrameAsync()
204204
Debug.Assert(length < long.MaxValue);
205205
var payload = new byte[length];
206206

207+
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
207208
if (length <= int.MaxValue)
208209
{
209210
await socket.ReceiveBytesAsync(payload, 0, Convert.ToInt32(length)).ConfigureAwait(false);

ClearScript/V8/SplitProxy/IV8SplitProxyNative.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ internal interface IV8SplitProxyNative
140140
V8Script.Handle V8Isolate_Compile(V8Isolate.Handle hIsolate, string resourceName, string sourceMapUrl, ulong uniqueId, bool isModule, IntPtr pDocumentInfo, string code);
141141
V8Script.Handle V8Isolate_CompileProducingCache(V8Isolate.Handle hIsolate, string resourceName, string sourceMapUrl, ulong uniqueId, bool isModule, IntPtr pDocumentInfo, string code, V8CacheKind cacheKind, out byte[] cacheBytes);
142142
V8Script.Handle V8Isolate_CompileConsumingCache(V8Isolate.Handle hIsolate, string resourceName, string sourceMapUrl, ulong uniqueId, bool isModule, IntPtr pDocumentInfo, string code, V8CacheKind cacheKind, byte[] cacheBytes, out bool cacheAccepted);
143+
bool V8Isolate_GetEnableInterruptPropagation(V8Isolate.Handle hIsolate);
144+
void V8Isolate_SetEnableInterruptPropagation(V8Isolate.Handle hIsolate, bool value);
143145
void V8Isolate_GetHeapStatistics(V8Isolate.Handle hIsolate, out ulong totalHeapSize, out ulong totalHeapSizeExecutable, out ulong totalPhysicalSize, out ulong usedHeapSize, out ulong heapSizeLimit);
144146
void V8Isolate_GetStatistics(V8Isolate.Handle hIsolate, out ulong scriptCount, out ulong scriptCacheSize, out ulong moduleCount, out ulong[] postedTaskCounts, out ulong[] invokedTaskCounts);
145147
void V8Isolate_CollectGarbage(V8Isolate.Handle hIsolate, bool exhaustive);
@@ -171,6 +173,9 @@ internal interface IV8SplitProxyNative
171173
V8Script.Handle V8Context_CompileConsumingCache(V8Context.Handle hContext, string resourceName, string sourceMapUrl, ulong uniqueId, bool isModule, IntPtr pDocumentInfo, string code, V8CacheKind cacheKind, byte[] cacheBytes, out bool cacheAccepted);
172174
object V8Context_ExecuteScript(V8Context.Handle hContext, V8Script.Handle hScript, bool evaluate);
173175
void V8Context_Interrupt(V8Context.Handle hContext);
176+
void V8Context_CancelInterrupt(V8Context.Handle hContext);
177+
bool V8Context_GetEnableIsolateInterruptPropagation(V8Context.Handle hContext);
178+
void V8Context_SetEnableIsolateInterruptPropagation(V8Context.Handle hContext, bool value);
174179
void V8Context_GetIsolateHeapStatistics(V8Context.Handle hContext, out ulong totalHeapSize, out ulong totalHeapSizeExecutable, out ulong totalPhysicalSize, out ulong usedHeapSize, out ulong heapSizeLimit);
175180
void V8Context_GetIsolateStatistics(V8Context.Handle hContext, out ulong scriptCount, out ulong scriptCacheSize, out ulong moduleCount, out ulong[] postedTaskCounts, out ulong[] invokedTaskCounts);
176181
void V8Context_GetStatistics(V8Context.Handle hContext, out ulong scriptCount, out ulong moduleCount, out ulong moduleCacheSize);

ClearScript/V8/SplitProxy/V8ContextProxyImpl.cs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ public V8ContextProxyImpl(V8IsolateProxy isolateProxy, string name, V8ScriptEngi
2222

2323
#region V8ContextProxy overrides
2424

25-
public override UIntPtr MaxRuntimeHeapSize
25+
public override UIntPtr MaxIsolateHeapSize
2626
{
2727
get => V8SplitProxyNative.Invoke(instance => instance.V8Context_GetMaxIsolateHeapSize(Handle));
2828
set => V8SplitProxyNative.Invoke(instance => instance.V8Context_SetMaxIsolateHeapSize(Handle, value));
2929
}
3030

31-
public override TimeSpan RuntimeHeapSizeSampleInterval
31+
public override TimeSpan IsolateHeapSizeSampleInterval
3232
{
3333
get => V8SplitProxyNative.Invoke(instance => TimeSpan.FromMilliseconds(instance.V8Context_GetIsolateHeapSizeSampleInterval(Handle)));
3434
set => V8SplitProxyNative.Invoke(instance => instance.V8Context_SetIsolateHeapSizeSampleInterval(Handle, value.TotalMilliseconds));
3535
}
3636

37-
public override UIntPtr MaxRuntimeStackUsage
37+
public override UIntPtr MaxIsolateStackUsage
3838
{
3939
get => V8SplitProxyNative.Invoke(instance => instance.V8Context_GetMaxIsolateStackUsage(Handle));
4040
set => V8SplitProxyNative.Invoke(instance => instance.V8Context_SetMaxIsolateStackUsage(Handle, value));
@@ -172,7 +172,18 @@ public override void Interrupt()
172172
V8SplitProxyNative.Invoke(instance => instance.V8Context_Interrupt(Handle));
173173
}
174174

175-
public override V8RuntimeHeapInfo GetRuntimeHeapInfo()
175+
public override void CancelInterrupt()
176+
{
177+
V8SplitProxyNative.Invoke(instance => instance.V8Context_CancelInterrupt(Handle));
178+
}
179+
180+
public override bool EnableIsolateInterruptPropagation
181+
{
182+
get => V8SplitProxyNative.Invoke(instance => instance.V8Context_GetEnableIsolateInterruptPropagation(Handle));
183+
set => V8SplitProxyNative.Invoke(instance => instance.V8Context_SetEnableIsolateInterruptPropagation(Handle, value));
184+
}
185+
186+
public override V8RuntimeHeapInfo GetIsolateHeapInfo()
176187
{
177188
var totalHeapSize = 0UL;
178189
var totalHeapSizeExecutable = 0UL;
@@ -191,7 +202,7 @@ public override V8RuntimeHeapInfo GetRuntimeHeapInfo()
191202
};
192203
}
193204

194-
public override V8Runtime.Statistics GetRuntimeStatistics()
205+
public override V8Runtime.Statistics GetIsolateStatistics()
195206
{
196207
var statistics = new V8Runtime.Statistics();
197208
V8SplitProxyNative.Invoke(instance => instance.V8Context_GetIsolateStatistics(Handle, out statistics.ScriptCount, out statistics.ScriptCacheSize, out statistics.ModuleCount, out statistics.PostedTaskCounts, out statistics.InvokedTaskCounts));
@@ -245,7 +256,7 @@ public override uint CpuProfileSampleInterval
245256
set => V8SplitProxyNative.Invoke(instance => instance.V8Context_SetCpuProfileSampleInterval(Handle, value));
246257
}
247258

248-
public override void WriteRuntimeHeapSnapshot(Stream stream)
259+
public override void WriteIsolateHeapSnapshot(Stream stream)
249260
{
250261
using (var streamScope = V8ProxyHelpers.CreateAddRefHostObjectScope(stream))
251262
{

ClearScript/V8/SplitProxy/V8IsolateProxyImpl.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ out tempCacheAccepted
144144
}
145145
}
146146

147+
public override bool EnableInterruptPropagation
148+
{
149+
get => V8SplitProxyNative.Invoke(instance => instance.V8Isolate_GetEnableInterruptPropagation(Handle));
150+
set => V8SplitProxyNative.Invoke(instance => instance.V8Isolate_SetEnableInterruptPropagation(Handle, value));
151+
}
152+
147153
public override V8RuntimeHeapInfo GetHeapInfo()
148154
{
149155
var totalHeapSize = 0UL;

0 commit comments

Comments
 (0)