Bug 16595
| Summary: | Add evaluateToVoid() and LoopNode subclasses which ignore completion type | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Eric Seidel (no email) <eric> |
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED INVALID | ||
| Severity: | Normal | CC: | ggaren, mjs |
| Priority: | P2 | ||
| Version: | 528+ (Nightly build) | ||
| Hardware: | Mac | ||
| OS: | OS X 10.4 | ||
Eric Seidel (no email)
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.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Eric Seidel (no email)
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
Cameron Zwarich (cpst)
This is now irrelevant after SquirrelFish.