Ignore:
Timestamp:
Feb 1, 2012, 3:23:30 PM (13 years ago)
Author:
[email protected]
Message:

Add support for inferred function names
https://bugs.webkit.org/show_bug.cgi?id=77579

Reviewed by Gavin Barraclough.

Source/JavaScriptCore:

Add new "inferred" names to function expressions, getters, and setters.
This property is not exposed to JS, so is only visible in the debugger
and profiler.

(JSC::BytecodeGenerator::makeFunction):

  • debugger/DebuggerCallFrame.cpp:

(JSC::DebuggerCallFrame::calculatedFunctionName):

  • parser/ASTBuilder.h:

(JSC::ASTBuilder::createAssignResolve):
(JSC::ASTBuilder::createGetterOrSetterProperty):
(JSC::ASTBuilder::createProperty):
(JSC::ASTBuilder::makeAssignNode):

  • parser/Nodes.h:

(JSC::FunctionBodyNode::setInferredName):
(JSC::FunctionBodyNode::inferredName):
(FunctionBodyNode):

  • profiler/Profiler.cpp:

(JSC):
(JSC::Profiler::createCallIdentifier):
(JSC::createCallIdentifierFromFunctionImp):

  • runtime/Executable.cpp:

(JSC::FunctionExecutable::FunctionExecutable):
(JSC::FunctionExecutable::fromGlobalCode):

  • runtime/Executable.h:

(JSC::FunctionExecutable::create):
(JSC::FunctionExecutable::inferredName):
(FunctionExecutable):

  • runtime/JSFunction.cpp:

(JSC::JSFunction::calculatedDisplayName):
(JSC):
(JSC::getCalculatedDisplayName):

  • runtime/JSFunction.h:

(JSC):

LayoutTests:

Update test case results.

  • fast/profiler/anonymous-event-handler-expected.txt:
  • fast/profiler/anonymous-function-called-from-different-contexts-expected.txt:
  • fast/profiler/anonymous-function-calls-built-in-functions-expected.txt:
  • fast/profiler/anonymous-function-calls-eval-expected.txt:
  • fast/profiler/built-in-function-calls-anonymous-expected.txt:
  • fast/profiler/inline-event-handler-expected.txt:
  • fast/profiler/many-calls-in-the-same-scope-expected.txt:
  • fast/profiler/multiple-and-different-scoped-anonymous-function-calls-expected.txt:
  • fast/profiler/multiple-and-different-scoped-function-calls-expected.txt:
  • fast/profiler/multiple-anonymous-functions-called-from-the-same-function-expected.txt:
  • fast/profiler/nested-anonymous-functon-expected.txt:
  • fast/profiler/start-and-stop-profiler-multiple-times-expected.txt:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/parser/Nodes.h

    r104900 r106504  
    14951495       
    14961496        const Identifier& ident() { return m_ident; }
     1497        void setInferredName(const Identifier& inferredName) { m_inferredName = inferredName; }
     1498        const Identifier& inferredName() { return m_inferredName.isEmpty() ? m_ident : m_inferredName; }
    14971499
    14981500        static const bool scopeIsFunction = true;
     
    15031505
    15041506        Identifier m_ident;
     1507        Identifier m_inferredName;
    15051508        RefPtr<FunctionParameters> m_parameters;
    15061509    };
Note: See TracChangeset for help on using the changeset viewer.