[Webkit-unassigned] [Bug 103727] Unset NodeMustGenerate flag for Call nodes of few String.prototype.* pure functions

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Nov 30 12:12:00 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=103727





--- Comment #3 from Filip Pizlo <fpizlo at apple.com>  2012-11-30 12:14:19 PST ---
(In reply to comment #0)
> Function calls have NodeMustGenerate flag set, but this is redundant in case the function has no side effects.  This patch aims to remove NodeMustGenerate flag for Call nodes of String.replace, String.split, and String.indexOf, if their argument types imply no side effects. This would allow to eliminate such calls, if their result is unused.
> 
> Example:
> 
> function foo() {
>   var str = "split it up";
>   var i;
>   for (i = 0; i < 10000; i++) {
>     var x = str.split(" ");
>   }
> }
> 
> var i;
> for (i = 0; i < 1000; i++)
>   foo();
> 
> Run time w/o patch: 1.756s
> With the patch: 0.032s
> 
> Is it, in general, the right way to eliminate redundant calls?
> I admit that using strcmp is not the best way to check for function names -- probably it would be better to create a hashtable with mapping of function names to argument checking routines, but for now I just would like to get some feedback to know whether this optimization is correct and if the WebKit community is interested in it.

I believe that what you are doing is broadly correct. You should just fix the bug regarding not making graph changes from AbstractState.

I'm also wondering if maye we should clear the NodeClobbersWorld flag...

Final thought: we would have previously used intrinsically to accomplish what you're doing. But I don't think that makes your approach wrong; particularly since your approach doesn't require new node types or any other special treatment of the fictions in question.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list