Title: [90437] trunk/Source/_javascript_Core
- Revision
- 90437
- Author
- [email protected]
- Date
- 2011-07-05 23:35:44 -0700 (Tue, 05 Jul 2011)
Log Message
2011-07-05 Filip Pizlo <[email protected]>
DFG JIT virtual call implementation is inefficient.
https://bugs.webkit.org/show_bug.cgi?id=63974
Reviewed by Gavin Barraclough.
* dfg/DFGOperations.cpp:
* runtime/Executable.h:
(JSC::ExecutableBase::generatedJITCodeForCallWithArityCheck):
(JSC::ExecutableBase::generatedJITCodeForConstructWithArityCheck):
(JSC::ExecutableBase::generatedJITCodeWithArityCheckFor):
(JSC::ExecutableBase::hasJITCodeForCall):
(JSC::ExecutableBase::hasJITCodeForConstruct):
(JSC::ExecutableBase::hasJITCodeFor):
* runtime/JSFunction.h:
(JSC::JSFunction::scopeUnchecked):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (90436 => 90437)
--- trunk/Source/_javascript_Core/ChangeLog 2011-07-06 05:29:48 UTC (rev 90436)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-07-06 06:35:44 UTC (rev 90437)
@@ -1,3 +1,21 @@
+2011-07-05 Filip Pizlo <[email protected]>
+
+ DFG JIT virtual call implementation is inefficient.
+ https://bugs.webkit.org/show_bug.cgi?id=63974
+
+ Reviewed by Gavin Barraclough.
+
+ * dfg/DFGOperations.cpp:
+ * runtime/Executable.h:
+ (JSC::ExecutableBase::generatedJITCodeForCallWithArityCheck):
+ (JSC::ExecutableBase::generatedJITCodeForConstructWithArityCheck):
+ (JSC::ExecutableBase::generatedJITCodeWithArityCheckFor):
+ (JSC::ExecutableBase::hasJITCodeForCall):
+ (JSC::ExecutableBase::hasJITCodeForConstruct):
+ (JSC::ExecutableBase::hasJITCodeFor):
+ * runtime/JSFunction.h:
+ (JSC::JSFunction::scopeUnchecked):
+
2011-07-05 Oliver Hunt <[email protected]>
Force inlining of simple functions that show up as not being inlined
Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.cpp (90436 => 90437)
--- trunk/Source/_javascript_Core/dfg/DFGOperations.cpp 2011-07-06 05:29:48 UTC (rev 90436)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.cpp 2011-07-06 06:35:44 UTC (rev 90437)
@@ -488,22 +488,21 @@
JSGlobalData* globalData = &exec->globalData();
JSValue calleeAsValue = execCallee->calleeAsValue();
JSCell* calleeAsFunctionCell = getJSFunction(*globalData, calleeAsValue);
- if (!calleeAsFunctionCell)
+ if (UNLIKELY(!calleeAsFunctionCell))
return handleHostCall(execCallee, calleeAsValue);
JSFunction* function = asFunction(calleeAsFunctionCell);
ExecutableBase* executable = function->executable();
- if (executable->isHostFunction())
- return executable->generatedJITCodeForCall().addressForCall().executableAddress();
-
- FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable);
- JSObject* error = functionExecutable->compileForCall(exec, function->scope());
- if (error) {
- exec->globalData().exception = error;
- return 0;
+ if (UNLIKELY(!executable->hasJITCodeForCall())) {
+ FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable);
+ JSObject* error = functionExecutable->compileForCall(exec, function->scope());
+ if (error) {
+ exec->globalData().exception = error;
+ return 0;
+ }
}
- execCallee->setScopeChain(function->scope());
- return functionExecutable->generatedJITCodeForCallWithArityCheck().executableAddress();
+ execCallee->setScopeChain(function->scopeUnchecked());
+ return executable->generatedJITCodeForCallWithArityCheck().executableAddress();
}
EncodedJSValue operationInstanceOf(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedBase, EncodedJSValue encodedPrototype)
Modified: trunk/Source/_javascript_Core/runtime/Executable.h (90436 => 90437)
--- trunk/Source/_javascript_Core/runtime/Executable.h 2011-07-06 05:29:48 UTC (rev 90436)
+++ trunk/Source/_javascript_Core/runtime/Executable.h 2011-07-06 06:35:44 UTC (rev 90437)
@@ -102,6 +102,46 @@
return generatedJITCodeForConstruct();
}
+ MacroAssemblerCodePtr generatedJITCodeForCallWithArityCheck()
+ {
+ ASSERT(m_jitCodeForCall);
+ ASSERT(m_jitCodeForCallWithArityCheck);
+ return m_jitCodeForCallWithArityCheck;
+ }
+
+ MacroAssemblerCodePtr generatedJITCodeForConstructWithArityCheck()
+ {
+ ASSERT(m_jitCodeForConstruct);
+ ASSERT(m_jitCodeForConstructWithArityCheck);
+ return m_jitCodeForConstructWithArityCheck;
+ }
+
+ MacroAssemblerCodePtr generatedJITCodeWithArityCheckFor(CodeSpecializationKind kind)
+ {
+ if (kind == CodeForCall)
+ return generatedJITCodeForCallWithArityCheck();
+ ASSERT(kind == CodeForConstruct);
+ return generatedJITCodeForConstructWithArityCheck();
+ }
+
+ bool hasJITCodeForCall() const
+ {
+ return m_numParametersForCall >= 0;
+ }
+
+ bool hasJITCodeForConstruct() const
+ {
+ return m_numParametersForConstruct >= 0;
+ }
+
+ bool hasJITCodeFor(CodeSpecializationKind kind) const
+ {
+ if (kind == CodeForCall)
+ return hasJITCodeForCall();
+ ASSERT(kind == CodeForConstruct);
+ return hasJITCodeForConstruct();
+ }
+
void clearExecutableCode()
{
m_jitCodeForCall.clear();
@@ -455,31 +495,6 @@
OwnPtr<FunctionCodeBlock> m_codeBlockForConstruct;
Identifier m_name;
SharedSymbolTable* m_symbolTable;
-
-#if ENABLE(JIT)
- public:
- MacroAssemblerCodePtr generatedJITCodeForCallWithArityCheck()
- {
- ASSERT(m_jitCodeForCall);
- ASSERT(m_jitCodeForCallWithArityCheck);
- return m_jitCodeForCallWithArityCheck;
- }
-
- MacroAssemblerCodePtr generatedJITCodeForConstructWithArityCheck()
- {
- ASSERT(m_jitCodeForConstruct);
- ASSERT(m_jitCodeForConstructWithArityCheck);
- return m_jitCodeForConstructWithArityCheck;
- }
-
- MacroAssemblerCodePtr generatedJITCodeWithArityCheckFor(CodeSpecializationKind kind)
- {
- if (kind == CodeForCall)
- return generatedJITCodeForCallWithArityCheck();
- ASSERT(kind == CodeForConstruct);
- return generatedJITCodeForConstructWithArityCheck();
- }
-#endif
};
inline FunctionExecutable* JSFunction::jsExecutable() const
Modified: trunk/Source/_javascript_Core/runtime/JSFunction.h (90436 => 90437)
--- trunk/Source/_javascript_Core/runtime/JSFunction.h 2011-07-06 05:29:48 UTC (rev 90436)
+++ trunk/Source/_javascript_Core/runtime/JSFunction.h 2011-07-06 06:35:44 UTC (rev 90437)
@@ -63,6 +63,15 @@
ASSERT(!isHostFunctionNonInline());
return m_scopeChain.get();
}
+ // This method may be called for host functins, in which case it
+ // will return an arbitrary value. This should only be used for
+ // optimized paths in which the return value does not matter for
+ // host functions, and checking whether the function is a host
+ // function is deemed too expensive.
+ ScopeChainNode* scopeUnchecked()
+ {
+ return m_scopeChain.get();
+ }
void setScope(JSGlobalData& globalData, ScopeChainNode* scopeChain)
{
ASSERT(!isHostFunctionNonInline());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes