Bug 21962 - AST uses way too much memory
Summary: AST uses way too much memory
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Geoffrey Garen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2008-10-29 16:24 PDT by Geoffrey Garen
Modified: 2012-09-06 12:00 PDT (History)
5 users (show)

See Also:


Attachments
patch - remove LabelStack from AST (42.87 KB, patch)
2008-10-30 21:28 PDT, Geoffrey Garen
no flags Details | Formatted Diff | Diff
patch - remove reference count and symbol table from FunctionBodyNode (11.86 KB, patch)
2008-10-31 18:27 PDT, Geoffrey Garen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Geoffrey Garen 2008-10-29 16:24:24 PDT
2 possible solutions:
1. Throw away function ASTs right after parsing. Reparse when compiling to bytecode. Use an AST cache to reduce performance hit.
2. Parse function bodies just enough to determine they're syntactically valid. Parse for real the first time the function executes.

Also
* Eagerly compiling to bytecode might work if we shrink bytecode footprint; for now, it's even worse than AST footprint.
* There's low-hanging fruit for reducing the size of AST nodes
Comment 1 Geoffrey Garen 2008-10-30 21:28:34 PDT
Created attachment 24792 [details]
patch - remove LabelStack from AST
Comment 2 Oliver Hunt 2008-10-30 21:31:09 PDT
Comment on attachment 24792 [details]
patch - remove LabelStack from AST

r=mw assuming perf is okay
Comment 3 Geoffrey Garen 2008-10-30 21:32:16 PDT
<rdar://problem/6170161>
Comment 4 Geoffrey Garen 2008-10-31 13:00:08 PDT
Committed attachment 24792 [details] as revision 38047.

I'll keep this bug open to monitor the rest of the work.
Comment 5 Geoffrey Garen 2008-10-31 18:27:49 PDT
Created attachment 24828 [details]
patch - remove reference count and symbol table from FunctionBodyNode
Comment 6 Geoffrey Garen 2008-11-01 14:42:22 PDT
Comment on attachment 24828 [details]
patch - remove reference count and symbol table from FunctionBodyNode

Clearing the review flag because this patch turned out to be a performance regression. Maybe someone else can finish it off.
Comment 7 Geoffrey Garen 2008-11-15 14:35:53 PST
Comment on attachment 24792 [details]
patch - remove LabelStack from AST

Clearing review flag on landed patch.
Comment 8 Gavin Barraclough 2012-09-06 12:00:28 PDT
This was fixed in r38047