On Mar 9, 2012, at 2:33 AM, Andy Wingo wrote: > Hi, > > A month ago, I wrote: > > On Thu, 2012-02-09 at 17:49 +0100, Andy Wingo wrote: >> I'll refactor JSStaticScope into something that uses lazy tear-off. > [...] >> The block [of registers] reserved >> for block scopes will have as many registers as the maximum of (number >> of block scope-bound variables + block scope depth). > > This is not something that can be computed easily at parse-time, because > variables can be declared anywhere within a block. Computing the > maximum depth of block-scoped variables has to be a second pass over the > statements of a compilation unit.
I don't understand why two passes are necessary. I would simply make the parser track the maximum number of live block scoped variables. Then at the end of parsing you know the maximum number of stack slots needed to hold live block scoped vars at once. Why do you want to know the number of block scoped variables ahead of codegen time? As for code size, i wouldn't be too worried unless it's a huge size increase: the parser+lexer are both so heavily templated that some (large) functions are generated like 8 times, some maybe more... --Oliver _______________________________________________ squirrelfish-dev mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/squirrelfish-dev
