Closed Bug 1607854 Opened 4 years ago Closed 4 years ago

Prepare to defer allocation of JSScript to just before JSScript::fullyInitFromEmitter

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

RESOLVED FIXED

People

(Reporter: mgaudet, Assigned: mgaudet)

References

Details

Attachments

(4 files, 16 obsolete files)

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

By the end of this bug I think JSScript::create and JSScript::fullyInitFromEmitter ought to collapse together.

This is surprisingly within reach already (not to say there are no blockers, but it's not as far away as I believed) because it turns out that the BytecodeEmitter does relatively few things with the passed in JSScript:

  • BytecodeEmitter::checkSingletonContext
  • Field-initalizers are set as part of emitFunctionScript
  • Checking script->noScriptRval()
  • setTreatAsRunOnce.
Depends on: 1607855
Depends on: 1607861
Priority: -- → P2

Most of the complexity of this patch is trying to preserve the same level of
assertion in the future case where a BytecodeEmitter may or may not have a
pre-allocated script.

Assignee: nobody → mgaudet
Status: NEW → ASSIGNED

Marking as leave open as the first batch won't finish this.

Keywords: leave-open
Pushed by mgaudet@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9cffcfb914d7
Use parser-options for noScriptRval where possible r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/04f020697732
Set field initializers as part of FunctionScriptEmitter::initScript r=djvj
https://hg.mozilla.org/integration/autoland/rev/24fd4240a3cf
Don't use Script to access ScriptSource object in BytecodeCompiler r=djvj
https://hg.mozilla.org/integration/autoland/rev/03c30bc4fb01
Centralize forwarding of LazyScript flags to CreateFromLazy r=djvj
Depends on: 1614061

Also use it to allocate the JSScript inside of BytecodeEmitter::emitFunction

This is a prepatory step to deferring JSScript allocation.

Depends on D64793

Use ScriptAllocationStencil inside of BytecodeEmitter instead of Script, and allocate on demand.

Depends on D64796

Uploaded my current-state-of-the-world patches.

Honestly would probably fold this stack for landing, as the intermediate patches change GC handling three times.

But I wanted this up to use as a discussion point (and also, if someone else starts looking at this they have a starting point)

Attachment #9129816 - Attachment is obsolete: true
Attachment #9129819 - Attachment is obsolete: true
Attachment #9129820 - Attachment is obsolete: true
Attachment #9129821 - Attachment is obsolete: true
Attachment #9129822 - Attachment is obsolete: true
Attachment #9129815 - Attachment is obsolete: true

One thing this patch makes pretty clear is that the story for manipulating
immutable flags is very confusing in the front end. For example, we have
flags on the functionbox, but also flags on the BCEScriptStencil, and they
need to get unioned together at script allocation time.

Also use it to allocate the JSScript inside of BytecodeEmitter::emitFunction

Use ScriptAllocationStencil inside of BytecodeEmitter instead of Script, and allocate on demand.

Depends on D68254

This is preparation for disconnecting BCEScriptStencil from the BytecodeEmitter to allow subsequent batch initialization

Attachment #9135781 - Attachment description: Bug 1607854 - Create ScriptAllocationStencil to represent the data required to allocate a script → Bug 1607854 - Create ScriptAllocationStencil to represent the data required to allocate a script r?tcampbell
Attachment #9135782 - Attachment description: Bug 1607854 - Make input and output aspects of the script management in CompilationInfo clearer. → Bug 1607854 - Make input and output aspects of the script management in CompilationInfo clearer. r?tcampbell
Attachment #9135783 - Attachment description: Bug 1607854 - Defer allocation of JSScript to just before initialization → Bug 1607854 - Defer allocation of JSScript to just before initialization r?tcampbell
Attachment #9135778 - Attachment description: Bug 1607854 - Merge BCEScriptStencil and ScriptAllocationStencil → Bug 1607854 - Merge BCEScriptStencil and ScriptAllocationStencil r?tcampbell

Comment on attachment 9135794 [details]
Bug 1607854 - Minimize dependency on BytecodeEmitter member of BCEScriptStencil

Revision D68266 was moved to bug 1618631. Setting attachment 9135794 [details] to obsolete.

Attachment #9135794 - Attachment is obsolete: true
Attachment #9135778 - Attachment is obsolete: true
Attachment #9135781 - Attachment is obsolete: true
Attachment #9135782 - Attachment is obsolete: true
Attachment #9135783 - Attachment is obsolete: true
Keywords: leave-open

Note: This stack doesn't add any uses of this, but this was invaluable in the
development of this stack, and it was the second time I had implmented this and
not landed it.

Splitting this bug to avoid patches going into multiple releases under the same bug.

Retitle as "Prepare -"

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Summary: Defer allocation of JSScript to just before JSScript::fullyInitFromEmitter → Prepare to defer allocation of JSScript to just before JSScript::fullyInitFromEmitter

Comment on attachment 9142456 [details]
Bug 1607854 - Add operator== support to SourceExtent r?tcampbell

Revision D71997 was moved to bug 1632260. Setting attachment 9142456 [details] to obsolete.

Attachment #9142456 - Attachment is obsolete: true

Comment on attachment 9142457 [details]
Bug 1607854 - Add a creation extent to SharedContext to drive JSScript allocation r?tcampbell

Revision D71998 was moved to bug 1632260. Setting attachment 9142457 [details] to obsolete.

Attachment #9142457 - Attachment is obsolete: true

Comment on attachment 9142459 [details]
Bug 1607854 - Use shared context immutable flags for doing JSScript::Create r?tcampbell

Revision D71999 was moved to bug 1632260. Setting attachment 9142459 [details] to obsolete.

Attachment #9142459 - Attachment is obsolete: true

Comment on attachment 9142460 [details]
Bug 1607854 - Clarify BytecodeEmitter input output a bit r?tcampbell

Revision D72000 was moved to bug 1632260. Setting attachment 9142460 [details] to obsolete.

Attachment #9142460 - Attachment is obsolete: true

Comment on attachment 9142461 [details]
Bug 1607854 - Defer allocation of JSScript to just before JSScript::fullyInitFromEmitter r?tcampbell

Revision D72001 was moved to bug 1632260. Setting attachment 9142461 [details] to obsolete.

Attachment #9142461 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: