Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (120988 => 120989)
--- trunk/Source/_javascript_Core/ChangeLog 2012-06-22 01:30:19 UTC (rev 120988)
+++ trunk/Source/_javascript_Core/ChangeLog 2012-06-22 01:33:30 UTC (rev 120989)
@@ -1,3 +1,29 @@
+2012-06-21 Filip Pizlo <[email protected]>
+
+ op_resolve_global should not prevent DFG inlining
+ https://bugs.webkit.org/show_bug.cgi?id=89726
+
+ Reviewed by Gavin Barraclough.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::CodeBlock):
+ (JSC::CodeBlock::shrinkToFit):
+ * bytecode/GlobalResolveInfo.h:
+ (JSC::GlobalResolveInfo::GlobalResolveInfo):
+ (GlobalResolveInfo):
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
+ * dfg/DFGCapabilities.h:
+ (JSC::DFG::canInlineOpcode):
+ * dfg/DFGOperations.cpp:
+ * dfg/DFGOperations.h:
+ * dfg/DFGSpeculativeJIT.h:
+ (JSC::DFG::SpeculativeJIT::callOperation):
+ * dfg/DFGSpeculativeJIT32_64.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT64.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+
2012-06-20 Filip Pizlo <[email protected]>
DFG should inline 'new Array()'
Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (120988 => 120989)
--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2012-06-22 01:30:19 UTC (rev 120988)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2012-06-22 01:33:30 UTC (rev 120989)
@@ -1583,7 +1583,7 @@
, m_source(other.m_source)
, m_sourceOffset(other.m_sourceOffset)
#if ENABLE(JIT)
- , m_globalResolveInfos(other.m_globalResolveInfos)
+ , m_globalResolveInfos(other.m_globalResolveInfos.size())
#endif
#if ENABLE(VALUE_PROFILER)
, m_executionEntryCount(0)
@@ -1609,6 +1609,11 @@
optimizeAfterWarmUp();
jitAfterWarmUp();
+#if ENABLE(JIT)
+ for (unsigned i = m_globalResolveInfos.size(); i--;)
+ m_globalResolveInfos[i] = GlobalResolveInfo(other.m_globalResolveInfos[i].bytecodeOffset);
+#endif
+
if (other.m_rareData) {
createRareDataIfNecessary();
@@ -2273,7 +2278,8 @@
#endif
#if ENABLE(JIT)
m_structureStubInfos.shrinkToFit();
- m_globalResolveInfos.shrinkToFit();
+ if (shrinkMode == EarlyShrink)
+ m_globalResolveInfos.shrinkToFit();
m_callLinkInfos.shrinkToFit();
m_methodCallLinkInfos.shrinkToFit();
#endif
Modified: trunk/Source/_javascript_Core/bytecode/GlobalResolveInfo.h (120988 => 120989)
--- trunk/Source/_javascript_Core/bytecode/GlobalResolveInfo.h 2012-06-22 01:30:19 UTC (rev 120988)
+++ trunk/Source/_javascript_Core/bytecode/GlobalResolveInfo.h 2012-06-22 01:33:30 UTC (rev 120989)
@@ -31,6 +31,8 @@
namespace JSC {
struct GlobalResolveInfo {
+ GlobalResolveInfo() { }
+
GlobalResolveInfo(unsigned bytecodeOffset)
: offset(0)
, bytecodeOffset(bytecodeOffset)
@@ -39,7 +41,7 @@
WriteBarrier<Structure> structure;
unsigned offset;
- unsigned bytecodeOffset;
+ unsigned bytecodeOffset; // Only valid in old JIT code. This means nothing in the DFG.
};
inline unsigned getGlobalResolveInfoBytecodeOffset(GlobalResolveInfo* globalResolveInfo)
Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (120988 => 120989)
--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2012-06-22 01:30:19 UTC (rev 120988)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2012-06-22 01:33:30 UTC (rev 120989)
@@ -3172,6 +3172,8 @@
}
m_constantRemap[i] = result.iterator->second;
}
+ for (unsigned i = 0; i < codeBlock->numberOfGlobalResolveInfos(); ++i)
+ byteCodeParser->m_codeBlock->addGlobalResolveInfo(std::numeric_limits<unsigned>::max());
m_callsiteBlockHeadNeedsLinking = true;
} else {
Modified: trunk/Source/_javascript_Core/dfg/DFGCapabilities.h (120988 => 120989)
--- trunk/Source/_javascript_Core/dfg/DFGCapabilities.h 2012-06-22 01:30:19 UTC (rev 120988)
+++ trunk/Source/_javascript_Core/dfg/DFGCapabilities.h 2012-06-22 01:33:30 UTC (rev 120989)
@@ -193,7 +193,6 @@
case op_put_scoped_var:
case op_resolve:
case op_resolve_base:
- case op_resolve_global:
// Constant buffers aren't copied correctly. This is easy to fix, but for
// now we just disable inlining for functions that use them.
Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.cpp (120988 => 120989)
--- trunk/Source/_javascript_Core/dfg/DFGOperations.cpp 2012-06-22 01:30:19 UTC (rev 120988)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.cpp 2012-06-22 01:33:30 UTC (rev 120989)
@@ -968,13 +968,11 @@
return JSValue::encode(base);
}
-EncodedJSValue DFG_OPERATION operationResolveGlobal(ExecState* exec, GlobalResolveInfo* resolveInfo, Identifier* propertyName)
+EncodedJSValue DFG_OPERATION operationResolveGlobal(ExecState* exec, GlobalResolveInfo* resolveInfo, JSGlobalObject* globalObject, Identifier* propertyName)
{
JSGlobalData* globalData = &exec->globalData();
NativeCallFrameTracer tracer(globalData, exec);
- JSGlobalObject* globalObject = exec->lexicalGlobalObject();
-
PropertySlot slot(globalObject);
if (globalObject->getPropertySlot(exec, *propertyName, slot)) {
JSValue result = slot.getValue(exec, *propertyName);
Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.h (120988 => 120989)
--- trunk/Source/_javascript_Core/dfg/DFGOperations.h 2012-06-22 01:30:19 UTC (rev 120988)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.h 2012-06-22 01:33:30 UTC (rev 120989)
@@ -65,7 +65,7 @@
typedef EncodedJSValue DFG_OPERATION (*J_DFGOperation_ECC)(ExecState*, JSCell*, JSCell*);
typedef EncodedJSValue DFG_OPERATION (*J_DFGOperation_ECI)(ExecState*, JSCell*, Identifier*);
typedef EncodedJSValue DFG_OPERATION (*J_DFGOperation_ECJ)(ExecState*, JSCell*, EncodedJSValue);
-typedef EncodedJSValue DFG_OPERATION (*J_DFGOperation_EGI)(ExecState*, GlobalResolveInfo*, Identifier*);
+typedef EncodedJSValue DFG_OPERATION (*J_DFGOperation_EGriJsgI)(ExecState*, GlobalResolveInfo*, JSGlobalObject*, Identifier*);
typedef EncodedJSValue DFG_OPERATION (*J_DFGOperation_EI)(ExecState*, Identifier*);
typedef EncodedJSValue DFG_OPERATION (*J_DFGOperation_EJ)(ExecState*, EncodedJSValue);
typedef EncodedJSValue DFG_OPERATION (*J_DFGOperation_EJA)(ExecState*, EncodedJSValue, JSArray*);
@@ -121,7 +121,7 @@
EncodedJSValue DFG_OPERATION operationResolve(ExecState*, Identifier*) WTF_INTERNAL;
EncodedJSValue DFG_OPERATION operationResolveBase(ExecState*, Identifier*) WTF_INTERNAL;
EncodedJSValue DFG_OPERATION operationResolveBaseStrictPut(ExecState*, Identifier*) WTF_INTERNAL;
-EncodedJSValue DFG_OPERATION operationResolveGlobal(ExecState*, GlobalResolveInfo*, Identifier*) WTF_INTERNAL;
+EncodedJSValue DFG_OPERATION operationResolveGlobal(ExecState*, GlobalResolveInfo*, JSGlobalObject*, Identifier*) WTF_INTERNAL;
EncodedJSValue DFG_OPERATION operationToPrimitive(ExecState*, EncodedJSValue) WTF_INTERNAL;
EncodedJSValue DFG_OPERATION operationStrCat(ExecState*, void*, size_t) WTF_INTERNAL;
EncodedJSValue DFG_OPERATION operationNewArray(ExecState*, void*, size_t) WTF_INTERNAL;
Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h (120988 => 120989)
--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h 2012-06-22 01:30:19 UTC (rev 120988)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h 2012-06-22 01:33:30 UTC (rev 120989)
@@ -1229,9 +1229,9 @@
m_jit.zeroExtend32ToPtr(GPRInfo::returnValueGPR, result);
return call;
}
- JITCompiler::Call callOperation(J_DFGOperation_EGI operation, GPRReg result, GPRReg arg1, Identifier* identifier)
+ JITCompiler::Call callOperation(J_DFGOperation_EGriJsgI operation, GPRReg result, GPRReg arg1, GPRReg arg2, Identifier* identifier)
{
- m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(identifier));
+ m_jit.setupArgumentsWithExecState(arg1, arg2, TrustedImmPtr(identifier));
return appendCallWithExceptionCheckSetResult(operation, result);
}
JITCompiler::Call callOperation(J_DFGOperation_EI operation, GPRReg result, Identifier* identifier)
@@ -1482,9 +1482,9 @@
m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(pointer));
return appendCallWithExceptionCheckSetResult(operation, resultPayload, resultTag);
}
- JITCompiler::Call callOperation(J_DFGOperation_EGI operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, Identifier* identifier)
+ JITCompiler::Call callOperation(J_DFGOperation_EGriJsgI operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, GPRReg arg2, Identifier* identifier)
{
- m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(identifier));
+ m_jit.setupArgumentsWithExecState(arg1, arg2, TrustedImmPtr(identifier));
return appendCallWithExceptionCheckSetResult(operation, resultPayload, resultTag);
}
JITCompiler::Call callOperation(J_DFGOperation_EP operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1)
Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp (120988 => 120989)
--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp 2012-06-22 01:30:19 UTC (rev 120988)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp 2012-06-22 01:33:30 UTC (rev 120989)
@@ -3840,7 +3840,7 @@
addSlowPathGenerator(
slowPathCall(
structuresNotMatch, this, operationResolveGlobal,
- JSValueRegs(resultTagGPR, resultPayloadGPR), resolveInfoGPR,
+ JSValueRegs(resultTagGPR, resultPayloadGPR), resolveInfoGPR, globalObjectGPR,
&m_jit.codeBlock()->identifier(data.identifierNumber)));
jsValueResult(resultTagGPR, resultPayloadGPR, m_compileIndex);
Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp (120988 => 120989)
--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp 2012-06-22 01:30:19 UTC (rev 120988)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp 2012-06-22 01:33:30 UTC (rev 120989)
@@ -3843,11 +3843,11 @@
m_jit.loadPtr(JITCompiler::Address(globalObjectGPR, JSObject::offsetOfPropertyStorage()), resultGPR);
m_jit.load32(JITCompiler::Address(resolveInfoGPR, OBJECT_OFFSETOF(GlobalResolveInfo, offset)), resolveInfoGPR);
m_jit.loadPtr(JITCompiler::BaseIndex(resultGPR, resolveInfoGPR, JITCompiler::ScalePtr), resultGPR);
-
+
addSlowPathGenerator(
slowPathCall(
structuresDontMatch, this, operationResolveGlobal,
- resultGPR, resolveInfoGPR,
+ resultGPR, resolveInfoGPR, globalObjectGPR,
&m_jit.codeBlock()->identifier(data.identifierNumber)));
jsValueResult(resultGPR, m_compileIndex);