Closed Bug 1649968 Opened 4 years ago Closed 4 years ago

Split CompilationInfo into input, state, and output

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

RESOLVED FIXED
82 Branch
Tracking Status
firefox82 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(14 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
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
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
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review

To use CompilationInfo (or part of it) as a top level struct of Stencil,

(updated)

it needs to be split into the following 4 structs:

  • input
    • const JS::ReadOnlyCompileOptions& options
    • JS::Rooted<BaseScript*> lazy
    • JS::Rooted<ScriptSourceHolder> source_
    • JS::Rooted<Scope*> enclosingScope
  • state
    • AutoKeepAtoms keepAtoms
    • Directives directives
    • ScopeContext scopeContext
    • FunctionBox* traceListHead (will be removed after parser atom)
    • UsedNameTracker usedNames
    • LifoAllocScope& allocScope
  • stencil output
    • Vector<RegExpCreationData> regExpData
    • Vector<BigIntCreationData> bigIntData
    • JS::RootedVector<ScriptStencil> funcData
    • JS::Rooted<ScriptStencil> topLevel
    • JS::RootedVector<ScopeCreationData> scopeCreationData
    • JS::Rooted<StencilModuleMetadata> moduleMetadata
    • HashMap<FunctionIndex, RefPtr<const JS::WasmModule>> asmJS
    • ParserAtomsTable parserAtoms
  • GC output
    • JS::Rooted<JSScript*> script
    • JS::Rooted<ModuleObject*> module
    • JS::RootedVector<JSFunction*> functions
    • JS::RootedVector<js::Scope*> scopes
    • JS::Rooted<ScriptSourceObject*> sourceObject
Depends on: 1592105
Severity: -- → N/A
Priority: -- → P2
See Also: → 1652056

things necessary to instantiate stencil also includes input.

input -> [parser+bytecode compiler, using state] -> input+stencil -> [instantiate] -> GC output

Depends on: 1657353
Blocks: 1658631
Blocks: 1661079
Depends on: 1658556
Blocks: 1661098
No longer blocks: 1544117, 1658631, 1661079

This patch just adds 4 structs to categolize CompilationInfo fields.
Later patches will simplify methods and consumers.

Depends on D88204

Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED

CompilationGCOutput will be moved out of CompilationInfo in later patch.

Depends on D88206

So that we don't need forward declaration.

Depends on D88207

CompilationGCOutput should have different lifetime than input + stencil.
CompilationGCOutput can even be allocated in different thread than the
compilation (off-thread compilation will instantiate stencil in main thread).

Depends on D88208

The output of the compilation is input + stencil, and CompilationState is
purely the internal data.

Depends on D88213

CompilationState is used from both Parser and BytecodeEmitter,
so SourceAwareCompiler should have it, and hide CompilationState from the API
consumers (except the place that directly calls Parser).

Depends on D88215

Now we have the following 5 public methods, and the consumer should call one of them, depending on the target:

  • initForGlobal
  • initForStandaloneFunction
  • initForEval
  • initForModule
  • initFromLazy

Depends on D88216

Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/3a159e26e470
Part 1: Create CompilationInput, CompilationState, CompilationStencil, and CompilationGCOutput. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/3cbce137e341
Part 2: Move CompilationInfo methods to CompilationInput. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/a025f184d951
Part 3: Use CompilationStencil and CompilationGCOutput in ScriptStencilIterable. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/bcdf0ed050f1
Part 4: Reorder ScriptStencilIterable definition. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/7b8ef9e9e834
Part 5: Move CompilationGCOutput out from CompilationInfo. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/73282eb9b64e
Part 6: Use CompilationStencil in ScopeCreationData::create. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/2c60395051a8
Part 7: Use CompilationStencil in BigIntLiteral. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/6c0fb1bf5570
Part 8: Use CompilationStencil in RegExpLiteral. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/1413c434a062
Part 9: Use CompilationState in ParseContext. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/f3fc160379a0
Part 10: Move CompilationState out of CompilationInfo. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/69e5bd11d0ed
Part 11: Move dump to CompilationStencil. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/cb97934e3192
Part 12: Move CompilationState into SourceAwareCompiler. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/0a42010bbfee
Part 13: Make CompilationInfo::init* explicit about the target. r=tcampbell
https://hg.mozilla.org/integration/autoland/rev/0ae2362c2288
Part 14: Make CompilationInput::setSource private. r=tcampbell
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: