Commit ff10c48f authored by mjs@apple.com's avatar mjs@apple.com

2008-06-14 Maciej Stachowiak <mjs@apple.com>

        Reviewed by Oliver.
        
        - initialize local vars as side effect of call instead of in bytecode
        1.004x speedup on SunSpider.

        This removes just the dispatch overhead for these loads - in the
        future, dead store elimination might be able to eliminate them
        entirely.
        
        * VM/CodeGenerator.cpp:
        (KJS::CodeGenerator::CodeGenerator): For function blocks, don't
        emit loads of undefined for var initialization.
        * VM/Machine.cpp:
        (KJS::slideRegisterWindowForCall): Instead, initialize locals
        as part of the call.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34541 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1b74c09a
2008-06-14 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- initialize local vars as side effect of call instead of in bytecode
1.004x speedup on SunSpider.
This removes just the dispatch overhead for these loads - in the
future, dead store elimination might be able to eliminate them
entirely.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::CodeGenerator): For function blocks, don't
emit loads of undefined for var initialization.
* VM/Machine.cpp:
(KJS::slideRegisterWindowForCall): Instead, initialize locals
as part of the call.
2008-06-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
......
......@@ -257,8 +257,7 @@ CodeGenerator::CodeGenerator(FunctionBodyNode* functionBody, const Debugger* deb
continue;
RegisterID* r0;
if (addVar(ident, r0, varStack[i].second & DeclarationStacks::IsConstant))
emitLoad(r0, jsUndefined());
addVar(ident, r0, varStack[i].second & DeclarationStacks::IsConstant);
}
Vector<Identifier>& parameters = functionBody->parameters();
......
......@@ -404,6 +404,10 @@ ALWAYS_INLINE Register* slideRegisterWindowForCall(ExecState* exec, CodeBlock* n
for ( ; it != end; ++it)
*(it + shift) = *it;
}
// initialize local variable slots
for (Register* it = r - newCodeBlock->numVars; it != r; ++it)
(*it).u.jsValue = jsUndefined();
return r;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment