summaryrefslogtreecommitdiff
path: root/src/support/json.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Strings] Represent string values as WTF-16 internally (#6418)Thomas Lively2024-03-221-1/+6
| | | | | | | | | | | | | | | | WTF-16, i.e. arbitrary sequences of 16-bit values, is the encoding of Java and JavaScript strings, and using the same encoding makes the interpretation of string operations trivial, even when accounting for non-ascii characters. Specifically, use little-endian WTF-16. Re-encode string constants from WTF-8 to WTF-16 in the parsers, then back to WTF-8 in the writers. Update the constructor for string `Literal`s to interpret the string as WTF-16 and store a sequence of WTF-16 code units, i.e. 16-bit integers. Update `Builder::makeConstantExpression` accordingly to convert from the new `Literal` string representation back to a WTF-16 string. Update the interpreter to remove the logic for detecting non-ascii characters and bailing out. The naive implementations of all the string operations are correct now that our string encoding matches the JS string encoding.
* StringLowering: Escape the JSON in the custom section (#6316)Alon Zakai2024-02-201-2/+2
| | | | Also add an end-to-end test using node to verify we can parse the escaped content properly using TextDecoder+JSON.parse.
* JSON: Add simple printing and creation (#6265)Alon Zakai2024-02-011-0/+43