Closed Bug 1580020 Opened 5 years ago Closed 5 years ago

Defer GC allocation of BigInts until afer parse is finished.

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED

People

(Reporter: mgaudet, Assigned: mgaudet)

References

Details

Attachments

(4 files)

Currently BigInts are allocated as they are parsed, but it would be good to defer them till after parse to help create a pure-parser.

This is a rough draft: There are some issues that need to be decided upon
(below) but I wanted to get this up to ensure the larger level design pieces
pass muster before going too far down the road.

  1. It's not clear to me how this is going to interact with the parser error
    handling system. It seems to me that this should succeed based on the
    comment above ParseBigIntLiteral that says "Called from parser with already
    trimmed and validated token.", along with the release assert that there's no
    parse error 1

  2. This will raise the high water mark of a parse, because we hold onto a copy
    of the CharBuffer. There's a hard upper limit of the memory increase
    possible of 2x, but, nevertheless, this could be impactful on code that
    uses BigInt literals extensively. I don't know that it's avoidable with the
    current tokenizer design, as it seems that this buffer already has all the
    escapes processed; the only alternative would be to save source coordinates
    however, I couldn't seem to figure out how we could get that data from our
    current token implementation.

  3. This is my first time attempting to write move constructors. I'll be honest,
    I mostly scattered && and std::move() until it worked, but I have no
    idea what the idiomatic way would be to express the moves I am trying to
    express.

Assignee: nobody → mgaudet
Attachment #9091577 - Attachment description: Bug 1580020 - DRAFT: First building draft of deferred BigInt allocation r?tcampbell → Bug 1580020 - Defer BigInt allocation in deferred mode r?tcampbell
Priority: -- → P1
Pushed by mgaudet@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/197706178905
Mark publishDeferredItems as MOZ_MUST_USE to prevent misuse r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/6731b16798c1
Switch ParseContext to consume a ParseInfo directly, rather than decomposing r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/14dcedb553f4
Simplify AsmJS handling for deferred allocation r=tcampbell
Keywords: leave-open
Pushed by mgaudet@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4af5b90d68a3
Defer BigInt allocation in deferred mode r=tcampbell,jwalden
Flags: needinfo?(mgaudet)
Backout by shindli@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/858991b684ef
Backed out changeset 4af5b90d68a3 for causing a build bustage in /builds/worker/workspace/build/src/js/src/frontend/ParseNode.h CLOSED TREE
Pushed by mgaudet@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/67ab1fa79ea9
Defer BigInt allocation in deferred mode r=tcampbell,jwalden
Status: NEW → RESOLVED
Closed: 5 years ago
Flags: needinfo?(mgaudet)
Keywords: leave-open
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: