-
Notifications
You must be signed in to change notification settings - Fork 647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hermes relies on deprecated/removed things in newer versions of LLVM #4
Comments
The current hash was chosen to align with our platform, and like for you it's not trivial to update it independently. How many of these issues are there, and how systematic are they? |
This was the main one:
If it's just a few one-liners like this, maybe we can wrap them in |
I don't see any issues with wrapping them like this, or wrapping typedef'ing them if there's many of the same type. External CI is probably a while out still, but this is a good reason to bump its priority. |
@matthargett Would you be able to send these required changes as a PR? I'm looking into whether we can be early adopters of the latest version of the FB platform with an LLVM version from October, and having the source changes ready would make that an easier sell |
We're now using a newer version. Please have a look and let us know how it works! |
Summary: With the `__cxa_throw` hook attached for gnustl, apps will crash if an object without a destructor is thrown: ``` try { throw 0; } catch(...) {} // or class SimpleException {}; try { throw SimpleException{}; } catch(...) {} ``` The issue is that the `__cxa_throw` abi has a destructor function pointer parameter, which may be null according to the documentation. In the gnustl region of the code, Lyra doesn't do a null check before invoking it at the following stack: ``` [???] 0X0 [unknown] + 0x0 +libfbjni.so facebook::lyra::(anonymous namespace)::HijackedExceptionTypeInfo::destructor(void*) (./fbandroid/libraries/fbjni/cxx/lyra/cxa_throw.cpp:213) libgnustl_shared.so 0X759F86716C [unknown] + 0x6116c libgnustl_shared.so 0X759F8DD2E0 _Unwind_DeleteException + 0x18 ``` I wrote a test which repros the issue, and without the fix it crashes with a similar stack: ``` backtrace: #00 pc 00000000 <unknown> #01 pc 00022e01 /data/app/com.facebook.builds.fb4a-vhhkGO4NTAZmUTmfS5wpfw==/lib/arm/libfbjni.so (BuildId: 7a0f9db0801e4f451162c28a392cd35d4ba46b9a) #2 pc 0004fb2d /data/app/com.facebook.lyra.tests-MJNqCBmU7StfOjPoAyfEgg==/lib/arm/libgnustl_shared.so!libgnustl_shared.so (offset 0x4f000) (BuildId: 059ab3ea3d764339fe3ceea2904f54637c89594e) #3 pc 0009b8e3 /data/app/com.facebook.lyra.tests-MJNqCBmU7StfOjPoAyfEgg==/lib/arm/libgnustl_shared.so!libgnustl_shared.so (offset 0x50000) (_Unwind_DeleteException+12) (BuildId: 059ab3ea3d764339fe3ceea2904f54637c89594e) #4 pc 0000aeb9 /data/app/com.facebook.lyra.tests-MJNqCBmU7StfOjPoAyfEgg==/lib/arm/liblyra-tests.so (testThatCxaThrowHookThrowsAndSetsTraceTrivialException(facebook::jni::alias_ref<_jclass*>)+220) (BuildId: 31cc0552d685f1ce9e896d1628656cd97096678d) ``` To fix, add a null check before invoking `mutable_info->orig_dest_`, which originates from the destructor parameter. Reviewed By: smeenai Differential Revision: D20841003 fbshipit-source-id: 907a13ebf994c5bad511b13ab9684efcbc2ce474
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
* 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="https://github.com/PrismJS/prism/commit/3432b4b1e4440d6592ed82b6b5b9e72f660e43a8"><code>3432b4b</code></a> 1.24.0</li> <li><a href="https://github.com/PrismJS/prism/commit/46d07207687fa747018b6676250507a486c0117f"><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="https://github.com/PrismJS/prism/commit/aef7f08df6d6fe1e027ee3ab347c2f391c0c1045"><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="https://github.com/PrismJS/prism/commit/e9477d8369bc59cacc99d1d81abfe3e20b7df258"><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="https://github.com/PrismJS/prism/commit/4b55bd6af88559d430fc195fbe5845364ade8df1"><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="https://github.com/PrismJS/prism/commit/e8d3b50330a325a8291f20d63f60e68a985ae738"><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="https://github.com/PrismJS/prism/commit/bfd7fded29755510571e3abf0846f2a9edf44ef6"><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="https://github.com/PrismJS/prism/commit/14e3868f05f84d05885f5465264c5c72e6ca9490"><code>14e3868</code></a> Fixed reST test</li> <li><a href="https://github.com/PrismJS/prism/commit/a7656de67a07e6415fe0c7149708c8613ff73c12"><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="https://github.com/PrismJS/prism/commit/b4ac0618156a13ab04ff685c5091cb436e8a13a4"><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:[email protected]">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:[email protected]">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:[email protected]">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:[email protected]">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="https://github.com/axios/axios/commit/66c46020bd01b39081259ae74edc2afc283818fa"><code>66c4602</code></a> Merge branch 'master' into release/0.21.4</li> <li><a href="https://github.com/axios/axios/commit/fc15665cc372bc7d2c59901e04c216c590364a67"><code>fc15665</code></a> [Releasing] v0.21.4</li> <li><a href="https://github.com/axios/axios/commit/c2714f08e5db79382b3e059cb6bd52134b320f7d"><code>c2714f0</code></a> [Updating] incorrect JSON syntax in README.md</li> <li><a href="https://github.com/axios/axios/commit/0fc7248cc3db1ea0680b7994eb2ab96b8f6e075f"><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="https://github.com/axios/axios/commit/90205f8ab7f73e6b3a2507bdd67a4f47ef57af9e"><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="https://github.com/axios/axios/commit/92b29d2775bd4cadb3f077fe639fa29c8cf0de8e"><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="https://github.com/axios/axios/commit/4eeb3b17e28581e6931ad7b78dcc025cf3f99bc8"><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="https://github.com/axios/axios/commit/cd7ff042b0b80f6f02e5564d184019131c90cacd"><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="https://github.com/axios/axios/commit/b5a1a67b3c2b20f5d6e78e7e80297e71da4ab74c"><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="https://github.com/axios/axios/commit/4f25380b3188816300d8ec7cad125d5e9ccf57d8"><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: 7256323b6f13525adaf10a8392b7c251e2f…
Our platform's LLVM is based on LLVM 7.0, but hermes expects source that are older. As such, I have to do some manual fix-ups to get hermes to compile with our newer LLVM sources. One example I can share:
This is due to this LLVM commit from last year:
llvm-mirror/llvm@7fe67cc
If we could update the hash LLVM requires to align with the LLVM on my platform, that would be cool.
The text was updated successfully, but these errors were encountered: