Ignore:
Timestamp:
Aug 11, 2009, 10:22:33 PM (16 years ago)
Author:
[email protected]
Message:

JavaScriptCore: Restrict use of FuncDeclNode & FuncExprNode to the parser.
https://bugs.webkit.org/show_bug.cgi?id=28209

Reviewed by Oliver Hunt.

These objects were also being referenced from the CodeBlock. By changing this
to just retain pointers to FunctionBodyNodes these classes can be restricted to
use during parsing.

No performance impact (or sub-percent progression).

Update symbols.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::mark):
(JSC::CodeBlock::reparseForExceptionInfoIfNecessary):
(JSC::CodeBlock::shrinkToFit):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::addFunction):
(JSC::CodeBlock::function):

Unify m_functions & m_functionExpressions into a single Vector<RefPtr<FuncExprNode> >.

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::addConstant):
(JSC::BytecodeGenerator::emitNewFunction):
(JSC::BytecodeGenerator::emitNewFunctionExpression):

  • bytecompiler/BytecodeGenerator.h:

FunctionStacks now contain FunctionBodyNodes not FuncDeclNodes.

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::execute):
(JSC::Interpreter::privateExecute):

Update to reflect chnages in CodeBlock.

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_new_func_exp):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • jit/JITStubs.h:

(JSC::):

Update to reflect chnages in CodeBlock.

  • parser/Grammar.y:

FunctionStacks now contain FunctionBodyNodes not FuncDeclNodes.

  • parser/NodeConstructors.h:

(JSC::FuncExprNode::FuncExprNode):
(JSC::FuncDeclNode::FuncDeclNode):

  • parser/Nodes.cpp:

(JSC::ScopeNodeData::mark):
(JSC::FunctionBodyNode::finishParsing):

  • parser/Nodes.h:

(JSC::FunctionBodyNode::ident):

Move m_ident & make methods from FuncDeclNode & FuncExprNode to FunctionBodyNode.

  • runtime/JSFunction.h:

(JSC::FunctionBodyNode::make):

Make this method inline (was FuncDeclNode::makeFunction).

WebCore: Restrict use of FuncDeclNode & FuncExprNode to the parser.
https://bugs.webkit.org/show_bug.cgi?id=28209

Reviewed by Oliver Hunt.

  • inspector/JavaScriptDebugServer.cpp:

(WebCore::JavaScriptDebugServer::recompileAllJSFunctions):

Function signature change.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/jit/JITStubs.cpp

    r46879 r47089  
    14681468    STUB_INIT_STACK_FRAME(stackFrame);
    14691469
    1470     return stackFrame.args[0].funcDeclNode()->makeFunction(stackFrame.callFrame, stackFrame.callFrame->scopeChain());
     1470    return stackFrame.args[0].function()->make(stackFrame.callFrame, stackFrame.callFrame->scopeChain());
    14711471}
    14721472
     
    25182518{
    25192519    STUB_INIT_STACK_FRAME(stackFrame);
    2520 
    2521     return stackFrame.args[0].funcExprNode()->makeFunction(stackFrame.callFrame, stackFrame.callFrame->scopeChain());
     2520    CallFrame* callFrame = stackFrame.callFrame;
     2521
     2522    FunctionBodyNode* body = stackFrame.args[0].function();
     2523    JSFunction* func = body->make(callFrame, callFrame->scopeChain());
     2524
     2525    /*
     2526        The Identifier in a FunctionExpression can be referenced from inside
     2527        the FunctionExpression's FunctionBody to allow the function to call
     2528        itself recursively. However, unlike in a FunctionDeclaration, the
     2529        Identifier in a FunctionExpression cannot be referenced from and
     2530        does not affect the scope enclosing the FunctionExpression.
     2531     */
     2532    if (!body->ident().isNull()) {
     2533        JSStaticScopeObject* functionScopeObject = new (callFrame) JSStaticScopeObject(callFrame, body->ident(), func, ReadOnly | DontDelete);
     2534        func->scope().push(functionScopeObject);
     2535    }
     2536
     2537    return func;
    25222538}
    25232539
Note: See TracChangeset for help on using the changeset viewer.