diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-18 15:53:33 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-18 15:53:33 +0200 |
commit | 6bbb7fbbac94d0f511a7bd0cbd50854ab643bfb2 (patch) | |
tree | d9c68d1cca0b3e352f1e438561f3e504e641a08f /Source/JavaScriptCore/bytecompiler | |
parent | d0424a769059c84ae20beb3c217812792ea6726b (diff) | |
download | qtwebkit-6bbb7fbbac94d0f511a7bd0cbd50854ab643bfb2.tar.gz |
Imported WebKit commit c7503cef7ecb236730d1309676ab9fc723fd061d (http://svn.webkit.org/repository/webkit/trunk@128886)
New snapshot with various build fixes
Diffstat (limited to 'Source/JavaScriptCore/bytecompiler')
-rw-r--r-- | Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index 055f605d2..e7a80fe2c 100644 --- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -423,18 +423,19 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, JSScope* sc } } - bool capturesAnyArgument = codeBlock->usesArguments() || codeBlock->usesEval() || m_shouldEmitDebugHooks; // May reify arguments object. - if (!capturesAnyArgument && functionBody->hasCapturedVariables()) { + bool mayReifyArgumentsObject = codeBlock->usesArguments() || codeBlock->usesEval() || m_shouldEmitDebugHooks; + bool capturesAnyArgumentByName = false; + if (functionBody->hasCapturedVariables()) { FunctionParameters& parameters = *functionBody->parameters(); for (size_t i = 0; i < parameters.size(); ++i) { if (!functionBody->captures(parameters[i])) continue; - capturesAnyArgument = true; + capturesAnyArgumentByName = true; break; } } - if (capturesAnyArgument) { + if (mayReifyArgumentsObject || capturesAnyArgumentByName) { symbolTable->setCaptureMode(SharedSymbolTable::AllOfTheThings); symbolTable->setCaptureStart(-CallFrame::offsetFor(symbolTable->parameterCountIncludingThis())); } else { @@ -442,6 +443,16 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, JSScope* sc symbolTable->setCaptureStart(m_codeBlock->m_numVars); } + if (mayReifyArgumentsObject && capturesAnyArgumentByName) { + size_t parameterCount = symbolTable->parameterCount(); + OwnArrayPtr<SlowArgument> slowArguments = adoptArrayPtr(new SlowArgument[parameterCount]); + for (size_t i = 0; i < parameterCount; ++i) { + slowArguments[i].status = SlowArgument::Captured; + slowArguments[i].indexIfCaptured = CallFrame::argumentOffset(i); + } + symbolTable->setSlowArguments(slowArguments.release()); + } + RegisterID* calleeRegister = resolveCallee(functionBody); // May push to the scope chain and/or add a captured var. const DeclarationStacks::FunctionStack& functionStack = functionBody->functionStack(); @@ -681,7 +692,7 @@ bool BytecodeGenerator::willResolveToArguments(const Identifier& ident) SymbolTableEntry entry = symbolTable().get(ident.impl()); if (entry.isNull()) return false; - + if (m_codeBlock->usesArguments() && m_codeType == FunctionCode) return true; |