Bug 20827

Summary: the 'typeof' operator is slow
Product: WebKit Reporter: Cameron Zwarich (cpst) <zwarich>
Component: JavaScriptCoreAssignee: Cameron Zwarich (cpst) <zwarich>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 20813    
Attachments:
Description Flags
Proposed patch
none
Proposed patch with ChangeLog
none
Proposed patch with ChangeLog mjs: review+

Description Cameron Zwarich (cpst) 2008-09-13 02:40:43 PDT
The 'typeof' operator now accounts for about 4.7% of the Shark profile of the V8 Earley-Boyer benchmark. We should look at optimizing it, probably taking advantage of StructureIDs. A lot of the examples in Earley-Boyer are of the form

typeof <expression> == <string>

We can optimize these using a peephole optimization in CodeGenerator and some new opcodes. I'll assign this to myself.
Comment 1 Cameron Zwarich (cpst) 2008-09-14 01:26:55 PDT
Created attachment 23407 [details]
Proposed patch

This patch is a 6% speedup on Earley-Boyer, but it unfortunately triggers the Richards compilation-related badness on my machine. I will try again soon.
Comment 2 Cameron Zwarich (cpst) 2008-09-14 16:24:30 PDT
Created attachment 23423 [details]
Proposed patch with ChangeLog
Comment 3 Cameron Zwarich (cpst) 2008-09-14 16:25:06 PDT
Comment on attachment 23423 [details]
Proposed patch with ChangeLog

Oops, I posted the wrong typeof patch.
Comment 4 Cameron Zwarich (cpst) 2008-09-14 16:26:06 PDT
Created attachment 23424 [details]
Proposed patch with ChangeLog
Comment 5 Maciej Stachowiak 2008-09-14 16:58:09 PDT
Comment on attachment 23424 [details]
Proposed patch with ChangeLog

r=me subject to comments from IRC.
Comment 6 Cameron Zwarich (cpst) 2008-09-14 17:26:43 PDT
Landed with requested changes in r36412.