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).

* JavaScriptCore.exp:
    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.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@47089 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/bytecode/CodeBlock.cpp b/JavaScriptCore/bytecode/CodeBlock.cpp
index e22f25a..beec559 100644
--- a/JavaScriptCore/bytecode/CodeBlock.cpp
+++ b/JavaScriptCore/bytecode/CodeBlock.cpp
@@ -33,6 +33,8 @@
 #include "JIT.h"
 #include "JSValue.h"
 #include "Interpreter.h"
+#include "JSFunction.h"
+#include "JSStaticScopeObject.h"
 #include "Debugger.h"
 #include "BytecodeGenerator.h"
 #include <stdio.h>
@@ -1435,15 +1437,11 @@
             markStack.append(m_constantRegisters[i].jsValue());
     }
 
-    for (size_t i = 0; i < m_functionExpressions.size(); ++i)
-        m_functionExpressions[i]->body()->markAggregate(markStack);
+    for (size_t i = 0; i < m_functions.size(); ++i)
+        m_functions[i]->markAggregate(markStack);
 
-    if (m_rareData) {
-        for (size_t i = 0; i < m_rareData->m_functions.size(); ++i)
-            m_rareData->m_functions[i]->body()->markAggregate(markStack);
-
+    if (m_rareData)
         m_rareData->m_evalCodeCache.markAggregate(markStack);
-    }
 }
 
 void CodeBlock::reparseForExceptionInfoIfNecessary(CallFrame* callFrame)
@@ -1470,7 +1468,7 @@
             FunctionBodyNode* ownerFunctionBodyNode = static_cast<FunctionBodyNode*>(m_ownerNode);
             RefPtr<FunctionBodyNode> newFunctionBody = m_globalData->parser->reparse<FunctionBodyNode>(m_globalData, ownerFunctionBodyNode);
             ASSERT(newFunctionBody);
-            newFunctionBody->finishParsing(ownerFunctionBodyNode->copyParameters(), ownerFunctionBodyNode->parameterCount());
+            newFunctionBody->finishParsing(ownerFunctionBodyNode->copyParameters(), ownerFunctionBodyNode->parameterCount(), ownerFunctionBodyNode->ident());
 
             m_globalData->scopeNodeBeingReparsed = newFunctionBody.get();
 
@@ -1728,7 +1726,7 @@
 #endif
 
     m_identifiers.shrinkToFit();
-    m_functionExpressions.shrinkToFit();
+    m_functions.shrinkToFit();
     m_constantRegisters.shrinkToFit();
 
     if (m_exceptionInfo) {
@@ -1739,7 +1737,6 @@
 
     if (m_rareData) {
         m_rareData->m_exceptionHandlers.shrinkToFit();
-        m_rareData->m_functions.shrinkToFit();
         m_rareData->m_regexps.shrinkToFit();
         m_rareData->m_immediateSwitchJumpTables.shrinkToFit();
         m_rareData->m_characterSwitchJumpTables.shrinkToFit();