Closed Bug 1631407 Opened 5 years ago Closed 5 years ago

Update the JS NameResolver for Stencil

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox78 --- fixed

People

(Reporter: tcampbell, Assigned: tcampbell)

References

Details

Attachments

(1 file)

The NameResolver code directly accesses the JSFunctions to read and write their guessed atom names. Right now this happens in a batch process at the very end of the initial parse, but we should still support it inside Stencil.

To fix this, we need to cleanup how guessed atoms are handled in the FunctionBox. Right now we track the "explicit" name, but this should be generalized.

Some terminology:

  • "explicit" name: The binding name in the source. Eg the f in function f() { }. Is exposed on fun.name in JS.
  • "implicit" name: The spec defines that some grammar forms should apply a name to an otherwise anonymous function. This is exposed on fun.name and may be computed at compile time (eg. the foo in let foo = function() {};), and others cases may compute at runtime using JSOp::SetFunName (eg. the foo in let name = "foo"; let x = { [name]: function() { } }).
  • "guessed" name: The engine synthesizes a name using the NameResolver. These usually have / and ^ characters. These function do not have a fun.name value, but the names may be used by the debugger to help out the user.
Priority: -- → P2
Assignee: nobody → tcampbell
Depends on: 1633964
Severity: -- → N/A

Use the FunctionFlags in the FunctionBox to distinguish explict, inferred,
and guessed atom types. When inter-converting between FunctionBox and
JSFunctions we now sync all types of atoms.

Note that if the function pre-exists we still propegate the name directly.
The code coverage initialization is triggered by JSScript creation which is
not fully deferred, so we need to the setInferredName to take effect before
then.

Pushed by tcampbell@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d72818f86279 Move inferred/guessed names into FunctionBox. r=mgaudet
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: