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.
Include string size when passing from WASM to JS
Summary: This is the first part of a fix for unicode handling within the Hermes parser compiled to WASM. JS strings may contain null bytes (e.g. if they are escaped using `\0`), but the current decoding utility (emscripten's `UTF8ToString`) is built to stop at the first null byte. In the next diff we will be introducing a new decoder to handle this issue with null bytes (along with handling of surrogate pairs from Hermes). To set up for this we need to refactor the portion of the JS/WASM bridge logic that pertains to strings. Instead of just sending a string's pointer over from WASM to JS, we must now send both the pointer and its size in bytes. These will be passed to a new `buildString` method in the JS library that decodes the string of a given length and returns a reference to it on the JS side. This reference can then be passed to an AST node builder function, just like references for nodes and node lists. Reviewed By: gkz Differential Revision: D24521408 fbshipit-source-id: a69d4c284aad1bba437ba6976d73f4879ba1585d
- Loading branch information
1 parent
fb0e241
commit 480d588
Showing
3 changed files
with
21 additions
and
18 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