Closed Bug 753249 Opened 7 years ago Closed 7 years ago

Remove non-TCF_FUN_FLAGS from TreeContextFlags

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla15

People

(Reporter: njn, Assigned: njn)

References

Details

Attachments

(6 files)

In this bug I will remove the flags in TreeContextFlags that are not in TCF_FUN_FLAGS.
TCF_IN_FUNCTION is pretty easy.  It can be replaced by
SharedContext::inFunction.

(BTW, Luke, if you get sick of reviewing these patches let me know and I'll find someone else to do them.)
Attachment #622293 - Flags: review?(luke)
TCF_IN_FOR_INIT is similarly easy.  There are a couple of places in
Parser.cpp where it is cleared and then restored and that involved
|oldflags|;  I suspect |oldflags| isn't necessary but I'm not sure so I've
modified that code in a very conservative way, and follow-up patches will
clarify things.
Attachment #622294 - Flags: review?(luke)
TCF_IN_WITH is easy.  It's *never* set in SharedContext::flags;  it's only
set in FunctionBox::tcflags.  So I made it a separate bit-field in
FunctionBox.
Attachment #622295 - Flags: review?(luke)
TCF_HAS_SINGLETONS is easy to move to a bit-field in BytecodeEmitter.
Attachment #622296 - Flags: review?(luke)
This is a precursor to removing TCF_GENEXP_LAMBDA.

TCF_GENEXP_LAMBDA is a funbox->tcflags-only flag, with one exception in
FoldConstants.  But if you look closely, the parser->tc->sc->flags use in
FoldConstants is really weird -- the PN_FUNC case in FoldConstants
temporarily overwrites the existing parser->tc->sc->flags with
pn->pn_funbox->tcflags, so that is what is really being checked!

So this patch stops that silliness, and instead just passes a boolean
around.  Also, FoldConstants did some weird saving/restoring with
functionList;  this is a no-op because nowhere else in FoldConstants.cpp
touches functionList, so I removed it too.
Attachment #622297 - Flags: review?(luke)
Thanks to the previous patch, TCF_GENEXP_LAMBDA is now only needed in
FunctionBox.  This patch converts it to a bit-field.
Attachment #622299 - Flags: review?(luke)
Attachment #622293 - Flags: review?(luke) → review+
Comment on attachment 622294 [details] [diff] [review]
Patch 2: remove TCF_IN_FOR_INIT

Awesome; this will make it 10x easier to watch the flow of these bits.
Attachment #622294 - Flags: review?(luke) → review+
Attachment #622295 - Flags: review?(luke) → review+
Attachment #622296 - Flags: review?(luke) → review+
Comment on attachment 622297 [details] [diff] [review]
Patch 5: simplify use of TCF_GENEXP_LAMBDA in FoldConstants

mindblowing
Attachment #622297 - Flags: review?(luke) → review+
Comment on attachment 622299 [details] [diff] [review]
Patch 6: remove TCF_GENEXP_LAMBDA

rock on
Attachment #622299 - Flags: review?(luke) → review+
Blocks: 753657
You need to log in before you can comment on or make changes to this bug.