## Summary
We need to implement a simple versioning schema for hermes-windows releases from release branches and
pre-releases from the main branch.
Thanks a lot to @dannyvv who implemented the version generation for this PR.
## The versioning schema
The versioning schema is described in the new `doc\WindowsVersioning.md ` document:
- The **pre-release package versions** built in the `main` branch look like
**0.0.0-2209.9002-8af7870c** where the `<major>.<minor>.<patch>` versions are
always `'0.0.0'`, and the prerelease part that follows after `'-'` is
`'yyMM.drrr-hhhhhhhh'`. Where `'yy'` are two numbers for the year, `'MM'` are
two numbers for the month, `'d'` is the day without `0` prefix, `'rrr'` is a
three digit number for the today's revision, and `'hhhhhhhh'` are the first 8
hexadecimal numbers from the source GitHub commit hash.
- The **pre-release file versions** look like `0.0.2209.9002` where the the
encoding is `'0.0.yyMM.drrr'`. Where numbers after `'0.0.'` have the same
encoding as for the pre-release package version.
- The **released package versions** use the usual semantic schema which is
based on RNW release numbers like `0.70.1`, where the `'0.70'` is the
`<major>.<minor>` release of RNW and RN, and the last number is a `'patch'`
number for that release. Note that the `'patch'` number will not match the
`'patch'` number of the RNW. We are going to generate the `'patch'` number
using ADO build revision with format `'r'` that avoids `0` prefixes for the
version to be valid semantic version.
- The `release file versions` look like `0.70.1.0` to match the version of the package. The last part of the file version number is always `0`.
Note, that the release version is going to be generated by the release pipeline.
We do not expect the release version to be set somewhere in the source files or by using the processes like beachball.
## Implementation details
- The `publish.yml` has a new `Setup` job that generates version numbers for the package and files using the new `setVersionNumber.js` script. The result of this job is used by `jobs.yml` to create two new variables `semanticVersion` and `fileVersion`. One is used for package semantic version and the other for the DLL/EXE file versions.
- The `semanticVersion` and `fileVersion` are passed to `cibuild.ps1` where they are used to update CMake project version and `package.json` version. The `fileVersion` is passed to CMake build as `HERMES_FILE_VERSION` definition.
- We ensure that `hermes.dll`, `inspector.dll`, and `hermes.exe` projects have the `version.rc` generated with the product and file versions, and with other meta-data settings.
- The generated Nuget packages pickup their versions from the `package.json` file.
- We set back versions in `package.json` and `CMakeLists.txt` to `0.12.0` to match `facebook/hermes` repo. This is done to reduce the diff between the two repos. We are always going to generate these versions in our release pipeline.
- The `ReactNative.Hermes.Windows.Fat.nuspec` is updated to match the `ReactNative.Hermes.Windows.nuspec` because it was missing some files such as `License`, and also had some unnecessary files such as `ninja` build scripts. Now the only extra files there are the symbol `*.pdb` files.
## Summary
When CMake uses VS 2022 to compile code we see issues with installing npm packages using yarn.
The issue is fixed by calling `yarn` using the `call` command.
We previously did the same trick with the `npx` command.
## Test Plan
All unit tests are passing.
## Summary
These set of changes are aiming to reduce the difference between `facebook/hermes` and `microsoft/hermes-windows` repos.
The final goal is to either eliminate the difference between the two repos or make them small and self-contained.
In these PR we are addressing the following set of changes:
- Extracted Windows-specific code from `hermes.h` and `hermes.cpp` flies into `hermes_win.h` and `hermes_win.cpp` files. The only remaining changes to these files:
- Explicit `__cdecl` caling conventions
- The new `getVMRuntime` method to get `hermes::vm::Runtime` from `facebook::jsi::Runtime`.
- Removed unnecessary `#ifdef CREATE_SHARED_LIBRARY` from `hermes.h` - this code is a part of the `public/hermes/Public/HermesExport.h`.
- All changes from `UTF8.h` and `UTF8.cpp` are moved to `hermes_napi.cpp`
- Removed `FinalizableNativeConstructor` in favor of using `NativeState` with `NativeConstructor` in `hermes_napi.cpp`.
## Test Plan
All unit tests are passing
Summary:
<!--
Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The two fields below are mandatory.
Before submitting a pull request, please make sure the following is done:
1. Fork [the repository](https://github.com/facebook/hermes) and create your branch from `main`.
2. If you've fixed a bug or added code that should be tested, add tests!
3. Ensure it builds and the test suite passes. [tips](https://github.com/facebook/hermes/blob/HEAD/doc/BuildingAndRunning.md)
4. Format your code with `.../hermes/utils/format.sh`
5. If you haven't already, complete the CLA.
-->
<!--
Explain the **motivation** for making this change.
What existing problem does the pull request solve?
-->
Pull Request resolved: https://github.com/facebook/hermes/pull/790
Test Plan:
<!--
Demonstrate the code is solid.
Example: The exact commands you ran and their output,
screenshots / videos if the pull request changes the user interface.
-->
Reviewed By: neildhar
Differential Revision: D38673492
Pulled By: fbmal7
fbshipit-source-id: 53481da6d6c1180a99d6b654c8015ec12073d3a2
Summary:
We currently generate the CLI together with generating the framework
for macOS. However, this is not ideal for two reasons:
1. The framework is now built by React Native, so the framework CI will
be deleted soon. Untangling the CLI from the framework makes this
possible.
2. We don't maintain the ability to fully control how the macOS CLI is
built, like turning on LTO and disabling the debugger.
Pull Request resolved: https://github.com/facebook/hermes/pull/781
Reviewed By: fbmal7
Differential Revision: D37913273
Pulled By: neildhar
fbshipit-source-id: 27694c8b1b54d47edef917458d337d650c223025
- Disable Stats Timer (fixes#92)
- Include revision as part of product version in addition to suffix (fixes#91)
- Include license file in NuGet (fixes#98)
- Add Source Link to linker (fixes#102)
This is ported from the v0.11 branch. We bump the version up to 0.12 (even though no such version exists in upstream) to signal we're no longer compatible with 0.11 (and RN 0.68).
We produce proper debug binaries for debug builds now, so this wrapper is no longer necessary.
This also addresses the issue where strings with embedded NUL characters would be truncated (due to the use of c_str instead of data/size).
## Summary
We want to make progress on passing BinSkim for SDL / security best practices.
Note: after these changes there are still 3 warnings disabled (4146, 4244 and 4267) that may require additional follow-up.
* Update to ES6 import/exports
Summary: Update remaining `hermes-parser` package files to use ES6 import/exports.
Reviewed By: gkz
Differential Revision: D30683207
fbshipit-source-id: 84e283d6efa15b7230848cc0584709c9d206140a
* Stop linking ICU and CORE_FOUNDATION where possible
Summary:
These libraries are only really used in the PlatformUnicode target, so
there is no need to link them into everything.
Reviewed By: tmikov
Differential Revision: D30657552
fbshipit-source-id: 00e4746251b458d5937e8e5aaccaaaa694bb9f05
* Do not find ICU on Apple platforms (#584)
Summary:
Pull Request resolved: https://github.com/facebook/hermes/pull/584
Omit the code to link in ICU on Apple platforms, since we use
CoreFoundation.
Reviewed By: tmikov
Differential Revision: D30690628
fbshipit-source-id: a532dda0dcebceba703a1e63b9790f5cca013fa6
* Add a test for CrashManager API
Summary:
Add a test that runs the CrashManager callbacks and verifies that we
get an accurate stack trace out of it.
Reviewed By: kodafb
Differential Revision: D30705223
fbshipit-source-id: bae27f1f73bd04c2b9dda882b5113a62ee82faaa
* Add ParserFlags to control parser behavior
Summary: .
Reviewed By: avp
Differential Revision: D30712622
fbshipit-source-id: 56e50e8e701ff5d0b5a2ae5dc5f76560a34acd05
* Handle use of non-serialisable literals in object literal
Summary:
Not all `Literal` types are serialisable (only 4 out of the 7 are). It
is safer to enumerate the types that can be serialised, than to check
by omitting types.
For instance, the global object is treated as a literal, but cannot be
serialised, however, since we only check for undefined, we end up
trying to serialise it and crashing or generating bad code.
Reviewed By: avp
Differential Revision: D30626995
fbshipit-source-id: 2631467b846434506f06899ef5aedea845025822
* Add error check for invalid JSX attr initializer
Summary:
There was an invalid assert as a result of using `else if` instead of
`else`. Fix the case and ensure that one of the two branches execute.
Reviewed By: tmikov
Differential Revision: D30710922
fbshipit-source-id: de48ece5a6d87deb3df72ba01e1a71d38076c607
* Test and fix more JS generation
Reviewed By: tmikov
Differential Revision: D30438835
fbshipit-source-id: 27ad500f722088c9912b3f5995a1e36fbca1de99
* Implement template literal generation
Summary:
Use the `raw` property that template literals are required to keep
around by the spec to print out template literals.
Reviewed By: tmikov
Differential Revision: D30196556
fbshipit-source-id: 26f4d76c4db87f58e52733d5f0ce711bc2408772
* Bump prismjs from 1.23.0 to 1.24.0 in /website (#540)
Summary:
Bumps [prismjs](https://github.com/PrismJS/prism) from 1.23.0 to 1.24.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/PrismJS/prism/releases">prismjs's releases</a>.</em></p>
<blockquote>
<h2>v1.24.0</h2>
<p>Release 1.24.0</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/PrismJS/prism/blob/master/CHANGELOG.md">prismjs's changelog</a>.</em></p>
<blockquote>
<h2>1.24.0 (2021-06-27)</h2>
<h3>New components</h3>
<ul>
<li><strong>CFScript</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2771">#2771</a>) <a href="https://github.com/PrismJS/prism/commit/b0a6ec85"><code>b0a6ec85</code></a></li>
<li><strong>ChaiScript</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2706">#2706</a>) <a href="https://github.com/PrismJS/prism/commit/3f7d7453"><code>3f7d7453</code></a></li>
<li><strong>COBOL</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2800">#2800</a>) <a href="https://github.com/PrismJS/prism/commit/7e5f78ff"><code>7e5f78ff</code></a></li>
<li><strong>Coq</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2803">#2803</a>) <a href="https://github.com/PrismJS/prism/commit/41e25d3c"><code>41e25d3c</code></a></li>
<li><strong>CSV</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2794">#2794</a>) <a href="https://github.com/PrismJS/prism/commit/f9b69528"><code>f9b69528</code></a></li>
<li><strong>DOT (Graphviz)</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2690">#2690</a>) <a href="https://github.com/PrismJS/prism/commit/1f91868e"><code>1f91868e</code></a></li>
<li><strong>False</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2802">#2802</a>) <a href="https://github.com/PrismJS/prism/commit/99a21dc5"><code>99a21dc5</code></a></li>
<li><strong>ICU Message Format</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2745">#2745</a>) <a href="https://github.com/PrismJS/prism/commit/bf4e7ba9"><code>bf4e7ba9</code></a></li>
<li><strong>Idris</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2755">#2755</a>) <a href="https://github.com/PrismJS/prism/commit/e9314415"><code>e9314415</code></a></li>
<li><strong>Jexl</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2764">#2764</a>) <a href="https://github.com/PrismJS/prism/commit/7e51b99c"><code>7e51b99c</code></a></li>
<li><strong>KuMir (КуМир)</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2760">#2760</a>) <a href="https://github.com/PrismJS/prism/commit/3419fb77"><code>3419fb77</code></a></li>
<li><strong>Log file</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2796">#2796</a>) <a href="https://github.com/PrismJS/prism/commit/2bc6475b"><code>2bc6475b</code></a></li>
<li><strong>Nevod</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2798">#2798</a>) <a href="https://github.com/PrismJS/prism/commit/f84c49c5"><code>f84c49c5</code></a></li>
<li><strong>OpenQasm</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2797">#2797</a>) <a href="https://github.com/PrismJS/prism/commit/1a2347a3"><code>1a2347a3</code></a></li>
<li><strong>PATROL Scripting Language</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2739">#2739</a>) <a href="https://github.com/PrismJS/prism/commit/18c67b49"><code>18c67b49</code></a></li>
<li><strong>Q#</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2804">#2804</a>) <a href="https://github.com/PrismJS/prism/commit/1b63cd01"><code>1b63cd01</code></a></li>
<li><strong>Rego</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2624">#2624</a>) <a href="https://github.com/PrismJS/prism/commit/e38986f9"><code>e38986f9</code></a></li>
<li><strong>Squirrel</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2721">#2721</a>) <a href="https://github.com/PrismJS/prism/commit/fd1081d2"><code>fd1081d2</code></a></li>
<li><strong>URI</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2708">#2708</a>) <a href="https://github.com/PrismJS/prism/commit/bbc77d19"><code>bbc77d19</code></a></li>
<li><strong>V</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2687">#2687</a>) <a href="https://github.com/PrismJS/prism/commit/72962701"><code>72962701</code></a></li>
<li><strong>Wolfram language</strong> & <strong>Mathematica</strong> & <strong>Mathematica Notebook</strong> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2921">#2921</a>) <a href="https://github.com/PrismJS/prism/commit/c4f6b2cc"><code>c4f6b2cc</code></a></li>
</ul>
<h3>Updated components</h3>
<ul>
<li>Fixed problems reported by <code>regexp/no-dupe-disjunctions</code> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2952">#2952</a>) <a href="https://github.com/PrismJS/prism/commit/f471d2d7"><code>f471d2d7</code></a></li>
<li>Fixed some cases of quadratic worst-case runtime (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2922">#2922</a>) <a href="https://github.com/PrismJS/prism/commit/79d22182"><code>79d22182</code></a></li>
<li>Fixed 2 cases of exponential backtracking (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2774">#2774</a>) <a href="https://github.com/PrismJS/prism/commit/d85e30da"><code>d85e30da</code></a></li>
<li><strong>AQL</strong>
<ul>
<li>Update for ArangoDB 3.8 (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2842">#2842</a>) <a href="https://github.com/PrismJS/prism/commit/ea82478d"><code>ea82478d</code></a></li>
</ul>
</li>
<li><strong>AutoHotkey</strong>
<ul>
<li>Improved tag pattern (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2920">#2920</a>) <a href="https://github.com/PrismJS/prism/commit/fc2a3334"><code>fc2a3334</code></a></li>
</ul>
</li>
<li><strong>Bash</strong>
<ul>
<li>Accept hyphens in function names (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2832">#2832</a>) <a href="https://github.com/PrismJS/prism/commit/e4ad22ad"><code>e4ad22ad</code></a></li>
<li>Fixed single-quoted strings (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2792">#2792</a>) <a href="https://github.com/PrismJS/prism/commit/e5cfdb4a"><code>e5cfdb4a</code></a></li>
</ul>
</li>
<li><strong>C++</strong>
<ul>
<li>Added support for generic functions and made <code>::</code> punctuation (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2814">#2814</a>) <a href="https://github.com/PrismJS/prism/commit/3df62fd0"><code>3df62fd0</code></a></li>
<li>Added missing keywords and modules (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2763">#2763</a>) <a href="https://github.com/PrismJS/prism/commit/88fa72cf"><code>88fa72cf</code></a></li>
</ul>
</li>
<li><strong>Dart</strong>
<ul>
<li>Improved support for classes & generics (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2810">#2810</a>) <a href="https://github.com/PrismJS/prism/commit/d0bcd074"><code>d0bcd074</code></a></li>
</ul>
</li>
<li><strong>Docker</strong>
<ul>
<li>Improvements (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2720">#2720</a>) <a href="https://github.com/PrismJS/prism/commit/93dd83c2"><code>93dd83c2</code></a></li>
</ul>
</li>
<li><strong>Elixir</strong>
<ul>
<li>Added missing keywords (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2958">#2958</a>) <a href="https://github.com/PrismJS/prism/commit/114e4626"><code>114e4626</code></a></li>
<li>Added missing keyword and other improvements (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2773">#2773</a>) <a href="https://github.com/PrismJS/prism/commit/e6c0d298"><code>e6c0d298</code></a></li>
<li>Added <code>defdelagate</code> keyword and highlighting for function/module names (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2709">#2709</a>) <a href="https://github.com/PrismJS/prism/commit/59f725d7"><code>59f725d7</code></a></li>
</ul>
</li>
<li><strong>F#</strong></li>
</ul>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="3432b4b1e4"><code>3432b4b</code></a> 1.24.0</li>
<li><a href="46d0720768"><code>46d0720</code></a> Updated <code>.npmignore</code> (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2971">#2971</a>)</li>
<li><a href="aef7f08df6"><code>aef7f08</code></a> Changelog for v1.24.0 (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2965">#2965</a>)</li>
<li><a href="e9477d8369"><code>e9477d8</code></a> Markdown: Improved code snippets (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2967">#2967</a>)</li>
<li><a href="4b55bd6af8"><code>4b55bd6</code></a> Made Match Braces and Custom Class compatible (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2947">#2947</a>)</li>
<li><a href="e8d3b50330"><code>e8d3b50</code></a> ESLint: Added <code>regexp/strict</code> rule (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2944">#2944</a>)</li>
<li><a href="bfd7fded29"><code>bfd7fde</code></a> GraphQL: Fixed <code>definition-query</code> and <code>definition-mutation</code> tokens (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2964">#2964</a>)</li>
<li><a href="14e3868f05"><code>14e3868</code></a> Fixed reST test</li>
<li><a href="a7656de67a"><code>a7656de</code></a> reST: Fixed <code>inline</code> pattern (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2946">#2946</a>)</li>
<li><a href="b4ac061815"><code>b4ac061</code></a> ESLint: Use cache (<a href="https://github-redirect.dependabot.com/PrismJS/prism/issues/2959">#2959</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/PrismJS/prism/compare/v1.23.0...v1.24.0">compare view</a></li>
</ul>
</details>
<details>
<summary>Maintainer changes</summary>
<p>This version was pushed to npm by <a href="https://www.npmjs.com/~rundevelopment">rundevelopment</a>, a new releaser for prismjs since your current version.</p>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=prismjs&package-manager=npm_and_yarn&previous-version=1.23.0&new-version=1.24.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `dependabot rebase` will rebase this PR
- `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `dependabot merge` will merge this PR after your CI passes on it
- `dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `dependabot cancel merge` will cancel a previously requested merge and block automerging
- `dependabot reopen` will reopen this PR if it is closed
- `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/facebook/hermes/network/alerts).
</details>
Pull Request resolved: https://github.com/facebook/hermes/pull/540
Reviewed By: kodafb
Differential Revision: D30682230
Pulled By: Huxpro
fbshipit-source-id: df191293d791306c0bd8320c040a6bd1381b0104
* Remove StackIncrement
Summary:
Making the stack direction toggle-able is likely to be error-prone and
hard to maintain, since it would require maintaining and testing a
separate build mode across different configurations and testsuites.
Reviewed By: kodafb
Differential Revision: D30845355
fbshipit-source-id: 0fdd462758a64c24d8fbaa8818f1a596ac5bcfad
* Add ArgIterator
Summary:
Add a typedef for `ArgIterator`s, which are iterators over the
arguments for a frame. When the stack direction is reversed, some of
the argument iteration can be updated transparently by changing this to
a `std::reverse_iterator`.
Reviewed By: kodafb
Differential Revision: D30846458
fbshipit-source-id: d6f429adfd87d6c886c58b0dff7f537a9a207856
* Separate register stack start from allocation
Summary:
Allow the register stack to start at an address that is separate from
the allocation address. This is used so we can randomise the stack
layout in an upward growing stack while still keeping the original
allocation address to free at the end.
Reviewed By: kodafb
Differential Revision: D30872436
fbshipit-source-id: 871bd4c72ce9275fcd32e411929f065e1fdd16c7
* Simplify setting newTarget in _proxyNativeCall
Summary:
`isConstructorCall` itself just checks whether `newTarget` is
`undefined`, so we know by definition that if it is false the value of
`getNewTargetRef` will be `undefined`.
Reviewed By: mhorowitz
Differential Revision: D30884569
fbshipit-source-id: 76f921e1fe2c4ce4b20c9cef5d0294333d8e1bef
* Store ArgIterator in NativeArgs
Summary:
Instead of explicitly storing a pointer in `NativeArgs` and the
`handle_iterator`, use an `ArgIterator`. This has two advantages:
1. It reduces the number of places in which `ArgIterators` are
constructed.
2. This iterator now points to the first argument (instead of `this`),
which makes it consistent with `argCount_`, which excludes `this`.
Reviewed By: kodafb
Differential Revision: D30884276
fbshipit-source-id: 6882c5e1c7837c340114aadeaa4432bb25f0290a
* Simplify BytecodeFunctionGenerator::shrinkJump
Summary:
We spend a lot of time in this function under TSAN, which slows down
our TSAN tests. Make the code more efficient.
Reviewed By: kodafb
Differential Revision: D30905682
fbshipit-source-id: 30e6dca56d4bd987835b682e9f537d0970f63467
* Support timezones without a colon separator in ISO dates (#596)
Summary:
Pull Request resolved: https://github.com/facebook/hermes/pull/596
Can now parse ISO dates with no colon between the timezone hours/minutes
Reviewed By: neildhar
Differential Revision: D30907907
fbshipit-source-id: 695dabb0d79b0fade0dccd5946c9a717347fd1a7
* Delete outlining code
Summary: This code is unused since the outliner was deleted.
Reviewed By: Huxpro
Differential Revision: D30889838
fbshipit-source-id: 4ec9dbd85d46a9dadcaa26df61a4e22af8bdb6a7
* Throw, don't assert, if the prop value is not of the expected type
Summary:
As an assert, this manifests as a C++ crash. Chances are,
this is a Java bug, so throwing is more likely to indicate the true
source of the error. Also, C++ errors are generally more difficult to
attribute.
Reviewed By: neildhar
Differential Revision: D30881798
fbshipit-source-id: b37e4bb65d71be4b746a69138661aab4eed136e3
* Reenable some tests which work now
Summary:
There was a failure in the test in the PR. Fixed it, noticed
this was lying around, and it was easy to fix and verify since I had
the OSS tests set up to run. See D21420114 for when they were
removed. Intl is now capable enough.
Reviewed By: neildhar
Differential Revision: D30881797
fbshipit-source-id: 8092c5747b4d18778e9ddff540a10d0d48074067
* Add a root node to profiler traces
Summary:
Currently, the sampling profiler does not correctly report gaps where
the runtime is not executing any code. These samples get dropped
entirely, and as a result, tracery just extends the preceding sample to
take up the gap. This is very misleading, since it makes it appear as
though a function is taking up more time than it actually is.
To fix this, add a new root node that exists for every sample, even
those where the runtime is inactive. Now, points where the runtime is
inactive will just show up as "[root]".
Reviewed By: kodafb
Differential Revision: D30895444
fbshipit-source-id: 9240de33a24febeae70ecc39c54c432489b8317e
* Remove findOrAddNewHelper in sampling profiler serialiser
Summary:
This helper is no longer needed, since the previous diff removes the
direct call to it. Instead, simplify it and merge it with
findOrAddNewChild.
Reviewed By: kodafb
Differential Revision: D30895476
fbshipit-source-id: d939fb4765ed2185c1ae0c4b558bcd2d6b903312
* Bump axios from 0.21.1 to 0.21.4 in /website (#591)
Summary:
Bumps [axios](https://github.com/axios/axios) from 0.21.1 to 0.21.4.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/axios/axios/releases">axios's releases</a>.</em></p>
<blockquote>
<h2>v0.21.4</h2>
<h3>0.21.4 (September 6, 2021)</h3>
<p>Fixes and Functionality:</p>
<ul>
<li>Fixing JSON transform when data is stringified. Providing backward compatibility and complying to the JSON RFC standard (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4020">#4020</a>)</li>
</ul>
<p>Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:</p>
<ul>
<li><a href="https://github.com/axios/axios/blob/HEAD/mailto:jasonsaayman@gmail.com">Jay</a></li>
<li><a href="https://github.com/gfortaine">Guillaume Fortaine</a></li>
<li><a href="https://github.com/kawanet">Yusuke Kawasaki</a></li>
<li><a href="https://github.com/DigitalBrainJS">Dmitriy Mozgovoy</a></li>
</ul>
<h2>v0.21.3</h2>
<h3>0.21.3 (September 4, 2021)</h3>
<p>Fixes and Functionality:</p>
<ul>
<li>Fixing response interceptor not being called when request interceptor is attached (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4013">#4013</a>)</li>
</ul>
<p>Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:</p>
<ul>
<li><a href="https://github.com/axios/axios/blob/HEAD/mailto:jasonsaayman@gmail.com">Jay</a></li>
<li><a href="https://github.com/nerdbeere">Julian Hollmann</a></li>
</ul>
<h2>v0.21.2</h2>
<h3>0.21.2 (September 4, 2021)</h3>
<p>Fixes and Functionality:</p>
<ul>
<li>Updating axios requests to be delayed by pre-emptive promise creation (<a href="https://github-redirect.dependabot.com/axios/axios/pull/2702">#2702</a>)</li>
<li>Adding "synchronous" and "runWhen" options to interceptors api (<a href="https://github-redirect.dependabot.com/axios/axios/pull/2702">#2702</a>)</li>
<li>Updating of transformResponse (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3377">#3377</a>)</li>
<li>Adding ability to omit User-Agent header (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3703">#3703</a>)</li>
<li>Adding multiple JSON improvements (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3688">#3688</a>, <a href="https://github-redirect.dependabot.com/axios/axios/pull/3763">#3763</a>)</li>
<li>Fixing quadratic runtime and extra memory usage when setting a maxContentLength (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3738">#3738</a>)</li>
<li>Adding parseInt to config.timeout (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3781">#3781</a>)</li>
<li>Adding custom return type support to interceptor (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3783">#3783</a>)</li>
<li>Adding security fix for ReDoS vulnerability (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3980">#3980</a>)</li>
</ul>
<p>Internal and Tests:</p>
<ul>
<li>Updating build dev dependancies (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3401">#3401</a>)</li>
<li>Fixing builds running on Travis CI (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3538">#3538</a>)</li>
<li>Updating follow rediect version (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3694">#3694</a>, <a href="https://github-redirect.dependabot.com/axios/axios/pull/3771">#3771</a>)</li>
<li>Updating karma sauce launcher to fix failing sauce tests (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3712">#3712</a>, <a href="https://github-redirect.dependabot.com/axios/axios/pull/3717">#3717</a>)</li>
<li>Updating content-type header for application/json to not contain charset field, according do RFC 8259 (<a href="https://github-redirect.dependabot.com/axios/axios/pull/2154">#2154</a>)</li>
<li>Fixing tests by bumping karma-sauce-launcher version (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3813">#3813</a>)</li>
<li>Changing testing process from Travis CI to GitHub Actions (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3938">#3938</a>)</li>
</ul>
<p>Documentation:</p>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/axios/axios/blob/master/CHANGELOG.md">axios's changelog</a>.</em></p>
<blockquote>
<h3>0.21.4 (September 6, 2021)</h3>
<p>Fixes and Functionality:</p>
<ul>
<li>Fixing JSON transform when data is stringified. Providing backward compatability and complying to the JSON RFC standard (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4020">#4020</a>)</li>
</ul>
<p>Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:</p>
<ul>
<li><a href="https://github.com/axios/axios/blob/master/mailto:jasonsaayman@gmail.com">Jay</a></li>
<li><a href="https://github.com/gfortaine">Guillaume Fortaine</a></li>
<li><a href="https://github.com/kawanet">Yusuke Kawasaki</a></li>
<li><a href="https://github.com/DigitalBrainJS">Dmitriy Mozgovoy</a></li>
</ul>
<h3>0.21.3 (September 4, 2021)</h3>
<p>Fixes and Functionality:</p>
<ul>
<li>Fixing response interceptor not being called when request interceptor is attached (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4013">#4013</a>)</li>
</ul>
<p>Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:</p>
<ul>
<li><a href="https://github.com/axios/axios/blob/master/mailto:jasonsaayman@gmail.com">Jay</a></li>
<li><a href="https://github.com/nerdbeere">Julian Hollmann</a></li>
</ul>
<h3>0.21.2 (September 4, 2021)</h3>
<p>Fixes and Functionality:</p>
<ul>
<li>Updating axios requests to be delayed by pre-emptive promise creation (<a href="https://github-redirect.dependabot.com/axios/axios/pull/2702">#2702</a>)</li>
<li>Adding "synchronous" and "runWhen" options to interceptors api (<a href="https://github-redirect.dependabot.com/axios/axios/pull/2702">#2702</a>)</li>
<li>Updating of transformResponse (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3377">#3377</a>)</li>
<li>Adding ability to omit User-Agent header (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3703">#3703</a>)</li>
<li>Adding multiple JSON improvements (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3688">#3688</a>, <a href="https://github-redirect.dependabot.com/axios/axios/pull/3763">#3763</a>)</li>
<li>Fixing quadratic runtime and extra memory usage when setting a maxContentLength (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3738">#3738</a>)</li>
<li>Adding parseInt to config.timeout (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3781">#3781</a>)</li>
<li>Adding custom return type support to interceptor (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3783">#3783</a>)</li>
<li>Adding security fix for ReDoS vulnerability (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3980">#3980</a>)</li>
</ul>
<p>Internal and Tests:</p>
<ul>
<li>Updating build dev dependancies (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3401">#3401</a>)</li>
<li>Fixing builds running on Travis CI (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3538">#3538</a>)</li>
<li>Updating follow rediect version (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3694">#3694</a>, <a href="https://github-redirect.dependabot.com/axios/axios/pull/3771">#3771</a>)</li>
<li>Updating karma sauce launcher to fix failing sauce tests (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3712">#3712</a>, <a href="https://github-redirect.dependabot.com/axios/axios/pull/3717">#3717</a>)</li>
<li>Updating content-type header for application/json to not contain charset field, according do RFC 8259 (<a href="https://github-redirect.dependabot.com/axios/axios/pull/2154">#2154</a>)</li>
<li>Fixing tests by bumping karma-sauce-launcher version (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3813">#3813</a>)</li>
<li>Changing testing process from Travis CI to GitHub Actions (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3938">#3938</a>)</li>
</ul>
<p>Documentation:</p>
<ul>
<li>Updating documentation around the use of <code>AUTH_TOKEN</code> with multiple domain endpoints (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3539">#3539</a>)</li>
<li>Remove duplication of item in changelog (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3523">#3523</a>)</li>
</ul>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="66c46020bd"><code>66c4602</code></a> Merge branch 'master' into release/0.21.4</li>
<li><a href="fc15665cc3"><code>fc15665</code></a> [Releasing] v0.21.4</li>
<li><a href="c2714f08e5"><code>c2714f0</code></a> [Updating] incorrect JSON syntax in README.md</li>
<li><a href="0fc7248cc3"><code>0fc7248</code></a> fix json transform when data is pre-stringified (<a href="https://github-redirect.dependabot.com/axios/axios/issues/4020">#4020</a>)</li>
<li><a href="90205f8ab7"><code>90205f8</code></a> Change headers type to string record (<a href="https://github-redirect.dependabot.com/axios/axios/issues/3021">#3021</a>)</li>
<li><a href="92b29d2775"><code>92b29d2</code></a> Make the default type of response data never (<a href="https://github-redirect.dependabot.com/axios/axios/issues/3002">#3002</a>)</li>
<li><a href="4eeb3b17e2"><code>4eeb3b1</code></a> Improved type-safety for AxiosRequestConfig (<a href="https://github-redirect.dependabot.com/axios/axios/issues/2995">#2995</a>)</li>
<li><a href="cd7ff042b0"><code>cd7ff04</code></a> Adding HTTP status code to error.toJSON (<a href="https://github-redirect.dependabot.com/axios/axios/issues/2956">#2956</a>)</li>
<li><a href="b5a1a67b3c"><code>b5a1a67</code></a> Adding nodejs http.request option: insecureHTTPParser (<a href="https://github-redirect.dependabot.com/axios/axios/issues/2930">#2930</a>)</li>
<li><a href="4f25380b31"><code>4f25380</code></a> Exposing the Axios constructor in index.d.ts (<a href="https://github-redirect.dependabot.com/axios/axios/issues/2872">#2872</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/axios/axios/compare/v0.21.1...v0.21.4">compare view</a></li>
</ul>
</details>
<details>
<summary>Maintainer changes</summary>
<p>This version was pushed to npm by <a href="https://www.npmjs.com/~jasonsaayman">jasonsaayman</a>, a new releaser for axios since your current version.</p>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=axios&package-manager=npm_and_yarn&previous-version=0.21.1&new-version=0.21.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `dependabot rebase` will rebase this PR
- `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `dependabot merge` will merge this PR after your CI passes on it
- `dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `dependabot cancel merge` will cancel a previously requested merge and block automerging
- `dependabot reopen` will reopen this PR if it is closed
- `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/facebook/hermes/network/alerts).
</details>
Pull Request resolved: https://github.com/facebook/hermes/pull/591
Reviewed By: kodafb
Differential Revision: D30851378
Pulled By: neildhar
fbshipit-source-id: cf24067c0d93d13ee6a9112b8d4af1a67de8e28b
* Remove special string printing under ICU
Summary:
This code provides special string encoding functionality, that is only
used for developer facing things (as far as I can tell) since it prints
to an `llvh::ostream`. This code was originally kept because only Apple
platforms were unable to use ICU, and we wanted the more accurate
encoding on all other platforms. However, we now only appear to do this
system specific encoding on Linux, since ICU is not included in Hermes
on Apple and Android, and the Windows version is hard-coded to UTF-8.
The motivation is that this is the only use of ICU outside
`PlatformUnicodeICU.cpp`, so removing it makes our unicode
implementation self contained.
Reviewed By: tmikov
Differential Revision: D30634531
fbshipit-source-id: b475a8173fc2947ca4c43c1b8bd61707fc699e0c
* Export types API
Summary:
When writing transforms its common to need to access the types API outside the transform function e.g.
```
const t = require('babel/core').types;
function CallExpression(path) {
if (t.isSomething(path)) { ... }
}
module.exports = function() {
return {
visitors: { CallExpression }
}
}
```
e.g.
https://www.internalfb.com/code/www/[8a2d1ae796d3]/scripts/static_resources/js/fb-transforms/babel-7/babel-plugin-fb-module/fb-module.js?lines=11
This change exposes the types API from the top level `hermes-parser` package.
Reviewed By: gkz
Differential Revision: D30683404
fbshipit-source-id: e7d21b6f96def2390178373b6f603e23117317ac
* Support passing options along with transform
Summary:
Support passing options to user transforms. This is commonly used in our infra and is useful for our codemod infra. See:
https://www.internalfb.com/code/www/[8a2d1ae796d3e3fcae426074a7a07010f8538512]/scripts/typedjs/transform_runner/Transformer.js?lines=143-163
Reviewed By: evanyeung
Differential Revision: D30686961
fbshipit-source-id: 2ef4babdd311d7ea8152a4eac840cee87d6e05c2
* Add vscode config for js editing
Summary: Copied the vscode config from `xplat/js`. This correctly configures vs code so `prettier` and `sort-requires` runs on save if you mount the `~/fbsource/xplat/hermes/tools/hermes-parser/js` dir.
Reviewed By: evanyeung
Differential Revision: D30787977
fbshipit-source-id: 3fdef93d714d92dc2a0ef1b8aa8d1086c973d9d1
* Run prettier
Summary: Run prettier to stabilize formatting of new files.
Reviewed By: gkz
Differential Revision: D30847684
fbshipit-source-id: d9e50cb06b4c9cf278fefe00dd8f6ae5f46ee25c
* Update code generators to better match babel
Reviewed By: evanyeung
Differential Revision: D30972430
fbshipit-source-id: 7db6051cfdb14fdeeca7a24c6440ab4a5ae330d9
* Use std::min/max
Summary: std::min/max in C++14 is constexpr.
Reviewed By: dulinriley
Differential Revision: D26495307
fbshipit-source-id: 38a5c415beff883cb3738cae7b4e24061993f17d
* Sync remaining Babel files + logic
Reviewed By: evanyeung
Differential Revision: D30976426
fbshipit-source-id: 41770a18b3924020601b27759d17eb8a76e0fc81
* Add more build and test instructions to the doc
Summary:
Add instruction on
1. how to build out of tree hermes
2. how to run Hermes aginast test262
3. how to run Hermes against Intl402
Reviewed By: neildhar
Differential Revision: D31045774
fbshipit-source-id: eb0612f732ab3962398079120f702c0743ce2263
* Remove isNodesEquivalent validator
Summary: This util function was not working correctly due to us not supporting `NODE_FIELDS`. The util is not used at all internally by babel (only in unit tests) so since it doesnt seem that useful lets just remove it instead of trying to support it better.
Reviewed By: avp
Differential Revision: D31087535
fbshipit-source-id: 1b321fb65d3921078f5c71ea66e2df38cb8fe50e
* Babel transform test files
Summary: Support ES6 syntax in test files by having jest also read the babel config. I had to rename the `.babelrc` file to use the `babel.config.js` style since thats all that `jest` supports.
Reviewed By: avp
Differential Revision: D31087990
fbshipit-source-id: 5044565ce0e39289ee7a6982941674dcde42a7de
* Back out "Accommodate toolchains where the compiler supports aligned/sized (de-)allocation but the stdlib doesn't"
Summary: We don't need to accommodate any such toolchains anymore.
Reviewed By: ispeters
Differential Revision: D31073475
fbshipit-source-id: 77bbb22b46d233d1a50384d9f6cd1fc9d3c19c0b
* Cargo.toml: add "." as a member
Summary:
The actual "Juno" wasn't part of the check, etc. Adding "." seems to fix
that problem.
Reviewed By: avp
Differential Revision: D31044166
fbshipit-source-id: daa2f870d5672391861e6cf6936cf321f57c3c2e
* Implement SourceLoc::invalid()
Summary: It is just easier to create instances that way.
Reviewed By: avp
Differential Revision: D31044156
fbshipit-source-id: 45c12d066116fe24ba1feaf3ab38c305e02e48f8
* fix lifetime of constructor result
Summary:
Lifetime elision was assigning the input lifetime (a file) to the output
(a buffer).
Reviewed By: avp
Differential Revision: D31044161
fbshipit-source-id: acd98d3a27395a32a39655746dfa1eaafd87bf98
* new constructor NullTerminatedBuf::from_reader()
Summary:
Apparently in Rust we need a way to read streams that don't have file
handles (stdin doesn't provide one on Windows for example).
Reviewed By: avp
Differential Revision: D31044158
fbshipit-source-id: 574c1dc5d9953ffff84ecdcb35db43f62d00308e
* EASY: remove unnecessary usage of BufReader
Summary: There is no need for BufReader when reading the entire file into a vec.
Reviewed By: avp
Differential Revision: D31044157
fbshipit-source-id: be692af668afbf3c1b80282035101cbe9fb85dcd
* Remove Cargo.lock from sub-crates
Summary: Apparently only the top level should have a Cargo.lock.
Reviewed By: avp
Differential Revision: D31044162
fbshipit-source-id: 9efa3107da3cb48ea95864c31280eade03f98659
* utility to fetch data from an URL
Summary:
fetch_url fetches all data from an URL and returns it. For now only
file: and data: URLs are supported, but more (like http:) can be added.
It returns the entire data instead of a reader for simplicity. Juno is
not a multithreaded server so it doesn't need to deal with reading a
file incrementally.
Reviewed By: avp
Differential Revision: D31044163
fbshipit-source-id: 1b3f4a3ee75744305019d6c4a8a4b569fa3fa473
* Coord.column is actually zero based offset
Summary:
There was some mixup: Coord.column was occasionally set to a 0-based
value, and to 1-based value at other times. Since the actual value
returned from Hermes is literally a byte offset (as opposed as a
codepoint index), int makes sense to standardize to offseti, which is
0-based. Juno can convert it to a 1-based column.
Reviewed By: avp
Differential Revision: D31044159
fbshipit-source-id: 7e1d99488a4e6908a15d4e420120954c3aa11c14
* implement simple main() for testing the binary
Summary:
The binary parses an input (file or STDIN), decodes the source mapping
URL, loads the source map, and optionally generates AST or JavaScript.
For testing Juno takes the following parameters:
- `no-pretty`: disable pretty printing
- `gen-js`, `gen-ast`: emit JS or JSON AST.
- `xtime`: measure and display parse, convert, AST drop times.
Unfortunately Structopt seems rather limited compared to
llvh::CommandLine, so I wasn't able to implement all CLI handling
cleanly in the way I wanted to. A couple of examples:
- There is no easy to implement a flag that takes an optional boolean
argument like `--pretty=true/false`, so I was forced to add a single
argument `--no-pretty`.
- There is no easy way to define mutually exclusive args as an enum.
Reviewed By: avp
Differential Revision: D31044160
fbshipit-source-id: f41fff7e3dcbd249b6e201114912560e5190c204
* Speed up location finding by caching cur line
Summary:
If locations are accessed in a natural left to right order, they will
always be either in the current or the next line, which we can cache to
avoid almost 100% of the lookups.
That is more the case for Juno than for Hermes, but it should benefit
Hermes too.
Juno needs access to the whole line anyway, because it needs to operate
with Unicode character indices, not byte offsets, so this kind of
caching integrates naturally into that model.
Reviewed By: avp
Differential Revision: D30720707
fbshipit-source-id: 5fc68250fdf7d758d5a79ac0a012734a0bed8d1c
* export new line-based location API to Rust
Summary:
The new API allows the Rust client to obtain the entire line of a
location, so that it can calculate utf-8 positions and do its own
caching.
Also fix a couple of places that incorrectly used int instead of
unsigned.
Reviewed By: avp
Differential Revision: D31044155
fbshipit-source-id: fd02dff9cf37d2225823c3d90d1e14bd441cb795
* hermes/utf: export a couple of more functions
Summary:
Export a couple of minor UTF-8 related function from the hermes/utf
module. Technically they may better belong in the support crate because
they are not Hermes-specific, but I didn't want to create a whole new
module for two trivial functions, plus the customer is a customer of the
hermes_parser module as well.
Reviewed By: avp
Differential Revision: D31044168
fbshipit-source-id: 099080ba2869c9df65e8f6713878b2895f950373
* hparser: make the convertor mutable
Summary:
I split this into a separate diff for an easier review since it makes
numerous but trivial changes. The next diff stores location cache in
the convertor, so it needs to be mutable.
Reviewed By: avp
Differential Revision: D31044164
fbshipit-source-id: cbd4aa2349e3a8cd49d6f016c9aa488f8def1dd2
* hparser: line caching for location finding
Summary:
Use the new line-based location APIs and speed up location finding by
caching the current and next line, like in the C++ implementation.
We have to re-implement the caching in Rust, because we need to build
utf-8 columns on top of it.
Performance of conversion was improved by 82%.
Reviewed By: avp
Differential Revision: D31044167
fbshipit-source-id: 5d97d0aee1860e1f7182ff8d96da0d51c169ab4d
* hparser: convert locations in increasing order
Summary:
Converting locations in strictly increasing order dramatically improves
location cache utilization and performance. Previously we were
converting the parent start and end location before recursively
converting the children. That means were were jumping from the start to
end and then back to the middle instead of going in increasing order.
Now we convert the parent start location first, convert the children
recursively, and finally in the end convert the parent end location.
In tests caching alone improved performance by 82%. The present change
further improved performance by another 83%! The total improvement from
both optimization was 234% (the new code is 3.34 times faster).
Reviewed By: avp
Differential Revision: D31044165
fbshipit-source-id: 06fa1aa2489fecc205d53e1f01d365dd1b8d40bf
* Port babel validators test
Reviewed By: evanyeung
Differential Revision: D31127263
fbshipit-source-id: 7d8970f43c473077c752d71b00c13a985090f58c
* Remove oscompat::to_string
Summary: With libc++ we now have `std::to_string`.
Reviewed By: tmikov
Differential Revision: D31025887
fbshipit-source-id: 53049953457002bf3c3f9bcf659b2797c4d8faf1
* Remove oscompat::isxdigit
Summary: This function is unused.
Reviewed By: tmikov
Differential Revision: D31025886
fbshipit-source-id: 4cca3868cd0161e16345e44c28819a35ebdcb7d8
* Remove OSCompat floating point functions
Summary: These now seem to work with `libc++`.
Reviewed By: tmikov
Differential Revision: D31027975
fbshipit-source-id: fef7e54f110f24612af9cbfee19ec4eec7e2d051
* Track output location during JS generation
Summary:
Add a `position` tracker field to `GenJS` which is updated whenever
we output to the writer.
We need to know how many characters we output each time.
In the majority of cases, we're just outputting ASCII,
so just check the number of bytes in the `write_ascii` case
(used by `out!`).
For now, `gen_js::generate` returns an empty `SourceMap`.
That will be made to work when we begin emitting segments for
tokens as we emit them in the source.
Reviewed By: tmikov
Differential Revision: D30546171
fbshipit-source-id: 5e584f19e5cb73f177b78f399a067953c06a19af
* Generate JS for RegExpLiteral
Summary:
RegExpLiterals can't contain any invalid unicode or newlines,
so just print each character and keep track as we go.
Reviewed By: tmikov
Differential Revision: D30559606
fbshipit-source-id: 2bc9df8da003a4366b0e971e4992d88a6c1d5854
* Make NodePtr into an index and allocate in a Context
Summary:
`NodePtr` now stores an index directly.
To dereference `NodePtr`, caller must pass a `Context` to `get`.
`NodePtr` is `Copy`, so it can be easily stored as a reference.
Memory must be managed manually via `Context`'s `alloc` and `free`.
Keep node creation in tests ergonomic via the `make_node` macro.
Reviewed By: tmikov
Differential Revision: D30673532
fbshipit-source-id: 1d73eb472860ed6cf7030122079a6bf59ccb19a7
* Allow testing with LIT
Summary:
`cargo test` now invokes the `lit` executable built by the
Hermes CMake build. When we start building Hermes in a more reproducible
fashion, we can reduce the hardcoded paths here a bit.
For now, we just pass the `juno` CLI path as a substitution.
Reviewed By: tmikov
Differential Revision: D31090740
fbshipit-source-id: 64051ab1d78f0f205933c4d9b169194d7137c0d2
* Test JS generation for Flow types
Reviewed By: tmikov
Differential Revision: D31084336
fbshipit-source-id: 14dd3d20648b938a26abdab288bfdc806a3f5cd7
* Rename ast::StringLiteral to NodeString
Summary: Avoid any naming conflicts with the StringLiteral node kind.
Reviewed By: tmikov
Differential Revision: D31114634
fbshipit-source-id: 83027e0128fcca24fb43eb19d00d656312510957
* Use nested structs in NodeKind
Summary:
In order to allow use of `Default` and more restrictive types
in parameters in the future, nest a struct in each of the variants
of `enum NodeKind` instead of having fields be accessed directly.
Reviewed By: tmikov
Differential Revision: D31114633
fbshipit-source-id: 514292a6051c0a8ff1707dfd18b2e42275c2d580
* Merge Node and NodeKind
Summary:
Avoid the awkward distinction between Node and NodeKind
by embedding the shared information within each of the individual
structs.
In order to ensure that we have efficient access to these shared
fields, we provide getter functions to retrieve references.
These will pattern match on all the nodes and retrieve the field,
which is generated to be the first field.
Forcing `repr(C)` on all relevant structures ensures the layout
is consistent and that the identical match branches will be optimized
away.
Reviewed By: tmikov
Differential Revision: D31123068
fbshipit-source-id: 665430335f014d08c1ca3ec9464a19144d951cc5
* Unique all identfiers in the AST
Summary:
All identifiers are kept in an "atom table" and identified by an index
called "atom". The name "atom" was debated and ultimately chosen because
it causes the least amount of conflicts and confusion.
Atoms are alive as long as the context owning them is alive.
Reviewed By: avp
Differential Revision: D31074777
fbshipit-source-id: e903d7a02cbed31dce0beb34ff9b9aae10c0ff0f
* cache NodeLabel to Atom conversion
Summary:
Since NodeLabel is already uniqued on the Hermes side, we don't need to
convert it every time. We can cache the conversion and index it by
NodeLabel.
This should be a considerable speed up of AST construction, assuming
that most identifiers occur more than once.
Reviewed By: avp
Differential Revision: D31075069
fbshipit-source-id: fc32354384af5ecf3a51f713fc7317bd0ad73192
* Reverse stack direction
Summary:
In a downward growing stack, increasing register offsets are found at
lower addresses. This means that when we load from a register, we are
applying a negative offset to some pointer.
In arm64 and x86, negative offsets are not part of the addressing mode
in load instructions. This means that instead of being able to apply
the offset and load in a single instruction, we first need an
instruction to perform the subtraction and compute the address.
See https://godbolt.org/z/qGW4a8d5a
This diff reverses the direction of the stack completely, so that it
grows upwards instead, allowing register loads to become more efficient.
Reviewed By: kodafb
Differential Revision: D30803535
fbshipit-source-id: 29010a9998a4b75dd68ebd45bb014e18820d1e84
* Force ldrd on armv7
Summary:
Clang generates suboptimal code for armv7 when loading a 64 bit value
with a register offset that is added rather than subtracted. For
example, when loading from a register, `frameRegs[-offset]` will
compile to:
```
sub.w r0, r0, r1, lsl #3
ldrd r0, r1, [r0]
bx lr
```
Whereas `frameRegs[offset]` will compile to:
```
ldr.w r2, [r0, r1, lsl #3]
add.w r0, r0, r1, lsl #3
ldr r1, [r0, #4]
mov r0, r2
bx lr
```
By using inline asm, we can force clang to perform the add as a
separate operation before the load, which prevents it from being folded
into the load and allows it to use the more efficient 64 bit load
instead.
Reviewed By: kodafb
Differential Revision: D31030620
fbshipit-source-id: 9620205e6382943c4a113d00c42d558bb5fbcdfc
* Fix and test JSX source generation
Summary:
JSXText stores the raw text in the node,
so just print that back out.
Change the JSX lexer to properly store the raw input by decoding
the UTF-8 supplied (as TemplateElement and Flow do).
Fix up and write tests for JSX text.
Reviewed By: tmikov
Differential Revision: D30559605
fbshipit-source-id: 5730c3bdf28c14fc7303f1c77fe917dfc08a7f07
* Emit source mappings during JS generation
Summary:
To avoid emitting the same mapping twice or emitting wrong mappings,
emit segments for the source map in specific cases of the `match`.
For now, we emit for every literal and identifier,
as well as specific keywords such as `return`, `if`, etc.
Reviewed By: tmikov
Differential Revision: D31172158
fbshipit-source-id: 3b7f5778ecc5dbe2e49b9dac7e41ee1100a9cc8c
* Fix unused parts of gen_js
Summary:
Parts of gen_js weren't being used, incorrectly.
Add some tests and fix the bugs and unused parts.
Reviewed By: tmikov
Differential Revision: D31208945
fbshipit-source-id: 6cc9505ec52ddd77beeb33b207600892c8e23e3c
* Remove dead_code ignores
Summary:
Exported symbols from a library won't warn when unused.
Get rid of the annotations at the top level of modules so we get the
warnings back. We can use `#[allow(dead_code)]` at a more granular
level if necessary in the future, but as it is it isn't hiding any warnings.
Reviewed By: tmikov
Differential Revision: D31208946
fbshipit-source-id: e1745c1177b0ef3b387e51bc6dc0a61ee9c1e89a
* Add a rudimentary merge_sourcemaps function
Summary:
Add a `merge_sourcemaps` function that operates on a single input
sourcemap and output sourcemap to produce a merged sourcemap.
Eventually we can add support for multiple input sourcemaps like
Hermes has.
Reviewed By: tmikov
Differential Revision: D31089356
fbshipit-source-id: e49582faf813eb7bc65bba2449a54dfe05f009e1
* Reorganize crates
Summary:
Make a `crates` dir where all Juno and related crates will live.
The primary Juno lib is simply called `juno`, and contains `lib.rs`.
Within, it also contains `bin/main.rs`, which is the main juno binary.
This can potentially be split into its own crate in the future,
but as it's a single file and only can use the public `juno` library
API anyway, I don't see any advantage to doing so right now.
The `support` and `hermes` crates are moved unchanged into `crates/`.
Reviewed By: tmikov
Differential Revision: D31221015
fbshipit-source-id: 723824117006d8892e63414828021cef672f58df
* Work around make_jstring returning null for empty strings
Summary:
fbjni's `make_jstring` incorrectly returns null when given an empty
`std::u16string`. Work around this bug by copying out the
implementation of `make_jstring`, but omitting the empty string special
case.
Reviewed By: mhorowitz
Differential Revision: D31254111
fbshipit-source-id: 7aec0aaa4eab8b0346a29173b8dbbe5e6ddf5bbe
* Fix some documentation generation warnings
Summary: I tried out `cargo doc` and there were some broken links so I fixed them.
Reviewed By: tmikov
Differential Revision: D31275280
fbshipit-source-id: dc8188a854ad0f1d30d3c88bf4def33d6a3a4a58
* Add an out_token! macro for emitting source mappings
Summary:
Instead of case-by-case calls to `add_segment` prior to `out!()` calls,
introduce an `out_token!()` macro that will add the segment prior
to calling `out!()`.
This makes it easier to keep track of when location info is being
output at the start of the generation for an AST node.
Reviewed By: tmikov
Differential Revision: D31254318
fbshipit-source-id: b9f8d0bd840b82b8ea3c2d3a6786df3995823b65
* Fix use of isnan in Intl.cpp (#606)
Summary:
Fix a compiler error from the Intl dummy.
Pull Request resolved: https://github.com/facebook/hermes/pull/606
Reviewed By: tmikov
Differential Revision: D31292176
Pulled By: neildhar
fbshipit-source-id: 81fdfee0fed1fd37b8978b65110383a940cd7a6c
* Remove getCalleeClosure
Summary:
`getCalleeClosure` seems prone to being used incorrectly. Most places
that call `getCalleeClosure` immediately `vmcast` the result to some
subclass of `Callable`, so we should just replace those calls with
`getCalleeClosureUnsafe`, which is clear that the operation is unsafe
and saves us a branch. Some other places immediately feed the result
into `dyn_vmcast_or_null`, which also adds an extra branch.
Given that, this diff removes `getCalleeClosure` entirely, and makes
the behaviour at the call sites more explicit.
Reviewed By: tmikov
Differential Revision: D30918025
fbshipit-source-id: 64dbe7f6c942482c69616d3a2cc013e4cf629488
* Remove unused variable ident
Summary: minor change to make compiler happy.
Reviewed By: avp
Differential Revision: D31253344
fbshipit-source-id: 730f95a35f96218c1c7d08fc91e10a5889c860e2
* Simplify proxyRevocationSteps
Summary:
Make two simplifications:
1. We do not need to unbox the `SmallHermesValue` to a full
`HermesValue` since we can perform the necessary checks and conversions
directly on `SmallHermesValue`. This is also more efficient.
2. Use `vmcast` instead of `dyn_vmcast`, since we're immediately
asserting that the result is non-null anyway.
Reviewed By: avp
Differential Revision: D31277187
fbshipit-source-id: 96ed7f6d58117e35fd266ee3f1d26a966aff040d
* Allow reading hermes_build from a TOML file
Summary:
Read `.hermes.toml` in the `juno` root if the env variable
doesn't exist.
Currently there is some code duplication, so that will have to be
encapsulated perhaps in a separate crate when we start building
with CMake. This is just a simple solution for now until we do
the CMake build properly.
Reviewed By: tmikov
Differential Revision: D31324689
fbshipit-source-id: 4355a9b8591fd971efdbdbd48013a63a84247422
* Add sourcemap output from CLI
Summary:
Allow the user to output the full sourcemap to a `.map` file.
To do this, also allow the user to output the actual output to whatever
file they would like.
To work around limitations of `clap`, add an `Opt::validate` function
that lets us do whatever post-validation we want with flexibility.
Reviewed By: tmikov
Differential Revision: D31347358
fbshipit-source-id: 7c6f3b2d0dc8dba4064761518e9b8c35039f6209
* remove the borrowing semantic of NullTerminatedBuf
Summary: The borrowing semantic was complicated and unnecessary.
Reviewed By: avp
Differential Revision: D31223750
fbshipit-source-id: 8c6f4c3c84454a37cbf6ced8b5232950fe1a44cf
* Simple SourceManager
Summary:
SourceManager owns a collection of source buffers with names (so they
can be parsed and so it can provide context when printing errors).
This is a very simple implementation - it directly prints error messages
to stderr without any buffering, etc.
The error() method takes `&self` by design - the implementation will use
interior mutability. A SourceManager is intended to be easily shareable.
Reviewed By: avp
Differential Revision: D31311326
fbshipit-source-id: 47d48d2efb3bcf2978d73b524cfd7e8b4122a8be
* Implement interior mutability in AtomTable
Summary:
AtomTable should be easily shareable, and it can be thought as
conceptually immutable anyway.
Reviewed By: avp
Differential Revision: D31328952
fbshipit-source-id: 5379b63965770e2a1e7e79cae84e132eba21a774
* Integrate SourceManager in Context
Summary:
Add SourceManager as a field in Context. For now it is default
initialized, but in the future we may add a move-constructor to pass in
an existing instance.
Change `Context::add_atom()` to take immutable self and rename it to
`Context::atom()` to reflect that (it maps a string to an atom).
Refactor existing parsing to integrate with the source manager.
Reviewed By: avp
Differential Revision: D31325011
fbshipit-source-id: 63086c5c502c1d40361693c5787e2f8621be096e
* Stable {Array,TypedArray}.prototype.sort
Summary: Make {Array,TypedArray}.prototype.sort stable, by keeping a parallel array of the original indices to break ties. This is a repeat of D23088088, but with proper bounds checking of the index array and added unit tests from D30662659.
Reviewed By: tmikov
Differential Revision: D31058489
fbshipit-source-id: 990c5ec232bd96d793ed490f5f1e0f25dd07dbc8
* Rename ImportDeclaration attributes to assertions
Summary:
ESTree refers to these as assertions.
Fix#607
Reviewed By: tmikov, neildhar
Differential Revision: D31383961
fbshipit-source-id: 78000a59591df52b222057c865ea3bdc2b258a46
* Enforce priority of mutator
Summary:
We currently transfer control between the background thread and mutator
by periodically unlocking `gcMutex_` on the background thread to give
the mutator a chance to acquire it. This seems to work, but it leaves
the scheduling decision up to the OS, which may choose to never yield
to the mutator.
However, we actually want the background thread to always yield to the
mutator, to avoid blocking JS execution. We can do this using a flag
and a condition variable to ensure that the mutex is released and
acquired by the mutator.
Reviewed By: tmikov
Differential Revision: D31323578
fbshipit-source-id: f9f0c5bf41fca8ab8585d2913121905d7b2bdfb5
* Flush handles in partsToJs
Summary: Flush handles created in each iteration.
Reviewed By: mhorowitz
Differential Revision: D31449441
fbshipit-source-id: 6b003fe0db54ac4178e1da370b98a6da26a6e95f
* Make intl.js a lit test
Summary: Allow this test to be run against dummy Intl and upcoming iOS Intl.
Reviewed By: mhorowitz
Differential Revision: D31449439
fbshipit-source-id: 6e126483b140f88409310036db1db1fa1aec0142
* Drop Intl test resources from version control
Summary: The downloaded test262 tests add noise to version control.
Reviewed By: mhorowitz
Differential Revision: D31449437
fbshipit-source-id: f8388d35bc36a5e838f8f9a701939f491e45e5b5
* Inline GCBase::weakRefMutex()
Summary:
This function should always be available for inlining since it will
definitely be cheaper to inline it than make a function call.
Reviewed By: kodafb
Differential Revision: D31424761
fbshipit-source-id: 597e340f90c56129a92841608bd8b538868f6d34
* Only acquire weak ref mutex when needed
Summary:
We don't need to hold the weak ref mutex the entire time we are
marking. Instead, we can just acquire it whenever we are actually about
to invoke a weak ref callback on some object, which should be fairly
rare.
This reduces contention for the mutex, which should improve performance.
Reviewed By: kodafb
Differential Revision: D31323956
fbshipit-source-id: 7118fc29fc0b9805cd8c0ae66f0748b171fa7964
* Simplify Intl build
Summary:
Since we already know the Intl platform in the build system, we can
directly select the relevant source files. Beyond simplifying the
build, this allows us to ensure Obj-C sources from the upcoming iOS
implementation can live in a separate target from cpp sources.
Reviewed By: mhorowitz
Differential Revision: D31449440
fbshipit-source-id: 6257d97f4635730f75b0b517eac472ede158f42d
* Add Obj-C stub for iOS implementation (#609)
Summary:
Pull Request resolved: https://github.com/facebook/hermes/pull/609
Copy PlatformIntlDummy.cpp into PlatformIntlApple.mm and do the build
system plumbing to get things building.
Reviewed By: mhorowitz
Differential Revision: D31487250
fbshipit-source-id: 7256323b6f13525adaf10a8392b7c251e2fb9713
* Handle typeof applied to empty in InstSimplify
Summary:
Do not simplify `typeof` if it is applied to an invalid type. This
handles a case like the one in the added test, where `typeof` is called
on a literal empty in unreachable code.
Reviewed By: kodafb
Differential Revision: D31000173
fbshipit-source-id: 2d7f69cbcc9c1bb0a916585c07171089444c85dc
* Disable TDZ by default
Summary:
TDZ support should be turned off by default to avoid running into
problems.
Reviewed By: tmikov
Differential Revision: D31601517
fbshipit-source-id: 2e5f1c4f7afdb2b3cc541cc353f83ce06c8cb9bb
* Remove redundant breaks from typeOf
Summary:
Remove these unreachable `break`s. Also remove the `else` clause from
one of the conditionals, since the branches do not have equal weight.
Reviewed By: tmikov
Differential Revision: D31635481
fbshipit-source-id: c6c931207fefc1de4b9d2dd1fd8ec15d698b8ab1
* Track OG marked bytes directly
Summary:
Instead of tracking the maximum possible remaining bytes to mark, track
the bytes that have been marked so far. We can compute the former from
the latter.
The number of marked bytes is useful for implementing a dynamic
collection threshold.
Reviewed By: kodafb
Differential Revision: D31365878
fbshipit-source-id: ab79801d0448f83ade885b130a5606627a7377d1
* Fix flakiness in WeakValueMap test
Summary:
Since the `Runtime` is destroyed after the `WeakValueMap`, it can
retain a dangling reference that is then accessed by the concurrent
marking thread.
Reviewed By: kodafb
Differential Revision: D31634432
fbshipit-source-id: c61e8b137bcbe97d46ca041d18cdca97ee548ba3
* Treat TDZ checks as unsupported
Summary:
TDZ checks are unsupported and not fully tested. They should not be
encouraged for production use.
Reviewed By: tmikov
Differential Revision: D31778780
fbshipit-source-id: 0448b2406828677e96e488b4888994b586aa2d25
* Remove NATIVE_CONSTRUCTOR_TYPED
Summary: Simplify the macros so we only need to define `NATIVE_CONSTRUCTOR`.
Reviewed By: avp
Differential Revision: D31754131
fbshipit-source-id: 579e5f713632ac2fa23cf0023af61f8f1dc8e038
* add flow types for hermes-estree AST
Summary: Add a new package containing flow types for the hermes-estree AST.
Reviewed By: pieterv
Differential Revision: D31673963
fbshipit-source-id: c13e7cfbb8450bcbdfecca2893b89c8762fc46e8
* strictify hermes-eslint
Summary: Cleanup and strictify types for `hermes-eslint`
Reviewed By: pieterv
Differential Revision: D31779525
fbshipit-source-id: 61e0db4d0b62f4549d82d4db43060acd706267ab
* Add test262 Intl skiplist (#611)
Summary:
<!--
Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The two fields below are mandatory.
Before submitting a pull request, please make sure the following is done:
1. Fork [the repository](https://github.com/facebook/hermes) and create your branch from `main`.
2. If you've fixed a bug or added code that should be tested, add tests!
3. Ensure it builds and the test suite passes. [tips](https://github.com/facebook/hermes/blob/HEAD/doc/BuildingAndRunning.md)
4. Format your code with `.../hermes/utils/format.sh`
5. If you haven't already, complete the CLA.
-->
Creates a skiplist for the test262 Intl tests and a flag to enable/disable them.
Pull Request resolved: https://github.com/facebook/hermes/pull/611
Test Plan:
Flag tested by removing all `Intl` tests (`test262/test/intl402/*`) from `PERMANENT_SKIP_LIST` and then adding them to `SUPPORTED_INTL_TESTS`. I then ran
```bash
python3 ./hermes/utils/testsuite/run_testsuite.py -b ./build/bin ./test262 --test-intl
```
Example output for `getCanonicalLocales` test cases:
```bash
EXECUTE_FAILED ./test262/test/intl402/Intl/getCanonicalLocales/error-cases.js
Uncaught Test262Error: Expected a RangeError to be thrown but no exception was thrown at all
EXECUTE_FAILED ./test262/test/intl402/Intl/getCanonicalLocales/returned-object-is-an-array.js
Uncaught Test262Error: result.length Expected SameValue(«2», «1») to be true
EXECUTE_FAILED ./test262/test/intl402/Intl/getCanonicalLocales/overriden-push.js
Uncaught Test262Error: Expected [fr-FR, es-ES] and [en-US] to have the same contents.
EXECUTE_FAILED ./test262/test/intl402/Intl/getCanonicalLocales/duplicates.js
Uncaught Test262Error: Expected [fr-FR, es-ES] and [ab-CD, ff, de-RT] to have the same contents.
EXECUTE_FAILED ./test262/test/intl402/Intl/getCanonicalLocales/main.js
Uncaught Test262Error: Expected [fr-FR, es-ES] and [] to have the same contents.
EXECUTE_FAILED ./test262/test/intl402/Intl/getCanonicalLocales/canonicalized-unicode-ext-seq.js
Uncaught Test262Error: Expected SameValue(«2», «1») to be true
EXECUTE_FAILED ./test262/test/intl402/Intl/getCanonicalLocales/Locale-object.js
Uncaught TypeError: Cannot read property 'prototype' of undefined
at global (/tmp/Locale-object-ofh46zck.js:290:18)
EXECUTE_FAILED ./test262/test/intl402/Intl/getCanonicalLocales/has-property.js
Uncaught Test262Error: Expected a Test262Error to be thrown but no exception was thrown at all
EXECUTE_FAILED ./test262/test/intl402/Intl/getCanonicalLocales/weird-cases.js
Uncaught Test262Error: Expected [fr-FR, es-ES] and [en-x-u-foo] to have the same contents.
EXECUTE_FAILED ./test262/test/intl402/Intl/getCanonicalLocales/elements-not-reordered.js
Uncaught Test262Error: Expected SameValue(«fr-FR», «zu») to be true
EXECUTE_FAILED ./test262/test/intl402/Intl/getCanonicalLocales/to-string.js
Uncaught Test262Error: Expected [fr-FR, es-ES] and [en-US, pt-BR] to have the same contents.
EXECUTE_FAILED ./test262/test/intl402/Intl/getCanonicalLocales/locales-is-not-a-string.js
Uncaught Test262Error: Expected [fr-FR, es-ES] and [] to have the same contents.
EXECUTE_FAILED ./test262/test/intl402/Intl/getCanonicalLocales/overriden-arg-length.js
Uncaught Test262Error: Expected [fr-FR, es-ES] and [en-US] to have the same contents. should return one element if locales.length is '1'
```
Reviewed By: avp
Differential Revision: D31733180
Pulled By: neildhar
fbshipit-source-id: bc34954ae81299c2140b8424aed5b4e9bf6e8a36
* Restore comment storage on directive check
Summary:
`isCurrentTokenADirective` was calling `skipBlockComment`,
which can push onto `commentStorage_`.
However, the function should be considered lookahead (it suppresses
messages, e.g.) and as such we should save and restore the comment
storage.
Tested locally on a large file and no substantive difference in
parser performance was observed.
Reviewed By: kodafb
Differential Revision: D31768635
fbshipit-source-id: ef0562bf580805095253abba7adeab8a3c72d886
* EASY: auto-derive Default
Summary: .
Reviewed By: avp
Differential Revision: D31848804
fbshipit-source-id: 5f62a29169f8c9d642b0290f21f4ead7b259b53b
* add MagicCommendKind::name()
Summary: .
Reviewed By: avp
Differential Revision: D31848803
fbshipit-source-id: 51c998d110e40fb4875637a2fedc4bdd64a2e80a
* pass the URL by reference
Summary: .
Reviewed By: avp
Differential Revision: D31848805
fbshipit-source-id: 0bc9b82e92665fc7ebb877cd9b31edca34a552ad
* fixes related to handling of //# sourceMappingUrl
Summary:
Several small changes related to better handling of the sourceMappingUrl
directive in the source:
- Better error messages.
- New command line option `--input-source-map` that allows us to ignore
the directive completely (even if it contains an invalid URL). More
options will be added later.
- New command line option `--base-url` to use with relative URLs
(I have seen files with a relative sourceMappingUrl).
Reviewed By: avp
Differential Revision: D31848802
fbshipit-source-id: e3c31e976b8bb0e566dc73c84069bf0622efa699
* Bump glob-parent from 5.1.1 to 5.1.2 in /tools/hermes-parser/js (#618)
Summary:
Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 5.1.1 to 5.1.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/gulpjs/glob-parent/releases">glob-parent's releases</a>.</em></p>
<blockquote>
<h2>v5.1.2</h2>
<h3>Bug Fixes</h3>
<ul>
<li>eliminate ReDoS (<a href="https://github-redirect.dependabot.com/gulpjs/glob-parent/issues/36">https://github.com/facebook/hermes/issues/36</a>) (<a href="f9231168b0">f923116</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md">glob-parent's changelog</a>.</em></p>
<blockquote>
<h3><a href="https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2">5.1.2</a> (2021-03-06)</h3>
<h3>Bug Fixes</h3>
<ul>
<li>eliminate ReDoS (<a href="https://github-redirect.dependabot.com/gulpjs/glob-parent/issues/36">https://github.com/facebook/hermes/issues/36</a>) (<a href="f9231168b0">f923116</a>)</li>
</ul>
<h3><a href="https://www.github.com/gulpjs/glob-parent/compare/v6.0.1...v6.0.2">6.0.2</a> (2021-09-29)</h3>
<h3>Bug Fixes</h3>
<ul>
<li>Improve performance (<a href="https://github-redirect.dependabot.com/gulpjs/glob-parent/issues/53">https://github.com/facebook/hermes/issues/53</a>) (<a href="843f8de1c1">843f8de</a>)</li>
</ul>
<h3><a href="https://www.github.com/gulpjs/glob-parent/compare/v6.0.0...v6.0.1">6.0.1</a> (2021-07-20)</h3>
<h3>Bug Fixes</h3>
<ul>
<li>Resolve ReDoS vulnerability from CVE-2021-35065 (<a href="https://github-redirect.dependabot.com/gulpjs/glob-parent/issues/49">https://github.com/facebook/hermes/issues/49</a>) (<a href="3e9f04a3b4">3e9f04a</a>)</li>
</ul>
<h2><a href="https://www.github.com/gulpjs/glob-parent/compare/v5.1.2...v6.0.0">6.0.0</a> (2021-05-03)</h2>
<h3>{emoji:26a0} BREAKING CHANGES</h3>
<ul>
<li>Correct mishandled escaped path separators (<a href="https://github-redirect.dependabot.com/gulpjs/glob-parent/issues/34">https://github.com/facebook/hermes/issues/34</a>)</li>
<li>upgrade scaffold, dropping node <10 support</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li>Correct mishandled escaped path separators (<a href="https://github-redirect.dependabot.com/gulpjs/glob-parent/issues/34">https://github.com/facebook/hermes/issues/34</a>) (<a href="32f6d52663">32f6d52</a>), closes <a href="https://github-redirect.dependabot.com/gulpjs/glob-parent/issues/32">https://github.com/facebook/hermes/issues/32</a></li>
</ul>
<h3>Miscellaneous Chores</h3>
<ul>
<li>upgrade scaffold, dropping node <10 support (<a href="e83d0c5a41">e83d0c5</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="eb2c439de4"><code>eb2c439</code></a> chore: update changelog</li>
<li><a href="12bcb6c45c"><code>12bcb6c</code></a> chore: release 5.1.2</li>
<li><a href="f9231168b0"><code>f923116</code></a> fix: eliminate ReDoS (<a href="https://github-redirect.dependabot.com/gulpjs/glob-parent/issues/36">https://github.com/facebook/hermes/issues/36</a>)</li>
<li><a href="0b014a7962"><code>0b014a7</code></a> chore: add JSDoc returns information (<a href="https://github-redirect.dependabot.com/gulpjs/glob-parent/issues/33">https://github.com/facebook/hermes/issues/33</a>)</li>
<li><a href="2b24ebd64b"><code>2b24ebd</code></a> chore: generate initial changelog</li>
<li>See full diff in <a href="https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2">compare view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=glob-parent&package-manager=npm_and_yarn&previous-version=5.1.1&new-version=5.1.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `dependabot rebase` will rebase this PR
- `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `dependabot merge` will merge this PR after your CI passes on it
- `dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `dependabot cancel merge` will cancel a previously requested merge and block automerging
- `dependabot reopen` will reopen this PR if it is closed
- `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/facebook/hermes/network/alerts).
</details>
Pull Request resolved: https://github.com/facebook/hermes/pull/618
Reviewed By: mhorowitz
Differential Revision: D31835353
Pulled By: neildhar
fbshipit-source-id: 21c86fc4ff4c4edcec7cdb64b9d09b44bbad2ca0
* Use Android machine image for e2e intl test (#614)
Summary: Pull Request resolved: https://github.com/facebook/hermes/pull/614
Reviewed By: mhorowitz
Differential Revision: D31818785
Pulled By: neildhar
fbshipit-source-id: 761fe9c2e44923dcc81360ef548094a869e44123
* Fix CircleCI e2e test (#617)
Summary: Pull Request resolved: https://github.com/facebook/hermes/pull/617
Reviewed By: mhorowitz
Differential Revision: D31852458
Pulled By: neildhar
fbshipit-source-id: 3651a6ec1543e68c472bade91ef8df0354a0cda9
* Create separate functions for DataView get and set
Summary:
Some compilers (like clang on Windows) can deduplicate the code
generated by a template, causing two separate functions to map to the
same address. This happens with some of these `DataView` functions for
instance, which can be templated on both `uint8_t` and `int8_t`. In
theory, this could be a useful optimisation, but given that other
compilers don't do it, and that it interferes with our ability to get
the function name string from a function pointer, we can avoid it for
now.
This diff creates multiple separate non-template functions for each
`TypedArray` type instead. Combined with the next diff, it also allows
us to delete the `NATIVE_FUNCTION_TYPED` macro, which simplifies our
handling of native functions in the preprocessor.
Reviewed By: avp
Differential Revision: D31781921
fbshipit-source-id: 898bd552dd597a077045f36434a0369e2ca75dff
* Create separate functions for TypedArray constructors
Summary:
Move the existing templates to generate TypedArrray constructor code
into an anonymous namespace, and instead generate separate standalone
functions for each one. Similar to the previous diff, this avoids the
compiler trying to deduplicate code, and saves us needing to deal with
templates in the places where we handle native functions.
Reviewed By: avp
Differential Revision: D31781920
fbshipit-source-id: e1dd082236935b47960a7ee31885adb9a9c654ac
* Delete NATIVE_FUNCTION_TYPED
Summary: It requires a fair amount of complexity to handle, and is now unused.
Reviewed By: avp
Differential Revision: D31781919
fbshipit-source-id: d6fa3245aabd1174bdb25dd6347bdf99b71face0
* Fix NativeFunctionNameTest
Summary:
Fix the test so that we can reliably take the address of
`creatorFunction`.
Reviewed By: avp
Differential Revision: D31754130
fbshipit-source-id: e1a4df708631e19ba94ce073c3d1e6753845a609
* Delete Serializer build
Summary:
Delete anything in the CMake and Buck builds used to support the
serializer.
Reviewed By: avp
Differential Revision: D31740380
fbshipit-source-id: ecc761d0708e56dfc47c10017fa540be06cb8d2b
* Delete serializer tests
Summary: Delete all the serializer tests.
Reviewed By: avp
Differential Revision: D31740378
fbshipit-source-id: 21418b60dddecc52e5d70646bb6b31b07594587d
* Delete serialiser source
Summary:
Delete the source code for the serialialiser. This diff just deletes
anything that is in a `HERMESVM_SERIALIZE` ifdef.
Reviewed By: avp
Differential Revision: D31740381
fbshipit-source-id: b1e9f6ff0137d209658c2bb589eaa5ff89650e6a
* Remove tagged pointer implementation of WeakRefSlot
Summary:
The tagged pointer version of WeakRefSlot cannot safely be used with
Hades since it cannot be marked concurrently. Given that GenGC is
about to be deleted, delete this as well.
Reviewed By: kodafb
Differential Revision: D31642787
fbshipit-source-id: 7a30467d54f0d5b14968d7a521ce7dcb23deaf81
* Allow some GenGC tests to run with other GCs
Summary:
Some tests that are currently disabled outside GenGC will actually run
fine with other GCs.
Reviewed By: kodafb
Differential Revision: D31643597
fbshipit-source-id: 3e75b769a961dbac919460070146306086765240
* Get canonical locales (#610)
Summary:
<!--
Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The two fields below are mandatory.
Before submitting a pull request, please make sure the following is done:
1. Fork [the repository](https://github.com/facebook/hermes) and create your branch from `main`.
2. If you've fixed a bug or added code that should be tested, add tests!
3. Ensure it builds and the test suite passes. [tips](https://github.com/facebook/hermes/blob/HEAD/doc/BuildingAndRunning.md)
4. Format your code with `.../hermes/utils/format.sh`
5. If you haven't already, complete the CLA.
-->
<!--
Explain the **motivation** for making this change.
What existing problem does the pull request solve?
--> Implements the getCanonicalLocales function on iOS.
Pull Request resolved: https://github.com/facebook/hermes/pull/610
Test Plan:
<!--
Demonstrate the code is solid.
Example: The exact commands you ran and their output,
screenshots / videos if the pull request changes the user interface.
-->
Running test262/test/intl402/Intl passes on 14 of the tests. The error log for the fails are below. Some of these have failed because BCP 47 tag validation is yet to be implemented (no errors are thrown on some invalid locales).
``` EXECUTE_FAILED /Users/mlhfellow/Documents/t/test262/test/intl402/Intl/getCanonicalLocales/error-cases.js
Uncaught Test262Error: Expected a RangeError to be thrown but no exception was thrown at all
EXECUTE_FAILED /Users/mlhfellow/Documents/t/test262/test/intl402/Intl/getCanonicalLocales/canonicalized-unicode-ext-seq.js
Uncaught Test262Error: Expected true but got false
EXECUTE_FAILED /Users/mlhfellow/Documents/t/test262/test/intl402/Intl/getCanonicalLocales/main.js
Uncaught Test262Error: Expected [th-TH-u-nu] and [th-TH-u-nu-thai] to have the same contents. th-TH-u-nu-thai
EXECUTE_FAILED /Users/mlhfellow/Documents/t/test262/test/intl402/Intl/getCanonicalLocales/has-property.js
Uncaught Test262Error: Expected a Test262Error to be thrown but no exception was thrown at all
EXECUTE_FAILED /Users/mlhfellow/Documents/t/test262/test/intl402/Intl/getCanonicalLocales/Locale-object.js
Uncaught TypeError: Cannot read property 'prototype' of undefined
at global (/var/folders/cg/lnpgdmcj7nsg2nfwmx52t97r0000gp/T/Locale-object-2d_po3dq.js:290:18)
```
Adding these failed tests to the skiplist now means that running /test262/test/intl402/Intl --test-intl results in all tests passing.
```-----------------------------------
| Results | PASS |
|----------------------+----------|
| Total | 64 |
| Pass | 14 |
| Fail | 0 |
| Skipped | 19 |
| Permanently Skipped | 31 |
| Pass Rate | 100.00% |
-----------------------------------
| Failures | |
|----------------------+----------|
| Compile fail | 0 |
| Compile timeout | 0 |
| Execute fail | 0 |
| Execute timeout | 0 |
-----------------------------------
```
Custom tests have also been written in get-canonical-locales.js. It tests an empty string, invalid unicode, and valid locales. The valid locales pass apart from (["aam", "zyb", "art-lojban"]) currently, which gives 'aam' instead of 'aas'.
Reviewed By: dmitryrykun
Differential Revision: D31863895
Pulled By: neildhar
fbshipit-source-id: 8349ee53ec483e54784a94bb3e4cce71d9bf634b
* Add general purpose Timer utility
Summary:
A simple utility to record durations between "marks" and format them for
output.
Reviewed By: avp
Differential Revision: D31852603
fbshipit-source-id: a86d703cc436b083d476f3b18ab3ab24e4988f84
* EASY: polymorphise NullBuf::from_reader()
Summary: because it is cool.
Reviewed By: avp
Differential Revision: D31871720
fbshipit-source-id: b18ba09cdbb20791468ecea6a4ce4e6dc50787f3
* add cli crate and increase stack size
Summary:
Move main.rs to a new cli crate. In that crate, increase the main stack
size to 16MB on MacOS.
This was prompted by stack overflow in debug mode.
Reviewed By: avp
Differential Revision: D31875754
fbshipit-source-id: fcd73e828457b6bf21a3ffc94bd0ed9551770fea
* improve Debug printing of Atom-s
Summary:
Printing Atom is not very informative, because they are just numbers
(unlike Hermes where they also point to the actual string).
Add mechanisms to optionally register an AtomTable as "active" in the
current thread. Implement a custom Debug formatter for Atom, which
checks if there is an active table and the atom is valid inside it, and
prints the corresponding string.
The safe mechanism is a function that sets the active table, invokes a
callback, and restores the active table.
Also provide an unsafe mechanism to just set the table, in case urgent
debugging is needed. It is unsafe, because there is no guarantee that
the table would not be moved or destroyed.
Reviewed By: avp
Differential Revision: D31878793
fbshipit-source-id: 49db11e414610643e0fd137e7938e5d53ca9c582
* Fix doc comment
Summary: .
Reviewed By: tmikov
Differential Revision: D31807956
fbshipit-source-id: c792e7053146342e5c292e3dd4b44815213954c9
* hermes | Add missing set_thread_name to emscripten oscompat.
Summary: Getting a missing symbol when building with emscripten - add it.
Reviewed By: rudybear
Differential Revision: D31919582
fbshipit-source-id: e37a57a939c275d1f2a760d69dad34ff1be6482a
* hermes | Remove posix_spawn specific stubs overrides, as they are available in emscripten.
Summary: Lates emscripten comes with these - so no need to stub them out.
Reviewed By: tmikov
Differential Revision: D31919580
fbshipit-source-id: 5257d4188f215488a267a723f639a2bcf885cc44
* improve jest config
Summary:
- Add types for jest
- Improve jest config so that it can run babel on source files
Reviewed By: pieterv
Differential Revision: D31877151
fbshipit-source-id: 6bced4073bd2d71259831dec77113a97ff754c72
* add skeleton `hermes-transform` package
Summary:
Build out the new transformation tooling.
This diff: Adds an empty package.
Reviewed By: pieterv
Differential Revision: D31849745
fbshipit-source-id: 45a71bdfc4755d54a7960411a000e97f6a0ed321
* add traversal tooling - SimpleTraverser
Summary:
Build out the new transformation tooling.
This diff:
Forks ESLint's "SimpleTraverser" - flowify it, and remove the cruft that we don't need.
This simple class simply allows for controlled traversal of an AST.
Reviewed By: pieterv
Differential Revision: D31877306
fbshipit-source-id: 7a873055d3e65e5d95ee93734f5c08145f0ac27d
* add traversal tooling - SafeEmitter
Summary:
Build out the new transformation tooling.
This diff:
Forks ESLint's "SafeEmitter" - flowify it, and remove the cruft that we don't need.
This simple class is just an event emitter typed to call listeners with nodes.
The traversal logic uses this as a store where the event names are esquery selectors, and it "emits" events against selectors as it traverses the AST.
Reviewed By: pieterv
Differential Revision: D31877350
fbshipit-source-id: b13570e5e5af4449d011875fc0f80dcbcad34fdc
* add traversal tooling - NodeEventGenerator
Summary:
Build out the new transformation tooling.
This diff:
Forks ESLint's "NodeEventGenerator" - flowify it, and remove the cruft that we don't need.
This class handles the parsing of selector strings as well as the correct "emitting" of events to those selectors.
Reviewed By: pieterv
Differential Revision: D31877397
fbshipit-source-id: eb54ea9fbc4b604b107023539b4148f4564936fe
* add traversal tooling - traverse
Summary:
Build out the new transformation tooling.
This diff:
Adds a function which consumes all of the previous code to allow you to use esquery selectors to visit the AST.
It also provides a "context" object which can be used to get some additional information during the traversal.
Currently that is just scope analysis information.
Reviewed By: pieterv
Differential Revision: D31877405
fbshipit-source-id: 6e0cf0d85ded33e12191a5e93cf0a74d6a6b11e3
* generate types for basic esquery selectors
Summary:
Build out the new transformation tooling.
This diff:
Adds a codegen step so that consumers can have really nice types for any and every node.
This means that when declaring visitors we get types for the most common simple selectors for free!
```
{
Program(node) {} // typeof node ==== Program
'Identifier:exit'(node) {} // typeof node === Identifier
}
```
Reviewed By: pieterv
Differential Revision: D31916554
fbshipit-source-id: 8570bd698f7b707cb711210cd6793e29430d416b
* Remove IsTriviallyCopyable
Summary:
We've removed support for the old libstdc++ already in OSCompat
anyway.
This also allows us to clean up one of the last remaining config files.
Reviewed By: tmikov
Differential Revision: D31915096
fbshipit-source-id: d5b39657006dab0b5b6ee703346846847c477c90
* Remove config file for repl
Summary: Match the buck build by adding a preprocessor flag.
Reviewed By: tmikov
Differential Revision: D31915520
fbshipit-source-id: ff49d7e839b6926404bfe5d21920e6cde8f47d8b
* Fix readline linking in CMake build (#619)
Summary:
Pull Request resolved: https://github.com/facebook/hermes/pull/619
Our CMake build imposes a hard requirement on tinfo, which doesn't
exist and isn't required on some platforms (e.g. macOS, CentOS). This
diff adds it in when it is available, and then uses
`check_function_exists` to verify that we can successfully build and
link against readline.
Reviewed By: tmikov
Differential Revision: D31917297
fbshipit-source-id: fcf884d8847c474ea47d5800d34c909fbaec0e23
* Fix test for double truncation
Summary:
Work around Clang 13 treating the truncation fast path as UB and
optimising it to not work on compile time constants.
This appears to be a bug in clang, since adding the
`-fno-strict-float-cast-overflow` flag does not fix it. Nonetheless,
this diff also adds that flag, since it is generally desirable for
Hermes code.
Reviewed By: tmikov
Differential Revision: D31939409
fbshipit-source-id: b86830d129e6bf1b872e502294ab9ea1893ce242
* add codegen step to create a JSON blob for estree defs
Summary:
Doing complex JS codegen using the C++ preprocessor is very cumbersome:
- we have to define 0-8 macros, often duplicating lines
- C++ preprocessor macros are filled with various pitfalls
- we can't do conditional generation based on input
- you have to pass in the C++ include paths to run the js script
Considering our scripts are written in JS - we don't really need a level of indirection. We just need to get the raw data into JS, then we can build our files using the full power of the language.
This diff:
- adds a generation step which generates a JSON blob from the ESTree defs.
- adds `babel-node` so that we can write flow-typesd scripts
In the next diff I'll start converting the existing codegen steps to be pure JS scripts AND to be driven from this blob
Reviewed By: pieterv
Differential Revision: D31940978
fbshipit-source-id: 70d792e7b185c404c20bfd709f72c54ad8e51c1a
* add tests to ensure that the declared flow types are correct
Summary:
By leveraging the JSON that we now output - we can do a sanity check of the declared flow types.
This allows us to have some assurance that the flow types are kept in sync with the parser declarations.
This diff also fixes up the gaps in the types that were exposed by the test!
Reviewed By: pieterv
Differential Revision: D31973335
fbshipit-source-id: bc623b43495c8bd482bee300eb621ee9dd50b41f
* convert genESLintVisitorKeys to build off the JSON
Summary: This is just SO much simpler than the C++ preprocessor template.
Reviewed By: pieterv
Differential Revision: D31948465
fbshipit-source-id: 128ce3f60f7e45a9258dc78e4caa9f1b42c36c28
* convert genParserAsserts to build off the JSON
Summary: About as simple - the nice thing is that it's all in one file now.
Reviewed By: pieterv
Differential Revision: D31981502
fbshipit-source-id: ec80ee89c22e309cc560b61444e072beb9632134
* convert genParserNodeTypes to build off the JSON
Summary: much simpler than before - all the logic is centralised
Reviewed By: pieterv
Differential Revision: D31982132
fbshipit-source-id: 06bfdb16a4d79bace762fa50749ea427486a280a
* convert genParserVisitorKeys to build off the JSON
Summary: Much simpler! Almost the same as the eslint visitor keys.
Reviewed By: pieterv
Differential Revision: D31982472
fbshipit-source-id: cc023b912b2d2c7ebe034755500118e8481deefe
* convert genSelectorTypes to build off the JSON
Summary:
The base generation is simpler than before - but I took this codegen A LOT further than before.
The types now cover the following selectors:
- `*` - the wildcard
- `:statement`, `:declaration`, `:pattern`, `:expression`, `:function` - special "class" selectors
- Including proper, automatically generated flow types for correct nodes these will match.
- `Node` - single node selector
- `Node[prop]` node with guaranteed property selector
- Including proper flow types which enforce that the property is non-null!
- the `<selector>:exit` version of all of the above!
I've tested this locally and flow actually handles it very quickly (which surprised me!).
Reviewed By: pieterv
Differential Revision: D31984259
fbshipit-source-id: 641cc23997bff981453c60681d1596ff28f451c8
* Fix path bug on windows in LLVH from LLVM that is fixed there. (#620)
Summary:
LLVH is a forked copy of LLVM. It has not been updated with the latest patches. Microsoft is running into an LLVM bug on Windows when using the [BuildXL](https://github.com/microsoft/buildxl) build engine.
LLVM fixed this with: [[Support] Fix FileNameLength passed to SetFileInformationByHandle](c94004ffdb) a few years ago.
This PR ports that fix to the LLVH forked copy in Hermes.
The LLVM commit has a good description of the issue, but TLDR:
> The rename_internal function used for Windows has a minor bug where the filename length is passed as a character count instead of a byte count.
This change does not affect running Hermes running normally on window as windows ignores the size parameter to the api. This only affects when Hermes runs in a build process that detours/intercepts the rename file api and depens on that parameter. A build process (like the [BuildXL](https://github.com/microsoft/buildxl) engine) would detour/intercept all windows filesystem api's to keep track of file accesses does to guarantee a fast, reliable, cacheable and distributable build yet allow for an over approximation of file dependencies and not overbuild.
Pull Request resolved: https://github.com/facebook/hermes/pull/620
Test Plan:
* This change has been successfully running in LLVM for 3 years.
* This change has been put in the fork of Hermes that react-native-windows uses and tested by various Microsoft developers
Reviewed By: tmikov
Differential Revision: D31999504
Pulled By: neildhar
fbshipit-source-id: 2ef337bb98842e2e2fe13f2ca52ab06e5b48cd22
* Remove false assert from Hermes JSNativeFunctions
Summary:
In Windows, when executing `runtime.instrumentation().createSnapshotToFile(snapshotPath.string())`, we were seeing an error at the now removed assertion because it appears that the linker optimized all calls to the same code.
{F674629822}
Reviewed By: neildhar
Differential Revision: D31996079
fbshipit-source-id: 1e9fbc277772be76068d1a78d4e8cadb876f7fba
* Treat SymbolID barrier as a snapshot barrier
Summary:
`writeBarrier(SymbolID)` looks and behaves exactly like the other
snapshot barriers, since it is only interested in the old value, so its
name is somewhat misleading. Change its name and interface to bring it
in line with the other snapshot write barriers.
This change also inlines the fast path of the write barrier, and adds
the `inYoungGen` check to elide the write barrier, which makes the code
consistent and could be a small perf bump.
Reviewed By: kodafb
Differential Revision: D31879541
fbshipit-source-id: 4df4ae502047d40082ee3fa2f63e1fa2a507fad9
* Garbage collected AST
Summary:
The AST now is garbage collected and managed by `Context`.
Nodes point to other nodes with references (`&Node<'a>`).
`Node` cannot be constructed directly by users,
instead they must use various `Builder` structs and pass them
`Template` structs to initialize new nodes,
which will then be allocated on the GC heap in `Context`.
Nodes themselves are immutable once placed on the GC heap.
Use of the actual `Node`s is facilitated by `GCContext`,
which provides `&'gc Node<'gc>` where `'gc` is the lifetime of the
`GCContext` itself.
Mutating and non-mutating visitors are provided.
Mutating visitor simply returns a new `Node` which is the mutated
AST, and the old AST nodes will be collected on the next GC cycle.
See the top-level comment in ast/mod.rs for more information.
Reviewed By: tmikov
Differential Revision: D31563998
fbshipit-source-id: df6849f6983b17e4d1f10fc83b0f0d90e08b5d92
* Double capacity of chunks
Summary:
Chunks are doubled every new chunk allocated,
with a limit of `MAX_CHUNK_CAPACITY`.
Reviewed By: tmikov
Differential Revision: D31848417
fbshipit-source-id: 26e9ab912fe86a312cbb5ae78e780b5d01cd93cc
* Implement simple garbage collector
Summary:
Garbage collection has three phases:
* Scan all chunks to find any roots by checking occupied entries
with non-zero refcounts
* Start at each root and mark all children recursively with `Visitor`
* Scan all chunks and free all nodes that aren't marked
Reviewed By: tmikov
Differential Revision: D31848416
fbshipit-source-id: ce9056f8e8e43a1df101938c48687a9fb3a917a0
* Add 'gc lifetime to Visitors
Summary:
`Visitor`s might sometimes want to store references to `Node`s while
visiting. To allow this, put a `<'gc>` annotation on `Visitor` so they
can link their knowledge of lifetimes to the lifetime of `Node` references
provided.
Reviewed By: tmikov
Differential Revision: D31930191
fbshipit-source-id: 1b1e01fcccb43ff1d4f0b179bbac33326295eb31
* validator returns std::error::Error
Summary:
It is more convenient if the AST validator uses the source manager to
report the errors and returns a std::error::Error, which can easily be
reported automatically.
Rename the existing function to `validate_tree_pure()` (since it doesn't
modify any state), and implement a simple wrapper `validate_tree()`,
reporting to SourceManager and returning Error.
Reviewed By: avp
Differential Revision: D32012703
fbshipit-source-id: 1401ed1ac99e7fd41b5adfba94dbc79b83bf4ccb
* EASY: write! => writeln!
Summary: .
Reviewed By: avp
Differential Revision: D32038963
fbshipit-source-id: 900064388122c6ecc61be5c0eca27c6ec1a7a8df
* implement ScopedHashMap
Summary: .
Reviewed By: avp
Differential Revision: D31676662
fbshipit-source-id: 815b1c990a5cb3f29487874693bf0c66ad3fbe5f
* EASY: add note(), warning()
Summary: .
Reviewed By: avp
Differential Revision: D32013205
fbshipit-source-id: 6996da61059541999490d530d723f781a2d3f8a2
* EASY: arrow function body can be an expression
Summary:
Add Expression to the allowed node types of
ArrowFunctionExpression.
Reviewed By: avp
Differential Revision: D32013213
fbshipit-source-id: 2a3165d32214527ba2bbb8f7eba5bf41347a15b4
* EASY: expose NodeVariant
Summary: NodeVariant wasn't public.
Reviewed By: avp
Differential Revision: D32013207
fbshipit-source-id: 23d8392798c35dfd94d176ac23061bcb00a84745
* EASY: add "strict mode" setting
Summary: It is not being set by anyone yet.
Reviewed By: avp
Differential Revision: D32013209
fbshipit-source-id: de81ffe9e636d53df145d5598bca5cd943238df7
* EASY: simplify alloc() signature
Summary: lifetimes were redundant.
Reviewed By: avp
Differential Revision: D32013212
fbshipit-source-id: 2f101c451d0271a56343a7ad6d54c8a826d2e5fb
* expose Context::atom_table(), GCContext::ctx()
Summary: These are occasionally needed.
Reviewed By: avp
Differential Revision: D32013206
fbshipit-source-id: 2d686d68d1c8d5380e63ee6d33b73afd4020ca37
* Make NodePtr hashable
Summary: Add shallow equality and hashing.
Reviewed By: avp
Differential Revision: D32013216
fbshipit-source-id: f4a7b36d82557a808a54ef323c096dde2eef33c5
* add NodeRef - shallow wrapper around Node&
Summary:
NodeRef allows to treat Node& as a pointer: hash it and compare it
shallow. It is supposed to be used when we will maintain a hash table
only for the duration of the GC lock.
Reviewed By: avp
Differential Revision: D32013210
fbshipit-source-id: a86bd2cd00cb230198bb12f28644f3912e9398a6
* expose Metadata::range
Summary: Occasionally it is convenient to access the range without the node.
Reviewed By: avp
Differential Revision: D32013215
fbshipit-source-id: 89c6787852a4bd01013682f0ee7d141493930580
* Fix localeCompare null bug (#623)
Summary:
`RequireObjectCoercible` should check for `null` and `undefined`
instead of number and `undefined`.
Pull Request resolved: https://github.com/facebook/hermes/pull/623
Test Plan:
<!--
Demonstrate the code is solid.
Example: The exact commands you ran and their output,
screenshots / videos if the pull request changes the user interface.
-->
This PR fixes a bug where Hermes does not throw a TypeError exception when passed null. This was uncovered while running test262/test/built-ins/String/prototype/toLocaleLowerCase. Prior to the change, 4 tests failed and output was
```EXECUTE_FAILED /Users/mlhfellow/Documents/t/test262/test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T8.js
Uncaught TypeError: String.prototype.localeCompare called on null or undefined
at toLocaleLowerCase (native)
at global (/var/folders/cg/lnpgdmcj7nsg2nfwmx52t97r0000gp/T/S15.5.4.17_A1_T8-dcti5io8.js:234:31)
EXECUTE_FAILED /Users/mlhfellow/Documents/t/test262/test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T6.js
Uncaught TypeError: String.prototype.localeCompare called on null or undefined
at toLocaleLowerCase (native)
at global (/var/folders/cg/lnpgdmcj7nsg2nfwmx52t97r0000gp/T/S15.5.4.17_A1_T6-p56ueggf.js:236:49)
EXECUTE_FAILED /Users/mlhfellow/Documents/t/test262/test/built-ins/String/prototype/toLocaleLowerCase/S15.5.4.17_A1_T7.js
Uncaught TypeError: String.prototype.localeCompare called on null or undefined
at toLocaleLowerCase (native)
at global (/var/folders/cg/lnpgdmcj7nsg2nfwmx52t97r0000gp/T/S15.5.4.17_A1_T7-u8n4zga1.js:236:26)
EXECUTE_FAILED /Users/mlhfellow/Documents/t/test262/test/built-ins/String/prototype/toLocaleLowerCase/this-value-not-obj-coercible.js
Uncaught Test262Error: null Expected a TypeError to be thrown but no exception was thrown at all
```
After changing isNumber to isNull in Intl.cpp, all tests not skipped pass.
```
-----------------------------------
| Results | PASS |
|----------------------+----------|
| Total | 28 |
| Pass | 25 |
| Fail | 0 |
| Skipped | 2 |
| Permanently Skipped | 1 |
| Pass Rate | 100.00% |
-----------------------------------
| Failures | |
|----------------------+----------|
| Compile fail | 0 |
| Compile timeout | 0 |
| Execute fail | 0 |
| Execute timeout | 0 |
-----------------------------------
```
Reviewed By: mhorowitz
Differential Revision: D32035274
Pulled By: neildhar
fbshipit-source-id: 7b3fed81115552a4b339ea676413b9423d29fddc
* Remove write barrier stubs in GCBase
Summary:
Shadowing the implementations of write barriers in subclasses is
riskier, since it's possible that a mistake somewhere causes the no-op
write barrier on GCBase to be invoked instead. This risk is
particularly high with barriers that are hard to get test coverage for,
like the symbol ID barrier.
Reviewed By: kodafb
Differential Revision: D31879542
fbshipit-source-id: 2c66758e8f700cda078fbc4d5646295612eb0b2b
* Use existing downloaded test262 for Intl tests (#624)
Summary:
Pull Request resolved: https://github.com/facebook/hermes/pull/624
Instead of downloading test262 each time, allow the Intl tests to use
an existing downloaded test262. This brings them in line with how our
other test262 runner works.
Reviewed By: mhorowitz
Differential Revision: D32040806
fbshipit-source-id: e6f99934402d9c9c6d70fb58e5439f508dfe9e34
* Add ability to disable the stats timer
Summary:
Recording timing stats for every JS<->C++ transition has some overhead, so add the ability for applications where such transitions are extremely frequent to disable the stats timer.
Use this in the recently added JSI microbenchmark.
Reviewed By: mhorowitz
Differential Revision: D32055120
fbshipit-source-id: 5d173c58e82ea1fbf6fdad2f6b37ab7d4f235f42
* Move markbit assertion in GC
Summary:
The assertion is not valid if the cell is free,
so move the check for `is_free` above the assert.
Reviewed By: tmikov
Differential Revision: D32075395
fbshipit-source-id: 71dc696fd475e3f2220abdfdc5bcad5922ce20f2
* Create PassManager and run optimization passes
Summary:
Add a new crate `pass` for writing and managing optimization passes
over Juno representations.
It exposes `PassManager` and `Pass`, which allow for users to create
and execute optimization pipelines.
To demonstrate that it works, create an `AddNegative` pass
and add it to the pipeline the `juno` CLI uses when given `-O`.
Reviewed By: tmikov
Differential Revision: D31998123
fbshipit-source-id: ffcb0d959b880c318e4f5269406f7b19bd2d6b74
* Avoid emitting extra semicolons for certain statements
Summary:
`if` and related statements were emitting extraneous `;`.
For example, if we have the AST for:
```js
if (x)
y()
else
z()
```
then we should only emit `;` for the `y()` and `z()` statements,
but not for the `if` or either the consequent or alternate.
To do this, change `ends_with_block` (which was only used in this one
place) and make it `stmt_skip_semi`, which indicates whether it's OK
to skip the semicolon on a given statement node. On `if` statements,
we must skip the semicolon because the semicolon will be emitted
when emitting the consequent or alternate. Same goes for `for`, `while`,
etc.
Reviewed By: tmikov
Differential Revision: D31937599
fbshipit-source-id: 1004258fee50e326a537765875782014f45b77ac
* Emit extra decimal point in numeric member expressions
Summary:
To handle cases like `50..toString()` we need to ensure that the
number has a decimal point in it.
The other way to handle this would be to pass a flag through to the C++
function that's doing the work, but given that number literal strings
are typically small and this is rare, special casing in `gen_js` seemed
easier.
Reviewed By: tmikov
Differential Revision: D31967210
fbshipit-source-id: 191c94ded5732e5a5be749ae6f851c9b2a3325f3
* Fix precedence for binary operators
Summary:
Binary operators were not correctly getting offset by `BIN_START`,
leading to incorrect parens between, e.g., `=` and `&&`.
Reviewed By: tmikov
Differential Revision: D31967212
fbshipit-source-id: d705f1f301c028b16f08b14e5a741790eab21321
* Force parentheses when callee of `new` contains a CallExpression
Summary:
In order to distinguish
```
new(foo().bar)
```
and
```
new foo().bar
```
we must detect whether the callee of a `new` has a call in it.
Do this by visiting the subtree and checking it.
In almost all cases the subtree will be very small.
Reviewed By: tmikov
Differential Revision: D31967211
fbshipit-source-id: f3f46b6691a5df5ed3d6bfff43725ed230ccdb4b
* Fix string literal generation character truncation bug
Summary:
`c` wasn't bounds-checked before casing to `u8`, resulting in truncation
on characters like `\u060b`.
Reviewed By: tmikov
Differential Revision: D31967209
fbshipit-source-id: 5965da5d2b592bd2f27043683e69b527b8c2804c
* Use a macro for RuntimeGC kinds
Summary:
Use a macro so that if we ever use the RuntimeGC mechanism again in
the future, we don't accidentally miss places to update. This risk is
particularly high because it is difficult to make sure multiple
available GCs are fully tested, particularly when dealing with things
like minimum and maximum allocation sizes, which may only trigger bugs
under certain configurations (like without compressed pointers).
Reviewed By: kodafb
Differential Revision: D31642786
fbshipit-source-id: acbfe46480d7d6f3a7c6e3d3ed300fafa927c861
* Remove GenGC from RuntimeGC
Reviewed By: avp
Differential Revision: D31673109
fbshipit-source-id: 8a8dd240b32651745cd9fa1bd06bdcebf0d85baf
* Remove GenGC only tests
Summary: Delete tests specific to GenGC.
Reviewed By: avp
Differential Revision: D31674432
fbshipit-source-id: 66112bbd3207e315bded5ed65ef594e997fd28aa
* Pass to reduce conditionals
Summary: Eliminate conditional expressions if the condition is a boolean literal.
Reviewed By: tmikov
Differential Revision: D32075396
fbshipit-source-id: e49807dcdd4dcab0af75e5c666b7c2c6e6bcd4f9
* Namespace builders and templates
Summary: .
Reviewed By: tmikov
Differential Revision: D32104833
fbshipit-source-id: 3e238972b5ba1947f4aafc68c4e53dd07e1bdbb3
* Basic dynamic threshold for concurrent collections
Summary:
Hades currently uses a fixed 75% threshold for starting full
collections. This is very conservative, and results in a large number
of unnecessary collections.
This diff changes the collection threshold so that it is computed
dynamically for concurrent mode, which allows us to dramatically reduce
the number of full collections. However, it doesn't make any change to
incremental mode, since increasing the threshold there needs to be
balanced with increased pause times, and we're not currently set up to
do that easily.
Reviewed By: kodafb
Differential Revision: D31365877
fbshipit-source-id: d6c6dceeb88785e48f8902bbe044b3089d7a918d
* Remove GenGC from the build
Reviewed By: avp
Differential Revision: D31674957
fbshipit-source-id: 6f9f65cc7578e092051e2c6f46872d0a94c0b841
* Delete GenGC source
Reviewed By: dulinriley
Differential Revision: D31675516
fbshipit-source-id: 96151d57da7e2da7dc064db80cfaa97d74bdb4da
* Make target size a moving average
Summary:
Dynamically adjusting the collection threshold means that we operate
much closer to the target size, since we can start collections fairly
late. Since the target size is currently strictly a function of the
amount of live data at the end of the previous collection, it can
fluctuate by a few MB each time it is updated.
Trying to track that number exactly adds extra work, since we need to
constantly compact away segments and then add them back. Instead, we
can use a moving average to smooth out the target size, so that small
fluctuations do not trigger immediate action from the GC.
Reviewed By: kodafb
Differential Revision: D31987201
fbshipit-source-id: d0b1b77ee6781545700ad940ca44512f53882bcf
* Add buffer before compacting in large heaps
Summary:
In large heaps, it is likely that variations in the heap size from one
collection to the next can be very large in terms of MB. However, the
compaction code as written doesn't deal with this well. Currently,
we'll trigger a compaction if the target size drops by more than 1
segment. In small heaps, this is not a concern since it represents a
4MB change.
However, once the heap size is in the hundreds of MB, even with the
moving average added in the previous diff, it is likely that the target
size will vary by more than one segment from one collection to the
next. In that case, it is useful to have a slightly more conservative
compaction criteria, that scales with the size of the heap.
This diff makes it so that the actual size can be up to 5% larger
than the target size.
Reviewed By: kodafb
Differential Revision: D32004981
fbshipit-source-id: 6e8cd26a472fae5aca236a2d91384820b126733d
* Provide more specialized mutation APIs
Reviewed By: tmikov
Differential Revision: D32154281
fbshipit-source-id: 981ba8f2260f88cade52cd7c99ba79c527ed0515
* EASY: Add Empty as ArrayExpression child.
Summary:
This should not fail:
```
var x = {
cs: [10, 20,,],
}
```
Reviewed By: avp
Differential Revision: D32045740
fbshipit-source-id: 1fdfdeb087fa4427819c2cf0b6761f575abc62ff
* fix bugs in NodeRef
Summary:
A ridiculous bug: NideRef::eq() was comparing self as a pointer instead
of self.0 as a pointer. Secondly, it wasn't copyable.
Reviewed By: avp
Differential Revision: D32045742
fbshipit-source-id: 98f519f8c3fa92a0f0e522e1bf258365d684d288
* add Node helpers
Summary:
- Add helpers allowing to treat all function-like nodes the same.
- Add macros for `node_isa!` and `node_cast!`. The existing Rust macro
`matches!` could already be used instead of `node_isa!`, but it is
slightly less convenient, plus we like the symmetry with `node_cast!`.
Reviewed By: avp
Differential Revision: D32013208
fbshipit-source-id: 6d2a5ccccd72cf4d76bff9972ceca57ac5ec9db6
* keep track of number of errors
Summary: We need to be able to tell whether errors occurred.
Reviewed By: avp
Differential Revision: D32044510
fbshipit-source-id: 44027b8d186ec86840b6731fe965ec9ff23a21cc
* --strict-mode and --warn-undefined flags
Summary:
`--strict-mode` forces strict mode over the entire input.
`--warm-undefined` warns about undefined variables in strict mode
functions.
Reviewed By: avp
Differential Revision: D32056904
fbshipit-source-id: 4728bd7302b5f74f8e2394e28e32daba77ce76ab
* new module decl_collector.
Summary:
`decl_collector` collects all declarations in a function and associates
them with scopes. This is necessary because all declarations need to be
hoisted either to the top of the function or the top of their own scope.
This is split for an easier review. It is used by a later diff.
Reviewed By: avp
Differential Revision: D32013211
fbshipit-source-id: 074296f36847fb18896ee355d3495bed2b9390b4
* new module Keywords
Summary:
Keywords is a just a convenient collection of Atoms like "arguments" and
"eval". It is split here for easier review.
Reviewed By: avp
Differential Revision: D32013214
fbshipit-source-id: 0ab38652b3b2b8b574942c2b8cfb36805ee312cd
* SemContext: all semantic resolution data for an AST
Summary:
SemContext contains the semantic resolution data for an AST: lexical
scopes, declarations, mapping from identifiers to declarations
(bindings), etc.
This is not intended to be the final form of this API, because it is not
yet fully understood how it will be used. Also, this form of index based
API is relatively unfamiliar.
Reviewed By: avp
Differential Revision: D32040068
fbshipit-source-id: 3a74fea81ea1de269244919f17ae19747aa5f686
* Semantic resolution
Summary:
The resolver returns a populated SemContext. The ES5 features should be
complete, many ES6 features are lacking.
It should be considered WIP, however barring any critical bugs, it
should be able to land and iteration can happen in following diffs.
There is a profound lack of tests, partly because it is not entirely
clear what the best way of testing would be. Error messages are not
sufficient, perhaps some form of structured printing of all data (that
is what the C++ version did, but it was never used).
Reviewed By: avp
Differential Revision: D32040069
fbshipit-source-id: 2609e3bdbc791004c8ea30b12a27f17fd701fb4f
* check that new.target is used in function scope
Summary: .
Reviewed By: avp
Differential Revision: D32044509
fbshipit-source-id: 6ec390c97227d64f091c8937585b7ccd1d7fa6f3
* validate FunctionExpression
Summary: .
Reviewed By: avp
Differential Revision: D32045741
fbshipit-source-id: fe3394a51a664dba2a0bffee5e72b2b834bef262
* Teach the resolver about well known globals
Summary:
If `warn_undefined` is enabled, pre-define a list of well known common
global properties, to decrease the number of generated warnings.
This is not expected to be used in production, but is useful for
testing. Also note that it does not possibly affect correctness in any
way, it only affects whether an ignorable warning is displayed. So there
is no harm in adding more "well known" globals.
Reviewed By: avp
Differential Revision: D32056903
fbshipit-source-id: a326ca1096b195f6617d992c402085b73964cfe2
* Resolve catch variables
Summary: .
Reviewed By: avp
Differential Revision: D32056902
fbshipit-source-id: 837ba40e80f5b0f1d117cb9c4065c5771133d303
* the renaming
Summary:
- Rename `NodePtr` to `NodeRc`.
- Rename `NodeRef` to `NodePtr`.
- Rename `GCContext` to `GCLock`.
Reviewed By: avp
Differential Revision: D32161281
fbshipit-source-id: a7c18800d086da4fb080e3bc6c06c87fdbc43d6d
* Speed up CircleCI e2e test build (#629)
Summary:
Pull Request resolved: https://github.com/facebook/hermes/pull/629
Our e2e tests are timing out on building RNTester. Speed it up by only
building for x86.
Reviewed By: mhorowitz
Differential Revision: D32153985
fbshipit-source-id: a4a76ed6611d2efd25e3481202216123afcc01e3
* add prettier locally
Summary: Add prettier and format files.
Reviewed By: pieterv
Differential Revision: D32116829
fbshipit-source-id: 24d7ac91d6a58deda41cc91aad569a556dda3946
* scaffold the transformation API
Summary:
This builds on top of the traversal API to create tooling for doing code transforms.
I've scaffolded the actions that will be available to manipulate the AST, and in the following diffs I'll add implementations.
Reviewed By: pieterv
Differential Revision: D32012261
fbshipit-source-id: 14e1a70b1b7c177fd827fe632d6f333b1c228883
* add InsertStatement transformation
Summary:
This adds the first functions for the API `insert(Before|After)Statement`.
These do what they say on the tin - they insert `1..n` nodes before/after the given node.
These functions will properly handle "bodyless" parents like `if (test) statement`, `while (test) statement`, etc, by wrapping in a `BlockStatement`.
Reviewed By: pieterv
Differential Revision: D32093539
fbshipit-source-id: 076d09b106fe3e503b4bbce2f20cc2af3c01f6cc
* add flow types to `hermes-parser` and delete the old transform/traverse code
Summary:
I left this codebase untyped before because it's really javascripty.
But I wanted to make sure I was safely deleting code, so I added some loose flow types.
Reviewed By: pieterv
Differential Revision: D32155234
fbshipit-source-id: 8f2304af8417f3e101516faa8693939d580ff964
* codegen node creation functions
Summary: Reappropriate the build step that was used for the old, incomplete infra to generate strictly typed node creation functions.
Reviewed By: pieterv
Differential Revision: D32155233
fbshipit-source-id: 5da1a9e0e8f3046dd51e28ee748d777a1b0d953a
* Add TransformResult::Removed
Summary: Allow the mutator to remove nodes in Options and Lists.
Reviewed By: tmikov
Differential Revision: D32181146
fbshipit-source-id: b790df47eec7f80d7e21f6b851ffc3a38ac93deb
* Reduce if/else conditionals
Summary: Allow the ReduceConditional pass to also collapse trivial if/else.
Reviewed By: tmikov
Differential Revision: D32181145
fbshipit-source-id: 07bdabcb67bea9a21e8379bffddaba741f4364c6
* Rename GCLock in rustgen
Reviewed By: tmikov
Differential Revision: D32184515
fbshipit-source-id: ff13506b3e56c7afa0f4682ba83ae4453665c280
* Remove external uses of getTopGCScope
Summary:
Remove usage of `getTopGCScope` outside of HandleRootOwner and make
it a protected method. We can instead just expose this functionality
through GCScopeMarkerRAII, which is likely less error prone.
Reviewed By: tmikov
Differential Revision: D26194779
fbshipit-source-id: 80578c22735b314327625fac591194e8ff774a23
* add RemoveStatement mutation
Summary:
Adds implementation and tests for the RemoveStatement mutation
As we discussed - I made the mutation error if you do something silly like
```
if (foo) return 1
^^^^^^^^ remove this
```
Reviewed By: pieterv
Differential Revision: D32190013
fbshipit-source-id: 0bc8b8663ce8bdace94c966a7d17c4262e11ec84
* add ReplaceStatementWithMany mutation
Summary: Adds implementation and tests for the ReplaceStatementWithMany mutation
Reviewed By: pieterv
Differential Revision: D32193526
fbshipit-source-id: d61d7b2ab84525c21bd35f46df30b6f29d3f779f
* Fix missing paren in typecast
Summary:
typecast was missing the closing `)`
Add it to the precedence list as well, to avoid extraneous parens.
Reviewed By: tmikov
Differential Revision: D32218405
fbshipit-source-id: 774dad92df997a95189d06444fb0353025f37114
* add ReplaceNode mutation
Summary:
Adds implementation and tests for the ReplaceNode mutation.
Sadly in order to get strict types for the function - I had to resort to codegen.
Reviewed By: pieterv
Differential Revision: D32195448
fbshipit-source-id: 5c273f308cf9b136e5e4983b5aee4858eb75bf70
* Clean up and simplify Intl test runner
Summary:
Make the following changes:
1. Change blacklist -> skiplist
2. Delete the whitelist entirely (it is unused)
3. Add an overload that just takes `basePath`
4. Fix `LOG_TAG` in the base class, and remove it from subclasses
Reviewed By: mhorowitz
Differential Revision: D32040807
fbshipit-source-id: 9cc1c23b3c28334077738013295d6c36e3bf84f5
* Test builtin functions in Intl tests (#625)
Summary:
Pull Request resolved: https://github.com/facebook/hermes/pull/625
Test the Date, Number, and String built-in functions that call into our
Intl implementation as part of the Android Intl tests.
Reviewed By: avp
Differential Revision: D32040804
fbshipit-source-id: 8b7e2f9be2b636ca378d7cfe4dedd0e48bc797db
* Add license to LLVH
Summary:
Copied from the relevant commit:
c1a0a21337/llvm/LICENSE.TXT
Reviewed By: kodafb
Differential Revision: D32259560
fbshipit-source-id: 7db4d1e97c07621afa2b23d1fb9e59600eebef01
* flow-remove-types implemented in Rust (#595)
Summary:
`flow-remove-types` uses the flow parser generated from OCaml (so in that sense, similar to `hermes-parser`) to strip flow types (with a visitor and codegen in JS). I tried to use hermes to achieve the same thing but without the additional roundtrips to JS.
A benchmark (`react-dom.development.js`) of stripping a 898kb Javascript file:
- `flow-remove-types`: 1.56s
- With this (release build): 53ms
(Not a totally fair comparison because this doesn't involve JS at all, where the final usecase would still be having an npm package that passes a string to a WASM module, executes the above operation, returns the string and sourcemap - these two steps are missing from this benchmark)
This PR is definitely not ready as a drop-in replacement for flow-remove-types, but I think this might be useful:
- ~I'm not sure if the unsupported Juno project is here to stay? This might be an interesting usecase for the already existing parser/ast/codegen Rust infrastructure because I imagine that the actual logic to optimize JS will take quite some time to be developed.~
- ~I haven't been able yet to create a WASM build because I haven't figured out how to create a WASM build of Rust with linked C++.~
- It currently behaves like `flow-remove-types --ignore-uninitialized-fields`.
Pull Request resolved: https://github.com/facebook/hermes/pull/595
Reviewed By: avp
Differential Revision: D31036996
Pulled By: tmikov
fbshipit-source-id: e906283ea32775c6d395e2fc7ffb0ad2867e7351
* Remove usage of bare BasedPointer in GCBase
Summary:
Move towards using `CompressedPointer` everywhere, and just making
`BasedPointer` an internal implementation detail.
Reviewed By: kodafb
Differential Revision: D32238592
fbshipit-source-id: 30eb041448eacd36f7c1b8278024c8c21426a850
* Remove CompressedPointer::getStorageType
Summary: Remove direct access to the storage type of `CompressedPointer`.
Reviewed By: kodafb
Differential Revision: D32238591
fbshipit-source-id: 59dfbde2de1800215ba90b3975e4e366cc0842b0
* Simplify PointerBase
Summary:
`BasedPointer` is now no longer used at all when compressed pointers
are disabled, since all calls to do conversion must go through
`CompressedPointer`. This allows us to compile it out when compressed
pointers are disabled, and to make the conversion functions visible
only to `CompressedPointer`.
Reviewed By: kodafb
Differential Revision: D32238647
fbshipit-source-id: f39dacc9fa0ac17558ed5ac73e20a970578f26d9
* flags for dialect, disabling validation and sema
Summary:
My patience with the structopt limitations is wearing thin. The command
line options are messy, illogical, poorly formatted.
Reviewed By: avp
Differential Revision: D32213815
fbshipit-source-id: 2ef7a81868e9d0287c52f8b3a93286425cad7fe9
* a library for CLI parsing.
Summary:
`command_line` is inspired by the API `llvm::CommandLine`, although it
doesn't follow it closely and the implementations are completely
different.
It is meant to be a very simple library for handling most common tasks,
where simple things work naturally and by default.
It does no tricks and doesn't worry much about memory or performance,
since those hardly matter in command line handling. Unsafe code is used
in only one place in a clearly defined way (for UnsafeCell).
It is intended to replace Structopt in Juno, since Structopt makes some
natural use cases almost impossible, or at least very difficult.
`command_line` works by constructing `Opt<T>` objects, which serve as
holders of the command line argument. This is similar to
`llvm::CommandLine`. A more detailed documentation will be added in
future diffs. Since it is written in Rust, it can rely on
`..Default::default()` to skip default fields, instead of the template
tricks that LLVM is forced to use.
Note that a wrapper similar to Structopt can be written on top of it,
but there probably wouldn't be much point. Even if it looks verbose,
options are not added to a program every day.
Reviewed By: avp
Differential Revision: D32242090
fbshipit-source-id: 470bd1464a80961e1edc7ddbaf9bce4074e70a8c
* replace Structopt with command_line
Summary:
While this is somewhat subjective, with `command_line` I was easily able
to get the behavior I require in every case. There was a little more
typing to create the options initially, but it was not excessive, it is
readable, and it is one time effort.
Reviewed By: avp
Differential Revision: D32242091
fbshipit-source-id: 2a434146f66ad126be8232e9739527f1e969e283
* Detect declare in class properties with variance
Summary:
`declare` wasn't detected as a property declaration when the lookahead
saw `+` or `-`, but class properties can also begin with variance.
Fix#635
Reviewed By: tmikov
Differential Revision: D32264850
fbshipit-source-id: 4339105b2be4094fee0f33f16ee15daffdf3e9a9
* Fix GCC warning about always_inline
Summary:
From the GCC manual
(https://gcc.gnu.org/onlinedocs/gcc-4.6.4/gcc/Function-Attributes.html):
> For functions declared inline, this attribute inlines the function
even if no optimization level was specified.
So the function needs to be declared as inline for the attribute to
apply. Otherwise, it generates this warning:
```
In file included from lib/VM/CMakeFiles/hermesVMRuntime.dir/Unity/unity_3_cxx.cxx:11:
/data/users/neildhar/fbsource/xplat/hermes/lib/VM/JSObject.cpp:674:18: warning: always_inline function might not be inlinable [-Wattributes]
CallResult<bool> getOwnComputedPrimitiveDescriptorImpl(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Reviewed By: mhorowitz
Differential Revision: D32238177
fbshipit-source-id: 97c86db5f0efd87a122f6a3dd9ee25c9b59a4fbc
* Add validation to Flow AST nodes
Summary: Add the validation kind annotations to `def.rs`
Reviewed By: tmikov
Differential Revision: D32223443
fbshipit-source-id: b9d302cf5a5cca7618d8ecbfe7fc30e479e86490
* Delete unused lifetime param in rustgen
Reviewed By: tmikov
Differential Revision: D32288141
fbshipit-source-id: a69df8068b699f31360568bf32e48bb8fa6f47a7
* Align Math.hypot with ES2022
Summary:
According to newer versions of the spec, the coercion to number must
happen strictly before we check for infinity or NaN. We also previously
were not explicitly checking for NaN, so add that as well.
Reviewed By: avp
Differential Revision: D32233283
fbshipit-source-id: d0f0fe2c4faa5beb689faae78a47fad75171a85c
* Update unicode data
Summary: Run `genUnicodeTable.py` to pull in Unicode 14 data.
Reviewed By: mhorowitz
Differential Revision: D32233287
fbshipit-source-id: 81444b5a1d45bc23286e011d76cb46f3e7777338
* Skip failing tests in test262 runner
Summary: Prepare to update pinned test262 version.
Reviewed By: mhorowitz
Differential Revision: D32233286
fbshipit-source-id: f37a04cdf9eb661369868c84919479aaa15d56bb
* Use a lookup table for return opcode
Summary:
Instead of generating a series of branches and relying on the compiler
to do something efficient, we can eliminate the branches entirely by
using a lookup table packed into a `uint32_t`. While this is slightly
more expensive in terms of instructions, it produces no branches and
results in a net perf win.
Reviewed By: tmikov
Differential Revision: D32229103
fbshipit-source-id: 9a332e51d0d910c41e4ee07e3146efbc61618a12
* Add utility functions (#634)
Summary:
In order to complete resolvedLocales in date time format, lookupMatcher is required. As a consequence, lookupMatcher requires toNoUnicodeExtensionsLocale(), bestAvailableLocale() and getDefaultLocale().
These four functions have therefore been added to this PR to help break dependancies between functions. They were previously implemented in the add-locale-case-functions PR.
Pull Request resolved: https://github.com/facebook/hermes/pull/634
Test Plan:
Three of the functions, toNoUnicodeExtensionsLocale(), bestAvailableLocale() and getDefaultLocale() have been tested within the toLocaleLowerCase/toLocaewUpperCase functions. They have passed the relevant hermes test suite tests - test262-to-locale-lowercase.js, to-locale-lowercase.js and to-locale-uppercase.js.
<!--
Demonstrate the code is solid.
Example: The exact commands you ran and their output,
screenshots / videos if the pull request changes the user interface.
-->
Reviewed By: kodafb
Differential Revision: D32299739
Pulled By: neildhar
fbshipit-source-id: 648a945a3f4e1ba3bb0fdf8f1f4ff1292e83ef5f
* Use latest node in e2e test (#636)
Summary:
Some RN dependencies have hard requirements on recent versions of node, causing the test to fail. Make sure we're always using the newest version of node.
Pull Request resolved: https://github.com/facebook/hermes/pull/636
Reviewed By: kodafb
Differential Revision: D32338357
Pulled By: neildhar
fbshipit-source-id: dbe7cbc15cad43a83f526fdb9d65494635668e6d
* Bump versions for 0.10.0 cut
Reviewed By: kodafb
Differential Revision: D32303346
fbshipit-source-id: f75cce197595a39b413a71aa7a330a5f518be4e9
* Implement Object.hasOwn
Summary: Implement `hasOwn` according to the language specs [here](https://tc39.es/proposal-accessible-object-hasownproperty/).
Reviewed By: avp
Differential Revision: D32287266
fbshipit-source-id: 22a8520adfa09a193696a68459c475005a29b752
* add eslint and fix lint errors
Summary:
Adds eslint, some plugins and uses their recommended configs.
This will help enforce better standards across the codebase (like not having unused variables).
Reviewed By: pieterv
Differential Revision: D32259967
fbshipit-source-id: 8dd92fa2016d175b24562a6acbe229f525df10ab
* update node creator codegen to better handle optional props
Summary:
previously the codegen would emit something like `DetachedNode<null | Identifier>` for an optional property - which technically correct, but pretty hard to use.
This just updates the codegen to mark optional properties as optional so that they can be omitted or set to an explicit `null`.
Reviewed By: pieterv
Differential Revision: D32269199
fbshipit-source-id: 24517ed25925fac2b140b837aa822c8b6e1a76df
* fix parent pointer assignment during mutations
Summary:
A bug in the logic - it was not correctly handling parent pointers for shallowly cloned nodes.
Some mutations rely on traversing the tree for you to figure out the best place to perform the mutation - for example inserting before a mutation involves looking for the statement parent.
This would mean that if if you attempted to mutate a shallowly cloned node a broken mutation could easily occur due to incorrect parent pointers.
To fix this the mutations now return the root node of the mutation, and the tooling will traverse the tree and ensure the pointers are correct automatically.
Reviewed By: pieterv
Differential Revision: D32271466
fbshipit-source-id: deb18abce536b52373ed8652d6768959c15c2e94
* fork prettier comment attachment codebase
Summary:
This diff simply forks prettier's comment attachment code.
We want to use their algorithms, but it's not an exposed API.
Pieter has a PR for prettier which exposes it within the formatting custom parser - but if we consume it that way then we'd be stuck always prettier over every file, instead of just on the files with mutations - which is a big waste of time during large transforms.
Reviewed By: pieterv
Differential Revision: D32263740
fbshipit-source-id: 2a3b990978a12bcaf71adc6b7a5e9434c08787c9
* support comments in mutations
Summary:
Using the prettier code forked in the previous diff we can attach comments to the relevant nodes. Because of how the infra was setup - this means almost no work was required to ensure comments are kept.
As we discussed - I added an option (default false) to replacements which allow you to keep the comments when the node is replaced.
Reviewed By: pieterv
Differential Revision: D32301464
fbshipit-source-id: fb729464684751e5568ab4b505c3276857ccd94b
* Remove use of makeHandleInParentScope in JSProxy
Summary:
Use the normal scoping behaviour for GCScope here, since it is easier
to reason about behaviour when Handle creation is tied to the current
GCScope.
Reviewed By: kodafb
Differential Revision: D26332784
fbshipit-source-id: fa3584298f8adadb4a1b0fb2916dfee6dc8ce324
* Fix Intl.DateTimeFormat TimeZone (#627)
Summary:
<!--
Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The two fields below are mandatory.
Before submitting a pull request, please make sure the following is done:
1. Fork [the repository](https://github.com/facebook/hermes) and create your branch from `main`.
2. If you've fixed a bug or added code that should be tested, add tests!
3. Ensure it builds and the test suite passes. [tips](https://github.com/facebook/hermes/blob/HEAD/doc/BuildingAndRunning.md)
4. Format your code with `.../hermes/utils/format.sh`
5. If you haven't already, complete the CLA.
-->
Please feel free to edit anything as necessary.
Picking up where https://github.com/facebook/hermes/pull/571 left off
Error:
![intl_error](https://user-images.githubusercontent.com/30021449/139603461-2ae20e1d-7ead-4fe2-ab9a-da5f647b3d19.png)
Cause: https://github.com/facebook/hermes/pull/627#discussion_r739885220
_Coauthored with anton-patrushev_ 🎉
_A special thanks to hcwesson_ 🙏
<!--
Explain the **motivation** for making this change.
What existing problem does the pull request solve?
-->
Pull Request resolved: https://github.com/facebook/hermes/pull/627
Test Plan:
<!--
Demonstrate the code is solid.
Example: The exact commands you ran and their output,
screenshots / videos if the pull request changes the user interface.
-->
Followed testing instructions provided by mhorowitz https://github.com/facebook/hermes/pull/571#pullrequestreview-773381009
![image](https://user-images.githubusercontent.com/30021449/139600222-316bb2e1-f718-4d15-b02e-281374a26eac.png)
Reviewed By: kodafb
Differential Revision: D32240632
Pulled By: neildhar
fbshipit-source-id: d9582d5908b22addb31516834a58649182da5c64
* Update test262 for Android Intl (#633)
Summary:
Pull Request resolved: https://github.com/facebook/hermes/pull/633
Update the version of test262 used in Android Intl testing, and update
the skiplists.
Reviewed By: mhorowitz
Differential Revision: D32233285
fbshipit-source-id: 8fbd2ce5217c3e8b530e934d3b3675e578f1a7e4
* Fix length and enable tests for Object.hasOwn
Summary:
Length of `Object.hasOwn` should be 2, since it takes two parameters.
test262 caught this, so enable those tests as well.
Reviewed By: tmikov
Differential Revision: D32411696
fbshipit-source-id: 90c9b9aaf196ab9b444223fbb147369eacc803df
* Converting couple of files to LF
Co-authored-by: Pieter Vanderwerff <pieterv@fb.com>
Co-authored-by: Neil Dhar <neildhar@fb.com>
Co-authored-by: Tzvetan Mikov <tmikov@fb.com>
Co-authored-by: Aakash Patel <avp@fb.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sean Ngo <sngo@fb.com>
Co-authored-by: Marc Horowitz <mhorowitz@fb.com>
Co-authored-by: Xuan Huang <jsx@fb.com>
Co-authored-by: Shoaib Meenai <smeenai@fb.com>
Co-authored-by: silva-nick <silva.d.nicholas@gmail.com>
Co-authored-by: Wei Wang (Server LLVM) <wangwei@fb.com>
Co-authored-by: Daniel Andersson <koda@fb.com>
Co-authored-by: Brad Zacher <bradzacher@fb.com>
Co-authored-by: Neil Dhar <neildhar@users.noreply.github.com>
Co-authored-by: Sarah Fluck <sarahjf2047@gmail.com>
Co-authored-by: Nikita Lutsenko <nlutsenko@fb.com>
Co-authored-by: Lee Chang <leehchang@fb.com>
Co-authored-by: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
Co-authored-by: Michael Anthony Leon <fbmal7@fb.com>
Co-authored-by: Caleb Davenport <xcmdprompt@gmail.com>
Co-authored-by: HermesDev <hermesdev@microsoft.com>
Add win32 exports for creating a runtime with a default CrashManager implementation that forwards calls into Windows Error Reporting (Watson) and a crashHandler that can output details (such as callstack) to a file handle.
Summary: This diff bumps the Hermes OSS version to 0.9.0
Reviewed By: avp
Differential Revision: D30681436
fbshipit-source-id: 4fff50623b0d0e54b21f283168b5f9f30470b57a
Summary: This diff bumps the version to 0.8.0
Reviewed By: avp
Differential Revision: D28052090
fbshipit-source-id: b06dd54ab3147a268af53e10c208ea6511c56b8f
Summary: This diff bumps the version to 0.7.0.
Reviewed By: tmikov
Differential Revision: D23640828
fbshipit-source-id: 6f7e830029b2811e9214f6caf3d96f7b9029061f
Summary: This diff bumps the version to 0.6.0.
Reviewed By: mhorowitz
Differential Revision: D22805447
fbshipit-source-id: 242ac1fbbd736b9171b463fa6f00df8d1236ee02
Summary:
{emoji:26a0} _This includes the changes of https://github.com/facebook/hermes/issues/296, so I’ll have to rebase this PR once that lands. The changes that pertain to this PR are in 9da61f7a9d_
Adds hermes-engine-darwin to the npm CI job.
Notably the symbolic links need to be stripped from the framework bundle, as npm by design does not support symbolic links to exist in packages. However, seeing as we already package distinct versions of the framework in distinct npm packages, there isn't any need to support multiple versions of Hermes in a single framework bundle; so this should be fine.
Pull Request resolved: https://github.com/facebook/hermes/pull/297
Test Plan: TODO: I’ll need to backport all changes to Hermes v0.4.1 in order to pull it into RN macOS v0.62. In the meantime I want to see if CI is correctly cutting this package.
Reviewed By: mhorowitz
Differential Revision: D22700399
Pulled By: willholen
fbshipit-source-id: f72aefa3fd98a85c8da3e9a38dfa6be9723a0270
Summary: Pull Request resolved: https://github.com/facebook/hermes/pull/269
Test Plan: Submitted as a GitHub PR. CircleCI artifacts shows the file is included.
Reviewed By: tmikov
Differential Revision: D21939479
Pulled By: willholen
fbshipit-source-id: 883168320b02119e1d99892f99d7942e89cf19dd
Summary: This diff bumps the version to 0.5.0 in anticipation of the next release.
Reviewed By: tmikov
Differential Revision: D20950490
fbshipit-source-id: 6149ab78e49a454ed4c4cee933668fd1e77e896a
Summary:
This diff removes the host runtime from the `hermes-engine` NPM, and adds a separate `hermes-engine-cli` package with these plus additional host tools.
This reduces the installed size from 120MB to 18MB, and gives interested parties more host tools to play with.
Since we're renaming the executable, `test-e2e` fails. We'll have to push a new Hermes release and update the path in RN master.
Reviewed By: tmikov
Differential Revision: D20895983
fbshipit-source-id: 8777c8e84bfe6a6c12561dccd583eeba4b6ed3ff
Summary:
msvcp140.dll and vcruntime140.dll were not being included in the release due to
the package.json. These are required for the Windows binaries.
Reviewed By: mhorowitz
Differential Revision: D18412036
fbshipit-source-id: d09e9f714390bdef28333c6a5047fdc5952010f6
Summary:
This Hermes release primarily updates several APIs in a breaking way to
better support future functionality. It is not compatible with existing
builds of React Native.
Reviewed By: mhorowitz
Differential Revision: D18404106
fbshipit-source-id: 3e9185e64cb685509a4276f27ffe7ab3321901ca
Summary: Update some licenses that were missed in the last passthrough.
Reviewed By: zertosh
Differential Revision: D18123057
fbshipit-source-id: d078c74472a6a794e0f9b12bf011265653f0d954
Summary: This adds the CPP runtime libraries to the npm, for anyone who wishes to use them
Reviewed By: jbower-fb
Differential Revision: D17330055
fbshipit-source-id: dadaa7b42404bb8b0b3ec511b50a39a8b6a414ba
Summary: Neither yarn nor npm cares if declared files are missing from the package, which caused v0.2.0 to be broken. This adds a manual check to ensure the build fails when they're missing.
Reviewed By: jbower-fb
Differential Revision: D17330054
fbshipit-source-id: 770ecd6d0f3102cddef6269c83cb52d611bc4cba