Bug 105232

Summary: Constant fold !{number} in the parser
Product: WebKit Reporter: Geoffrey Garen <ggaren>
Component: JavaScriptCoreAssignee: Geoffrey Garen <ggaren>
Status: RESOLVED FIXED    
Severity: Normal CC: darin
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch fpizlo: review+

Geoffrey Garen
Reported 2012-12-17 17:11:01 PST
Constant fold !{number} in the parser
Attachments
Patch (2.16 KB, patch)
2012-12-17 17:18 PST, Geoffrey Garen
fpizlo: review+
Geoffrey Garen
Comment 1 2012-12-17 17:18:10 PST
Filip Pizlo
Comment 2 2012-12-17 17:21:49 PST
Comment on attachment 179839 [details] Patch R=me We should have the parser do more extensive constant folding. It will reduce (a) reduce amount of bytecode, (b) reduce amount of baseline JIT machine code, and (c) reduce the amount of work that the DFG has to do.
Geoffrey Garen
Comment 3 2012-12-17 22:55:50 PST
Darin Adler
Comment 4 2012-12-18 09:23:55 PST
The comment makes it sound like you’d want to do this for other constant nodes such as NullNode, BooleanNode, StringNode, RegExpNode, ThisNode, and ArrayNode. I’m assuming we don’t do that because the only cases that are actually common are !0 and !1, not, say !null or !true or !false. Since we’re already calling a virtual function just to find out it’s a number node it seems like we could do a version with more coverage. The only cost of this seems to be more code in Nodes.h/cpp.
Note You need to log in before you can comment on or make changes to this bug.