Last Comment Bug 750279 - (UntangleFrontEnd) [meta] Untangle front-end state
: [meta] Untangle front-end state
: meta
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: All All
-- normal (vote)
: ---
Assigned To: Nicholas Nethercote [:njn]
: Jason Orendorff [:jorendorff]
Depends on: 750282 750580 750606 751818 752758 752793 752816 753249 753657 754179 754180 754181 754739 757336 757690 759246 761914 764714 767202 770067
  Show dependency treegraph
Reported: 2012-04-30 08:15 PDT by Nicholas Nethercote [:njn]
Modified: 2012-07-09 22:32 PDT (History)
4 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description User image Nicholas Nethercote [:njn] 2012-04-30 08:15:57 PDT
The front-end is a big ball of mud.  In particular, the state is very intertwined.  Examples:

- Parser has a pointer to TreeContext, and TreeContext has a pointer to Parser.  

- Parser.cpp includes BytecodeEmitter.h;  BytecodeEmitter.cpp includes Parser.h.

- BytecodeEmitter is a sub-class of TreeContext, but sometimes we down-cast TreeContext to BytecodeEmitter.

- The tcflags are a mish-mash of values with a range of lifetimes and mutability.  Some are set up-front and not changed;  some are set and cleared multiple times.  Some are relevant only in the parser; some are relevant in the parser and bytecode emitter.

As a result, any function that has access to any of the major pieces of front-end state -- Parser, TreeContext, BytecodeEmitter -- has access to pretty much all of it.  Speaking as someone who's only just started looking closely at the front-end, this makes things really hard to understand.

This is a tracking bug for cleaning this up.
Comment 1 User image Luke Wagner [:luke] 2012-04-30 10:07:45 PDT
Comment 2 User image Nicholas Nethercote [:njn] 2012-07-09 22:32:05 PDT
I think I'm done with this.

Note You need to log in before you can comment on or make changes to this bug.