Title: [174478] trunk/Source/_javascript_Core
- Revision
- 174478
- Author
- [email protected]
- Date
- 2014-10-08 13:54:24 -0700 (Wed, 08 Oct 2014)
Log Message
Make sure arguments tearoff is performed through the environment record if necessary
https://bugs.webkit.org/show_bug.cgi?id=137538
Reviewed by Michael Saboff.
Fairly simple change. If we have a lexical record we need to pull the unmodified
arguments object from the record and then use the standard op_tear_off_arguments
instruction on the temporary.
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitGetOwnScope):
(JSC::BytecodeGenerator::emitReturn):
* bytecompiler/BytecodeGenerator.h:
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (174477 => 174478)
--- trunk/Source/_javascript_Core/ChangeLog 2014-10-08 20:40:18 UTC (rev 174477)
+++ trunk/Source/_javascript_Core/ChangeLog 2014-10-08 20:54:24 UTC (rev 174478)
@@ -1,3 +1,19 @@
+2014-10-08 Oliver Hunt <[email protected]>
+
+ Make sure arguments tearoff is performed through the environment record if necessary
+ https://bugs.webkit.org/show_bug.cgi?id=137538
+
+ Reviewed by Michael Saboff.
+
+ Fairly simple change. If we have a lexical record we need to pull the unmodified
+ arguments object from the record and then use the standard op_tear_off_arguments
+ instruction on the temporary.
+
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::emitGetOwnScope):
+ (JSC::BytecodeGenerator::emitReturn):
+ * bytecompiler/BytecodeGenerator.h:
+
2014-10-08 [email protected] <[email protected]>
[WinCairo] Enable JIT on 32-bit.
Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (174477 => 174478)
--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp 2014-10-08 20:40:18 UTC (rev 174477)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp 2014-10-08 20:54:24 UTC (rev 174478)
@@ -1299,6 +1299,20 @@
return dst;
}
+
+RegisterID* BytecodeGenerator::emitGetOwnScope(RegisterID* dst, const Identifier& identifier, OwnScopeLookupRules)
+{
+ emitOpcode(op_resolve_scope);
+ instructions().append(kill(dst));
+ instructions().append(addConstant(identifier));
+ instructions().append(LocalClosureVar);
+ // This should be m_localScopeDepth if we aren't doing
+ // resolution during emitReturn()
+ instructions().append(0);
+ instructions().append(0);
+ return dst;
+}
+
RegisterID* BytecodeGenerator::emitResolveConstantLocal(RegisterID* dst, const Identifier& identifier, ResolveScopeInfo& info)
{
if (!m_symbolTable || m_codeType != FunctionCode)
@@ -1906,8 +1920,17 @@
RegisterID* BytecodeGenerator::emitReturn(RegisterID* src)
{
if (m_codeBlock->usesArguments() && m_codeBlock->numParameters() != 1 && !isStrictMode()) {
+ RefPtr<RegisterID> scratchRegister;
+ int argumentsIndex = unmodifiedArgumentsRegister(m_codeBlock->argumentsRegister()).offset();
+ if (m_lexicalEnvironmentRegister && m_codeType == FunctionCode) {
+ scratchRegister = newTemporary();
+ emitGetOwnScope(scratchRegister.get(), propertyNames().arguments, OwnScopeForReturn);
+ ResolveScopeInfo scopeInfo(unmodifiedArgumentsRegister(m_codeBlock->argumentsRegister()).offset());
+ emitGetFromScope(scratchRegister.get(), scratchRegister.get(), propertyNames().arguments, ThrowIfNotFound, scopeInfo);
+ argumentsIndex = scratchRegister->index();
+ }
emitOpcode(op_tear_off_arguments);
- instructions().append(unmodifiedArgumentsRegister(m_codeBlock->argumentsRegister()).offset());
+ instructions().append(argumentsIndex);
instructions().append(m_lexicalEnvironmentRegister ? m_lexicalEnvironmentRegister->index() : emitLoad(0, JSValue())->index());
}
Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h (174477 => 174478)
--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h 2014-10-08 20:40:18 UTC (rev 174477)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h 2014-10-08 20:54:24 UTC (rev 174478)
@@ -659,6 +659,13 @@
RegisterID* emitCallVarargs(OpcodeID, RegisterID* dst, RegisterID* func, RegisterID* thisRegister, RegisterID* arguments, RegisterID* firstFreeRegister, int32_t firstVarArgOffset, RegisterID* profileHookRegister, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd);
RegisterID* initializeCapturedVariable(RegisterID* dst, const Identifier&, RegisterID*);
+ // We'll may want a non-return mode in future, but currently
+ // this is only used during emitReturn(). emitReturn() occurs
+ // with the novel state of having popped off all the local scope
+ // nodes, but not actually modify any internal stack depth tracking.
+ enum OwnScopeLookupRules { OwnScopeForReturn };
+ RegisterID* emitGetOwnScope(RegisterID* dst, const Identifier&, OwnScopeLookupRules);
+
public:
JSString* addStringConstant(const Identifier&);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes