Bug 16595 - Add evaluateToVoid() and LoopNode subclasses which ignore completion type
Summary: Add evaluateToVoid() and LoopNode subclasses which ignore completion type
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-24 00:58 PST by Eric Seidel (no email)
Modified: 2008-09-03 02:41 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2007-12-24 00:58:48 PST
Add evaluateToVoid() and LoopNode subclasses which ignore completion type

Loop nodes are spending time updating a completion value to be returned (and generally ignored).  For example, most for loops never have their returned completion type examined.  I've never seen code like this:

function bar() {
  for(var x = 0; x < 10; x++)
       x;
}

alert(bar());

Only in cases like that do we need to care what the loop completion value was.

In the common case, we can use a reverse execution walk through the node tree to keep track of when completion values are ignored:

var x = 2; // the fact that this updates the last completion value is completely ignored
var y = 4;

and use evaluateToVoid() calls instead.  We could even swap out entire BlockNodes which call void executeToVoid(exec) instead.
Comment 1 Eric Seidel (no email) 2007-12-24 01:01:55 PST
actually, the only way to access a completion value is from a function w/o a return value or an eval statement so you don't even need to walk, you just look at the last statement.  in the global context you can always evaluate to void
Comment 2 Cameron Zwarich (cpst) 2008-09-03 02:41:38 PDT
This is now irrelevant after SquirrelFish.