Ignore:
Timestamp:
May 19, 2010, 7:38:01 PM (15 years ago)
Author:
[email protected]
Message:

JavaScriptCore: Bug 39393 - JSFunction need not be a subclass of InternalFunction.

Reviewed by Oliver Hunt.

re-landing r59800.

(JSC::Interpreter::retrieveCaller):
(JSC::Interpreter::findFunctionCallFrame):

  • interpreter/Interpreter.h:
  • profiler/Profiler.cpp:

(JSC::Profiler::createCallIdentifier):

  • runtime/FunctionPrototype.cpp:

(JSC::functionProtoFuncToString):

  • runtime/JSFunction.cpp:

(JSC::):
(JSC::JSFunction::JSFunction):
(JSC::JSFunction::name):
(JSC::JSFunction::displayName):
(JSC::JSFunction::calculatedDisplayName):

  • runtime/JSFunction.h:
  • runtime/JSObject.cpp:

(JSC::JSObject::putDirectFunction):
(JSC::JSObject::putDirectFunctionWithoutTransition):

  • runtime/JSObject.h:
  • runtime/Lookup.cpp:

(JSC::setUpStaticFunctionSlot):

WebCore: Rubber Stamped by Sam Weinig.

JSFunctions are no longer a subclass of InternalFunction.

  • bindings/js/ScriptCallStack.cpp:

(WebCore::ScriptCallStack::ScriptCallStack):
(WebCore::ScriptCallStack::initialize):

  • bindings/js/ScriptCallStack.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSFunction.cpp

    r59801 r59811  
    4444ASSERT_CLASS_FITS_IN_CELL(JSFunction);
    4545
    46 const ClassInfo JSFunction::info = { "Function", &InternalFunction::info, 0, 0 };
     46const ClassInfo JSFunction::info = { "Function", 0, 0, 0 };
    4747
    4848bool JSFunction::isHostFunctionNonInline() const
     
    5959
    6060JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, PassRefPtr<NativeExecutable> thunk)
    61     : Base(&exec->globalData(), structure, name)
     61    : Base(structure)
    6262#if ENABLE(JIT)
    6363    , m_executable(thunk)
     
    6565    , m_scopeChain(NoScopeChain())
    6666{
     67    putDirect(exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);
    6768#if ENABLE(JIT)
    6869    putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum);
     
    7576
    7677JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, NativeFunction func)
    77     : Base(&exec->globalData(), structure, name)
     78    : Base(structure)
    7879#if ENABLE(JIT)
    7980    , m_executable(exec->globalData().getHostFunction(func))
     
    8182    , m_scopeChain(NoScopeChain())
    8283{
     84    putDirect(exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);
    8385#if ENABLE(JIT)
    8486    putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum);
     
    9193
    9294JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<FunctionExecutable> executable, ScopeChainNode* scopeChainNode)
    93     : Base(&exec->globalData(), exec->lexicalGlobalObject()->functionStructure(), executable->name())
     95    : Base(exec->lexicalGlobalObject()->functionStructure())
    9496    , m_executable(executable)
    9597    , m_scopeChain(scopeChainNode)
    9698{
     99    const Identifier& name = static_cast<FunctionExecutable*>(m_executable.get())->name();
     100    putDirect(exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum);
    97101}
    98102
     
    115119}
    116120
     121const UString& JSFunction::name(ExecState* exec)
     122{
     123    return asString(getDirect(exec->globalData().propertyNames->name))->value(exec);
     124}
     125
     126const UString JSFunction::displayName(ExecState* exec)
     127{
     128    JSValue displayName = getDirect(exec->globalData().propertyNames->displayName);
     129   
     130    if (displayName && isJSString(&exec->globalData(), displayName))
     131        return asString(displayName)->value(exec);
     132   
     133    return UString::null();
     134}
     135
     136const UString JSFunction::calculatedDisplayName(ExecState* exec)
     137{
     138    const UString explicitName = displayName(exec);
     139   
     140    if (!explicitName.isEmpty())
     141        return explicitName;
     142   
     143    return name(exec);
     144}
     145
    117146void JSFunction::markChildren(MarkStack& markStack)
    118147{
Note: See TracChangeset for help on using the changeset viewer.