quickjs-2024-01-13.tar.xz

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4765 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2024-01-13 13:04:19 +00:00
parent 10d438e723
commit 2b7077ca70
35 changed files with 3799 additions and 1453 deletions

View File

@ -72,7 +72,7 @@ ul.no-bullet {list-style: none}
<ul class="no-bullet">
<li><a name="toc-Language-support" href="#Language-support">3.1 Language support</a>
<ul class="no-bullet">
<li><a name="toc-ES2020-support" href="#ES2020-support">3.1.1 ES2020 support</a></li>
<li><a name="toc-ES2023-support" href="#ES2023-support">3.1.1 ES2023 support</a></li>
<li><a name="toc-ECMA402" href="#ECMA402">3.1.2 ECMA402</a></li>
<li><a name="toc-Extensions" href="#Extensions">3.1.3 Extensions</a></li>
<li><a name="toc-Mathematical-extensions" href="#Mathematical-extensions">3.1.4 Mathematical extensions</a></li>
@ -128,8 +128,8 @@ ul.no-bullet {list-style: none}
<a name="Introduction"></a>
<h2 class="chapter">1 Introduction</h2>
<p>QuickJS is a small and embeddable Javascript engine. It supports the
ES2020 specification
<p>QuickJS is a small and embeddable Javascript engine. It supports most of the
ES2023 specification
<a name="DOCF1" href="#FOOT1"><sup>1</sup></a>
including modules, asynchronous generators, proxies and BigInt.
</p>
@ -143,14 +143,14 @@ and operator overloading.
<ul>
<li> Small and easily embeddable: just a few C files, no external dependency, 210 KiB of x86 code for a simple &ldquo;hello world&rdquo; program.
</li><li> Fast interpreter with very low startup time: runs the 69000 tests of the ECMAScript Test Suite<a name="DOCF2" href="#FOOT2"><sup>2</sup></a> in about 95 seconds on a single core of a desktop PC. The complete life cycle of a runtime instance completes in less than 300 microseconds.
</li><li> Fast interpreter with very low startup time: runs the 77000 tests of the ECMAScript Test Suite<a name="DOCF2" href="#FOOT2"><sup>2</sup></a> in less than 2 minutes on a single core of a desktop PC. The complete life cycle of a runtime instance completes in less than 300 microseconds.
</li><li> Almost complete ES2020 support including modules, asynchronous
generators and full Annex B support (legacy web compatibility). Many
features from the upcoming ES2021 specification
</li><li> Almost complete ES2023 support including modules, asynchronous
generators and full Annex B support (legacy web compatibility). Some
features from the upcoming ES2024 specification
<a name="DOCF3" href="#FOOT3"><sup>3</sup></a> are also supported.
</li><li> Passes nearly 100% of the ECMAScript Test Suite tests when selecting the ES2020 features.
</li><li> Passes nearly 100% of the ECMAScript Test Suite tests when selecting the ES2023 features.
</li><li> Compile Javascript sources to executables with no external dependency.
@ -180,6 +180,11 @@ options then run <code>make</code>.
<p>You can type <code>make install</code> as root if you wish to install the binaries and support files to
<code>/usr/local</code> (this is not necessary to use QuickJS).
</p>
<p>Note: On some OSes atomic operations are not available or need a
specific library. If you get related errors, you should either add
<code>-latomics</code> in the Makefile <code>LIBS</code> variable or disable
<code>CONFIG_ATOMICS</code> in <samp>quickjs.c</samp>.
</p>
<a name="Quick-start"></a>
<h3 class="section">2.2 Quick start</h3>
@ -400,10 +405,10 @@ about 100 seconds).
<a name="Language-support"></a>
<h3 class="section">3.1 Language support</h3>
<a name="ES2020-support"></a>
<h4 class="subsection">3.1.1 ES2020 support</h4>
<a name="ES2023-support"></a>
<h4 class="subsection">3.1.1 ES2023 support</h4>
<p>The ES2020 specification is almost fully supported including the Annex
<p>The ES2023 specification is almost fully supported including the Annex
B (legacy web compatibility) and the Unicode related features.
</p>
<p>The following features are not supported yet:
@ -411,6 +416,10 @@ B (legacy web compatibility) and the Unicode related features.
<ul>
<li> Tail calls<a name="DOCF6" href="#FOOT6"><sup>6</sup></a>
</li><li> WeakRef and FinalizationRegistry objects
</li><li> Symbols as WeakMap keys
</li></ul>
<a name="ECMA402"></a>
@ -511,6 +520,10 @@ optional properties:
<dd><p>Boolean (default = false). If true, error backtraces do not list the
stack frames below the evalScript.
</p></dd>
<dt><code>async</code></dt>
<dd><p>Boolean (default = false). If true, <code>await</code> is accepted in the
script and a promise is returned.
</p></dd>
</dl>
</dd>
@ -968,6 +981,10 @@ object containing optional parameters:
</dd>
</dl>
</dd>
<dt><code>getpid()</code></dt>
<dd><p>Return the current process ID.
</p>
</dd>
<dt><code>waitpid(pid, options)</code></dt>
<dd><p><code>waitpid</code> Unix system call. Return the array <code>[ret,
@ -995,6 +1012,19 @@ write_fd]</code> or null in case of error.
<dd><p>Sleep during <code>delay_ms</code> milliseconds.
</p>
</dd>
<dt><code>sleepAsync(delay_ms)</code></dt>
<dd><p>Asynchronouse sleep during <code>delay_ms</code> milliseconds. Returns a promise. Example:
</p><div class="example">
<pre class="example">await os.sleepAsync(500);
</pre></div>
</dd>
<dt><code>now()</code></dt>
<dd><p>Return a timestamp in milliseconds with more precision than
<code>Date.now()</code>. The time origin is unspecified and is normally not
impacted by system clock adjustments.
</p>
</dd>
<dt><code>setTimeout(func, delay)</code></dt>
<dd><p>Call the function <code>func</code> after <code>delay</code> ms. Return a handle
to the timer.
@ -1310,7 +1340,7 @@ stack holds the Javascript parameters and local variables.
<h3 class="section">4.4 RegExp</h3>
<p>A specific regular expression engine was developed. It is both small
and efficient and supports all the ES2020 features including the
and efficient and supports all the ES2023 features including the
Unicode properties. As the Javascript compiler, it directly generates
bytecode without a parse tree.
</p>
@ -1318,9 +1348,6 @@ bytecode without a parse tree.
recursion on the system stack. Simple quantifiers are specifically
optimized to avoid recursions.
</p>
<p>Infinite recursions coming from quantifiers with empty terms are
avoided.
</p>
<p>The full regexp library weights about 15 KiB (x86 code), excluding the
Unicode library.
</p>
@ -1359,11 +1386,11 @@ Bellard and Charlie Gordon.
<h4 class="footnotes-heading">Footnotes</h4>
<h3><a name="FOOT1" href="#DOCF1">(1)</a></h3>
<p><a href="https://tc39.es/ecma262/">https://tc39.es/ecma262/</a></p>
<p><a href="https://tc39.es/ecma262/2023">https://tc39.es/ecma262/2023</a></p>
<h3><a name="FOOT2" href="#DOCF2">(2)</a></h3>
<p><a href="https://github.com/tc39/test262">https://github.com/tc39/test262</a></p>
<h3><a name="FOOT3" href="#DOCF3">(3)</a></h3>
<p><a href="https://tc39.github.io/ecma262/">https://tc39.github.io/ecma262/</a></p>
<p><a href="https://tc39.es/ecma262/">https://tc39.es/ecma262/</a></p>
<h3><a name="FOOT4" href="#DOCF4">(4)</a></h3>
<p>The old
ES5.1 tests can be extracted with <code>git clone --single-branch