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/interpreter/Interpreter.cpp

    r46766 r47089  
    852852        for (DeclarationStacks::FunctionStack::const_iterator it = functionStack.begin(); it != functionStackEnd; ++it) {
    853853            PutPropertySlot slot;
    854             variableObject->put(callFrame, (*it)->m_ident, (*it)->makeFunction(callFrame, scopeChain), slot);
     854            variableObject->put(callFrame, (*it)->ident(), (*it)->make(callFrame, scopeChain), slot);
    855855        }
    856856
     
    29202920        */
    29212921        int dst = (++vPC)->u.operand;
    2922         int func = (++vPC)->u.operand;
    2923 
    2924         callFrame->r(dst) = JSValue(callFrame->codeBlock()->function(func)->makeFunction(callFrame, callFrame->scopeChain()));
     2922        int funcIndex = (++vPC)->u.operand;
     2923
     2924        FunctionBodyNode* body = callFrame->codeBlock()->function(funcIndex);
     2925        JSFunction* func = body->make(callFrame, callFrame->scopeChain());
     2926
     2927        /*
     2928            The Identifier in a FunctionExpression can be referenced from inside
     2929            the FunctionExpression's FunctionBody to allow the function to call
     2930            itself recursively. However, unlike in a FunctionDeclaration, the
     2931            Identifier in a FunctionExpression cannot be referenced from and
     2932            does not affect the scope enclosing the FunctionExpression.
     2933         */
     2934        if (!body->ident().isNull()) {
     2935            JSStaticScopeObject* functionScopeObject = new (callFrame) JSStaticScopeObject(callFrame, body->ident(), func, ReadOnly | DontDelete);
     2936            func->scope().push(functionScopeObject);
     2937        }
     2938
     2939        callFrame->r(dst) = JSValue(func);
    29252940
    29262941        ++vPC;
     
    29382953        int func = (++vPC)->u.operand;
    29392954
    2940         callFrame->r(dst) = JSValue(callFrame->codeBlock()->functionExpression(func)->makeFunction(callFrame, callFrame->scopeChain()));
     2955        callFrame->r(dst) = JSValue(callFrame->codeBlock()->function(func)->make(callFrame, callFrame->scopeChain()));
    29412956
    29422957        ++vPC;
Note: See TracChangeset for help on using the changeset viewer.