Bug 20827 - the 'typeof' operator is slow
Summary: the 'typeof' operator is slow
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Cameron Zwarich (cpst)
URL:
Keywords:
Depends on:
Blocks: 20813
  Show dependency treegraph
 
Reported: 2008-09-13 02:40 PDT by Cameron Zwarich (cpst)
Modified: 2008-09-14 17:26 PDT (History)
0 users

See Also:


Attachments
Proposed patch (15.23 KB, patch)
2008-09-14 01:26 PDT, Cameron Zwarich (cpst)
no flags Details | Formatted Diff | Diff
Proposed patch with ChangeLog (1.86 KB, patch)
2008-09-14 16:24 PDT, Cameron Zwarich (cpst)
no flags Details | Formatted Diff | Diff
Proposed patch with ChangeLog (16.70 KB, patch)
2008-09-14 16:26 PDT, Cameron Zwarich (cpst)
mjs: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.