forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Tweak the CMake build to better support Emacripten and add instructions. ## Performance When built in Release+Wasm mode and executed by NodeJS, the Hermes compiler itself is about 5-10% slower than a native version when compiling a multi-megabyte JS source. It is likely that tweaking the memory growth parameters will help even further. VM execution performance of interp-dispatch.js is about 6 times slower with Wasm Hermes compared to a native one. I haven't spent time to look into it though. It is likely that it can be improved. Reviewed By: dulinriley Differential Revision: D19804100 fbshipit-source-id: d808fa9235d28b3217504e51ddd0d408befeb534
- Loading branch information
1 parent
694d1e9
commit 4b46541
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
id: Emscripten | ||
title: Building Hermes with Emscripten | ||
--- | ||
|
||
# Building Hermes With Emscripten and CMake | ||
|
||
# Create a new build directory | ||
mkdir embuild && cd embuild | ||
# Configure the build | ||
cmake ${HermesSourcePath?} \ | ||
-DCMAKE_TOOLCHAIN_FILE=${EmscriptenRoot?}/emscripten/cmake/Modules/Platform/Emscripten.cmake \ | ||
-DCMAKE_BUILD_TYPE=MinSizeRel \ | ||
-DEMSCRIPTEN_FASTCOMP=1 \ | ||
-DCMAKE_EXE_LINKER_FLAGS="-s NODERAWFS=1 -s WASM=0 -s ALLOW_MEMORY_GROWTH=1" | ||
# Build Hermes | ||
make -j hermes | ||
# Execute hermes | ||
node bin/hermes.js --help | ||
|
||
In the commands above, replace `${HermesSourcePath?}` with the path where you | ||
cloned Hermes, and `${EmscriptenRoot?}` with the path to your Emscripten | ||
install. | ||
|
||
You can further customize the following settings: | ||
- `CMAKE_BUILD_TYPE`: set it to one of CMake's build modes: `Debug`, `Release`, | ||
`MinSizeRel`, etc. | ||
- `EMSCRIPTEN_FASTCOMP`: Set it to 1 or 0 depending on whether you are using | ||
Emscripten with the *fastcomp* backend, or with the new LLVM backend. | ||
- `-s NODERAWFS`: add this if you will be running Hermes directly with Node. It | ||
enables direct access to the filesystem. | ||
- `-s WASM=`: set this to 0 for *Asm.js* output, 1 for *Wasm*, and 2 for both. | ||
|
||
You can customize the build generator by passing the `-G` option to CMake, for | ||
example `-G Ninja`. | ||
|