Closed Bug 1664293 Opened 4 years ago Closed 4 years ago

Add frontend::CompileLazyFunctionToStencil

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
82 Branch
Tracking Status
firefox82 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(2 files)

Incremental encoding needs to support XDR encode stencil for lazy functions

https://searchfox.org/mozilla-central/rev/eb9d5c97927aea75f0c8e38bbc5b5d288099e687/js/src/vm/JSFunction.cpp#1588-1629

static bool DelazifyCanonicalScriptedFunction(JSContext* cx,
                                              HandleFunction fun) {
...
  {
...
    if (ss->hasSourceType<Utf8Unit>()) {
...
      if (!frontend::CompileLazyFunction(cx, lazy, units.get(), sourceLength)) {
        // The frontend shouldn't fail after linking the function and the
        // non-lazy script together.
        MOZ_ASSERT(fun->baseScript() == lazy);
        MOZ_ASSERT(lazy->isReadyForDelazification());
        return false;
      }
    } else {
...
      if (!frontend::CompileLazyFunction(cx, lazy, units.get(), sourceLength)) {
        // The frontend shouldn't fail after linking the function and the
        // non-lazy script together.
        MOZ_ASSERT(fun->baseScript() == lazy);
        MOZ_ASSERT(lazy->isReadyForDelazification());
        return false;
      }
    }
  }
...
  // XDR the newly delazified function.
  if (ss->hasEncoder()) {
    RootedScriptSourceObject sourceObject(cx, script->sourceObject());
    if (!ss->xdrEncodeFunction(cx, fun, sourceObject)) {
      return false;
    }
  }

  return true;
}

that callsite needs to be replaced with:

  • frontend::CompileLazyFunctionToStencil
    frontend::CompileLazyFunction without instantiateStencils
  • frontend::InstantiateFunctionStencils
    almost same as frontend::InstantiateStencils, but for function

So that it can receive stencil and encode it there instead.

the above is the only consumer of frontend::CompileLazyFunction, so we can replace frontend::CompileLazyFunction with stencil APIs

Attachment #9175161 - Attachment description: Bug 1664293 - Part 2: Replace frontend::CompileLazyFunction with frontend::CompileLazyFunctionToStencil + frontend::InstantiateFunctionStencils. r?tcampbell! → Bug 1664293 - Part 2: Replace frontend::CompileLazyFunction with frontend::CompileLazyFunctionToStencil + frontend::InstantiateStencilsForDelazify. r?tcampbell!
Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/a38622e0d603 Part 1: Templatize DelazifyCanonicalScriptedFunction for char unit. r=tcampbell https://hg.mozilla.org/integration/autoland/rev/e5ce23073da5 Part 2: Replace frontend::CompileLazyFunction with frontend::CompileLazyFunctionToStencil + frontend::InstantiateStencilsForDelazify. r=tcampbell
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: