Closed Bug 1823326 Opened 3 years ago Closed 3 years ago

Refactor JSON parser to decouple allocation

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
114 Branch
Tracking Status
firefox114 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(11 files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

The current JSON parser is tightly coupled with JSContext and JS::Value/JSObject handling.

To achieve JSContext-free parsing, the parser needs to be decoupled from the allocation of the runtime objects.

We could use a template-based approach similar to FullParseHandler and SyntaxParseHandler,
so that the abstraction itself doesn't affect the performance.

The later patch will add JSONTokenizer class to store those methods.

JSONToken is going to be used across tokenizer and parser classes.

Depends on D174559

Depends on D174560

Allocation part is going to be moved to handler class later.

Depends on D174562

JSONFullParseHandler and JSONFullParseHandlerAnyChar corresponds to
FullParseHandler in frontend.
These classes handle allocation and runtime-specific things.

Depends on D174564

In order to add syntax-parser later, make tokenizer accept template parameter.

Depends on D174565

Syntax parser does not need string allocation.

Depends on D174566

To support handler for syntax parser, make the parser templatized for handler.

Depends on D174568

Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/20e31adf0627 Part 1: Move tokenization methods to the top of the file. r=bthrall https://hg.mozilla.org/integration/autoland/rev/927bc0c48c6d Part 2: Move token enum out of JSONParserBase. r=bthrall https://hg.mozilla.org/integration/autoland/rev/f21226706008 Part 3: Add JSONTokenizer. r=bthrall https://hg.mozilla.org/integration/autoland/rev/07f59d899003 Part 4: Move JSONStringType out of JSONTokenizer. r=bthrall https://hg.mozilla.org/integration/autoland/rev/8dd802c54fe3 Part 5: Move string and number value handling into JSON parser. r=bthrall https://hg.mozilla.org/integration/autoland/rev/bbfe63774429 Part 6: Move JSONParserState out of JSONParserBase. r=bthrall https://hg.mozilla.org/integration/autoland/rev/cfa47a2d2829 Part 7: Split JSONParser into handler and parser. r=bthrall https://hg.mozilla.org/integration/autoland/rev/363ef3379606 Part 8: Templatize JSONTokenizer. r=bthrall https://hg.mozilla.org/integration/autoland/rev/a5dd696c30bd Part 9: Wrap JSStringBuilder to support syntax parser. r=bthrall https://hg.mozilla.org/integration/autoland/rev/630daf6fe40f Part 10: Reorder JSONFullParseHandlerAnyChar declaration. r=bthrall https://hg.mozilla.org/integration/autoland/rev/8f20eba2a842 Part 11: Add JSONPerHandlerParser. r=bthrall
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: