Closed Bug 1593354 Opened 5 years ago Closed 5 years ago

Add IsFunction flag to js::BaseScript

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox72 --- fixed

People

(Reporter: tcampbell, Assigned: tcampbell)

References

Details

Attachments

(1 file)

Currently we check if JSScript::function() is nullptr in a number of places to determine if a script is a function script. This requires traversing through several GC edges which makes it annoying to use during finalization or other unusual cases. Instead just define an Immutable flag like we do for the isForEval/isModule checks.

Set this flag for scripts that are for functions. This is equivalent to
checking the kind of the bodyScope() but is safe to call in GC contexts such
as finalization.
Also use an isFunction() accessor instead of checking if JSScript::function()
is nullptr throughout the codebase. Similarly, cleanup similar uses of
JSScript::module().

Pushed by tcampbell@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/821b104d357b Add BaseScript::IsFunction flag. r=jandem
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: