Don't allocate a backing store just for a function's name
https://bugs.webkit.org/show_bug.cgi?id=96468
Reviewed by Oliver Hunt.
Treat function.name like function.length etc., and use a custom getter.
This saves space in closures.
* debugger/DebuggerCallFrame.cpp:
(JSC::DebuggerCallFrame::functionName):
* debugger/DebuggerCallFrame.h:
(DebuggerCallFrame): Updated for interface change.
* runtime/Executable.h:
(JSC::JSFunction::JSFunction): Do a little inlining.
* runtime/JSFunction.cpp:
(JSC::JSFunction::finishCreation): Gone now. That's the point of the patch.
(JSC::JSFunction::name):
(JSC::JSFunction::displayName):
(JSC::JSFunction::nameGetter):
(JSC::JSFunction::getOwnPropertySlot):
(JSC::JSFunction::getOwnPropertyDescriptor):
(JSC::JSFunction::getOwnPropertyNames):
(JSC::JSFunction::put):
(JSC::JSFunction::deleteProperty):
(JSC::JSFunction::defineOwnProperty): Added custom accessors for .name
just like .length and others.
* runtime/JSFunction.h:
(JSC::JSFunction::create):
(JSFunction): Updated for interface changes.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@128265 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp b/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
index 97e792b6..e924ad3 100644
--- a/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
+++ b/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
@@ -36,18 +36,18 @@
namespace JSC {
-const String* DebuggerCallFrame::functionName() const
+String DebuggerCallFrame::functionName() const
{
if (!m_callFrame->codeBlock())
- return 0;
+ return String();
if (!m_callFrame->callee())
- return 0;
+ return String();
JSObject* function = m_callFrame->callee();
if (!function || !function->inherits(&JSFunction::s_info))
- return 0;
- return &jsCast<JSFunction*>(function)->name(m_callFrame);
+ return String();
+ return jsCast<JSFunction*>(function)->name(m_callFrame);
}
String DebuggerCallFrame::calculatedFunctionName() const