hermes-windows/CMakeLists.txt

847 строки
28 KiB
CMake
Исходник Обычный вид История

# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
cmake_minimum_required(VERSION 3.13.0)
# Set the VERSION variables based on the project command
if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif()
Use internal fork of LLVM Summary: Place a fork of LLVM git rev c179d7b006348005d2da228aed4c3c251590baa3 under `external/llvh`(1) and modify the CMake build to use it. I am calling it a "fork", because it is not all of LLVM. Only the parts that are used by Hermes are included, which at this time is only parts of `libLLVMSupporrt`. Most(2) of LLVM build scripts are removed, and it is treated just as another ordinary library. (1) Why `llvh`? To be able to coexist with instances of the "real" LLVM, we must change the namespace, all public symbols containing the `llvm` string and the include directory name. `llvh` seemed as good a name as any. I also considered `llvm-h` and `h-llvm`, but the problem is that they are a superstring of `llvm` so it becomes harder to search for the `llvm` string. Note that the actual rename will happen in a follow up diff. It would be a massive patch. (2) libLLVMSupport relies on pretty elaborate feature detection scripts, which would be painful to duplicate, so for now I have preserved them under external/llvh/cmake. Unfortunately turning LLVM into an ordinary library is not enough, since we were implicitly relying on a lot of functionality provided by the LLVM build scripts. Things like setting default warning flags, easily turning exceptions on and off, etc. I attempted to replace it with Hermes equivalents, which are now provided by `cmake/Hermes.cmake`: - `add_llvm_library/tool()` is replaced by `add_hermes_library/tool()`. - Several `LLVM_xxx` variables are replaced my similar `HERMES_xxx` ones. As a result, building Hermes now requires only checking it out, and running CMake and Ninja. It is a vastly simpler process than before. == Limitations - CMake LTO and ASAN builds aren't supported yet. - The JIT requires the "real" LLVM for disassembly. Reviewed By: avp Differential Revision: D19658656 fbshipit-source-id: 5094d2af45e343973b1aab02c550a18b2bf93a06
2020-02-06 11:30:00 +03:00
# find_package uses <PackageName>_ROOT variables.
if (POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
# Include file check macros honor CMAKE_REQUIRED_LIBRARIES.
if (POLICY CMP0075)
cmake_policy(SET CMP0075 NEW)
endif()
Use internal fork of LLVM Summary: Place a fork of LLVM git rev c179d7b006348005d2da228aed4c3c251590baa3 under `external/llvh`(1) and modify the CMake build to use it. I am calling it a "fork", because it is not all of LLVM. Only the parts that are used by Hermes are included, which at this time is only parts of `libLLVMSupporrt`. Most(2) of LLVM build scripts are removed, and it is treated just as another ordinary library. (1) Why `llvh`? To be able to coexist with instances of the "real" LLVM, we must change the namespace, all public symbols containing the `llvm` string and the include directory name. `llvh` seemed as good a name as any. I also considered `llvm-h` and `h-llvm`, but the problem is that they are a superstring of `llvm` so it becomes harder to search for the `llvm` string. Note that the actual rename will happen in a follow up diff. It would be a massive patch. (2) libLLVMSupport relies on pretty elaborate feature detection scripts, which would be painful to duplicate, so for now I have preserved them under external/llvh/cmake. Unfortunately turning LLVM into an ordinary library is not enough, since we were implicitly relying on a lot of functionality provided by the LLVM build scripts. Things like setting default warning flags, easily turning exceptions on and off, etc. I attempted to replace it with Hermes equivalents, which are now provided by `cmake/Hermes.cmake`: - `add_llvm_library/tool()` is replaced by `add_hermes_library/tool()`. - Several `LLVM_xxx` variables are replaced my similar `HERMES_xxx` ones. As a result, building Hermes now requires only checking it out, and running CMake and Ninja. It is a vastly simpler process than before. == Limitations - CMake LTO and ASAN builds aren't supported yet. - The JIT requires the "real" LLVM for disassembly. Reviewed By: avp Differential Revision: D19658656 fbshipit-source-id: 5094d2af45e343973b1aab02c550a18b2bf93a06
2020-02-06 11:30:00 +03:00
# Only interpret if() arguments as variables or keywords when unquoted.
# CMake emits a warning if this is not set.
if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
# Pick up a workaround for a CMake problem from LLVM r282552.
if(POLICY CMP0057)
cmake_policy(SET CMP0057 NEW)
endif()
# Enable transitive library dependencies
if(POLICY CMP0022)
cmake_policy(SET CMP0022 NEW)
endif()
Build macOS framework and add CocoaPods podspec (#285) Summary: Supersedes https://github.com/facebook/hermes/issues/239 Currently used in our macOS fork of React Native https://github.com/microsoft/react-native-macos/pull/473. (Although we’re using a build of Hermes v0.4.1, as we’re at RN 0.62.0.) * On Apple platforms build a [dynamic] framework bundle when `HERMES_BUILD_APPLE_FRAMEWORK` is set. When set to `FALSE` it will produce a `dylib`, like previously. Defaults to `TRUE`. * On Apple platforms create a debugging symbols bundle. * Add `HERMES_ENABLE_FUZZING`, which is enabled by default. * Add `HERMES_ENABLE_TEST_SUITE`, which is enabled by default. * Add a CocoaPods podspec that can build from source or use a binary. A standalone macOS app that pulls in Hermes as a CocoaPods pod can be found here https://github.com/alloy/TestHermesMaster. ## Framework variant (default) ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── Library │ └── Frameworks │ ├── hermes.framework │ │ ├── Headers -> Versions/Current/Headers │ │ ├── Resources -> Versions/Current/Resources │ │ ├── Versions │ │ │ ├── 0 │ │ │ │ ├── Headers │ │ │ │ │ ├── CompileJS.h │ │ │ │ │ ├── DebuggerAPI.h │ │ │ │ │ ├── Public │ │ │ │ │ │ ├── Buffer.h │ │ │ │ │ │ ├── CrashManager.h │ │ │ │ │ │ ├── CtorConfig.h │ │ │ │ │ │ ├── DebuggerTypes.h │ │ │ │ │ │ ├── GCConfig.h │ │ │ │ │ │ ├── GCTripwireContext.h │ │ │ │ │ │ └── RuntimeConfig.h │ │ │ │ │ ├── SynthTrace.h │ │ │ │ │ ├── SynthTraceParser.h │ │ │ │ │ ├── TraceInterpreter.h │ │ │ │ │ ├── TracingRuntime.h │ │ │ │ │ ├── hermes.h │ │ │ │ │ └── hermes_tracing.h │ │ │ │ ├── Resources │ │ │ │ │ └── Info.plist │ │ │ │ └── hermes │ │ │ └── Current -> 0 │ │ └── hermes -> Versions/Current/hermes │ └── hermes.framework.dSYM │ └── Contents │ ├── Info.plist │ └── Resources │ └── DWARF │ └── hermes ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm └── include ├── hermes │ ├── CompileJS.h │ ├── DebuggerAPI.h │ ├── Public │ │ ├── Buffer.h │ │ ├── CrashManager.h │ │ ├── CtorConfig.h │ │ ├── DebuggerTypes.h │ │ ├── GCConfig.h │ │ ├── GCTripwireContext.h │ │ └── RuntimeConfig.h │ ├── SynthTrace.h │ ├── SynthTraceParser.h │ ├── TraceInterpreter.h │ ├── TracingRuntime.h │ ├── hermes.h │ └── hermes_tracing.h └── jsi ├── JSIDynamic.h ├── decorator.h ├── instrumentation.h ├── jsi-inl.h ├── jsi.h ├── jsilib.h └── threadsafe.h ``` # dylib variant ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=false -DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm ├── include │ ├── hermes │ │ ├── CompileJS.h │ │ ├── DebuggerAPI.h │ │ ├── Public │ │ │ ├── Buffer.h │ │ │ ├── CrashManager.h │ │ │ ├── CtorConfig.h │ │ │ ├── DebuggerTypes.h │ │ │ ├── GCConfig.h │ │ │ ├── GCTripwireContext.h │ │ │ └── RuntimeConfig.h │ │ ├── SynthTrace.h │ │ ├── SynthTraceParser.h │ │ ├── TraceInterpreter.h │ │ ├── TracingRuntime.h │ │ ├── hermes.h │ │ └── hermes_tracing.h │ └── jsi │ ├── JSIDynamic.h │ ├── decorator.h │ ├── instrumentation.h │ ├── jsi-inl.h │ ├── jsi.h │ ├── jsilib.h │ └── threadsafe.h └── lib ├── libhermes.dylib └── libhermes.dylib.dSYM └── Contents ├── Info.plist └── Resources └── DWARF └── libhermes.dylib ``` Pull Request resolved: https://github.com/facebook/hermes/pull/285 Reviewed By: willholen Differential Revision: D22398354 Pulled By: mhorowitz fbshipit-source-id: 732524275cf273866171fc6e2ac2acb062185fbd
2020-07-09 03:13:30 +03:00
# Allow reading the LOCATION property of a target to determine the eventual
# location of build targets. This is needed when building the debugging symbols
# bundles for Apple platforms.
if (POLICY CMP0026)
cmake_policy(SET CMP0026 OLD)
endif()
Use internal fork of LLVM Summary: Place a fork of LLVM git rev c179d7b006348005d2da228aed4c3c251590baa3 under `external/llvh`(1) and modify the CMake build to use it. I am calling it a "fork", because it is not all of LLVM. Only the parts that are used by Hermes are included, which at this time is only parts of `libLLVMSupporrt`. Most(2) of LLVM build scripts are removed, and it is treated just as another ordinary library. (1) Why `llvh`? To be able to coexist with instances of the "real" LLVM, we must change the namespace, all public symbols containing the `llvm` string and the include directory name. `llvh` seemed as good a name as any. I also considered `llvm-h` and `h-llvm`, but the problem is that they are a superstring of `llvm` so it becomes harder to search for the `llvm` string. Note that the actual rename will happen in a follow up diff. It would be a massive patch. (2) libLLVMSupport relies on pretty elaborate feature detection scripts, which would be painful to duplicate, so for now I have preserved them under external/llvh/cmake. Unfortunately turning LLVM into an ordinary library is not enough, since we were implicitly relying on a lot of functionality provided by the LLVM build scripts. Things like setting default warning flags, easily turning exceptions on and off, etc. I attempted to replace it with Hermes equivalents, which are now provided by `cmake/Hermes.cmake`: - `add_llvm_library/tool()` is replaced by `add_hermes_library/tool()`. - Several `LLVM_xxx` variables are replaced my similar `HERMES_xxx` ones. As a result, building Hermes now requires only checking it out, and running CMake and Ninja. It is a vastly simpler process than before. == Limitations - CMake LTO and ASAN builds aren't supported yet. - The JIT requires the "real" LLVM for disassembly. Reviewed By: avp Differential Revision: D19658656 fbshipit-source-id: 5094d2af45e343973b1aab02c550a18b2bf93a06
2020-02-06 11:30:00 +03:00
Build Hermes for iOS (#332) Summary: This PR allows building and running Hermes on iOS devices. It extends the prior work done by alloy that enabled Hermes to run on MacOS. In a nutshell, the Hermes podspec was extended to include a dedicated framework for iOS devices. That framework itself is a universal framework that includes binaries for different iOS architectures and an iPhone simulator. Every target is built into `build_<name>`, e.g. `build_iphoneos` and `build_iphonesimulator`. This convention (and helpers that I have created) allows for quick and easy extension to support iPad as well (and probably should happen as a part of this or next PR). Here's dump of `destroot` folder to give you an idea how frameworks are located: ``` destroot/Library/Frameworks ├── iphoneos │ ├── hermes.framework │ └── hermes.framework.dSYM ├── iphonesimulator │ ├── hermes.framework │ └── hermes.framework.dSYM └── macosx ├── hermes.framework └── hermes.framework.dSYM ``` Things work locally and the test mobile application prints "Hello World" just fine. I have started an appropriate discussion regarding them around the lines where the todos are located. As a follow-up, ## Follow-up - [ ] a PR to React Native to allow using Hermes as a default engine - [ ] https://github.com/facebook/hermes/pull/332#issuecomment-678109796 ## Todo - [x] https://github.com/facebook/hermes/pull/332#issuecomment-678111329 Pull Request resolved: https://github.com/facebook/hermes/pull/332 Test Plan: 1. Clone the project 2. `cd test/ApplePlatformsIntegrationTestApp/` && `pod install` 3. Open `ApplePlatformsIntegrationTestApp.xcworkspace` 4. Choose `ApplePlatformsIntegrationTestMobileApp` target 5. Run on a device or a simulator Reviewed By: willholen Differential Revision: D23320554 Pulled By: mhorowitz fbshipit-source-id: 806c98257904df426a76b441954061a261f97e86
2020-09-09 05:19:09 +03:00
# Has to be set before `project` as per documentation
# https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_SYSROOT.html
set(CMAKE_OSX_SYSROOT ${HERMES_APPLE_TARGET_PLATFORM})
if(HERMES_APPLE_TARGET_PLATFORM MATCHES "catalyst")
set(CMAKE_OSX_SYSROOT "macosx")
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-target x86_64-arm64-apple-ios14.0-macabi -isystem ${CMAKE_OSX_SYSROOT}/System/iOSSupport/usr/include")
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-target x86_64-arm64-apple-ios14.0-macabi -isystem ${CMAKE_OSX_SYSROOT}/System/iOSSupport/usr/include")
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
set(THREADS_PREFER_PTHREAD_FLAG ON)
endif()
Build macOS framework and add CocoaPods podspec (#285) Summary: Supersedes https://github.com/facebook/hermes/issues/239 Currently used in our macOS fork of React Native https://github.com/microsoft/react-native-macos/pull/473. (Although we’re using a build of Hermes v0.4.1, as we’re at RN 0.62.0.) * On Apple platforms build a [dynamic] framework bundle when `HERMES_BUILD_APPLE_FRAMEWORK` is set. When set to `FALSE` it will produce a `dylib`, like previously. Defaults to `TRUE`. * On Apple platforms create a debugging symbols bundle. * Add `HERMES_ENABLE_FUZZING`, which is enabled by default. * Add `HERMES_ENABLE_TEST_SUITE`, which is enabled by default. * Add a CocoaPods podspec that can build from source or use a binary. A standalone macOS app that pulls in Hermes as a CocoaPods pod can be found here https://github.com/alloy/TestHermesMaster. ## Framework variant (default) ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── Library │ └── Frameworks │ ├── hermes.framework │ │ ├── Headers -> Versions/Current/Headers │ │ ├── Resources -> Versions/Current/Resources │ │ ├── Versions │ │ │ ├── 0 │ │ │ │ ├── Headers │ │ │ │ │ ├── CompileJS.h │ │ │ │ │ ├── DebuggerAPI.h │ │ │ │ │ ├── Public │ │ │ │ │ │ ├── Buffer.h │ │ │ │ │ │ ├── CrashManager.h │ │ │ │ │ │ ├── CtorConfig.h │ │ │ │ │ │ ├── DebuggerTypes.h │ │ │ │ │ │ ├── GCConfig.h │ │ │ │ │ │ ├── GCTripwireContext.h │ │ │ │ │ │ └── RuntimeConfig.h │ │ │ │ │ ├── SynthTrace.h │ │ │ │ │ ├── SynthTraceParser.h │ │ │ │ │ ├── TraceInterpreter.h │ │ │ │ │ ├── TracingRuntime.h │ │ │ │ │ ├── hermes.h │ │ │ │ │ └── hermes_tracing.h │ │ │ │ ├── Resources │ │ │ │ │ └── Info.plist │ │ │ │ └── hermes │ │ │ └── Current -> 0 │ │ └── hermes -> Versions/Current/hermes │ └── hermes.framework.dSYM │ └── Contents │ ├── Info.plist │ └── Resources │ └── DWARF │ └── hermes ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm └── include ├── hermes │ ├── CompileJS.h │ ├── DebuggerAPI.h │ ├── Public │ │ ├── Buffer.h │ │ ├── CrashManager.h │ │ ├── CtorConfig.h │ │ ├── DebuggerTypes.h │ │ ├── GCConfig.h │ │ ├── GCTripwireContext.h │ │ └── RuntimeConfig.h │ ├── SynthTrace.h │ ├── SynthTraceParser.h │ ├── TraceInterpreter.h │ ├── TracingRuntime.h │ ├── hermes.h │ └── hermes_tracing.h └── jsi ├── JSIDynamic.h ├── decorator.h ├── instrumentation.h ├── jsi-inl.h ├── jsi.h ├── jsilib.h └── threadsafe.h ``` # dylib variant ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=false -DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm ├── include │ ├── hermes │ │ ├── CompileJS.h │ │ ├── DebuggerAPI.h │ │ ├── Public │ │ │ ├── Buffer.h │ │ │ ├── CrashManager.h │ │ │ ├── CtorConfig.h │ │ │ ├── DebuggerTypes.h │ │ │ ├── GCConfig.h │ │ │ ├── GCTripwireContext.h │ │ │ └── RuntimeConfig.h │ │ ├── SynthTrace.h │ │ ├── SynthTraceParser.h │ │ ├── TraceInterpreter.h │ │ ├── TracingRuntime.h │ │ ├── hermes.h │ │ └── hermes_tracing.h │ └── jsi │ ├── JSIDynamic.h │ ├── decorator.h │ ├── instrumentation.h │ ├── jsi-inl.h │ ├── jsi.h │ ├── jsilib.h │ └── threadsafe.h └── lib ├── libhermes.dylib └── libhermes.dylib.dSYM └── Contents ├── Info.plist └── Resources └── DWARF └── libhermes.dylib ``` Pull Request resolved: https://github.com/facebook/hermes/pull/285 Reviewed By: willholen Differential Revision: D22398354 Pulled By: mhorowitz fbshipit-source-id: 732524275cf273866171fc6e2ac2acb062185fbd
2020-07-09 03:13:30 +03:00
# This must be consistent with the release_version in:
# - android/build.gradle
# - npm/package.json
# - hermes-engine.podspec
project(Hermes
Implement new rules for release versions (#133) ## 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.
2022-09-30 06:54:52 +03:00
VERSION 0.12.0
LANGUAGES C CXX)
Use internal fork of LLVM Summary: Place a fork of LLVM git rev c179d7b006348005d2da228aed4c3c251590baa3 under `external/llvh`(1) and modify the CMake build to use it. I am calling it a "fork", because it is not all of LLVM. Only the parts that are used by Hermes are included, which at this time is only parts of `libLLVMSupporrt`. Most(2) of LLVM build scripts are removed, and it is treated just as another ordinary library. (1) Why `llvh`? To be able to coexist with instances of the "real" LLVM, we must change the namespace, all public symbols containing the `llvm` string and the include directory name. `llvh` seemed as good a name as any. I also considered `llvm-h` and `h-llvm`, but the problem is that they are a superstring of `llvm` so it becomes harder to search for the `llvm` string. Note that the actual rename will happen in a follow up diff. It would be a massive patch. (2) libLLVMSupport relies on pretty elaborate feature detection scripts, which would be painful to duplicate, so for now I have preserved them under external/llvh/cmake. Unfortunately turning LLVM into an ordinary library is not enough, since we were implicitly relying on a lot of functionality provided by the LLVM build scripts. Things like setting default warning flags, easily turning exceptions on and off, etc. I attempted to replace it with Hermes equivalents, which are now provided by `cmake/Hermes.cmake`: - `add_llvm_library/tool()` is replaced by `add_hermes_library/tool()`. - Several `LLVM_xxx` variables are replaced my similar `HERMES_xxx` ones. As a result, building Hermes now requires only checking it out, and running CMake and Ninja. It is a vastly simpler process than before. == Limitations - CMake LTO and ASAN builds aren't supported yet. - The JIT requires the "real" LLVM for disassembly. Reviewed By: avp Differential Revision: D19658656 fbshipit-source-id: 5094d2af45e343973b1aab02c550a18b2bf93a06
2020-02-06 11:30:00 +03:00
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")
set(LLVH_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/llvh)
include(Hermes)
include(Lit)
# This is not a cache variable so that it is recomputed when the project
# version is updated.
if(NOT DEFINED HERMES_RELEASE_VERSION)
set(HERMES_RELEASE_VERSION ${PROJECT_VERSION})
endif()
Implement new rules for release versions (#133) ## 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.
2022-09-30 06:54:52 +03:00
# The version that we put inside of DLL files
if(NOT DEFINED HERMES_FILE_VERSION)
set(HERMES_FILE_VERSION "${PROJECT_VERSION}.0")
endif()
# The file version convertible to number representation.
# We must replace dots with commas.
string(REPLACE "." "," HERMES_FILE_VERSION_BIN ${HERMES_FILE_VERSION})
find_package(Python COMPONENTS Interpreter)
if (NOT Python_Interpreter_FOUND)
message(FATAL_ERROR "Unable to find Python interpreter, required for builds and testing.
Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
endif()
# Project options.
set(HERMES_IS_ANDROID OFF CACHE BOOL
"Building for Android")
set(HERMES_IS_MOBILE_BUILD ${HERMES_IS_ANDROID} CACHE BOOL
"Building for a mobile device")
set(HERMESVM_GCKIND HADES
CACHE STRING
Merging Hermes v0.10 into our fork (#58) * 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> &amp; <strong>Mathematica</strong> &amp; <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 &amp; 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: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 &quot;synchronous&quot; and &quot;runWhen&quot; 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 &quot;synchronous&quot; and &quot;runWhen&quot; 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: 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="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366">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="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366">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="https://www.github.com/gulpjs/glob-parent/commit/843f8de1c177e9a5c06c4cfd2349ca5207168e00">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="https://www.github.com/gulpjs/glob-parent/commit/3e9f04a3b4349db7e1962d87c9a7398cda51f339">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 &lt;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="https://www.github.com/gulpjs/glob-parent/commit/32f6d52663b7addac38d0dff570d8127edf03f47">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 &lt;10 support (<a href="https://www.github.com/gulpjs/glob-parent/commit/e83d0c5a411947cf69eb58f36349db80439c606f">e83d0c5</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/gulpjs/glob-parent/commit/eb2c439de448c779b450472e591a2bc9e37e9668"><code>eb2c439</code></a> chore: update changelog</li> <li><a href="https://github.com/gulpjs/glob-parent/commit/12bcb6c45c942e2d05fc1e6ff5402e72555b54b6"><code>12bcb6c</code></a> chore: release 5.1.2</li> <li><a href="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366"><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="https://github.com/gulpjs/glob-parent/commit/0b014a7962789b2d8f2cf0b6311f40667aecd62c"><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="https://github.com/gulpjs/glob-parent/commit/2b24ebd64b2a045aa167c825376335555da139fd"><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](https://github.com/llvm-mirror/llvm/commit/c94004ffdb1ee37b3c4e762e4e7576cc3844d79b) 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: https://github.com/llvm/llvm-project/blob/c1a0a213378a458fbea1a5c77b315c7dce08fd05/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>
2021-11-30 20:56:51 +03:00
"HermesVM GC type: either MALLOC or HADES")
# Hermes VM opcode stats profiling
set(HERMESVM_PROFILER_OPCODE OFF CACHE BOOL
"Enable opcode stats profiling in hermes VM")
# Hermes VM basic block profiling
set(HERMESVM_PROFILER_BB OFF CACHE BOOL
"Enable basic block profiling in hermes VM")
# Hermes VM JS Function profiling
set(HERMESVM_PROFILER_JSFUNCTION OFF CACHE BOOL
"Enable JS Function profiling in hermes VM")
# Hermes VM native call profiling
set(HERMESVM_PROFILER_NATIVECALL OFF CACHE BOOL
"Enable native call profiling in hermes VM")
CHECK_CXX_SOURCE_COMPILES(
"int main() { void *p = &&label; goto *p; label: return 0; }"
HAVE_COMPUTED_GOTO)
if(HAVE_COMPUTED_GOTO)
set(DEFAULT_INTERPRETER_THREADING ON)
else()
set(DEFAULT_INTERPRETER_THREADING OFF)
endif()
set(HERMESVM_INDIRECT_THREADING ${DEFAULT_INTERPRETER_THREADING} CACHE BOOL
"Enable the indirect threaded interpreter")
set(HERMESVM_ALLOW_COMPRESSED_POINTERS ON CACHE BOOL
"Enable compressed pointers. If this is on and the target is a 64-bit build, compressed pointers will be used.")
if(APPLE)
set(DEFAULT_CONTIGUOUS_HEAP OFF)
else()
set(DEFAULT_CONTIGUOUS_HEAP ON)
endif()
set(HERMESVM_ALLOW_CONTIGUOUS_HEAP ${DEFAULT_CONTIGUOUS_HEAP} CACHE BOOL
"If this is on and compressed pointers are used, the heap will be allocated in a contiguous 4GB region.")
set(HERMESVM_ALLOW_HUGE_PAGES OFF CACHE BOOL
"Enable huge pages to back the GC managed heap. Only useful on Linux.")
# Note that smaller heap segments will lower the maximum number of properties
# that can be stored in an object.
set(HERMESVM_HEAP_SEGMENT_SIZE_KB 4096
CACHE STRING
"Size of segments in the GC managed heap in KB. Must be a power of 2.")
set(HERMESVM_ALLOW_CONCURRENT_GC ON CACHE BOOL
"Enable concurrency in the GC for 64-bit builds.")
Merging Hermes v0.10 into our fork (#58) * 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> &amp; <strong>Mathematica</strong> &amp; <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 &amp; 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: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 &quot;synchronous&quot; and &quot;runWhen&quot; 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 &quot;synchronous&quot; and &quot;runWhen&quot; 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: 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="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366">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="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366">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="https://www.github.com/gulpjs/glob-parent/commit/843f8de1c177e9a5c06c4cfd2349ca5207168e00">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="https://www.github.com/gulpjs/glob-parent/commit/3e9f04a3b4349db7e1962d87c9a7398cda51f339">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 &lt;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="https://www.github.com/gulpjs/glob-parent/commit/32f6d52663b7addac38d0dff570d8127edf03f47">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 &lt;10 support (<a href="https://www.github.com/gulpjs/glob-parent/commit/e83d0c5a411947cf69eb58f36349db80439c606f">e83d0c5</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/gulpjs/glob-parent/commit/eb2c439de448c779b450472e591a2bc9e37e9668"><code>eb2c439</code></a> chore: update changelog</li> <li><a href="https://github.com/gulpjs/glob-parent/commit/12bcb6c45c942e2d05fc1e6ff5402e72555b54b6"><code>12bcb6c</code></a> chore: release 5.1.2</li> <li><a href="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366"><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="https://github.com/gulpjs/glob-parent/commit/0b014a7962789b2d8f2cf0b6311f40667aecd62c"><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="https://github.com/gulpjs/glob-parent/commit/2b24ebd64b2a045aa167c825376335555da139fd"><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](https://github.com/llvm-mirror/llvm/commit/c94004ffdb1ee37b3c4e762e4e7576cc3844d79b) 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: https://github.com/llvm/llvm-project/blob/c1a0a213378a458fbea1a5c77b315c7dce08fd05/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>
2021-11-30 20:56:51 +03:00
set(HERMESVM_ALLOW_INLINE_ASM ON CACHE BOOL
"Allow the use of inline assembly in VM code.")
set(HERMESVM_API_TRACE_ANDROID_REPLAY OFF CACHE BOOL
"Simulate Android config on Linux in API tracing.")
# Hermes VM Handle sanitization (moving the heap after every alloc)
set(HERMESVM_SANITIZE_HANDLES OFF CACHE BOOL
"Enable Handle sanitization")
set(HERMESVM_CRASH_TRACE OFF CACHE BOOL
"Enable recording of instructions for crash debugging depending on VMExperiments")
# Enable Address Sanitizer
set(HERMES_ENABLE_ADDRESS_SANITIZER OFF CACHE BOOL
"Enable -fsanitize=address")
# Enable Undefined Behavior Sanitizer
set(HERMES_ENABLE_UNDEFINED_BEHAVIOR_SANITIZER OFF CACHE BOOL
"Enable -fsanitize=undefined")
# Enable Thread Sanitizer
set(HERMES_ENABLE_THREAD_SANITIZER OFF CACHE BOOL
"Enable -fsanitize=thread")
# Enable Trace PC Guard
set(HERMES_ENABLE_TRACE_PC_GUARD OFF CACHE BOOL
"Enable -fsanitize-coverage=trace-pc-guard")
set(HERMES_ENABLE_CODE_COVERAGE OFF CACHE BOOL
"Enables code coverage to be collected from binaries. Coverage output will be placed in a subdirectory called \"coverage\" of the build directory.")
set(HERMES_ENABLE_LIBFUZZER OFF CACHE BOOL
"Enable libfuzzer")
set(HERMES_ENABLE_FUZZILLI OFF CACHE BOOL
"Enable fuzzilli")
Build macOS framework and add CocoaPods podspec (#285) Summary: Supersedes https://github.com/facebook/hermes/issues/239 Currently used in our macOS fork of React Native https://github.com/microsoft/react-native-macos/pull/473. (Although we’re using a build of Hermes v0.4.1, as we’re at RN 0.62.0.) * On Apple platforms build a [dynamic] framework bundle when `HERMES_BUILD_APPLE_FRAMEWORK` is set. When set to `FALSE` it will produce a `dylib`, like previously. Defaults to `TRUE`. * On Apple platforms create a debugging symbols bundle. * Add `HERMES_ENABLE_FUZZING`, which is enabled by default. * Add `HERMES_ENABLE_TEST_SUITE`, which is enabled by default. * Add a CocoaPods podspec that can build from source or use a binary. A standalone macOS app that pulls in Hermes as a CocoaPods pod can be found here https://github.com/alloy/TestHermesMaster. ## Framework variant (default) ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── Library │ └── Frameworks │ ├── hermes.framework │ │ ├── Headers -> Versions/Current/Headers │ │ ├── Resources -> Versions/Current/Resources │ │ ├── Versions │ │ │ ├── 0 │ │ │ │ ├── Headers │ │ │ │ │ ├── CompileJS.h │ │ │ │ │ ├── DebuggerAPI.h │ │ │ │ │ ├── Public │ │ │ │ │ │ ├── Buffer.h │ │ │ │ │ │ ├── CrashManager.h │ │ │ │ │ │ ├── CtorConfig.h │ │ │ │ │ │ ├── DebuggerTypes.h │ │ │ │ │ │ ├── GCConfig.h │ │ │ │ │ │ ├── GCTripwireContext.h │ │ │ │ │ │ └── RuntimeConfig.h │ │ │ │ │ ├── SynthTrace.h │ │ │ │ │ ├── SynthTraceParser.h │ │ │ │ │ ├── TraceInterpreter.h │ │ │ │ │ ├── TracingRuntime.h │ │ │ │ │ ├── hermes.h │ │ │ │ │ └── hermes_tracing.h │ │ │ │ ├── Resources │ │ │ │ │ └── Info.plist │ │ │ │ └── hermes │ │ │ └── Current -> 0 │ │ └── hermes -> Versions/Current/hermes │ └── hermes.framework.dSYM │ └── Contents │ ├── Info.plist │ └── Resources │ └── DWARF │ └── hermes ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm └── include ├── hermes │ ├── CompileJS.h │ ├── DebuggerAPI.h │ ├── Public │ │ ├── Buffer.h │ │ ├── CrashManager.h │ │ ├── CtorConfig.h │ │ ├── DebuggerTypes.h │ │ ├── GCConfig.h │ │ ├── GCTripwireContext.h │ │ └── RuntimeConfig.h │ ├── SynthTrace.h │ ├── SynthTraceParser.h │ ├── TraceInterpreter.h │ ├── TracingRuntime.h │ ├── hermes.h │ └── hermes_tracing.h └── jsi ├── JSIDynamic.h ├── decorator.h ├── instrumentation.h ├── jsi-inl.h ├── jsi.h ├── jsilib.h └── threadsafe.h ``` # dylib variant ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=false -DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm ├── include │ ├── hermes │ │ ├── CompileJS.h │ │ ├── DebuggerAPI.h │ │ ├── Public │ │ │ ├── Buffer.h │ │ │ ├── CrashManager.h │ │ │ ├── CtorConfig.h │ │ │ ├── DebuggerTypes.h │ │ │ ├── GCConfig.h │ │ │ ├── GCTripwireContext.h │ │ │ └── RuntimeConfig.h │ │ ├── SynthTrace.h │ │ ├── SynthTraceParser.h │ │ ├── TraceInterpreter.h │ │ ├── TracingRuntime.h │ │ ├── hermes.h │ │ └── hermes_tracing.h │ └── jsi │ ├── JSIDynamic.h │ ├── decorator.h │ ├── instrumentation.h │ ├── jsi-inl.h │ ├── jsi.h │ ├── jsilib.h │ └── threadsafe.h └── lib ├── libhermes.dylib └── libhermes.dylib.dSYM └── Contents ├── Info.plist └── Resources └── DWARF └── libhermes.dylib ``` Pull Request resolved: https://github.com/facebook/hermes/pull/285 Reviewed By: willholen Differential Revision: D22398354 Pulled By: mhorowitz fbshipit-source-id: 732524275cf273866171fc6e2ac2acb062185fbd
2020-07-09 03:13:30 +03:00
Do not build cli tools for iphone targets (#354) Summary: Currently (in `v0.7.0`) we build the CLI tools for both `iphone` and `macos` targets, which means that, when installing into the same location, cmake will skip installing the CLI tools from the second build. In our current situation, the second installation is the macOS build, which is really the only target from which we want CLI tools. ``` $ tar -zxvf hermes-engine-darwin-0.7.0.tgz $ file package/destroot/bin/hermesc package/destroot/bin/hermesc: Mach-O universal binary with 3 architectures: [arm_v7:Mach-O executable arm_v7] [arm_v7s:Mach-O executable arm_v7s] [arm64] package/destroot/bin/hermesc (for architecture armv7): Mach-O executable arm_v7 package/destroot/bin/hermesc (for architecture armv7s): Mach-O executable arm_v7s package/destroot/bin/hermesc (for architecture arm64): Mach-O 64-bit executable arm64 ``` Put differently, nobody runs `hermesc` on iOS, we always only want the macOS builds of these. ---- I opted to make building CLI tools a simple cmake option and then use that from the apple builds to control wether or not to include them. Pull Request resolved: https://github.com/facebook/hermes/pull/354 Test Plan: With the `hermes-engine-darwin-0.7.0.tgz` artefact of this `npm` CI job: ``` $ tar -zxvf hermes-engine-darwin-0.7.0.tgz $ file package/destroot/bin/hermesc package/destroot/bin/hermesc: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64] package/destroot/bin/hermesc (for architecture x86_64): Mach-O 64-bit executable x86_64 package/destroot/bin/hermesc (for architecture arm64): Mach-O 64-bit executable arm64 ``` Reviewed By: tmikov Differential Revision: D23824972 Pulled By: Huxpro fbshipit-source-id: 9ec12c7231e1392a5287af510c6f30014784ed41
2020-09-29 01:04:05 +03:00
set(HERMES_ENABLE_TOOLS ON CACHE BOOL
"Enable CLI tools")
# Enable bitcode
set(HERMES_ENABLE_BITCODE OFF CACHE BOOL
"Include bitcode with the framework")
# Set linker flag for building the fuzzer
set(HERMES_FUZZING_FLAG "-fsanitize=fuzzer" CACHE STRING
"Linker argument to link fuzz targets against a given fuzzer.")
# Build with -DHERMES_SLOW_DEBUG for debug builds
# This does not affect release builds
set(HERMES_SLOW_DEBUG ON CACHE BOOL
"Enable slow checks in Debug builds")
# Build with -DHERMES_HARDENED for hardened builds
set(HERMES_HARDENED OFF CACHE BOOL
"Enable compile-time security mitigations")
# On CentOS:
# sudo yum install zlib-static glibc-static ncurses-static readline-static
set(HERMES_STATIC_LINK OFF CACHE BOOL
"Link Hermes statically. May only work on GNU/Linux.")
set(HERMES_USE_STATIC_ICU OFF CACHE BOOL
"Force static linking of ICU. May only work on GNU/Linux.")
set(HERMES_UNICODE_LITE OFF CACHE BOOL
"Enable to use internal no-op unicode functionality instead of relying on underlying system libraries")
if(WIN32)
set(DEFAULT_HERMES_CHECK_NATIVE_STACK OFF)
else()
set(DEFAULT_HERMES_CHECK_NATIVE_STACK ON)
endif()
set(HERMES_CHECK_NATIVE_STACK ${DEFAULT_HERMES_CHECK_NATIVE_STACK} CACHE BOOL
"Check the native stack for stack overflow")
set(HERMES_ENABLE_DEBUGGER ON CACHE BOOL
"Build with debugger support")
set(HERMES_MEMORY_INSTRUMENTATION ${HERMES_ENABLE_DEBUGGER} CACHE BOOL
"Build with memory instrumentation support")
set(HERMES_ENABLE_IR_INSTRUMENTATION OFF CACHE BOOL
"Build IR instrumentation support")
set(HERMES_FACEBOOK_BUILD OFF CACHE BOOL
"Build Facebook (rather than open-source) version of Hermes")
set(HERMESVM_EXCEPTION_ON_OOM OFF CACHE BOOL
"GC Out-of-memory raises an exception, rather than causing a crash")
set(HERMESVM_PLATFORM_LOGGING OFF CACHE BOOL
"hermesLog(...) is enabled, using the platform's logging mechanism")
set(HERMES_RUN_WASM OFF CACHE BOOL
"Emit Asm.js/Wasm unsafe compiler intrinsics")
set(HERMES_USE_FLOWPARSER OFF CACHE BOOL
"Use libflowparser for parsing es6")
set(HERMES_ENABLE_WERROR OFF CACHE BOOL
"Whether the build should have -Werror enabled")
set(HERMES_THREAD_SAFETY_ANALYSIS ON CACHE BOOL
"Whether to compile with clang's -Wthread-safety")
set(HERMES_ENABLE_WIN10_ICU_FALLBACK ON CACHE BOOL
"Whether to allow falling back on Win10 ICU")
set(HERMES_GITHUB_RESOURCE_DIR "" CACHE STRING
"A directory with additional files to bundle in the GitHub release")
set(ANDROID_LINUX_PERF_PATH ""
CACHE STRING
"If buildling for Android, full path to <linux/perf_events.h>")
set(HERMES_MSVC_MP ON CACHE STRING
"Enable /MP in MSVC for parallel builds")
set(EMSCRIPTEN_FASTCOMP OFF CACHE BOOL
"Emscripten is using the fastcomp backend instead of the LLVM one")
set(HERMES_ENABLE_INTL OFF CACHE BOOL
"Enable JS Intl support (WIP)")
Build macOS framework and add CocoaPods podspec (#285) Summary: Supersedes https://github.com/facebook/hermes/issues/239 Currently used in our macOS fork of React Native https://github.com/microsoft/react-native-macos/pull/473. (Although we’re using a build of Hermes v0.4.1, as we’re at RN 0.62.0.) * On Apple platforms build a [dynamic] framework bundle when `HERMES_BUILD_APPLE_FRAMEWORK` is set. When set to `FALSE` it will produce a `dylib`, like previously. Defaults to `TRUE`. * On Apple platforms create a debugging symbols bundle. * Add `HERMES_ENABLE_FUZZING`, which is enabled by default. * Add `HERMES_ENABLE_TEST_SUITE`, which is enabled by default. * Add a CocoaPods podspec that can build from source or use a binary. A standalone macOS app that pulls in Hermes as a CocoaPods pod can be found here https://github.com/alloy/TestHermesMaster. ## Framework variant (default) ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── Library │ └── Frameworks │ ├── hermes.framework │ │ ├── Headers -> Versions/Current/Headers │ │ ├── Resources -> Versions/Current/Resources │ │ ├── Versions │ │ │ ├── 0 │ │ │ │ ├── Headers │ │ │ │ │ ├── CompileJS.h │ │ │ │ │ ├── DebuggerAPI.h │ │ │ │ │ ├── Public │ │ │ │ │ │ ├── Buffer.h │ │ │ │ │ │ ├── CrashManager.h │ │ │ │ │ │ ├── CtorConfig.h │ │ │ │ │ │ ├── DebuggerTypes.h │ │ │ │ │ │ ├── GCConfig.h │ │ │ │ │ │ ├── GCTripwireContext.h │ │ │ │ │ │ └── RuntimeConfig.h │ │ │ │ │ ├── SynthTrace.h │ │ │ │ │ ├── SynthTraceParser.h │ │ │ │ │ ├── TraceInterpreter.h │ │ │ │ │ ├── TracingRuntime.h │ │ │ │ │ ├── hermes.h │ │ │ │ │ └── hermes_tracing.h │ │ │ │ ├── Resources │ │ │ │ │ └── Info.plist │ │ │ │ └── hermes │ │ │ └── Current -> 0 │ │ └── hermes -> Versions/Current/hermes │ └── hermes.framework.dSYM │ └── Contents │ ├── Info.plist │ └── Resources │ └── DWARF │ └── hermes ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm └── include ├── hermes │ ├── CompileJS.h │ ├── DebuggerAPI.h │ ├── Public │ │ ├── Buffer.h │ │ ├── CrashManager.h │ │ ├── CtorConfig.h │ │ ├── DebuggerTypes.h │ │ ├── GCConfig.h │ │ ├── GCTripwireContext.h │ │ └── RuntimeConfig.h │ ├── SynthTrace.h │ ├── SynthTraceParser.h │ ├── TraceInterpreter.h │ ├── TracingRuntime.h │ ├── hermes.h │ └── hermes_tracing.h └── jsi ├── JSIDynamic.h ├── decorator.h ├── instrumentation.h ├── jsi-inl.h ├── jsi.h ├── jsilib.h └── threadsafe.h ``` # dylib variant ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=false -DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm ├── include │ ├── hermes │ │ ├── CompileJS.h │ │ ├── DebuggerAPI.h │ │ ├── Public │ │ │ ├── Buffer.h │ │ │ ├── CrashManager.h │ │ │ ├── CtorConfig.h │ │ │ ├── DebuggerTypes.h │ │ │ ├── GCConfig.h │ │ │ ├── GCTripwireContext.h │ │ │ └── RuntimeConfig.h │ │ ├── SynthTrace.h │ │ ├── SynthTraceParser.h │ │ ├── TraceInterpreter.h │ │ ├── TracingRuntime.h │ │ ├── hermes.h │ │ └── hermes_tracing.h │ └── jsi │ ├── JSIDynamic.h │ ├── decorator.h │ ├── instrumentation.h │ ├── jsi-inl.h │ ├── jsi.h │ ├── jsilib.h │ └── threadsafe.h └── lib ├── libhermes.dylib └── libhermes.dylib.dSYM └── Contents ├── Info.plist └── Resources └── DWARF └── libhermes.dylib ``` Pull Request resolved: https://github.com/facebook/hermes/pull/285 Reviewed By: willholen Differential Revision: D22398354 Pulled By: mhorowitz fbshipit-source-id: 732524275cf273866171fc6e2ac2acb062185fbd
2020-07-09 03:13:30 +03:00
set(HERMES_ENABLE_TEST_SUITE ON CACHE BOOL
"Enable the test suite")
set(HERMES_BUILD_APPLE_FRAMEWORK ON CACHE BOOL
"Whether to build the libhermes target as a framework bundle or dylib on Apple platforms")
Build macOS framework and add CocoaPods podspec (#285) Summary: Supersedes https://github.com/facebook/hermes/issues/239 Currently used in our macOS fork of React Native https://github.com/microsoft/react-native-macos/pull/473. (Although we’re using a build of Hermes v0.4.1, as we’re at RN 0.62.0.) * On Apple platforms build a [dynamic] framework bundle when `HERMES_BUILD_APPLE_FRAMEWORK` is set. When set to `FALSE` it will produce a `dylib`, like previously. Defaults to `TRUE`. * On Apple platforms create a debugging symbols bundle. * Add `HERMES_ENABLE_FUZZING`, which is enabled by default. * Add `HERMES_ENABLE_TEST_SUITE`, which is enabled by default. * Add a CocoaPods podspec that can build from source or use a binary. A standalone macOS app that pulls in Hermes as a CocoaPods pod can be found here https://github.com/alloy/TestHermesMaster. ## Framework variant (default) ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── Library │ └── Frameworks │ ├── hermes.framework │ │ ├── Headers -> Versions/Current/Headers │ │ ├── Resources -> Versions/Current/Resources │ │ ├── Versions │ │ │ ├── 0 │ │ │ │ ├── Headers │ │ │ │ │ ├── CompileJS.h │ │ │ │ │ ├── DebuggerAPI.h │ │ │ │ │ ├── Public │ │ │ │ │ │ ├── Buffer.h │ │ │ │ │ │ ├── CrashManager.h │ │ │ │ │ │ ├── CtorConfig.h │ │ │ │ │ │ ├── DebuggerTypes.h │ │ │ │ │ │ ├── GCConfig.h │ │ │ │ │ │ ├── GCTripwireContext.h │ │ │ │ │ │ └── RuntimeConfig.h │ │ │ │ │ ├── SynthTrace.h │ │ │ │ │ ├── SynthTraceParser.h │ │ │ │ │ ├── TraceInterpreter.h │ │ │ │ │ ├── TracingRuntime.h │ │ │ │ │ ├── hermes.h │ │ │ │ │ └── hermes_tracing.h │ │ │ │ ├── Resources │ │ │ │ │ └── Info.plist │ │ │ │ └── hermes │ │ │ └── Current -> 0 │ │ └── hermes -> Versions/Current/hermes │ └── hermes.framework.dSYM │ └── Contents │ ├── Info.plist │ └── Resources │ └── DWARF │ └── hermes ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm └── include ├── hermes │ ├── CompileJS.h │ ├── DebuggerAPI.h │ ├── Public │ │ ├── Buffer.h │ │ ├── CrashManager.h │ │ ├── CtorConfig.h │ │ ├── DebuggerTypes.h │ │ ├── GCConfig.h │ │ ├── GCTripwireContext.h │ │ └── RuntimeConfig.h │ ├── SynthTrace.h │ ├── SynthTraceParser.h │ ├── TraceInterpreter.h │ ├── TracingRuntime.h │ ├── hermes.h │ └── hermes_tracing.h └── jsi ├── JSIDynamic.h ├── decorator.h ├── instrumentation.h ├── jsi-inl.h ├── jsi.h ├── jsilib.h └── threadsafe.h ``` # dylib variant ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=false -DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm ├── include │ ├── hermes │ │ ├── CompileJS.h │ │ ├── DebuggerAPI.h │ │ ├── Public │ │ │ ├── Buffer.h │ │ │ ├── CrashManager.h │ │ │ ├── CtorConfig.h │ │ │ ├── DebuggerTypes.h │ │ │ ├── GCConfig.h │ │ │ ├── GCTripwireContext.h │ │ │ └── RuntimeConfig.h │ │ ├── SynthTrace.h │ │ ├── SynthTraceParser.h │ │ ├── TraceInterpreter.h │ │ ├── TracingRuntime.h │ │ ├── hermes.h │ │ └── hermes_tracing.h │ └── jsi │ ├── JSIDynamic.h │ ├── decorator.h │ ├── instrumentation.h │ ├── jsi-inl.h │ ├── jsi.h │ ├── jsilib.h │ └── threadsafe.h └── lib ├── libhermes.dylib └── libhermes.dylib.dSYM └── Contents ├── Info.plist └── Resources └── DWARF └── libhermes.dylib ``` Pull Request resolved: https://github.com/facebook/hermes/pull/285 Reviewed By: willholen Differential Revision: D22398354 Pulled By: mhorowitz fbshipit-source-id: 732524275cf273866171fc6e2ac2acb062185fbd
2020-07-09 03:13:30 +03:00
Add explicit option to build Apple dSYM (#296) Summary: Add `HERMES_BUILD_APPLE_DSYM` option to build a dSYM bundle for the libhermes target on Apple platforms. This will work with any of the build types and is off by default. Installing the tools with the install/strip target will ensure all tools and the runtime lib are stripped of debug symbols, but leaving the dSYM bundle in tact. Pull Request resolved: https://github.com/facebook/hermes/pull/296 Test Plan: ### Build ```bash ./src/utils/build/configure.py --distribute --cmake-flags='-DHERMES_BUILD_APPLE_DSYM:BOOLEAN=true -DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build_release cmake --build ./build_release ``` ### Install without stripping ```bash cmake --build ./build_release --target install nm -a destroot_release/bin/hermesc | wc -l 27943 ``` ### Install with stripping ```bash cmake --build ./build_release --target install/strip nm -a destroot_release/bin/hermesc | wc -l 250 ``` …and dSYM DWARF metadata is maintained: ```bash dwarfdump --statistics destroot_release/Library/Frameworks/hermes.framework.dSYM {"version":3,"file":"destroot_release/Library/Frameworks/hermes.framework.dSYM/Contents/Resources/DWARF/hermes","format":"Mach-O 64-bit x86-64","source functions":30305,"source functions with location":30302,"inlined functions":172725,"inlined funcs with abstract origins":172725,"unique source variables":79276,"source variables":353690,"variables with location":232195,"call site entries":186409,"scope bytes total":19161949,"scope bytes covered":10500176,"total function size":1763513,"total inlined function size":998375,"total formal params":300264,"formal params with source location":166067,"formal params with type":300264,"formal params with binary location":200407,"total vars":38809,"vars with source location":38385,"vars with type":38809,"vars with binary location":22161} ``` Reviewed By: tmikov Differential Revision: D22576263 Pulled By: willholen fbshipit-source-id: 2bda49e638d145ba5d029e77069d6adcc0b1dd8c
2020-07-17 00:04:10 +03:00
set(HERMES_BUILD_APPLE_DSYM OFF CACHE BOOL
"Whether to build a DWARF debugging symbols bundle")
set(IMPORT_HERMESC "" CACHE FILEPATH
"Import the hermesc compiler from another build using the given CMake file.")
set(HERMES_BUILD_NODE_HERMES OFF CACHE BOOL "Whether to build node-hermes")
# On Windows, produce static libraries by default so that tests and tools work
# without needing to move DLLs around.
# On Emscripten, there is no concept of a shared library.
if(WIN32 OR EMSCRIPTEN)
set(DEFAULT_BUILD_SHARED_LIBS OFF)
else()
set(DEFAULT_BUILD_SHARED_LIBS ON)
endif()
set(HERMES_BUILD_SHARED_JSI ${DEFAULT_BUILD_SHARED_LIBS} CACHE BOOL "Build JSI as a shared library.")
set(BUILD_SHARED_LIBS ${DEFAULT_BUILD_SHARED_LIBS} CACHE BOOL "Prefer producing shared libraries.")
if (HERMES_IS_ANDROID)
add_definitions(-DHERMES_PLATFORM_UNICODE=HERMES_PLATFORM_UNICODE_JAVA)
endif()
if(HERMES_CHECK_NATIVE_STACK)
if (WIN32)
message(
FATAL_ERROR
"Native stack checking not supported on Windows"
)
endif()
add_definitions(-DHERMES_CHECK_NATIVE_STACK)
endif()
Add explicit option to build Apple dSYM (#296) Summary: Add `HERMES_BUILD_APPLE_DSYM` option to build a dSYM bundle for the libhermes target on Apple platforms. This will work with any of the build types and is off by default. Installing the tools with the install/strip target will ensure all tools and the runtime lib are stripped of debug symbols, but leaving the dSYM bundle in tact. Pull Request resolved: https://github.com/facebook/hermes/pull/296 Test Plan: ### Build ```bash ./src/utils/build/configure.py --distribute --cmake-flags='-DHERMES_BUILD_APPLE_DSYM:BOOLEAN=true -DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build_release cmake --build ./build_release ``` ### Install without stripping ```bash cmake --build ./build_release --target install nm -a destroot_release/bin/hermesc | wc -l 27943 ``` ### Install with stripping ```bash cmake --build ./build_release --target install/strip nm -a destroot_release/bin/hermesc | wc -l 250 ``` …and dSYM DWARF metadata is maintained: ```bash dwarfdump --statistics destroot_release/Library/Frameworks/hermes.framework.dSYM {"version":3,"file":"destroot_release/Library/Frameworks/hermes.framework.dSYM/Contents/Resources/DWARF/hermes","format":"Mach-O 64-bit x86-64","source functions":30305,"source functions with location":30302,"inlined functions":172725,"inlined funcs with abstract origins":172725,"unique source variables":79276,"source variables":353690,"variables with location":232195,"call site entries":186409,"scope bytes total":19161949,"scope bytes covered":10500176,"total function size":1763513,"total inlined function size":998375,"total formal params":300264,"formal params with source location":166067,"formal params with type":300264,"formal params with binary location":200407,"total vars":38809,"vars with source location":38385,"vars with type":38809,"vars with binary location":22161} ``` Reviewed By: tmikov Differential Revision: D22576263 Pulled By: willholen fbshipit-source-id: 2bda49e638d145ba5d029e77069d6adcc0b1dd8c
2020-07-17 00:04:10 +03:00
if(HERMES_BUILD_APPLE_DSYM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gdwarf")
endif()
if (HERMES_IS_MOBILE_BUILD)
add_definitions(-DHERMES_IS_MOBILE_BUILD)
endif()
# Enable debug mode by default
2022-05-07 07:31:02 +03:00
if ((NOT GENERATOR_IS_MULTI_CONFIG) AND CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE Debug)
endif()
if (HERMES_STATIC_LINK)
append("-static" CMAKE_EXE_LINKER_FLAGS)
set(HERMES_USE_STATIC_ICU ON)
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(HERMES_BUILD_SHARED_JSI OFF)
set(BUILD_SHARED_LIBS OFF)
endif()
2021-09-09 17:59:20 +03:00
if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
# Check if the linker supports deleting unused sections and ICF.
2021-09-09 17:59:20 +03:00
# We can't simply CHECK_CXX_COMPILER_FLAG("-Wl,--gc-sections" ..) because CMake
# will compile and link separately and only passes the flag during compilation.
# TODO: Use check_linker_flag once we have CMake 3.18.
2021-09-09 17:59:20 +03:00
set(OLD_CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${OLD_CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
2021-09-09 17:59:20 +03:00
CHECK_CXX_COMPILER_FLAG("" HAVE_GC_SECTIONS)
# Only check for -dead_strip on Apple because some linkers may interpret it
# as "-d -e ad_strip".
if(APPLE)
set(CMAKE_EXE_LINKER_FLAGS "${OLD_CMAKE_EXE_LINKER_FLAGS} -Wl,-dead_strip")
CHECK_CXX_COMPILER_FLAG("" HAVE_DEAD_STRIP)
endif()
set(CMAKE_EXE_LINKER_FLAGS "${OLD_CMAKE_EXE_LINKER_FLAGS} -Wl,--icf=safe")
CHECK_CXX_COMPILER_FLAG("" HAVE_ICF)
2021-09-09 17:59:20 +03:00
set(CMAKE_EXE_LINKER_FLAGS "${OLD_CMAKE_EXE_LINKER_FLAGS}")
if(HAVE_GC_SECTIONS)
add_flag_if_supported("-ffunction-sections" FUNCTION_SECTIONS)
add_flag_if_supported("-fdata-sections" DATA_SECTIONS)
list(APPEND HERMES_EXTRA_LINKER_FLAGS "LINKER:--gc-sections")
elseif(HAVE_DEAD_STRIP)
# This is similar to the above, but for macOS.
list(APPEND HERMES_EXTRA_LINKER_FLAGS "LINKER:-dead_strip")
endif()
if(HAVE_ICF)
add_flag_if_supported("-faddrsig" ADDRSIG)
list(APPEND HERMES_EXTRA_LINKER_FLAGS "LINKER:--icf=safe")
2021-09-09 17:59:20 +03:00
endif()
endif()
# Make the HERMES_RELEASE_VERSION accessible for version printing in C++.
if(HERMES_RELEASE_VERSION)
add_definitions(-DHERMES_RELEASE_VERSION="${HERMES_RELEASE_VERSION}")
endif()
Implement new rules for release versions (#133) ## 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.
2022-09-30 06:54:52 +03:00
# Make the HERMES_FILE_VERSION accessible for version printing in C++.
if(HERMES_FILE_VERSION)
add_definitions(-DHERMES_FILE_VERSION="${HERMES_FILE_VERSION}")
endif()
# Make the HERMES_FILE_VERSION_BIN accessible for converting to a number.
if(HERMES_FILE_VERSION_BIN)
add_definitions(-DHERMES_FILE_VERSION_BIN=${HERMES_FILE_VERSION_BIN})
endif()
if(HERMES_ENABLE_IR_INSTRUMENTATION)
add_definitions(-DHERMES_ENABLE_IR_INSTRUMENTATION)
endif()
add_definitions(-DHERMESVM_GC_${HERMESVM_GCKIND})
set(HERMES_PROFILER_MODE_IN_LIT_TEST "NONE")
if(HERMESVM_PROFILER_OPCODE)
add_definitions(-DHERMESVM_PROFILER_OPCODE)
set(HERMES_PROFILER_MODE_IN_LIT_TEST "OPCODE")
endif()
if(HERMESVM_PROFILER_BB)
add_definitions(-DHERMESVM_PROFILER_BB)
set(HERMES_PROFILER_MODE_IN_LIT_TEST "BB")
endif()
if(HERMESVM_PROFILER_JSFUNCTION)
add_definitions(-DHERMESVM_PROFILER_JSFUNCTION)
set(HERMES_PROFILER_MODE_IN_LIT_TEST "SAMPLING")
endif()
if(HERMESVM_PROFILER_NATIVECALL)
add_definitions(-DHERMESVM_PROFILER_NATIVECALL)
set(HERMES_PROFILER_MODE_IN_LIT_TEST "EXTERN")
endif()
if(HERMESVM_INDIRECT_THREADING)
add_definitions(-DHERMESVM_INDIRECT_THREADING)
endif()
if(HERMESVM_ALLOW_COMPRESSED_POINTERS)
add_definitions(-DHERMESVM_ALLOW_COMPRESSED_POINTERS)
endif()
if(HERMESVM_ALLOW_CONTIGUOUS_HEAP)
add_definitions(-DHERMESVM_ALLOW_CONTIGUOUS_HEAP)
endif()
if(HERMESVM_ALLOW_HUGE_PAGES)
add_definitions(-DHERMESVM_ALLOW_HUGE_PAGES)
endif()
add_definitions(-DHERMESVM_HEAP_SEGMENT_SIZE_KB=${HERMESVM_HEAP_SEGMENT_SIZE_KB})
if(HERMESVM_ALLOW_CONCURRENT_GC)
add_definitions(-DHERMESVM_ALLOW_CONCURRENT_GC)
endif()
Merging Hermes v0.10 into our fork (#58) * 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> &amp; <strong>Mathematica</strong> &amp; <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 &amp; 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: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 &quot;synchronous&quot; and &quot;runWhen&quot; 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 &quot;synchronous&quot; and &quot;runWhen&quot; 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: 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="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366">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="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366">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="https://www.github.com/gulpjs/glob-parent/commit/843f8de1c177e9a5c06c4cfd2349ca5207168e00">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="https://www.github.com/gulpjs/glob-parent/commit/3e9f04a3b4349db7e1962d87c9a7398cda51f339">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 &lt;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="https://www.github.com/gulpjs/glob-parent/commit/32f6d52663b7addac38d0dff570d8127edf03f47">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 &lt;10 support (<a href="https://www.github.com/gulpjs/glob-parent/commit/e83d0c5a411947cf69eb58f36349db80439c606f">e83d0c5</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/gulpjs/glob-parent/commit/eb2c439de448c779b450472e591a2bc9e37e9668"><code>eb2c439</code></a> chore: update changelog</li> <li><a href="https://github.com/gulpjs/glob-parent/commit/12bcb6c45c942e2d05fc1e6ff5402e72555b54b6"><code>12bcb6c</code></a> chore: release 5.1.2</li> <li><a href="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366"><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="https://github.com/gulpjs/glob-parent/commit/0b014a7962789b2d8f2cf0b6311f40667aecd62c"><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="https://github.com/gulpjs/glob-parent/commit/2b24ebd64b2a045aa167c825376335555da139fd"><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](https://github.com/llvm-mirror/llvm/commit/c94004ffdb1ee37b3c4e762e4e7576cc3844d79b) 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: https://github.com/llvm/llvm-project/blob/c1a0a213378a458fbea1a5c77b315c7dce08fd05/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>
2021-11-30 20:56:51 +03:00
if(HERMESVM_ALLOW_INLINE_ASM)
add_definitions(-DHERMESVM_ALLOW_INLINE_ASM)
endif()
if(HERMESVM_API_TRACE_ANDROID_REPLAY)
add_definitions(-DHERMESVM_API_TRACE_ANDROID_REPLAY)
endif()
if(HERMESVM_SANITIZE_HANDLES)
add_definitions(-DHERMESVM_SANITIZE_HANDLES)
endif()
if(HERMESVM_CRASH_TRACE)
add_definitions(-DHERMESVM_CRASH_TRACE=1)
endif()
if (HERMES_ENABLE_ADDRESS_SANITIZER)
append("-fsanitize=address" CMAKE_CXX_FLAGS CMAKE_C_FLAGS CMAKE_EXE_LINKER_FLAGS)
# GCC does not automatically link libpthread when using ASAN
append("-lpthread" CMAKE_EXE_LINKER_FLAGS)
endif()
if (HERMES_ENABLE_UNDEFINED_BEHAVIOR_SANITIZER)
add_definitions(-DHERMES_UBSAN)
# Do not enable the vptr sanitizer, as it requires RTTI.
append("-fsanitize=undefined -fno-sanitize=vptr -fno-sanitize-recover=undefined" CMAKE_CXX_FLAGS CMAKE_C_FLAGS CMAKE_EXE_LINKER_FLAGS)
endif()
if (HERMES_ENABLE_THREAD_SANITIZER)
append("-fsanitize=thread" CMAKE_CXX_FLAGS CMAKE_C_FLAGS CMAKE_EXE_LINKER_FLAGS)
endif()
if (HERMES_ENABLE_TRACE_PC_GUARD)
append("-fsanitize-coverage=trace-pc-guard" CMAKE_CXX_FLAGS CMAKE_C_FLAGS CMAKE_EXE_LINKER_FLAGS)
endif()
if (HERMES_ENABLE_CODE_COVERAGE)
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
append("-fprofile-instr-generate -fcoverage-mapping" CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
else()
message(FATAL_ERROR "Code coverage flags not defined for this compiler: ${CMAKE_CXX_COMPILER_ID}")
endif()
endif()
if(HERMES_FACEBOOK_BUILD)
add_definitions(-DHERMES_FACEBOOK_BUILD)
endif()
if(HERMESVM_EXCEPTION_ON_OOM)
set(HERMES_ENABLE_EH_RTTI ON)
add_definitions(-DHERMESVM_EXCEPTION_ON_OOM)
endif()
if(HERMESVM_PLATFORM_LOGGING)
add_definitions(-DHERMESVM_PLATFORM_LOGGING)
endif()
if(HERMES_RUN_WASM)
add_definitions(-DHERMES_RUN_WASM)
endif()
if (NOT (ANDROID_LINUX_PERF_PATH STREQUAL ""))
add_definitions(-DANDROID_LINUX_PERF_PATH="${ANDROID_LINUX_PERF_PATH}")
endif()
if (HERMES_ENABLE_INTL)
Merging Hermes v0.10 into our fork (#58) * 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> &amp; <strong>Mathematica</strong> &amp; <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 &amp; 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: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 &quot;synchronous&quot; and &quot;runWhen&quot; 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 &quot;synchronous&quot; and &quot;runWhen&quot; 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: 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="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366">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="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366">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="https://www.github.com/gulpjs/glob-parent/commit/843f8de1c177e9a5c06c4cfd2349ca5207168e00">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="https://www.github.com/gulpjs/glob-parent/commit/3e9f04a3b4349db7e1962d87c9a7398cda51f339">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 &lt;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="https://www.github.com/gulpjs/glob-parent/commit/32f6d52663b7addac38d0dff570d8127edf03f47">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 &lt;10 support (<a href="https://www.github.com/gulpjs/glob-parent/commit/e83d0c5a411947cf69eb58f36349db80439c606f">e83d0c5</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/gulpjs/glob-parent/commit/eb2c439de448c779b450472e591a2bc9e37e9668"><code>eb2c439</code></a> chore: update changelog</li> <li><a href="https://github.com/gulpjs/glob-parent/commit/12bcb6c45c942e2d05fc1e6ff5402e72555b54b6"><code>12bcb6c</code></a> chore: release 5.1.2</li> <li><a href="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366"><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="https://github.com/gulpjs/glob-parent/commit/0b014a7962789b2d8f2cf0b6311f40667aecd62c"><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="https://github.com/gulpjs/glob-parent/commit/2b24ebd64b2a045aa167c825376335555da139fd"><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](https://github.com/llvm-mirror/llvm/commit/c94004ffdb1ee37b3c4e762e4e7576cc3844d79b) 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: https://github.com/llvm/llvm-project/blob/c1a0a213378a458fbea1a5c77b315c7dce08fd05/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>
2021-11-30 20:56:51 +03:00
add_definitions(-DHERMES_ENABLE_INTL)
endif()
if (HERMES_ENABLE_WERROR)
Use internal fork of LLVM Summary: Place a fork of LLVM git rev c179d7b006348005d2da228aed4c3c251590baa3 under `external/llvh`(1) and modify the CMake build to use it. I am calling it a "fork", because it is not all of LLVM. Only the parts that are used by Hermes are included, which at this time is only parts of `libLLVMSupporrt`. Most(2) of LLVM build scripts are removed, and it is treated just as another ordinary library. (1) Why `llvh`? To be able to coexist with instances of the "real" LLVM, we must change the namespace, all public symbols containing the `llvm` string and the include directory name. `llvh` seemed as good a name as any. I also considered `llvm-h` and `h-llvm`, but the problem is that they are a superstring of `llvm` so it becomes harder to search for the `llvm` string. Note that the actual rename will happen in a follow up diff. It would be a massive patch. (2) libLLVMSupport relies on pretty elaborate feature detection scripts, which would be painful to duplicate, so for now I have preserved them under external/llvh/cmake. Unfortunately turning LLVM into an ordinary library is not enough, since we were implicitly relying on a lot of functionality provided by the LLVM build scripts. Things like setting default warning flags, easily turning exceptions on and off, etc. I attempted to replace it with Hermes equivalents, which are now provided by `cmake/Hermes.cmake`: - `add_llvm_library/tool()` is replaced by `add_hermes_library/tool()`. - Several `LLVM_xxx` variables are replaced my similar `HERMES_xxx` ones. As a result, building Hermes now requires only checking it out, and running CMake and Ninja. It is a vastly simpler process than before. == Limitations - CMake LTO and ASAN builds aren't supported yet. - The JIT requires the "real" LLVM for disassembly. Reviewed By: avp Differential Revision: D19658656 fbshipit-source-id: 5094d2af45e343973b1aab02c550a18b2bf93a06
2020-02-06 11:30:00 +03:00
# Turn all warnings into errors on GCC-compatible compilers.
if (GCC_COMPATIBLE)
append("-Werror" CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
endif()
endif()
# Collect all header files and add them to the IDE.
file(GLOB_RECURSE ALL_HEADER_FILES "*.h")
if(HERMES_SLOW_DEBUG)
# Enable HERMES_SLOW_DEBUG in Debug mode
set_property(DIRECTORY APPEND PROPERTY
COMPILE_DEFINITIONS $<$<CONFIG:Debug>:HERMES_SLOW_DEBUG>)
endif()
if (HERMES_HARDENED)
add_definitions(-DHERMES_HARDENED)
endif()
if (GCC_COMPATIBLE)
# Don't export symbols unless we explicitly say so
append("-fvisibility=hidden" CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
# C4068 unknown pragma
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4068")
# C4200 nonstandard extension used: zero-sized array in struct/union
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4200")
# C4201 nonstandard extension used: nameless struct/union
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4201")
Use internal fork of LLVM Summary: Place a fork of LLVM git rev c179d7b006348005d2da228aed4c3c251590baa3 under `external/llvh`(1) and modify the CMake build to use it. I am calling it a "fork", because it is not all of LLVM. Only the parts that are used by Hermes are included, which at this time is only parts of `libLLVMSupporrt`. Most(2) of LLVM build scripts are removed, and it is treated just as another ordinary library. (1) Why `llvh`? To be able to coexist with instances of the "real" LLVM, we must change the namespace, all public symbols containing the `llvm` string and the include directory name. `llvh` seemed as good a name as any. I also considered `llvm-h` and `h-llvm`, but the problem is that they are a superstring of `llvm` so it becomes harder to search for the `llvm` string. Note that the actual rename will happen in a follow up diff. It would be a massive patch. (2) libLLVMSupport relies on pretty elaborate feature detection scripts, which would be painful to duplicate, so for now I have preserved them under external/llvh/cmake. Unfortunately turning LLVM into an ordinary library is not enough, since we were implicitly relying on a lot of functionality provided by the LLVM build scripts. Things like setting default warning flags, easily turning exceptions on and off, etc. I attempted to replace it with Hermes equivalents, which are now provided by `cmake/Hermes.cmake`: - `add_llvm_library/tool()` is replaced by `add_hermes_library/tool()`. - Several `LLVM_xxx` variables are replaced my similar `HERMES_xxx` ones. As a result, building Hermes now requires only checking it out, and running CMake and Ninja. It is a vastly simpler process than before. == Limitations - CMake LTO and ASAN builds aren't supported yet. - The JIT requires the "real" LLVM for disassembly. Reviewed By: avp Differential Revision: D19658656 fbshipit-source-id: 5094d2af45e343973b1aab02c550a18b2bf93a06
2020-02-06 11:30:00 +03:00
# C4530 C++ exception handler used, but unwind semantics are not enabled
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4530")
Implement Node-API for Hermes (#61) This is an implementation of Node-API for Hermes. ### Why do we need this change? Currently Hermes engine does not offer an ABI safe API that can be used on DLL boundary. It is not a problem if Hermes code is embedded into an application which uses compatible build system. Though, it does not work well in scenarios when a third-party app does not use the same build system or the same programming language such as C#. The issue can be addressed by distributing Hermes as a DLL with an ABI-safe API. While it is possible to implement Hermes-specific ABI-safe API, this PR follows a different approach: we adopt the Node-API from Node.JS project that could be considered as an industry standard in that area. It should allow writing native code that works with any JS engine that implement the Node-API. Imagine that developers could create a native module in the language of their choice that works in Node.js, Electron, and ReactNative applications. Since Node-API is already implemented for V8 JS engine, the Node-API for Hermes implementation makes us one step closer to such goal. We already have the JSI implemented on top of the Node-API in ReactNative for Windows project and any existing ReactNative JSI-based code could continue to work without any changes. The Node-API is C-based API and ideally must never be used directly from C++ code that may throw exceptions. C++ developers should either use JSI or the Node-API C++ wrappers from Node.JS project. In future we must be able to add a .Net wrapper for Node-API to enable use of C# with the JS engines. ### Implementation details The core of the implementation is in the `hermes_napi.cpp` file. It is done in the single file to match the JSI implementation in `hermes.cpp`. These files are copied from Node.js sources code and represent the core Node-API: - `js_native_api.h` - `js_native_api_types.h` The `js_native_ext_api.h` is copied from the `v8-jsi` project as the extensions to Node-API required to host JS engine and to implement JSI. The implementation has required changes to Hermes code: - Added new `FinalizableNativeConstructor` class inherited from `NativeConstructor` to allow defining classes in native code. - `UTF8.h` and `UTF8.cpp` - added functions to simplify conversion from UTF16 to UTF8 where a target is an arbitrary buffer instead of `std::string`. - `JSArrayBuffer.h` and `JSArrayBuffer.cpp` - added support for external buffers. - `StorageProvider.cpp` - fix use of a wrong variable to suppress the unused variable message. - Fixed TypedArray property implementation for detached buffers. ### Unit tests The NAPI unit tests were adopted from the [microsoft/v8-jsi](https://github.com/microsoft/v8-jsi) project. They have some modifications due to some Hermes vs V8 incompatibilities: - Hermes does not support BigInt - Hermes does not support sparce Arrays - Different error messages Hermes does not support the full ES6 specification yet, and the unit tests add the Babel transforms with the presets targeting Hermes engine for ReactNative.
2022-02-07 19:59:44 +03:00
# C4251 class X needs to have dll-interface to be used by clients of class Y
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4251")
# C4275: non dll-interface class X used as base for dll-interface class Y
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4275")
# C4646: function declared with 'noreturn' has non-void return type
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4646")
# C4312: 'reinterpret_cast': conversion from 'X' to 'hermes::vm::GCCell *' of greater size
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4312")
# Parallelize build
if (HERMES_MSVC_MP)
add_compile_options( /MP )
endif()
endif()
if ("${CMAKE_C_COMPILER_ID}" MATCHES "MSVC")
# Enable source linking
# NOTE: Dependencies are not properly setup here.
# Currently, CMake does not know to re-link if SOURCE_LINK_JSON changes
# Currently, CMake does not re-generate SOURCE_LINK_JSON if git's HEAD changes
if ("${CMAKE_C_COMPILER_VERSION}" VERSION_GREATER_EQUAL "19.20")
include(SourceLink)
file(TO_NATIVE_PATH "${PROJECT_BINARY_DIR}/source_link.json" SOURCE_LINK_JSON)
source_link(${PROJECT_SOURCE_DIR} ${SOURCE_LINK_JSON})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SOURCELINK:${SOURCE_LINK_JSON}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SOURCELINK:${SOURCE_LINK_JSON}")
else()
message(WARNING "Disabling SourceLink due to old version of MSVC. Please update to VS2019!")
endif()
endif()
# Export a JSON file with the compilation commands that external tools can use
# to analyze the source code of the project.
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Attempt to use system ICU first, if none specified.
Merging Hermes v0.10 into our fork (#58) * 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> &amp; <strong>Mathematica</strong> &amp; <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 &amp; 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: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 &quot;synchronous&quot; and &quot;runWhen&quot; 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 &quot;synchronous&quot; and &quot;runWhen&quot; 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: 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="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366">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="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366">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="https://www.github.com/gulpjs/glob-parent/commit/843f8de1c177e9a5c06c4cfd2349ca5207168e00">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="https://www.github.com/gulpjs/glob-parent/commit/3e9f04a3b4349db7e1962d87c9a7398cda51f339">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 &lt;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="https://www.github.com/gulpjs/glob-parent/commit/32f6d52663b7addac38d0dff570d8127edf03f47">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 &lt;10 support (<a href="https://www.github.com/gulpjs/glob-parent/commit/e83d0c5a411947cf69eb58f36349db80439c606f">e83d0c5</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/gulpjs/glob-parent/commit/eb2c439de448c779b450472e591a2bc9e37e9668"><code>eb2c439</code></a> chore: update changelog</li> <li><a href="https://github.com/gulpjs/glob-parent/commit/12bcb6c45c942e2d05fc1e6ff5402e72555b54b6"><code>12bcb6c</code></a> chore: release 5.1.2</li> <li><a href="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366"><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="https://github.com/gulpjs/glob-parent/commit/0b014a7962789b2d8f2cf0b6311f40667aecd62c"><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="https://github.com/gulpjs/glob-parent/commit/2b24ebd64b2a045aa167c825376335555da139fd"><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](https://github.com/llvm-mirror/llvm/commit/c94004ffdb1ee37b3c4e762e4e7576cc3844d79b) 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: https://github.com/llvm/llvm-project/blob/c1a0a213378a458fbea1a5c77b315c7dce08fd05/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>
2021-11-30 20:56:51 +03:00
# Don't need ICU on Apple, Emscripten, and Android.
if (APPLE OR EMSCRIPTEN OR HERMES_IS_ANDROID)
set(ICU_FOUND 1)
endif()
if (NOT ICU_FOUND)
if (NOT ICU_ROOT)
set(FB_ICU_ROOT_A "/mnt/gvfs/third-party2/icu/4e8f3e00e1c7d7315fd006903a9ff7f073dfc02b/53.1/gcc-5-glibc-2.23/9bc6787")
set(FB_ICU_ROOT_B "/mnt/gvfs/third-party2/icu/4e8f3e00e1c7d7315fd006903a9ff7f073dfc02b/53.1/gcc-4.8.1-glibc-2.17/c3f970a/")
if(EXISTS ${FB_ICU_ROOT_A})
set(ICU_ROOT ${FB_ICU_ROOT_A})
elseif(EXISTS ${FB_ICU_ROOT_B})
set(ICU_ROOT ${FB_ICU_ROOT_B})
endif()
endif()
set(CMAKE_FIND_LIBRARY_SUFFIXES_OLD "${CMAKE_FIND_LIBRARY_SUFFIXES}")
if (HERMES_USE_STATIC_ICU)
add_definitions(-DU_STATIC_IMPLEMENTATION)
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif()
# FindICU uses ICU_ROOT variable as a hint
# Include 'uc' twice for static libraries that depend on each other.
Use internal fork of LLVM Summary: Place a fork of LLVM git rev c179d7b006348005d2da228aed4c3c251590baa3 under `external/llvh`(1) and modify the CMake build to use it. I am calling it a "fork", because it is not all of LLVM. Only the parts that are used by Hermes are included, which at this time is only parts of `libLLVMSupporrt`. Most(2) of LLVM build scripts are removed, and it is treated just as another ordinary library. (1) Why `llvh`? To be able to coexist with instances of the "real" LLVM, we must change the namespace, all public symbols containing the `llvm` string and the include directory name. `llvh` seemed as good a name as any. I also considered `llvm-h` and `h-llvm`, but the problem is that they are a superstring of `llvm` so it becomes harder to search for the `llvm` string. Note that the actual rename will happen in a follow up diff. It would be a massive patch. (2) libLLVMSupport relies on pretty elaborate feature detection scripts, which would be painful to duplicate, so for now I have preserved them under external/llvh/cmake. Unfortunately turning LLVM into an ordinary library is not enough, since we were implicitly relying on a lot of functionality provided by the LLVM build scripts. Things like setting default warning flags, easily turning exceptions on and off, etc. I attempted to replace it with Hermes equivalents, which are now provided by `cmake/Hermes.cmake`: - `add_llvm_library/tool()` is replaced by `add_hermes_library/tool()`. - Several `LLVM_xxx` variables are replaced my similar `HERMES_xxx` ones. As a result, building Hermes now requires only checking it out, and running CMake and Ninja. It is a vastly simpler process than before. == Limitations - CMake LTO and ASAN builds aren't supported yet. - The JIT requires the "real" LLVM for disassembly. Reviewed By: avp Differential Revision: D19658656 fbshipit-source-id: 5094d2af45e343973b1aab02c550a18b2bf93a06
2020-02-06 11:30:00 +03:00
find_global_package(ICU 52 COMPONENTS uc i18n data uc)
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES_OLD}")
if (ICU_FOUND)
foreach(LIB_FILE ${ICU_LIBRARIES})
get_filename_component(LIB_DIR ${LIB_FILE} DIRECTORY)
list(APPEND ICU_RPATH ${LIB_DIR})
endforeach(LIB_FILE)
list(REMOVE_DUPLICATES ICU_RPATH)
message("icu dir: ${ICU_RPATH}")
include_directories(${ICU_INCLUDE_DIRS})
endif()
endif()
# ICU is available on Windows, but only since Windows 10 v1703.
# Therefore, use it only as fallback.
if (NOT ICU_FOUND AND HERMES_ENABLE_WIN10_ICU_FALLBACK AND
WIN32 # Windows 32 or 64 bit
# We used to check for at least Windows 10 version 1703 (aka Creators Update)
# but the new compliant images return 6.2. Everybody should be running
# the right version of windows now.
# NOT ${CMAKE_SYSTEM_VERSION} VERSION_LESS "10.0.15063"
)
add_definitions(-DUSE_WIN10_ICU)
set(ICU_FOUND 1)
set(ICU_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/external/icu_decls)
set(ICU_LIBRARIES
icuuc icuin
)
include_directories(${ICU_INCLUDE_DIRS})
message("Using Windows 10 built-in ICU")
endif()
# If we have no ICU, then error out.
Merging Hermes v0.10 into our fork (#58) * 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> &amp; <strong>Mathematica</strong> &amp; <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 &amp; 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: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 &quot;synchronous&quot; and &quot;runWhen&quot; 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 &quot;synchronous&quot; and &quot;runWhen&quot; 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: 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="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366">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="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366">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="https://www.github.com/gulpjs/glob-parent/commit/843f8de1c177e9a5c06c4cfd2349ca5207168e00">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="https://www.github.com/gulpjs/glob-parent/commit/3e9f04a3b4349db7e1962d87c9a7398cda51f339">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 &lt;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="https://www.github.com/gulpjs/glob-parent/commit/32f6d52663b7addac38d0dff570d8127edf03f47">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 &lt;10 support (<a href="https://www.github.com/gulpjs/glob-parent/commit/e83d0c5a411947cf69eb58f36349db80439c606f">e83d0c5</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/gulpjs/glob-parent/commit/eb2c439de448c779b450472e591a2bc9e37e9668"><code>eb2c439</code></a> chore: update changelog</li> <li><a href="https://github.com/gulpjs/glob-parent/commit/12bcb6c45c942e2d05fc1e6ff5402e72555b54b6"><code>12bcb6c</code></a> chore: release 5.1.2</li> <li><a href="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366"><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="https://github.com/gulpjs/glob-parent/commit/0b014a7962789b2d8f2cf0b6311f40667aecd62c"><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="https://github.com/gulpjs/glob-parent/commit/2b24ebd64b2a045aa167c825376335555da139fd"><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](https://github.com/llvm-mirror/llvm/commit/c94004ffdb1ee37b3c4e762e4e7576cc3844d79b) 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: https://github.com/llvm/llvm-project/blob/c1a0a213378a458fbea1a5c77b315c7dce08fd05/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>
2021-11-30 20:56:51 +03:00
if (NOT ICU_FOUND)
message(FATAL_ERROR "Unable to find ICU for ${CMAKE_SYSTEM_VERSION}.")
endif()
# Declare a function that links ICU for the given target.
# This adds the correct -rpath link flag as necessary.
function(hermes_link_icu target_name)
get_target_property(target_type ${target_name} TYPE)
# target_link_libraries(${target_name} ${ICU_LIBRARIES})
if (HERMES_USE_STATIC_ICU)
if ((NOT EMSCRIPTEN) AND target_type MATCHES "EXECUTABLE|STATIC_LIBRARY")
target_link_libraries(${target_name} dl pthread)
elseif(target_type MATCHES "MODULE_LIBRARY|SHARED_LIBRARY")
message(WARNING "ICU cannot be statically linked against shared library target ${target_name}")
endif()
endif()
if (ICU_RPATH)
set_property(TARGET ${target_name} APPEND PROPERTY
INSTALL_RPATH ${ICU_RPATH})
set_property(TARGET ${target_name} PROPERTY
BUILD_WITH_INSTALL_RPATH TRUE)
endif()
endfunction()
if (APPLE)
find_library(CORE_FOUNDATION CoreFoundation)
Merging Hermes v0.10 into our fork (#58) * 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> &amp; <strong>Mathematica</strong> &amp; <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 &amp; 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: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 &quot;synchronous&quot; and &quot;runWhen&quot; 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 &quot;synchronous&quot; and &quot;runWhen&quot; 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: 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="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366">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="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366">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="https://www.github.com/gulpjs/glob-parent/commit/843f8de1c177e9a5c06c4cfd2349ca5207168e00">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="https://www.github.com/gulpjs/glob-parent/commit/3e9f04a3b4349db7e1962d87c9a7398cda51f339">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 &lt;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="https://www.github.com/gulpjs/glob-parent/commit/32f6d52663b7addac38d0dff570d8127edf03f47">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 &lt;10 support (<a href="https://www.github.com/gulpjs/glob-parent/commit/e83d0c5a411947cf69eb58f36349db80439c606f">e83d0c5</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/gulpjs/glob-parent/commit/eb2c439de448c779b450472e591a2bc9e37e9668"><code>eb2c439</code></a> chore: update changelog</li> <li><a href="https://github.com/gulpjs/glob-parent/commit/12bcb6c45c942e2d05fc1e6ff5402e72555b54b6"><code>12bcb6c</code></a> chore: release 5.1.2</li> <li><a href="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366"><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="https://github.com/gulpjs/glob-parent/commit/0b014a7962789b2d8f2cf0b6311f40667aecd62c"><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="https://github.com/gulpjs/glob-parent/commit/2b24ebd64b2a045aa167c825376335555da139fd"><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](https://github.com/llvm-mirror/llvm/commit/c94004ffdb1ee37b3c4e762e4e7576cc3844d79b) 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: https://github.com/llvm/llvm-project/blob/c1a0a213378a458fbea1a5c77b315c7dce08fd05/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>
2021-11-30 20:56:51 +03:00
find_library(FOUNDATION Foundation)
else()
set(CORE_FOUNDATION "")
Merging Hermes v0.10 into our fork (#58) * 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> &amp; <strong>Mathematica</strong> &amp; <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 &amp; 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: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 &quot;synchronous&quot; and &quot;runWhen&quot; 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 &quot;synchronous&quot; and &quot;runWhen&quot; 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: 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="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366">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="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366">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="https://www.github.com/gulpjs/glob-parent/commit/843f8de1c177e9a5c06c4cfd2349ca5207168e00">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="https://www.github.com/gulpjs/glob-parent/commit/3e9f04a3b4349db7e1962d87c9a7398cda51f339">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 &lt;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="https://www.github.com/gulpjs/glob-parent/commit/32f6d52663b7addac38d0dff570d8127edf03f47">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 &lt;10 support (<a href="https://www.github.com/gulpjs/glob-parent/commit/e83d0c5a411947cf69eb58f36349db80439c606f">e83d0c5</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/gulpjs/glob-parent/commit/eb2c439de448c779b450472e591a2bc9e37e9668"><code>eb2c439</code></a> chore: update changelog</li> <li><a href="https://github.com/gulpjs/glob-parent/commit/12bcb6c45c942e2d05fc1e6ff5402e72555b54b6"><code>12bcb6c</code></a> chore: release 5.1.2</li> <li><a href="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366"><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="https://github.com/gulpjs/glob-parent/commit/0b014a7962789b2d8f2cf0b6311f40667aecd62c"><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="https://github.com/gulpjs/glob-parent/commit/2b24ebd64b2a045aa167c825376335555da139fd"><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](https://github.com/llvm-mirror/llvm/commit/c94004ffdb1ee37b3c4e762e4e7576cc3844d79b) 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: https://github.com/llvm/llvm-project/blob/c1a0a213378a458fbea1a5c77b315c7dce08fd05/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>
2021-11-30 20:56:51 +03:00
set(FOUNDATION "")
endif()
if (HERMES_USE_FLOWPARSER)
if (CMAKE_SYSTEM_NAME STREQUAL Darwin AND NOT HERMES_BUILD_32_BITS)
set(LIBFLOWPARSER ${CMAKE_CURRENT_SOURCE_DIR}/external/flowparser/libflowparser-mac.a)
elseif (CMAKE_SYSTEM_NAME STREQUAL Linux AND NOT HERMES_BUILD_32_BITS)
set(LIBFLOWPARSER ${CMAKE_CURRENT_SOURCE_DIR}/external/flowparser/libflowparser-linux.a)
else()
set(LIBFLOWPARSER "")
set(HERMES_USE_FLOWPARSER OFF)
endif()
endif()
if (HERMES_USE_FLOWPARSER)
add_definitions(-DHERMES_USE_FLOWPARSER)
endif()
if (HERMES_ENABLE_DEBUGGER)
add_definitions(-DHERMES_ENABLE_DEBUGGER)
endif()
if (HERMES_MEMORY_INSTRUMENTATION)
add_definitions(-DHERMES_MEMORY_INSTRUMENTATION)
endif()
2021-09-09 17:59:20 +03:00
if (HERMES_MSVC_CHECKED_ITERATORS)
add_definitions(-D_ITERATOR_DEBUG_LEVEL=1)
endif()
if (HERMES_MSVC_USE_PLATFORM_UNICODE_WINGLOB)
add_definitions(-DUSE_PLATFORM_UNICODE_WINGLOB)
endif()
# Disables the GCC 64-to-32 bit truncation diagnostic if the compiler supports
# -Wshorten-64-to-32.
check_cxx_compiler_flag("-Wshorten-64-to-32" CXX_SUPPORTS_SHORTEN_64_TO_32)
if (${CXX_SUPPORTS_SHORTEN_64_TO_32})
add_definitions(-DHERMES_COMPILER_SUPPORTS_WSHORTEN_64_TO_32)
endif()
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++17")
# JSI_DIR has always priority over other folders.
# It's used by React Native when building Hermes from source so
# the copy of JSI inside `react-native/ReactCommon/jsi` can be used.
if(JSI_DIR)
if(EXISTS ${JSI_DIR})
set(HERMES_JSI_DIR ${JSI_DIR})
else()
message(FATAL_ERROR "You specified a JSI directory with -DJSI_DIR but JSI can't be found there.")
endif()
elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/API/jsi)
set(HERMES_JSI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/API/jsi)
elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../jsi)
set(HERMES_JSI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../jsi)
else()
message(FATAL_ERROR "Unable to find jsi.")
endif()
Use internal fork of LLVM Summary: Place a fork of LLVM git rev c179d7b006348005d2da228aed4c3c251590baa3 under `external/llvh`(1) and modify the CMake build to use it. I am calling it a "fork", because it is not all of LLVM. Only the parts that are used by Hermes are included, which at this time is only parts of `libLLVMSupporrt`. Most(2) of LLVM build scripts are removed, and it is treated just as another ordinary library. (1) Why `llvh`? To be able to coexist with instances of the "real" LLVM, we must change the namespace, all public symbols containing the `llvm` string and the include directory name. `llvh` seemed as good a name as any. I also considered `llvm-h` and `h-llvm`, but the problem is that they are a superstring of `llvm` so it becomes harder to search for the `llvm` string. Note that the actual rename will happen in a follow up diff. It would be a massive patch. (2) libLLVMSupport relies on pretty elaborate feature detection scripts, which would be painful to duplicate, so for now I have preserved them under external/llvh/cmake. Unfortunately turning LLVM into an ordinary library is not enough, since we were implicitly relying on a lot of functionality provided by the LLVM build scripts. Things like setting default warning flags, easily turning exceptions on and off, etc. I attempted to replace it with Hermes equivalents, which are now provided by `cmake/Hermes.cmake`: - `add_llvm_library/tool()` is replaced by `add_hermes_library/tool()`. - Several `LLVM_xxx` variables are replaced my similar `HERMES_xxx` ones. As a result, building Hermes now requires only checking it out, and running CMake and Ninja. It is a vastly simpler process than before. == Limitations - CMake LTO and ASAN builds aren't supported yet. - The JIT requires the "real" LLVM for disassembly. Reviewed By: avp Differential Revision: D19658656 fbshipit-source-id: 5094d2af45e343973b1aab02c550a18b2bf93a06
2020-02-06 11:30:00 +03:00
include_directories(
external/llvh/include
external/llvh/gen/include
${CMAKE_CURRENT_BINARY_DIR}/external/llvh/include
)
include_directories(BEFORE
${CMAKE_CURRENT_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/external/flowparser/include
${CMAKE_CURRENT_SOURCE_DIR}/external
)
if(HERMES_IS_ANDROID)
find_package(fbjni REQUIRED CONFIG)
endif()
set(CMAKE_CXX_STANDARD 17)
Use internal fork of LLVM Summary: Place a fork of LLVM git rev c179d7b006348005d2da228aed4c3c251590baa3 under `external/llvh`(1) and modify the CMake build to use it. I am calling it a "fork", because it is not all of LLVM. Only the parts that are used by Hermes are included, which at this time is only parts of `libLLVMSupporrt`. Most(2) of LLVM build scripts are removed, and it is treated just as another ordinary library. (1) Why `llvh`? To be able to coexist with instances of the "real" LLVM, we must change the namespace, all public symbols containing the `llvm` string and the include directory name. `llvh` seemed as good a name as any. I also considered `llvm-h` and `h-llvm`, but the problem is that they are a superstring of `llvm` so it becomes harder to search for the `llvm` string. Note that the actual rename will happen in a follow up diff. It would be a massive patch. (2) libLLVMSupport relies on pretty elaborate feature detection scripts, which would be painful to duplicate, so for now I have preserved them under external/llvh/cmake. Unfortunately turning LLVM into an ordinary library is not enough, since we were implicitly relying on a lot of functionality provided by the LLVM build scripts. Things like setting default warning flags, easily turning exceptions on and off, etc. I attempted to replace it with Hermes equivalents, which are now provided by `cmake/Hermes.cmake`: - `add_llvm_library/tool()` is replaced by `add_hermes_library/tool()`. - Several `LLVM_xxx` variables are replaced my similar `HERMES_xxx` ones. As a result, building Hermes now requires only checking it out, and running CMake and Ninja. It is a vastly simpler process than before. == Limitations - CMake LTO and ASAN builds aren't supported yet. - The JIT requires the "real" LLVM for disassembly. Reviewed By: avp Differential Revision: D19658656 fbshipit-source-id: 5094d2af45e343973b1aab02c550a18b2bf93a06
2020-02-06 11:30:00 +03:00
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_subdirectory(external/llvh)
add_subdirectory(utils/hermes-lit)
add_subdirectory(lib)
Build macOS framework and add CocoaPods podspec (#285) Summary: Supersedes https://github.com/facebook/hermes/issues/239 Currently used in our macOS fork of React Native https://github.com/microsoft/react-native-macos/pull/473. (Although we’re using a build of Hermes v0.4.1, as we’re at RN 0.62.0.) * On Apple platforms build a [dynamic] framework bundle when `HERMES_BUILD_APPLE_FRAMEWORK` is set. When set to `FALSE` it will produce a `dylib`, like previously. Defaults to `TRUE`. * On Apple platforms create a debugging symbols bundle. * Add `HERMES_ENABLE_FUZZING`, which is enabled by default. * Add `HERMES_ENABLE_TEST_SUITE`, which is enabled by default. * Add a CocoaPods podspec that can build from source or use a binary. A standalone macOS app that pulls in Hermes as a CocoaPods pod can be found here https://github.com/alloy/TestHermesMaster. ## Framework variant (default) ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── Library │ └── Frameworks │ ├── hermes.framework │ │ ├── Headers -> Versions/Current/Headers │ │ ├── Resources -> Versions/Current/Resources │ │ ├── Versions │ │ │ ├── 0 │ │ │ │ ├── Headers │ │ │ │ │ ├── CompileJS.h │ │ │ │ │ ├── DebuggerAPI.h │ │ │ │ │ ├── Public │ │ │ │ │ │ ├── Buffer.h │ │ │ │ │ │ ├── CrashManager.h │ │ │ │ │ │ ├── CtorConfig.h │ │ │ │ │ │ ├── DebuggerTypes.h │ │ │ │ │ │ ├── GCConfig.h │ │ │ │ │ │ ├── GCTripwireContext.h │ │ │ │ │ │ └── RuntimeConfig.h │ │ │ │ │ ├── SynthTrace.h │ │ │ │ │ ├── SynthTraceParser.h │ │ │ │ │ ├── TraceInterpreter.h │ │ │ │ │ ├── TracingRuntime.h │ │ │ │ │ ├── hermes.h │ │ │ │ │ └── hermes_tracing.h │ │ │ │ ├── Resources │ │ │ │ │ └── Info.plist │ │ │ │ └── hermes │ │ │ └── Current -> 0 │ │ └── hermes -> Versions/Current/hermes │ └── hermes.framework.dSYM │ └── Contents │ ├── Info.plist │ └── Resources │ └── DWARF │ └── hermes ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm └── include ├── hermes │ ├── CompileJS.h │ ├── DebuggerAPI.h │ ├── Public │ │ ├── Buffer.h │ │ ├── CrashManager.h │ │ ├── CtorConfig.h │ │ ├── DebuggerTypes.h │ │ ├── GCConfig.h │ │ ├── GCTripwireContext.h │ │ └── RuntimeConfig.h │ ├── SynthTrace.h │ ├── SynthTraceParser.h │ ├── TraceInterpreter.h │ ├── TracingRuntime.h │ ├── hermes.h │ └── hermes_tracing.h └── jsi ├── JSIDynamic.h ├── decorator.h ├── instrumentation.h ├── jsi-inl.h ├── jsi.h ├── jsilib.h └── threadsafe.h ``` # dylib variant ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=false -DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm ├── include │ ├── hermes │ │ ├── CompileJS.h │ │ ├── DebuggerAPI.h │ │ ├── Public │ │ │ ├── Buffer.h │ │ │ ├── CrashManager.h │ │ │ ├── CtorConfig.h │ │ │ ├── DebuggerTypes.h │ │ │ ├── GCConfig.h │ │ │ ├── GCTripwireContext.h │ │ │ └── RuntimeConfig.h │ │ ├── SynthTrace.h │ │ ├── SynthTraceParser.h │ │ ├── TraceInterpreter.h │ │ ├── TracingRuntime.h │ │ ├── hermes.h │ │ └── hermes_tracing.h │ └── jsi │ ├── JSIDynamic.h │ ├── decorator.h │ ├── instrumentation.h │ ├── jsi-inl.h │ ├── jsi.h │ ├── jsilib.h │ └── threadsafe.h └── lib ├── libhermes.dylib └── libhermes.dylib.dSYM └── Contents ├── Info.plist └── Resources └── DWARF └── libhermes.dylib ``` Pull Request resolved: https://github.com/facebook/hermes/pull/285 Reviewed By: willholen Differential Revision: D22398354 Pulled By: mhorowitz fbshipit-source-id: 732524275cf273866171fc6e2ac2acb062185fbd
2020-07-09 03:13:30 +03:00
add_subdirectory(public)
add_subdirectory(external)
add_subdirectory(API)
add_subdirectory(android/intltest/java/com/facebook/hermes/test)
add_subdirectory(unsupported)
Do not build cli tools for iphone targets (#354) Summary: Currently (in `v0.7.0`) we build the CLI tools for both `iphone` and `macos` targets, which means that, when installing into the same location, cmake will skip installing the CLI tools from the second build. In our current situation, the second installation is the macOS build, which is really the only target from which we want CLI tools. ``` $ tar -zxvf hermes-engine-darwin-0.7.0.tgz $ file package/destroot/bin/hermesc package/destroot/bin/hermesc: Mach-O universal binary with 3 architectures: [arm_v7:Mach-O executable arm_v7] [arm_v7s:Mach-O executable arm_v7s] [arm64] package/destroot/bin/hermesc (for architecture armv7): Mach-O executable arm_v7 package/destroot/bin/hermesc (for architecture armv7s): Mach-O executable arm_v7s package/destroot/bin/hermesc (for architecture arm64): Mach-O 64-bit executable arm64 ``` Put differently, nobody runs `hermesc` on iOS, we always only want the macOS builds of these. ---- I opted to make building CLI tools a simple cmake option and then use that from the apple builds to control wether or not to include them. Pull Request resolved: https://github.com/facebook/hermes/pull/354 Test Plan: With the `hermes-engine-darwin-0.7.0.tgz` artefact of this `npm` CI job: ``` $ tar -zxvf hermes-engine-darwin-0.7.0.tgz $ file package/destroot/bin/hermesc package/destroot/bin/hermesc: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64] package/destroot/bin/hermesc (for architecture x86_64): Mach-O 64-bit executable x86_64 package/destroot/bin/hermesc (for architecture arm64): Mach-O 64-bit executable arm64 ``` Reviewed By: tmikov Differential Revision: D23824972 Pulled By: Huxpro fbshipit-source-id: 9ec12c7231e1392a5287af510c6f30014784ed41
2020-09-29 01:04:05 +03:00
if(HERMES_ENABLE_TOOLS)
add_subdirectory(tools)
endif()
Use internal fork of LLVM Summary: Place a fork of LLVM git rev c179d7b006348005d2da228aed4c3c251590baa3 under `external/llvh`(1) and modify the CMake build to use it. I am calling it a "fork", because it is not all of LLVM. Only the parts that are used by Hermes are included, which at this time is only parts of `libLLVMSupporrt`. Most(2) of LLVM build scripts are removed, and it is treated just as another ordinary library. (1) Why `llvh`? To be able to coexist with instances of the "real" LLVM, we must change the namespace, all public symbols containing the `llvm` string and the include directory name. `llvh` seemed as good a name as any. I also considered `llvm-h` and `h-llvm`, but the problem is that they are a superstring of `llvm` so it becomes harder to search for the `llvm` string. Note that the actual rename will happen in a follow up diff. It would be a massive patch. (2) libLLVMSupport relies on pretty elaborate feature detection scripts, which would be painful to duplicate, so for now I have preserved them under external/llvh/cmake. Unfortunately turning LLVM into an ordinary library is not enough, since we were implicitly relying on a lot of functionality provided by the LLVM build scripts. Things like setting default warning flags, easily turning exceptions on and off, etc. I attempted to replace it with Hermes equivalents, which are now provided by `cmake/Hermes.cmake`: - `add_llvm_library/tool()` is replaced by `add_hermes_library/tool()`. - Several `LLVM_xxx` variables are replaced my similar `HERMES_xxx` ones. As a result, building Hermes now requires only checking it out, and running CMake and Ninja. It is a vastly simpler process than before. == Limitations - CMake LTO and ASAN builds aren't supported yet. - The JIT requires the "real" LLVM for disassembly. Reviewed By: avp Differential Revision: D19658656 fbshipit-source-id: 5094d2af45e343973b1aab02c550a18b2bf93a06
2020-02-06 11:30:00 +03:00
# Make sure JSI is compiled with PIC
set(save_CMAKE_POSITION_INDEPENDENT_CODE ${CMAKE_POSITION_INDEPENDENT_CODE})
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(save_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS ${HERMES_BUILD_SHARED_JSI})
Use internal fork of LLVM Summary: Place a fork of LLVM git rev c179d7b006348005d2da228aed4c3c251590baa3 under `external/llvh`(1) and modify the CMake build to use it. I am calling it a "fork", because it is not all of LLVM. Only the parts that are used by Hermes are included, which at this time is only parts of `libLLVMSupporrt`. Most(2) of LLVM build scripts are removed, and it is treated just as another ordinary library. (1) Why `llvh`? To be able to coexist with instances of the "real" LLVM, we must change the namespace, all public symbols containing the `llvm` string and the include directory name. `llvh` seemed as good a name as any. I also considered `llvm-h` and `h-llvm`, but the problem is that they are a superstring of `llvm` so it becomes harder to search for the `llvm` string. Note that the actual rename will happen in a follow up diff. It would be a massive patch. (2) libLLVMSupport relies on pretty elaborate feature detection scripts, which would be painful to duplicate, so for now I have preserved them under external/llvh/cmake. Unfortunately turning LLVM into an ordinary library is not enough, since we were implicitly relying on a lot of functionality provided by the LLVM build scripts. Things like setting default warning flags, easily turning exceptions on and off, etc. I attempted to replace it with Hermes equivalents, which are now provided by `cmake/Hermes.cmake`: - `add_llvm_library/tool()` is replaced by `add_hermes_library/tool()`. - Several `LLVM_xxx` variables are replaced my similar `HERMES_xxx` ones. As a result, building Hermes now requires only checking it out, and running CMake and Ninja. It is a vastly simpler process than before. == Limitations - CMake LTO and ASAN builds aren't supported yet. - The JIT requires the "real" LLVM for disassembly. Reviewed By: avp Differential Revision: D19658656 fbshipit-source-id: 5094d2af45e343973b1aab02c550a18b2bf93a06
2020-02-06 11:30:00 +03:00
add_subdirectory(${HERMES_JSI_DIR}/jsi ${CMAKE_CURRENT_BINARY_DIR}/jsi)
set(BUILD_SHARED_LIBS ${save_BUILD_SHARED_LIBS})
Use internal fork of LLVM Summary: Place a fork of LLVM git rev c179d7b006348005d2da228aed4c3c251590baa3 under `external/llvh`(1) and modify the CMake build to use it. I am calling it a "fork", because it is not all of LLVM. Only the parts that are used by Hermes are included, which at this time is only parts of `libLLVMSupporrt`. Most(2) of LLVM build scripts are removed, and it is treated just as another ordinary library. (1) Why `llvh`? To be able to coexist with instances of the "real" LLVM, we must change the namespace, all public symbols containing the `llvm` string and the include directory name. `llvh` seemed as good a name as any. I also considered `llvm-h` and `h-llvm`, but the problem is that they are a superstring of `llvm` so it becomes harder to search for the `llvm` string. Note that the actual rename will happen in a follow up diff. It would be a massive patch. (2) libLLVMSupport relies on pretty elaborate feature detection scripts, which would be painful to duplicate, so for now I have preserved them under external/llvh/cmake. Unfortunately turning LLVM into an ordinary library is not enough, since we were implicitly relying on a lot of functionality provided by the LLVM build scripts. Things like setting default warning flags, easily turning exceptions on and off, etc. I attempted to replace it with Hermes equivalents, which are now provided by `cmake/Hermes.cmake`: - `add_llvm_library/tool()` is replaced by `add_hermes_library/tool()`. - Several `LLVM_xxx` variables are replaced my similar `HERMES_xxx` ones. As a result, building Hermes now requires only checking it out, and running CMake and Ninja. It is a vastly simpler process than before. == Limitations - CMake LTO and ASAN builds aren't supported yet. - The JIT requires the "real" LLVM for disassembly. Reviewed By: avp Differential Revision: D19658656 fbshipit-source-id: 5094d2af45e343973b1aab02c550a18b2bf93a06
2020-02-06 11:30:00 +03:00
set(CMAKE_POSITION_INDEPENDENT_CODE ${save_CMAKE_POSITION_INDEPENDENT_CODE})
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/facebook)
add_subdirectory(facebook)
endif()
# Configure the test suites
#
Build macOS framework and add CocoaPods podspec (#285) Summary: Supersedes https://github.com/facebook/hermes/issues/239 Currently used in our macOS fork of React Native https://github.com/microsoft/react-native-macos/pull/473. (Although we’re using a build of Hermes v0.4.1, as we’re at RN 0.62.0.) * On Apple platforms build a [dynamic] framework bundle when `HERMES_BUILD_APPLE_FRAMEWORK` is set. When set to `FALSE` it will produce a `dylib`, like previously. Defaults to `TRUE`. * On Apple platforms create a debugging symbols bundle. * Add `HERMES_ENABLE_FUZZING`, which is enabled by default. * Add `HERMES_ENABLE_TEST_SUITE`, which is enabled by default. * Add a CocoaPods podspec that can build from source or use a binary. A standalone macOS app that pulls in Hermes as a CocoaPods pod can be found here https://github.com/alloy/TestHermesMaster. ## Framework variant (default) ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── Library │ └── Frameworks │ ├── hermes.framework │ │ ├── Headers -> Versions/Current/Headers │ │ ├── Resources -> Versions/Current/Resources │ │ ├── Versions │ │ │ ├── 0 │ │ │ │ ├── Headers │ │ │ │ │ ├── CompileJS.h │ │ │ │ │ ├── DebuggerAPI.h │ │ │ │ │ ├── Public │ │ │ │ │ │ ├── Buffer.h │ │ │ │ │ │ ├── CrashManager.h │ │ │ │ │ │ ├── CtorConfig.h │ │ │ │ │ │ ├── DebuggerTypes.h │ │ │ │ │ │ ├── GCConfig.h │ │ │ │ │ │ ├── GCTripwireContext.h │ │ │ │ │ │ └── RuntimeConfig.h │ │ │ │ │ ├── SynthTrace.h │ │ │ │ │ ├── SynthTraceParser.h │ │ │ │ │ ├── TraceInterpreter.h │ │ │ │ │ ├── TracingRuntime.h │ │ │ │ │ ├── hermes.h │ │ │ │ │ └── hermes_tracing.h │ │ │ │ ├── Resources │ │ │ │ │ └── Info.plist │ │ │ │ └── hermes │ │ │ └── Current -> 0 │ │ └── hermes -> Versions/Current/hermes │ └── hermes.framework.dSYM │ └── Contents │ ├── Info.plist │ └── Resources │ └── DWARF │ └── hermes ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm └── include ├── hermes │ ├── CompileJS.h │ ├── DebuggerAPI.h │ ├── Public │ │ ├── Buffer.h │ │ ├── CrashManager.h │ │ ├── CtorConfig.h │ │ ├── DebuggerTypes.h │ │ ├── GCConfig.h │ │ ├── GCTripwireContext.h │ │ └── RuntimeConfig.h │ ├── SynthTrace.h │ ├── SynthTraceParser.h │ ├── TraceInterpreter.h │ ├── TracingRuntime.h │ ├── hermes.h │ └── hermes_tracing.h └── jsi ├── JSIDynamic.h ├── decorator.h ├── instrumentation.h ├── jsi-inl.h ├── jsi.h ├── jsilib.h └── threadsafe.h ``` # dylib variant ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=false -DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm ├── include │ ├── hermes │ │ ├── CompileJS.h │ │ ├── DebuggerAPI.h │ │ ├── Public │ │ │ ├── Buffer.h │ │ │ ├── CrashManager.h │ │ │ ├── CtorConfig.h │ │ │ ├── DebuggerTypes.h │ │ │ ├── GCConfig.h │ │ │ ├── GCTripwireContext.h │ │ │ └── RuntimeConfig.h │ │ ├── SynthTrace.h │ │ ├── SynthTraceParser.h │ │ ├── TraceInterpreter.h │ │ ├── TracingRuntime.h │ │ ├── hermes.h │ │ └── hermes_tracing.h │ └── jsi │ ├── JSIDynamic.h │ ├── decorator.h │ ├── instrumentation.h │ ├── jsi-inl.h │ ├── jsi.h │ ├── jsilib.h │ └── threadsafe.h └── lib ├── libhermes.dylib └── libhermes.dylib.dSYM └── Contents ├── Info.plist └── Resources └── DWARF └── libhermes.dylib ``` Pull Request resolved: https://github.com/facebook/hermes/pull/285 Reviewed By: willholen Differential Revision: D22398354 Pulled By: mhorowitz fbshipit-source-id: 732524275cf273866171fc6e2ac2acb062185fbd
2020-07-09 03:13:30 +03:00
if(HERMES_ENABLE_TEST_SUITE)
Do not build cli tools for iphone targets (#354) Summary: Currently (in `v0.7.0`) we build the CLI tools for both `iphone` and `macos` targets, which means that, when installing into the same location, cmake will skip installing the CLI tools from the second build. In our current situation, the second installation is the macOS build, which is really the only target from which we want CLI tools. ``` $ tar -zxvf hermes-engine-darwin-0.7.0.tgz $ file package/destroot/bin/hermesc package/destroot/bin/hermesc: Mach-O universal binary with 3 architectures: [arm_v7:Mach-O executable arm_v7] [arm_v7s:Mach-O executable arm_v7s] [arm64] package/destroot/bin/hermesc (for architecture armv7): Mach-O executable arm_v7 package/destroot/bin/hermesc (for architecture armv7s): Mach-O executable arm_v7s package/destroot/bin/hermesc (for architecture arm64): Mach-O 64-bit executable arm64 ``` Put differently, nobody runs `hermesc` on iOS, we always only want the macOS builds of these. ---- I opted to make building CLI tools a simple cmake option and then use that from the apple builds to control wether or not to include them. Pull Request resolved: https://github.com/facebook/hermes/pull/354 Test Plan: With the `hermes-engine-darwin-0.7.0.tgz` artefact of this `npm` CI job: ``` $ tar -zxvf hermes-engine-darwin-0.7.0.tgz $ file package/destroot/bin/hermesc package/destroot/bin/hermesc: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64] package/destroot/bin/hermesc (for architecture x86_64): Mach-O 64-bit executable x86_64 package/destroot/bin/hermesc (for architecture arm64): Mach-O 64-bit executable arm64 ``` Reviewed By: tmikov Differential Revision: D23824972 Pulled By: Huxpro fbshipit-source-id: 9ec12c7231e1392a5287af510c6f30014784ed41
2020-09-29 01:04:05 +03:00
if(NOT HERMES_ENABLE_TOOLS)
message(FATAL_ERROR, "Running the test-suite requires the CLI tools to be built.")
endif()
Build macOS framework and add CocoaPods podspec (#285) Summary: Supersedes https://github.com/facebook/hermes/issues/239 Currently used in our macOS fork of React Native https://github.com/microsoft/react-native-macos/pull/473. (Although we’re using a build of Hermes v0.4.1, as we’re at RN 0.62.0.) * On Apple platforms build a [dynamic] framework bundle when `HERMES_BUILD_APPLE_FRAMEWORK` is set. When set to `FALSE` it will produce a `dylib`, like previously. Defaults to `TRUE`. * On Apple platforms create a debugging symbols bundle. * Add `HERMES_ENABLE_FUZZING`, which is enabled by default. * Add `HERMES_ENABLE_TEST_SUITE`, which is enabled by default. * Add a CocoaPods podspec that can build from source or use a binary. A standalone macOS app that pulls in Hermes as a CocoaPods pod can be found here https://github.com/alloy/TestHermesMaster. ## Framework variant (default) ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── Library │ └── Frameworks │ ├── hermes.framework │ │ ├── Headers -> Versions/Current/Headers │ │ ├── Resources -> Versions/Current/Resources │ │ ├── Versions │ │ │ ├── 0 │ │ │ │ ├── Headers │ │ │ │ │ ├── CompileJS.h │ │ │ │ │ ├── DebuggerAPI.h │ │ │ │ │ ├── Public │ │ │ │ │ │ ├── Buffer.h │ │ │ │ │ │ ├── CrashManager.h │ │ │ │ │ │ ├── CtorConfig.h │ │ │ │ │ │ ├── DebuggerTypes.h │ │ │ │ │ │ ├── GCConfig.h │ │ │ │ │ │ ├── GCTripwireContext.h │ │ │ │ │ │ └── RuntimeConfig.h │ │ │ │ │ ├── SynthTrace.h │ │ │ │ │ ├── SynthTraceParser.h │ │ │ │ │ ├── TraceInterpreter.h │ │ │ │ │ ├── TracingRuntime.h │ │ │ │ │ ├── hermes.h │ │ │ │ │ └── hermes_tracing.h │ │ │ │ ├── Resources │ │ │ │ │ └── Info.plist │ │ │ │ └── hermes │ │ │ └── Current -> 0 │ │ └── hermes -> Versions/Current/hermes │ └── hermes.framework.dSYM │ └── Contents │ ├── Info.plist │ └── Resources │ └── DWARF │ └── hermes ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm └── include ├── hermes │ ├── CompileJS.h │ ├── DebuggerAPI.h │ ├── Public │ │ ├── Buffer.h │ │ ├── CrashManager.h │ │ ├── CtorConfig.h │ │ ├── DebuggerTypes.h │ │ ├── GCConfig.h │ │ ├── GCTripwireContext.h │ │ └── RuntimeConfig.h │ ├── SynthTrace.h │ ├── SynthTraceParser.h │ ├── TraceInterpreter.h │ ├── TracingRuntime.h │ ├── hermes.h │ └── hermes_tracing.h └── jsi ├── JSIDynamic.h ├── decorator.h ├── instrumentation.h ├── jsi-inl.h ├── jsi.h ├── jsilib.h └── threadsafe.h ``` # dylib variant ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=false -DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm ├── include │ ├── hermes │ │ ├── CompileJS.h │ │ ├── DebuggerAPI.h │ │ ├── Public │ │ │ ├── Buffer.h │ │ │ ├── CrashManager.h │ │ │ ├── CtorConfig.h │ │ │ ├── DebuggerTypes.h │ │ │ ├── GCConfig.h │ │ │ ├── GCTripwireContext.h │ │ │ └── RuntimeConfig.h │ │ ├── SynthTrace.h │ │ ├── SynthTraceParser.h │ │ ├── TraceInterpreter.h │ │ ├── TracingRuntime.h │ │ ├── hermes.h │ │ └── hermes_tracing.h │ └── jsi │ ├── JSIDynamic.h │ ├── decorator.h │ ├── instrumentation.h │ ├── jsi-inl.h │ ├── jsi.h │ ├── jsilib.h │ └── threadsafe.h └── lib ├── libhermes.dylib └── libhermes.dylib.dSYM └── Contents ├── Info.plist └── Resources └── DWARF └── libhermes.dylib ``` Pull Request resolved: https://github.com/facebook/hermes/pull/285 Reviewed By: willholen Differential Revision: D22398354 Pulled By: mhorowitz fbshipit-source-id: 732524275cf273866171fc6e2ac2acb062185fbd
2020-07-09 03:13:30 +03:00
add_subdirectory(unittests)
list(APPEND HERMES_TEST_DEPS
HermesUnitTests
hermes
hermesc
hvm
interp-dispatch-bench
hdb
hbcdump
hbc-attribute
hbc-deltaprep
hbc-diff
dependency-extractor
)
if(HERMES_BUILD_NODE_HERMES)
list(APPEND HERMES_TEST_DEPS node-hermes)
endif()
set(coverage_directory "")
if (HERMES_ENABLE_CODE_COVERAGE)
set(coverage_directory ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/coverage)
endif()
set(HERMES_LIT_TEST_PARAMS_BASE
test_exec_root=${CMAKE_CURRENT_BINARY_DIR}/test
unittests_dir=${CMAKE_CURRENT_BINARY_DIR}/unittests
Build macOS framework and add CocoaPods podspec (#285) Summary: Supersedes https://github.com/facebook/hermes/issues/239 Currently used in our macOS fork of React Native https://github.com/microsoft/react-native-macos/pull/473. (Although we’re using a build of Hermes v0.4.1, as we’re at RN 0.62.0.) * On Apple platforms build a [dynamic] framework bundle when `HERMES_BUILD_APPLE_FRAMEWORK` is set. When set to `FALSE` it will produce a `dylib`, like previously. Defaults to `TRUE`. * On Apple platforms create a debugging symbols bundle. * Add `HERMES_ENABLE_FUZZING`, which is enabled by default. * Add `HERMES_ENABLE_TEST_SUITE`, which is enabled by default. * Add a CocoaPods podspec that can build from source or use a binary. A standalone macOS app that pulls in Hermes as a CocoaPods pod can be found here https://github.com/alloy/TestHermesMaster. ## Framework variant (default) ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── Library │ └── Frameworks │ ├── hermes.framework │ │ ├── Headers -> Versions/Current/Headers │ │ ├── Resources -> Versions/Current/Resources │ │ ├── Versions │ │ │ ├── 0 │ │ │ │ ├── Headers │ │ │ │ │ ├── CompileJS.h │ │ │ │ │ ├── DebuggerAPI.h │ │ │ │ │ ├── Public │ │ │ │ │ │ ├── Buffer.h │ │ │ │ │ │ ├── CrashManager.h │ │ │ │ │ │ ├── CtorConfig.h │ │ │ │ │ │ ├── DebuggerTypes.h │ │ │ │ │ │ ├── GCConfig.h │ │ │ │ │ │ ├── GCTripwireContext.h │ │ │ │ │ │ └── RuntimeConfig.h │ │ │ │ │ ├── SynthTrace.h │ │ │ │ │ ├── SynthTraceParser.h │ │ │ │ │ ├── TraceInterpreter.h │ │ │ │ │ ├── TracingRuntime.h │ │ │ │ │ ├── hermes.h │ │ │ │ │ └── hermes_tracing.h │ │ │ │ ├── Resources │ │ │ │ │ └── Info.plist │ │ │ │ └── hermes │ │ │ └── Current -> 0 │ │ └── hermes -> Versions/Current/hermes │ └── hermes.framework.dSYM │ └── Contents │ ├── Info.plist │ └── Resources │ └── DWARF │ └── hermes ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm └── include ├── hermes │ ├── CompileJS.h │ ├── DebuggerAPI.h │ ├── Public │ │ ├── Buffer.h │ │ ├── CrashManager.h │ │ ├── CtorConfig.h │ │ ├── DebuggerTypes.h │ │ ├── GCConfig.h │ │ ├── GCTripwireContext.h │ │ └── RuntimeConfig.h │ ├── SynthTrace.h │ ├── SynthTraceParser.h │ ├── TraceInterpreter.h │ ├── TracingRuntime.h │ ├── hermes.h │ └── hermes_tracing.h └── jsi ├── JSIDynamic.h ├── decorator.h ├── instrumentation.h ├── jsi-inl.h ├── jsi.h ├── jsilib.h └── threadsafe.h ``` # dylib variant ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=false -DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm ├── include │ ├── hermes │ │ ├── CompileJS.h │ │ ├── DebuggerAPI.h │ │ ├── Public │ │ │ ├── Buffer.h │ │ │ ├── CrashManager.h │ │ │ ├── CtorConfig.h │ │ │ ├── DebuggerTypes.h │ │ │ ├── GCConfig.h │ │ │ ├── GCTripwireContext.h │ │ │ └── RuntimeConfig.h │ │ ├── SynthTrace.h │ │ ├── SynthTraceParser.h │ │ ├── TraceInterpreter.h │ │ ├── TracingRuntime.h │ │ ├── hermes.h │ │ └── hermes_tracing.h │ └── jsi │ ├── JSIDynamic.h │ ├── decorator.h │ ├── instrumentation.h │ ├── jsi-inl.h │ ├── jsi.h │ ├── jsilib.h │ └── threadsafe.h └── lib ├── libhermes.dylib └── libhermes.dylib.dSYM └── Contents ├── Info.plist └── Resources └── DWARF └── libhermes.dylib ``` Pull Request resolved: https://github.com/facebook/hermes/pull/285 Reviewed By: willholen Differential Revision: D22398354 Pulled By: mhorowitz fbshipit-source-id: 732524275cf273866171fc6e2ac2acb062185fbd
2020-07-09 03:13:30 +03:00
debugger_enabled=${HERMES_ENABLE_DEBUGGER}
Merging Hermes v0.10 into our fork (#58) * 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> &amp; <strong>Mathematica</strong> &amp; <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 &amp; 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: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 &quot;synchronous&quot; and &quot;runWhen&quot; 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 &quot;synchronous&quot; and &quot;runWhen&quot; 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: 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="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366">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="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366">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="https://www.github.com/gulpjs/glob-parent/commit/843f8de1c177e9a5c06c4cfd2349ca5207168e00">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="https://www.github.com/gulpjs/glob-parent/commit/3e9f04a3b4349db7e1962d87c9a7398cda51f339">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 &lt;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="https://www.github.com/gulpjs/glob-parent/commit/32f6d52663b7addac38d0dff570d8127edf03f47">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 &lt;10 support (<a href="https://www.github.com/gulpjs/glob-parent/commit/e83d0c5a411947cf69eb58f36349db80439c606f">e83d0c5</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/gulpjs/glob-parent/commit/eb2c439de448c779b450472e591a2bc9e37e9668"><code>eb2c439</code></a> chore: update changelog</li> <li><a href="https://github.com/gulpjs/glob-parent/commit/12bcb6c45c942e2d05fc1e6ff5402e72555b54b6"><code>12bcb6c</code></a> chore: release 5.1.2</li> <li><a href="https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366"><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="https://github.com/gulpjs/glob-parent/commit/0b014a7962789b2d8f2cf0b6311f40667aecd62c"><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="https://github.com/gulpjs/glob-parent/commit/2b24ebd64b2a045aa167c825376335555da139fd"><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](https://github.com/llvm-mirror/llvm/commit/c94004ffdb1ee37b3c4e762e4e7576cc3844d79b) 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: https://github.com/llvm/llvm-project/blob/c1a0a213378a458fbea1a5c77b315c7dce08fd05/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>
2021-11-30 20:56:51 +03:00
intl_enabled=${HERMES_ENABLE_INTL}
Build macOS framework and add CocoaPods podspec (#285) Summary: Supersedes https://github.com/facebook/hermes/issues/239 Currently used in our macOS fork of React Native https://github.com/microsoft/react-native-macos/pull/473. (Although we’re using a build of Hermes v0.4.1, as we’re at RN 0.62.0.) * On Apple platforms build a [dynamic] framework bundle when `HERMES_BUILD_APPLE_FRAMEWORK` is set. When set to `FALSE` it will produce a `dylib`, like previously. Defaults to `TRUE`. * On Apple platforms create a debugging symbols bundle. * Add `HERMES_ENABLE_FUZZING`, which is enabled by default. * Add `HERMES_ENABLE_TEST_SUITE`, which is enabled by default. * Add a CocoaPods podspec that can build from source or use a binary. A standalone macOS app that pulls in Hermes as a CocoaPods pod can be found here https://github.com/alloy/TestHermesMaster. ## Framework variant (default) ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── Library │ └── Frameworks │ ├── hermes.framework │ │ ├── Headers -> Versions/Current/Headers │ │ ├── Resources -> Versions/Current/Resources │ │ ├── Versions │ │ │ ├── 0 │ │ │ │ ├── Headers │ │ │ │ │ ├── CompileJS.h │ │ │ │ │ ├── DebuggerAPI.h │ │ │ │ │ ├── Public │ │ │ │ │ │ ├── Buffer.h │ │ │ │ │ │ ├── CrashManager.h │ │ │ │ │ │ ├── CtorConfig.h │ │ │ │ │ │ ├── DebuggerTypes.h │ │ │ │ │ │ ├── GCConfig.h │ │ │ │ │ │ ├── GCTripwireContext.h │ │ │ │ │ │ └── RuntimeConfig.h │ │ │ │ │ ├── SynthTrace.h │ │ │ │ │ ├── SynthTraceParser.h │ │ │ │ │ ├── TraceInterpreter.h │ │ │ │ │ ├── TracingRuntime.h │ │ │ │ │ ├── hermes.h │ │ │ │ │ └── hermes_tracing.h │ │ │ │ ├── Resources │ │ │ │ │ └── Info.plist │ │ │ │ └── hermes │ │ │ └── Current -> 0 │ │ └── hermes -> Versions/Current/hermes │ └── hermes.framework.dSYM │ └── Contents │ ├── Info.plist │ └── Resources │ └── DWARF │ └── hermes ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm └── include ├── hermes │ ├── CompileJS.h │ ├── DebuggerAPI.h │ ├── Public │ │ ├── Buffer.h │ │ ├── CrashManager.h │ │ ├── CtorConfig.h │ │ ├── DebuggerTypes.h │ │ ├── GCConfig.h │ │ ├── GCTripwireContext.h │ │ └── RuntimeConfig.h │ ├── SynthTrace.h │ ├── SynthTraceParser.h │ ├── TraceInterpreter.h │ ├── TracingRuntime.h │ ├── hermes.h │ └── hermes_tracing.h └── jsi ├── JSIDynamic.h ├── decorator.h ├── instrumentation.h ├── jsi-inl.h ├── jsi.h ├── jsilib.h └── threadsafe.h ``` # dylib variant ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=false -DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm ├── include │ ├── hermes │ │ ├── CompileJS.h │ │ ├── DebuggerAPI.h │ │ ├── Public │ │ │ ├── Buffer.h │ │ │ ├── CrashManager.h │ │ │ ├── CtorConfig.h │ │ │ ├── DebuggerTypes.h │ │ │ ├── GCConfig.h │ │ │ ├── GCTripwireContext.h │ │ │ └── RuntimeConfig.h │ │ ├── SynthTrace.h │ │ ├── SynthTraceParser.h │ │ ├── TraceInterpreter.h │ │ ├── TracingRuntime.h │ │ ├── hermes.h │ │ └── hermes_tracing.h │ └── jsi │ ├── JSIDynamic.h │ ├── decorator.h │ ├── instrumentation.h │ ├── jsi-inl.h │ ├── jsi.h │ ├── jsilib.h │ └── threadsafe.h └── lib ├── libhermes.dylib └── libhermes.dylib.dSYM └── Contents ├── Info.plist └── Resources └── DWARF └── libhermes.dylib ``` Pull Request resolved: https://github.com/facebook/hermes/pull/285 Reviewed By: willholen Differential Revision: D22398354 Pulled By: mhorowitz fbshipit-source-id: 732524275cf273866171fc6e2ac2acb062185fbd
2020-07-09 03:13:30 +03:00
use_flowparser=${HERMES_USE_FLOWPARSER}
hbc_deltaprep=${HERMES_TOOLS_OUTPUT_DIR}/hbc-deltaprep
dependency_extractor=${HERMES_TOOLS_OUTPUT_DIR}/dependency-extractor
FileCheck=${HERMES_TOOLS_OUTPUT_DIR}/FileCheck
Build macOS framework and add CocoaPods podspec (#285) Summary: Supersedes https://github.com/facebook/hermes/issues/239 Currently used in our macOS fork of React Native https://github.com/microsoft/react-native-macos/pull/473. (Although we’re using a build of Hermes v0.4.1, as we’re at RN 0.62.0.) * On Apple platforms build a [dynamic] framework bundle when `HERMES_BUILD_APPLE_FRAMEWORK` is set. When set to `FALSE` it will produce a `dylib`, like previously. Defaults to `TRUE`. * On Apple platforms create a debugging symbols bundle. * Add `HERMES_ENABLE_FUZZING`, which is enabled by default. * Add `HERMES_ENABLE_TEST_SUITE`, which is enabled by default. * Add a CocoaPods podspec that can build from source or use a binary. A standalone macOS app that pulls in Hermes as a CocoaPods pod can be found here https://github.com/alloy/TestHermesMaster. ## Framework variant (default) ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── Library │ └── Frameworks │ ├── hermes.framework │ │ ├── Headers -> Versions/Current/Headers │ │ ├── Resources -> Versions/Current/Resources │ │ ├── Versions │ │ │ ├── 0 │ │ │ │ ├── Headers │ │ │ │ │ ├── CompileJS.h │ │ │ │ │ ├── DebuggerAPI.h │ │ │ │ │ ├── Public │ │ │ │ │ │ ├── Buffer.h │ │ │ │ │ │ ├── CrashManager.h │ │ │ │ │ │ ├── CtorConfig.h │ │ │ │ │ │ ├── DebuggerTypes.h │ │ │ │ │ │ ├── GCConfig.h │ │ │ │ │ │ ├── GCTripwireContext.h │ │ │ │ │ │ └── RuntimeConfig.h │ │ │ │ │ ├── SynthTrace.h │ │ │ │ │ ├── SynthTraceParser.h │ │ │ │ │ ├── TraceInterpreter.h │ │ │ │ │ ├── TracingRuntime.h │ │ │ │ │ ├── hermes.h │ │ │ │ │ └── hermes_tracing.h │ │ │ │ ├── Resources │ │ │ │ │ └── Info.plist │ │ │ │ └── hermes │ │ │ └── Current -> 0 │ │ └── hermes -> Versions/Current/hermes │ └── hermes.framework.dSYM │ └── Contents │ ├── Info.plist │ └── Resources │ └── DWARF │ └── hermes ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm └── include ├── hermes │ ├── CompileJS.h │ ├── DebuggerAPI.h │ ├── Public │ │ ├── Buffer.h │ │ ├── CrashManager.h │ │ ├── CtorConfig.h │ │ ├── DebuggerTypes.h │ │ ├── GCConfig.h │ │ ├── GCTripwireContext.h │ │ └── RuntimeConfig.h │ ├── SynthTrace.h │ ├── SynthTraceParser.h │ ├── TraceInterpreter.h │ ├── TracingRuntime.h │ ├── hermes.h │ └── hermes_tracing.h └── jsi ├── JSIDynamic.h ├── decorator.h ├── instrumentation.h ├── jsi-inl.h ├── jsi.h ├── jsilib.h └── threadsafe.h ``` # dylib variant ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=false -DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm ├── include │ ├── hermes │ │ ├── CompileJS.h │ │ ├── DebuggerAPI.h │ │ ├── Public │ │ │ ├── Buffer.h │ │ │ ├── CrashManager.h │ │ │ ├── CtorConfig.h │ │ │ ├── DebuggerTypes.h │ │ │ ├── GCConfig.h │ │ │ ├── GCTripwireContext.h │ │ │ └── RuntimeConfig.h │ │ ├── SynthTrace.h │ │ ├── SynthTraceParser.h │ │ ├── TraceInterpreter.h │ │ ├── TracingRuntime.h │ │ ├── hermes.h │ │ └── hermes_tracing.h │ └── jsi │ ├── JSIDynamic.h │ ├── decorator.h │ ├── instrumentation.h │ ├── jsi-inl.h │ ├── jsi.h │ ├── jsilib.h │ └── threadsafe.h └── lib ├── libhermes.dylib └── libhermes.dylib.dSYM └── Contents ├── Info.plist └── Resources └── DWARF └── libhermes.dylib ``` Pull Request resolved: https://github.com/facebook/hermes/pull/285 Reviewed By: willholen Differential Revision: D22398354 Pulled By: mhorowitz fbshipit-source-id: 732524275cf273866171fc6e2ac2acb062185fbd
2020-07-09 03:13:30 +03:00
hermes=${HERMES_TOOLS_OUTPUT_DIR}/hermes
hermesc=${HERMES_TOOLS_OUTPUT_DIR}/hermesc
hdb=${HERMES_TOOLS_OUTPUT_DIR}/hdb
hbcdump=${HERMES_TOOLS_OUTPUT_DIR}/hbcdump
hbc-deltaprep=${HERMES_TOOLS_OUTPUT_DIR}/hbc-deltaprep
hbc_diff=${HERMES_TOOLS_OUTPUT_DIR}/hbc-diff
build_mode="$<IF:$<CONFIG:Debug>,dbg,opt>"
Build macOS framework and add CocoaPods podspec (#285) Summary: Supersedes https://github.com/facebook/hermes/issues/239 Currently used in our macOS fork of React Native https://github.com/microsoft/react-native-macos/pull/473. (Although we’re using a build of Hermes v0.4.1, as we’re at RN 0.62.0.) * On Apple platforms build a [dynamic] framework bundle when `HERMES_BUILD_APPLE_FRAMEWORK` is set. When set to `FALSE` it will produce a `dylib`, like previously. Defaults to `TRUE`. * On Apple platforms create a debugging symbols bundle. * Add `HERMES_ENABLE_FUZZING`, which is enabled by default. * Add `HERMES_ENABLE_TEST_SUITE`, which is enabled by default. * Add a CocoaPods podspec that can build from source or use a binary. A standalone macOS app that pulls in Hermes as a CocoaPods pod can be found here https://github.com/alloy/TestHermesMaster. ## Framework variant (default) ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── Library │ └── Frameworks │ ├── hermes.framework │ │ ├── Headers -> Versions/Current/Headers │ │ ├── Resources -> Versions/Current/Resources │ │ ├── Versions │ │ │ ├── 0 │ │ │ │ ├── Headers │ │ │ │ │ ├── CompileJS.h │ │ │ │ │ ├── DebuggerAPI.h │ │ │ │ │ ├── Public │ │ │ │ │ │ ├── Buffer.h │ │ │ │ │ │ ├── CrashManager.h │ │ │ │ │ │ ├── CtorConfig.h │ │ │ │ │ │ ├── DebuggerTypes.h │ │ │ │ │ │ ├── GCConfig.h │ │ │ │ │ │ ├── GCTripwireContext.h │ │ │ │ │ │ └── RuntimeConfig.h │ │ │ │ │ ├── SynthTrace.h │ │ │ │ │ ├── SynthTraceParser.h │ │ │ │ │ ├── TraceInterpreter.h │ │ │ │ │ ├── TracingRuntime.h │ │ │ │ │ ├── hermes.h │ │ │ │ │ └── hermes_tracing.h │ │ │ │ ├── Resources │ │ │ │ │ └── Info.plist │ │ │ │ └── hermes │ │ │ └── Current -> 0 │ │ └── hermes -> Versions/Current/hermes │ └── hermes.framework.dSYM │ └── Contents │ ├── Info.plist │ └── Resources │ └── DWARF │ └── hermes ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm └── include ├── hermes │ ├── CompileJS.h │ ├── DebuggerAPI.h │ ├── Public │ │ ├── Buffer.h │ │ ├── CrashManager.h │ │ ├── CtorConfig.h │ │ ├── DebuggerTypes.h │ │ ├── GCConfig.h │ │ ├── GCTripwireContext.h │ │ └── RuntimeConfig.h │ ├── SynthTrace.h │ ├── SynthTraceParser.h │ ├── TraceInterpreter.h │ ├── TracingRuntime.h │ ├── hermes.h │ └── hermes_tracing.h └── jsi ├── JSIDynamic.h ├── decorator.h ├── instrumentation.h ├── jsi-inl.h ├── jsi.h ├── jsilib.h └── threadsafe.h ``` # dylib variant ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=false -DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm ├── include │ ├── hermes │ │ ├── CompileJS.h │ │ ├── DebuggerAPI.h │ │ ├── Public │ │ │ ├── Buffer.h │ │ │ ├── CrashManager.h │ │ │ ├── CtorConfig.h │ │ │ ├── DebuggerTypes.h │ │ │ ├── GCConfig.h │ │ │ ├── GCTripwireContext.h │ │ │ └── RuntimeConfig.h │ │ ├── SynthTrace.h │ │ ├── SynthTraceParser.h │ │ ├── TraceInterpreter.h │ │ ├── TracingRuntime.h │ │ ├── hermes.h │ │ └── hermes_tracing.h │ └── jsi │ ├── JSIDynamic.h │ ├── decorator.h │ ├── instrumentation.h │ ├── jsi-inl.h │ ├── jsi.h │ ├── jsilib.h │ └── threadsafe.h └── lib ├── libhermes.dylib └── libhermes.dylib.dSYM └── Contents ├── Info.plist └── Resources └── DWARF └── libhermes.dylib ``` Pull Request resolved: https://github.com/facebook/hermes/pull/285 Reviewed By: willholen Differential Revision: D22398354 Pulled By: mhorowitz fbshipit-source-id: 732524275cf273866171fc6e2ac2acb062185fbd
2020-07-09 03:13:30 +03:00
exception_on_oom_enabled=${HERMESVM_EXCEPTION_ON_OOM}
node_hermes_enabled_flag=${HERMES_BUILD_NODE_HERMES}
node-hermes=${HERMES_TOOLS_OUTPUT_DIR}/node-hermes
Build macOS framework and add CocoaPods podspec (#285) Summary: Supersedes https://github.com/facebook/hermes/issues/239 Currently used in our macOS fork of React Native https://github.com/microsoft/react-native-macos/pull/473. (Although we’re using a build of Hermes v0.4.1, as we’re at RN 0.62.0.) * On Apple platforms build a [dynamic] framework bundle when `HERMES_BUILD_APPLE_FRAMEWORK` is set. When set to `FALSE` it will produce a `dylib`, like previously. Defaults to `TRUE`. * On Apple platforms create a debugging symbols bundle. * Add `HERMES_ENABLE_FUZZING`, which is enabled by default. * Add `HERMES_ENABLE_TEST_SUITE`, which is enabled by default. * Add a CocoaPods podspec that can build from source or use a binary. A standalone macOS app that pulls in Hermes as a CocoaPods pod can be found here https://github.com/alloy/TestHermesMaster. ## Framework variant (default) ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── Library │ └── Frameworks │ ├── hermes.framework │ │ ├── Headers -> Versions/Current/Headers │ │ ├── Resources -> Versions/Current/Resources │ │ ├── Versions │ │ │ ├── 0 │ │ │ │ ├── Headers │ │ │ │ │ ├── CompileJS.h │ │ │ │ │ ├── DebuggerAPI.h │ │ │ │ │ ├── Public │ │ │ │ │ │ ├── Buffer.h │ │ │ │ │ │ ├── CrashManager.h │ │ │ │ │ │ ├── CtorConfig.h │ │ │ │ │ │ ├── DebuggerTypes.h │ │ │ │ │ │ ├── GCConfig.h │ │ │ │ │ │ ├── GCTripwireContext.h │ │ │ │ │ │ └── RuntimeConfig.h │ │ │ │ │ ├── SynthTrace.h │ │ │ │ │ ├── SynthTraceParser.h │ │ │ │ │ ├── TraceInterpreter.h │ │ │ │ │ ├── TracingRuntime.h │ │ │ │ │ ├── hermes.h │ │ │ │ │ └── hermes_tracing.h │ │ │ │ ├── Resources │ │ │ │ │ └── Info.plist │ │ │ │ └── hermes │ │ │ └── Current -> 0 │ │ └── hermes -> Versions/Current/hermes │ └── hermes.framework.dSYM │ └── Contents │ ├── Info.plist │ └── Resources │ └── DWARF │ └── hermes ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm └── include ├── hermes │ ├── CompileJS.h │ ├── DebuggerAPI.h │ ├── Public │ │ ├── Buffer.h │ │ ├── CrashManager.h │ │ ├── CtorConfig.h │ │ ├── DebuggerTypes.h │ │ ├── GCConfig.h │ │ ├── GCTripwireContext.h │ │ └── RuntimeConfig.h │ ├── SynthTrace.h │ ├── SynthTraceParser.h │ ├── TraceInterpreter.h │ ├── TracingRuntime.h │ ├── hermes.h │ └── hermes_tracing.h └── jsi ├── JSIDynamic.h ├── decorator.h ├── instrumentation.h ├── jsi-inl.h ├── jsi.h ├── jsilib.h └── threadsafe.h ``` # dylib variant ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=false -DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm ├── include │ ├── hermes │ │ ├── CompileJS.h │ │ ├── DebuggerAPI.h │ │ ├── Public │ │ │ ├── Buffer.h │ │ │ ├── CrashManager.h │ │ │ ├── CtorConfig.h │ │ │ ├── DebuggerTypes.h │ │ │ ├── GCConfig.h │ │ │ ├── GCTripwireContext.h │ │ │ └── RuntimeConfig.h │ │ ├── SynthTrace.h │ │ ├── SynthTraceParser.h │ │ ├── TraceInterpreter.h │ │ ├── TracingRuntime.h │ │ ├── hermes.h │ │ └── hermes_tracing.h │ └── jsi │ ├── JSIDynamic.h │ ├── decorator.h │ ├── instrumentation.h │ ├── jsi-inl.h │ ├── jsi.h │ ├── jsilib.h │ └── threadsafe.h └── lib ├── libhermes.dylib └── libhermes.dylib.dSYM └── Contents ├── Info.plist └── Resources └── DWARF └── libhermes.dylib ``` Pull Request resolved: https://github.com/facebook/hermes/pull/285 Reviewed By: willholen Differential Revision: D22398354 Pulled By: mhorowitz fbshipit-source-id: 732524275cf273866171fc6e2ac2acb062185fbd
2020-07-09 03:13:30 +03:00
profiler=${HERMES_PROFILER_MODE_IN_LIT_TEST}
gc=${HERMESVM_GCKIND}
ubsan=${HERMES_ENABLE_UNDEFINED_BEHAVIOR_SANITIZER}
coverage=${coverage_directory}
check_native_stack=${HERMES_CHECK_NATIVE_STACK}
Build macOS framework and add CocoaPods podspec (#285) Summary: Supersedes https://github.com/facebook/hermes/issues/239 Currently used in our macOS fork of React Native https://github.com/microsoft/react-native-macos/pull/473. (Although we’re using a build of Hermes v0.4.1, as we’re at RN 0.62.0.) * On Apple platforms build a [dynamic] framework bundle when `HERMES_BUILD_APPLE_FRAMEWORK` is set. When set to `FALSE` it will produce a `dylib`, like previously. Defaults to `TRUE`. * On Apple platforms create a debugging symbols bundle. * Add `HERMES_ENABLE_FUZZING`, which is enabled by default. * Add `HERMES_ENABLE_TEST_SUITE`, which is enabled by default. * Add a CocoaPods podspec that can build from source or use a binary. A standalone macOS app that pulls in Hermes as a CocoaPods pod can be found here https://github.com/alloy/TestHermesMaster. ## Framework variant (default) ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── Library │ └── Frameworks │ ├── hermes.framework │ │ ├── Headers -> Versions/Current/Headers │ │ ├── Resources -> Versions/Current/Resources │ │ ├── Versions │ │ │ ├── 0 │ │ │ │ ├── Headers │ │ │ │ │ ├── CompileJS.h │ │ │ │ │ ├── DebuggerAPI.h │ │ │ │ │ ├── Public │ │ │ │ │ │ ├── Buffer.h │ │ │ │ │ │ ├── CrashManager.h │ │ │ │ │ │ ├── CtorConfig.h │ │ │ │ │ │ ├── DebuggerTypes.h │ │ │ │ │ │ ├── GCConfig.h │ │ │ │ │ │ ├── GCTripwireContext.h │ │ │ │ │ │ └── RuntimeConfig.h │ │ │ │ │ ├── SynthTrace.h │ │ │ │ │ ├── SynthTraceParser.h │ │ │ │ │ ├── TraceInterpreter.h │ │ │ │ │ ├── TracingRuntime.h │ │ │ │ │ ├── hermes.h │ │ │ │ │ └── hermes_tracing.h │ │ │ │ ├── Resources │ │ │ │ │ └── Info.plist │ │ │ │ └── hermes │ │ │ └── Current -> 0 │ │ └── hermes -> Versions/Current/hermes │ └── hermes.framework.dSYM │ └── Contents │ ├── Info.plist │ └── Resources │ └── DWARF │ └── hermes ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm └── include ├── hermes │ ├── CompileJS.h │ ├── DebuggerAPI.h │ ├── Public │ │ ├── Buffer.h │ │ ├── CrashManager.h │ │ ├── CtorConfig.h │ │ ├── DebuggerTypes.h │ │ ├── GCConfig.h │ │ ├── GCTripwireContext.h │ │ └── RuntimeConfig.h │ ├── SynthTrace.h │ ├── SynthTraceParser.h │ ├── TraceInterpreter.h │ ├── TracingRuntime.h │ ├── hermes.h │ └── hermes_tracing.h └── jsi ├── JSIDynamic.h ├── decorator.h ├── instrumentation.h ├── jsi-inl.h ├── jsi.h ├── jsilib.h └── threadsafe.h ``` # dylib variant ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=false -DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm ├── include │ ├── hermes │ │ ├── CompileJS.h │ │ ├── DebuggerAPI.h │ │ ├── Public │ │ │ ├── Buffer.h │ │ │ ├── CrashManager.h │ │ │ ├── CtorConfig.h │ │ │ ├── DebuggerTypes.h │ │ │ ├── GCConfig.h │ │ │ ├── GCTripwireContext.h │ │ │ └── RuntimeConfig.h │ │ ├── SynthTrace.h │ │ ├── SynthTraceParser.h │ │ ├── TraceInterpreter.h │ │ ├── TracingRuntime.h │ │ ├── hermes.h │ │ └── hermes_tracing.h │ └── jsi │ ├── JSIDynamic.h │ ├── decorator.h │ ├── instrumentation.h │ ├── jsi-inl.h │ ├── jsi.h │ ├── jsilib.h │ └── threadsafe.h └── lib ├── libhermes.dylib └── libhermes.dylib.dSYM └── Contents ├── Info.plist └── Resources └── DWARF └── libhermes.dylib ``` Pull Request resolved: https://github.com/facebook/hermes/pull/285 Reviewed By: willholen Differential Revision: D22398354 Pulled By: mhorowitz fbshipit-source-id: 732524275cf273866171fc6e2ac2acb062185fbd
2020-07-09 03:13:30 +03:00
)
set(HERMES_LIT_TEST_PARAMS
${HERMES_LIT_TEST_PARAMS_BASE}
FileCheckOrRegen=${HERMES_TOOLS_OUTPUT_DIR}/FileCheck
)
set(HERMES_LIT_UPDATE_PARAMS
${HERMES_LIT_TEST_PARAMS_BASE}
"FileCheckOrRegen=${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/lit-expect-gen/generate.py"
)
Build macOS framework and add CocoaPods podspec (#285) Summary: Supersedes https://github.com/facebook/hermes/issues/239 Currently used in our macOS fork of React Native https://github.com/microsoft/react-native-macos/pull/473. (Although we’re using a build of Hermes v0.4.1, as we’re at RN 0.62.0.) * On Apple platforms build a [dynamic] framework bundle when `HERMES_BUILD_APPLE_FRAMEWORK` is set. When set to `FALSE` it will produce a `dylib`, like previously. Defaults to `TRUE`. * On Apple platforms create a debugging symbols bundle. * Add `HERMES_ENABLE_FUZZING`, which is enabled by default. * Add `HERMES_ENABLE_TEST_SUITE`, which is enabled by default. * Add a CocoaPods podspec that can build from source or use a binary. A standalone macOS app that pulls in Hermes as a CocoaPods pod can be found here https://github.com/alloy/TestHermesMaster. ## Framework variant (default) ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── Library │ └── Frameworks │ ├── hermes.framework │ │ ├── Headers -> Versions/Current/Headers │ │ ├── Resources -> Versions/Current/Resources │ │ ├── Versions │ │ │ ├── 0 │ │ │ │ ├── Headers │ │ │ │ │ ├── CompileJS.h │ │ │ │ │ ├── DebuggerAPI.h │ │ │ │ │ ├── Public │ │ │ │ │ │ ├── Buffer.h │ │ │ │ │ │ ├── CrashManager.h │ │ │ │ │ │ ├── CtorConfig.h │ │ │ │ │ │ ├── DebuggerTypes.h │ │ │ │ │ │ ├── GCConfig.h │ │ │ │ │ │ ├── GCTripwireContext.h │ │ │ │ │ │ └── RuntimeConfig.h │ │ │ │ │ ├── SynthTrace.h │ │ │ │ │ ├── SynthTraceParser.h │ │ │ │ │ ├── TraceInterpreter.h │ │ │ │ │ ├── TracingRuntime.h │ │ │ │ │ ├── hermes.h │ │ │ │ │ └── hermes_tracing.h │ │ │ │ ├── Resources │ │ │ │ │ └── Info.plist │ │ │ │ └── hermes │ │ │ └── Current -> 0 │ │ └── hermes -> Versions/Current/hermes │ └── hermes.framework.dSYM │ └── Contents │ ├── Info.plist │ └── Resources │ └── DWARF │ └── hermes ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm └── include ├── hermes │ ├── CompileJS.h │ ├── DebuggerAPI.h │ ├── Public │ │ ├── Buffer.h │ │ ├── CrashManager.h │ │ ├── CtorConfig.h │ │ ├── DebuggerTypes.h │ │ ├── GCConfig.h │ │ ├── GCTripwireContext.h │ │ └── RuntimeConfig.h │ ├── SynthTrace.h │ ├── SynthTraceParser.h │ ├── TraceInterpreter.h │ ├── TracingRuntime.h │ ├── hermes.h │ └── hermes_tracing.h └── jsi ├── JSIDynamic.h ├── decorator.h ├── instrumentation.h ├── jsi-inl.h ├── jsi.h ├── jsilib.h └── threadsafe.h ``` # dylib variant ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=false -DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm ├── include │ ├── hermes │ │ ├── CompileJS.h │ │ ├── DebuggerAPI.h │ │ ├── Public │ │ │ ├── Buffer.h │ │ │ ├── CrashManager.h │ │ │ ├── CtorConfig.h │ │ │ ├── DebuggerTypes.h │ │ │ ├── GCConfig.h │ │ │ ├── GCTripwireContext.h │ │ │ └── RuntimeConfig.h │ │ ├── SynthTrace.h │ │ ├── SynthTraceParser.h │ │ ├── TraceInterpreter.h │ │ ├── TracingRuntime.h │ │ ├── hermes.h │ │ └── hermes_tracing.h │ └── jsi │ ├── JSIDynamic.h │ ├── decorator.h │ ├── instrumentation.h │ ├── jsi-inl.h │ ├── jsi.h │ ├── jsilib.h │ └── threadsafe.h └── lib ├── libhermes.dylib └── libhermes.dylib.dSYM └── Contents ├── Info.plist └── Resources └── DWARF └── libhermes.dylib ``` Pull Request resolved: https://github.com/facebook/hermes/pull/285 Reviewed By: willholen Differential Revision: D22398354 Pulled By: mhorowitz fbshipit-source-id: 732524275cf273866171fc6e2ac2acb062185fbd
2020-07-09 03:13:30 +03:00
set(LLVH_LIT_ARGS "-sv")
add_lit_testsuite(check-hermes "Running the Hermes regression tests"
${CMAKE_CURRENT_SOURCE_DIR}/test
${CMAKE_CURRENT_SOURCE_DIR}/unittests
Build macOS framework and add CocoaPods podspec (#285) Summary: Supersedes https://github.com/facebook/hermes/issues/239 Currently used in our macOS fork of React Native https://github.com/microsoft/react-native-macos/pull/473. (Although we’re using a build of Hermes v0.4.1, as we’re at RN 0.62.0.) * On Apple platforms build a [dynamic] framework bundle when `HERMES_BUILD_APPLE_FRAMEWORK` is set. When set to `FALSE` it will produce a `dylib`, like previously. Defaults to `TRUE`. * On Apple platforms create a debugging symbols bundle. * Add `HERMES_ENABLE_FUZZING`, which is enabled by default. * Add `HERMES_ENABLE_TEST_SUITE`, which is enabled by default. * Add a CocoaPods podspec that can build from source or use a binary. A standalone macOS app that pulls in Hermes as a CocoaPods pod can be found here https://github.com/alloy/TestHermesMaster. ## Framework variant (default) ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── Library │ └── Frameworks │ ├── hermes.framework │ │ ├── Headers -> Versions/Current/Headers │ │ ├── Resources -> Versions/Current/Resources │ │ ├── Versions │ │ │ ├── 0 │ │ │ │ ├── Headers │ │ │ │ │ ├── CompileJS.h │ │ │ │ │ ├── DebuggerAPI.h │ │ │ │ │ ├── Public │ │ │ │ │ │ ├── Buffer.h │ │ │ │ │ │ ├── CrashManager.h │ │ │ │ │ │ ├── CtorConfig.h │ │ │ │ │ │ ├── DebuggerTypes.h │ │ │ │ │ │ ├── GCConfig.h │ │ │ │ │ │ ├── GCTripwireContext.h │ │ │ │ │ │ └── RuntimeConfig.h │ │ │ │ │ ├── SynthTrace.h │ │ │ │ │ ├── SynthTraceParser.h │ │ │ │ │ ├── TraceInterpreter.h │ │ │ │ │ ├── TracingRuntime.h │ │ │ │ │ ├── hermes.h │ │ │ │ │ └── hermes_tracing.h │ │ │ │ ├── Resources │ │ │ │ │ └── Info.plist │ │ │ │ └── hermes │ │ │ └── Current -> 0 │ │ └── hermes -> Versions/Current/hermes │ └── hermes.framework.dSYM │ └── Contents │ ├── Info.plist │ └── Resources │ └── DWARF │ └── hermes ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm └── include ├── hermes │ ├── CompileJS.h │ ├── DebuggerAPI.h │ ├── Public │ │ ├── Buffer.h │ │ ├── CrashManager.h │ │ ├── CtorConfig.h │ │ ├── DebuggerTypes.h │ │ ├── GCConfig.h │ │ ├── GCTripwireContext.h │ │ └── RuntimeConfig.h │ ├── SynthTrace.h │ ├── SynthTraceParser.h │ ├── TraceInterpreter.h │ ├── TracingRuntime.h │ ├── hermes.h │ └── hermes_tracing.h └── jsi ├── JSIDynamic.h ├── decorator.h ├── instrumentation.h ├── jsi-inl.h ├── jsi.h ├── jsilib.h └── threadsafe.h ``` # dylib variant ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=false -DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm ├── include │ ├── hermes │ │ ├── CompileJS.h │ │ ├── DebuggerAPI.h │ │ ├── Public │ │ │ ├── Buffer.h │ │ │ ├── CrashManager.h │ │ │ ├── CtorConfig.h │ │ │ ├── DebuggerTypes.h │ │ │ ├── GCConfig.h │ │ │ ├── GCTripwireContext.h │ │ │ └── RuntimeConfig.h │ │ ├── SynthTrace.h │ │ ├── SynthTraceParser.h │ │ ├── TraceInterpreter.h │ │ ├── TracingRuntime.h │ │ ├── hermes.h │ │ └── hermes_tracing.h │ └── jsi │ ├── JSIDynamic.h │ ├── decorator.h │ ├── instrumentation.h │ ├── jsi-inl.h │ ├── jsi.h │ ├── jsilib.h │ └── threadsafe.h └── lib ├── libhermes.dylib └── libhermes.dylib.dSYM └── Contents ├── Info.plist └── Resources └── DWARF └── libhermes.dylib ``` Pull Request resolved: https://github.com/facebook/hermes/pull/285 Reviewed By: willholen Differential Revision: D22398354 Pulled By: mhorowitz fbshipit-source-id: 732524275cf273866171fc6e2ac2acb062185fbd
2020-07-09 03:13:30 +03:00
PARAMS ${HERMES_LIT_TEST_PARAMS}
DEPENDS ${HERMES_TEST_DEPS}
ARGS ${HERMES_TEST_EXTRA_ARGS}
)
set_target_properties(check-hermes PROPERTIES FOLDER "Hermes regression tests")
# update-lit will regenerate the expectations for all tests that are verified with FileCheckOrRegen.
# All other tests are run normally.
add_lit_testsuite(update-lit "Running the Hermes regression tests, and updating auto-generated expectations."
${CMAKE_CURRENT_SOURCE_DIR}/test
${CMAKE_CURRENT_SOURCE_DIR}/unittests
PARAMS ${HERMES_LIT_UPDATE_PARAMS}
DEPENDS ${HERMES_TEST_DEPS}
ARGS ${HERMES_TEST_EXTRA_ARGS}
)
set_target_properties(update-lit PROPERTIES FOLDER "Hermes regression tests")
Build macOS framework and add CocoaPods podspec (#285) Summary: Supersedes https://github.com/facebook/hermes/issues/239 Currently used in our macOS fork of React Native https://github.com/microsoft/react-native-macos/pull/473. (Although we’re using a build of Hermes v0.4.1, as we’re at RN 0.62.0.) * On Apple platforms build a [dynamic] framework bundle when `HERMES_BUILD_APPLE_FRAMEWORK` is set. When set to `FALSE` it will produce a `dylib`, like previously. Defaults to `TRUE`. * On Apple platforms create a debugging symbols bundle. * Add `HERMES_ENABLE_FUZZING`, which is enabled by default. * Add `HERMES_ENABLE_TEST_SUITE`, which is enabled by default. * Add a CocoaPods podspec that can build from source or use a binary. A standalone macOS app that pulls in Hermes as a CocoaPods pod can be found here https://github.com/alloy/TestHermesMaster. ## Framework variant (default) ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── Library │ └── Frameworks │ ├── hermes.framework │ │ ├── Headers -> Versions/Current/Headers │ │ ├── Resources -> Versions/Current/Resources │ │ ├── Versions │ │ │ ├── 0 │ │ │ │ ├── Headers │ │ │ │ │ ├── CompileJS.h │ │ │ │ │ ├── DebuggerAPI.h │ │ │ │ │ ├── Public │ │ │ │ │ │ ├── Buffer.h │ │ │ │ │ │ ├── CrashManager.h │ │ │ │ │ │ ├── CtorConfig.h │ │ │ │ │ │ ├── DebuggerTypes.h │ │ │ │ │ │ ├── GCConfig.h │ │ │ │ │ │ ├── GCTripwireContext.h │ │ │ │ │ │ └── RuntimeConfig.h │ │ │ │ │ ├── SynthTrace.h │ │ │ │ │ ├── SynthTraceParser.h │ │ │ │ │ ├── TraceInterpreter.h │ │ │ │ │ ├── TracingRuntime.h │ │ │ │ │ ├── hermes.h │ │ │ │ │ └── hermes_tracing.h │ │ │ │ ├── Resources │ │ │ │ │ └── Info.plist │ │ │ │ └── hermes │ │ │ └── Current -> 0 │ │ └── hermes -> Versions/Current/hermes │ └── hermes.framework.dSYM │ └── Contents │ ├── Info.plist │ └── Resources │ └── DWARF │ └── hermes ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm └── include ├── hermes │ ├── CompileJS.h │ ├── DebuggerAPI.h │ ├── Public │ │ ├── Buffer.h │ │ ├── CrashManager.h │ │ ├── CtorConfig.h │ │ ├── DebuggerTypes.h │ │ ├── GCConfig.h │ │ ├── GCTripwireContext.h │ │ └── RuntimeConfig.h │ ├── SynthTrace.h │ ├── SynthTraceParser.h │ ├── TraceInterpreter.h │ ├── TracingRuntime.h │ ├── hermes.h │ └── hermes_tracing.h └── jsi ├── JSIDynamic.h ├── decorator.h ├── instrumentation.h ├── jsi-inl.h ├── jsi.h ├── jsilib.h └── threadsafe.h ``` # dylib variant ``` $ ./src/utils/build/configure.py --distribute --cmake-flags='-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=false -DCMAKE_INSTALL_PREFIX:PATH=../destroot_release' build $ cd build && ninja install && cd .. $ tree destroot_release/ destroot_release/ ├── bin │ ├── hbcdump │ ├── hdb │ ├── hermes │ ├── hermesc │ └── hvm ├── include │ ├── hermes │ │ ├── CompileJS.h │ │ ├── DebuggerAPI.h │ │ ├── Public │ │ │ ├── Buffer.h │ │ │ ├── CrashManager.h │ │ │ ├── CtorConfig.h │ │ │ ├── DebuggerTypes.h │ │ │ ├── GCConfig.h │ │ │ ├── GCTripwireContext.h │ │ │ └── RuntimeConfig.h │ │ ├── SynthTrace.h │ │ ├── SynthTraceParser.h │ │ ├── TraceInterpreter.h │ │ ├── TracingRuntime.h │ │ ├── hermes.h │ │ └── hermes_tracing.h │ └── jsi │ ├── JSIDynamic.h │ ├── decorator.h │ ├── instrumentation.h │ ├── jsi-inl.h │ ├── jsi.h │ ├── jsilib.h │ └── threadsafe.h └── lib ├── libhermes.dylib └── libhermes.dylib.dSYM └── Contents ├── Info.plist └── Resources └── DWARF └── libhermes.dylib ``` Pull Request resolved: https://github.com/facebook/hermes/pull/285 Reviewed By: willholen Differential Revision: D22398354 Pulled By: mhorowitz fbshipit-source-id: 732524275cf273866171fc6e2ac2acb062185fbd
2020-07-09 03:13:30 +03:00
endif()