/// A separate V8 runtime is created for the new script engine instance.
/// </remarks>
publicV8ScriptEngine()
:this(null,null)
{
}
/// <summary>
/// Initializes a new V8 script engine instance with the specified name.
/// </summary>
/// <param name="name">A name to associate with the instance. Currently this name is used only as a label in presentation contexts such as debugger user interfaces.</param>
/// <remarks>
/// A separate V8 runtime is created for the new script engine instance.
/// </remarks>
publicV8ScriptEngine(stringname)
:this(name,null)
{
}
/// <summary>
/// Initializes a new V8 script engine instance with the specified resource constraints.
/// </summary>
/// <param name="constraints">Resource constraints for the V8 runtime (see remarks).</param>
/// <remarks>
/// A separate V8 runtime is created for the new script engine instance.
/// Initializes a new V8 script engine instance with the specified name and resource constraints.
/// </summary>
/// <param name="name">A name to associate with the instance. Currently this name is used only as a label in presentation contexts such as debugger user interfaces.</param>
/// <param name="constraints">Resource constraints for the V8 runtime (see remarks).</param>
/// <remarks>
/// A separate V8 runtime is created for the new script engine instance.
/// Initializes a new V8 script engine instance with the specified name and options.
/// </summary>
/// <param name="name">A name to associate with the instance. Currently this name is used only as a label in presentation contexts such as debugger user interfaces.</param>
/// <param name="flags">A value that selects options for the operation.</param>
/// <remarks>
/// A separate V8 runtime is created for the new script engine instance.
/// Initializes a new V8 script engine instance with the specified name, options, and debug port.
/// </summary>
/// <param name="name">A name to associate with the instance. Currently this name is used only as a label in presentation contexts such as debugger user interfaces.</param>
/// <param name="flags">A value that selects options for the operation.</param>
/// <param name="debugPort">A TCP port on which to listen for a debugger connection.</param>
/// <remarks>
/// A separate V8 runtime is created for the new script engine instance.
/// Initializes a new V8 script engine instance with the specified name, resource constraints, and options.
/// </summary>
/// <param name="name">A name to associate with the instance. Currently this name is used only as a label in presentation contexts such as debugger user interfaces.</param>
/// <param name="constraints">Resource constraints for the V8 runtime (see remarks).</param>
/// <param name="flags">A value that selects options for the operation.</param>
/// <remarks>
/// A separate V8 runtime is created for the new script engine instance.
/// Initializes a new V8 script engine instance with the specified name, resource constraints, options, and debug port.
/// </summary>
/// <param name="name">A name to associate with the instance. Currently this name is used only as a label in presentation contexts such as debugger user interfaces.</param>
/// <param name="constraints">Resource constraints for the V8 runtime (see remarks).</param>
/// <param name="flags">A value that selects options for the operation.</param>
/// <param name="debugPort">A TCP port on which to listen for a debugger connection.</param>
/// <remarks>
/// A separate V8 runtime is created for the new script engine instance.
/// Gets or sets a soft limit for the size of the V8 runtime's heap.
/// </summary>
/// <remarks>
/// <para>
/// This property is specified in bytes. When it is set to the default value, heap size
/// monitoring is disabled, and scripts with memory leaks or excessive memory usage
/// can cause unrecoverable errors and process termination.
/// </para>
/// <para>
/// A V8 runtime unconditionally terminates the process when it exceeds its resource
/// constraints (see <see cref="V8RuntimeConstraints"/>). This property enables external
/// heap size monitoring that can prevent termination in some scenarios. To be effective,
/// it should be set to a value that is significantly lower than
/// <see cref="V8RuntimeConstraints.MaxOldSpaceSize"/>. Note that enabling heap size
/// monitoring results in slower script execution.
/// </para>
/// <para>
/// Exceeding this limit causes the V8 runtime to interrupt script execution and throw an
/// exception. To re-enable script execution, set this property to a new value.
/// </para>
/// </remarks>
publicUIntPtrMaxRuntimeHeapSize
{
get
{
VerifyNotDisposed();
returnproxy.MaxRuntimeHeapSize;
}
set
{
VerifyNotDisposed();
proxy.MaxRuntimeHeapSize=value;
}
}
/// <summary>
/// Gets or sets the minimum time interval between consecutive heap size samples.
/// </summary>
/// <remarks>
/// This property is effective only when heap size monitoring is enabled (see
/// <see cref="MaxRuntimeHeapSize"/>).
/// </remarks>
publicTimeSpanRuntimeHeapSizeSampleInterval
{
get
{
VerifyNotDisposed();
returnproxy.RuntimeHeapSizeSampleInterval;
}
set
{
VerifyNotDisposed();
proxy.RuntimeHeapSizeSampleInterval=value;
}
}
/// <summary>
/// Gets or sets the maximum amount by which the V8 runtime is permitted to grow the stack during script execution.
/// </summary>
/// <remarks>
/// <para>
/// This property is specified in bytes. When it is set to the default value, no stack
/// usage limit is enforced, and scripts with unchecked recursion or other excessive stack
/// usage can cause unrecoverable errors and process termination.
/// </para>
/// <para>
/// Note that the V8 runtime does not monitor stack usage while a host call is in progress.
/// Monitoring is resumed when control returns to the runtime.
/// </para>
/// </remarks>
publicUIntPtrMaxRuntimeStackUsage
{
get
{
VerifyNotDisposed();
returnproxy.MaxRuntimeStackUsage;
}
set
{
VerifyNotDisposed();
proxy.MaxRuntimeStackUsage=value;
}
}
/// <summary>
/// Enables or disables instance method enumeration.
/// </summary>
/// <remarks>
/// By default, a host object's instance methods are exposed as enumerable properties.
/// Setting this property to <c>true</c> causes instance methods to be excluded from
/// property enumeration. This affects all host objects exposed in the current script
/// engine. Note that instance methods remain both retrievable and invocable regardless of
/// this property's value.
/// </remarks>
publicboolSuppressInstanceMethodEnumeration
{
get=>suppressInstanceMethodEnumeration;
set
{
suppressInstanceMethodEnumeration=value;
OnEnumerationSettingsChanged();
}
}
/// <summary>
/// Enables or disables extension method enumeration.
/// </summary>
/// <remarks>
/// <para>
/// By default, all exposed extension methods appear as enumerable properties of all host
/// objects, regardless of type. Setting this property to <c>true</c> causes extension
/// methods to be excluded from property enumeration. This affects all host objects exposed
/// in the current script engine. Note that extension methods remain both retrievable and
/// invocable regardless of this property's value.
/// </para>
/// <para>
/// This property has no effect if <see cref="SuppressInstanceMethodEnumeration"/> is set
/// to <c>true</c>.
/// </para>
/// </remarks>
publicboolSuppressExtensionMethodEnumeration
{
get=>suppressExtensionMethodEnumeration;
set
{
suppressExtensionMethodEnumeration=value;
RebuildExtensionMethodSummary();
}
}
/// <summary>
/// Creates a compiled script.
/// </summary>
/// <param name="code">The script code to compile.</param>
/// <returns>A compiled script that can be executed multiple times without recompilation.</returns>
publicV8ScriptCompile(stringcode)
{
returnCompile(null,code);
}
/// <summary>
/// Creates a compiled script with an associated document name.
/// </summary>
/// <param name="documentName">A document name for the compiled script. Currently this name is used only as a label in presentation contexts such as debugger user interfaces.</param>
/// <param name="code">The script code to compile.</param>
/// <returns>A compiled script that can be executed multiple times without recompilation.</returns>
/// Creates a compiled script with an associated document name, generating cache data for accelerated recompilation.
/// </summary>
/// <param name="documentName">A document name for the compiled script. Currently this name is used only as a label in presentation contexts such as debugger user interfaces.</param>
/// <param name="code">The script code to compile.</param>
/// <param name="cacheKind">The kind of cache data to be generated.</param>
/// <param name="cacheBytes">Cache data for accelerated recompilation.</param>
/// <returns>A compiled script that can be executed multiple times without recompilation.</returns>
/// <remarks>
/// The generated cache data can be stored externally and is usable in other V8 script
/// engines and application processes.
/// </remarks>
/// <seealso cref="Compile(string, string, V8CacheKind, byte[], out bool)"/>
/// Creates a compiled script with an associated document name, consuming previously generated cache data.
/// </summary>
/// <param name="documentName">A document name for the compiled script. Currently this name is used only as a label in presentation contexts such as debugger user interfaces.</param>
/// <param name="code">The script code to compile.</param>
/// <param name="cacheKind">The kind of cache data to be consumed.</param>
/// <param name="cacheBytes">Cache data for accelerated compilation.</param>
/// <param name="cacheAccepted"><c>True</c> if <paramref name="cacheBytes"/> was accepted, <c>false</c> otherwise.</param>
/// <returns>A compiled script that can be executed multiple times without recompilation.</returns>
/// <remarks>
/// To be accepted, the cache data must have been generated for identical script code by
/// the same V8 build.
/// </remarks>
/// <seealso cref="Compile(string, string, V8CacheKind, out byte[])"/>