Commit 9e7ecd38 authored by ap@webkit.org's avatar ap@webkit.org

Reviewed by Geoff.

        Remove more threadInstance() calls.

        * kjs/JSFunction.cpp:
        (KJS::JSFunction::getParameterName):
        (KJS::IndexToNameMap::unMap):
        (KJS::Arguments::deleteProperty):
        * kjs/JSFunction.h:
        Access nullIdentifier without going to thread specific storage.

        * JavaScriptCore.exp:
        * kjs/JSGlobalData.cpp:
        (KJS::JSGlobalData::JSGlobalData):
        * kjs/JSGlobalData.h:
        * kjs/Parser.cpp:
        (KJS::Parser::parse):
        * kjs/Parser.h:
        (KJS::ParserRefCountedData::ParserRefCountedData):
        (KJS::Parser::parse):
        * kjs/grammar.y:
        * kjs/nodes.cpp:
        (KJS::ParserRefCounted::ParserRefCounted):
        (KJS::ParserRefCounted::ref):
        (KJS::ParserRefCounted::deref):
        (KJS::ParserRefCounted::hasOneRef):
        (KJS::ParserRefCounted::deleteNewObjects):
        (KJS::Node::Node):
        (KJS::StatementNode::StatementNode):
        (KJS::BreakpointCheckStatement::BreakpointCheckStatement):
        (KJS::ConstDeclNode::ConstDeclNode):
        (KJS::BlockNode::BlockNode):
        (KJS::ForInNode::ForInNode):
        (KJS::ScopeNode::ScopeNode):
        (KJS::ProgramNode::ProgramNode):
        (KJS::ProgramNode::create):
        (KJS::EvalNode::EvalNode):
        (KJS::EvalNode::create):
        (KJS::FunctionBodyNode::FunctionBodyNode):
        (KJS::FunctionBodyNode::create):
        * kjs/nodes.h:
        (KJS::ExpressionNode::):
        (KJS::NullNode::):
        (KJS::BooleanNode::):
        (KJS::NumberNode::):
        (KJS::ImmediateNumberNode::):
        (KJS::StringNode::):
        (KJS::RegExpNode::):
        (KJS::ThisNode::):
        (KJS::ResolveNode::):
        (KJS::ElementNode::):
        (KJS::ArrayNode::):
        (KJS::PropertyNode::):
        (KJS::PropertyListNode::):
        (KJS::ObjectLiteralNode::):
        (KJS::BracketAccessorNode::):
        (KJS::DotAccessorNode::):
        (KJS::ArgumentListNode::):
        (KJS::ArgumentsNode::):
        (KJS::NewExprNode::):
        (KJS::EvalFunctionCallNode::):
        (KJS::FunctionCallValueNode::):
        (KJS::FunctionCallResolveNode::):
        (KJS::FunctionCallBracketNode::):
        (KJS::FunctionCallDotNode::):
        (KJS::PrePostResolveNode::):
        (KJS::PostIncResolveNode::):
        (KJS::PostDecResolveNode::):
        (KJS::PostfixBracketNode::):
        (KJS::PostIncBracketNode::):
        (KJS::PostDecBracketNode::):
        (KJS::PostfixDotNode::):
        (KJS::PostIncDotNode::):
        (KJS::PostDecDotNode::):
        (KJS::PostfixErrorNode::):
        (KJS::DeleteResolveNode::):
        (KJS::DeleteBracketNode::):
        (KJS::DeleteDotNode::):
        (KJS::DeleteValueNode::):
        (KJS::VoidNode::):
        (KJS::TypeOfResolveNode::):
        (KJS::TypeOfValueNode::):
        (KJS::PreIncResolveNode::):
        (KJS::PreDecResolveNode::):
        (KJS::PrefixBracketNode::):
        (KJS::PreIncBracketNode::):
        (KJS::PreDecBracketNode::):
        (KJS::PrefixDotNode::):
        (KJS::PreIncDotNode::):
        (KJS::PreDecDotNode::):
        (KJS::PrefixErrorNode::):
        (KJS::UnaryOpNode::UnaryOpNode):
        (KJS::UnaryPlusNode::):
        (KJS::NegateNode::):
        (KJS::BitwiseNotNode::):
        (KJS::LogicalNotNode::):
        (KJS::BinaryOpNode::BinaryOpNode):
        (KJS::ReverseBinaryOpNode::ReverseBinaryOpNode):
        (KJS::MultNode::):
        (KJS::DivNode::):
        (KJS::ModNode::):
        (KJS::AddNode::):
        (KJS::SubNode::):
        (KJS::LeftShiftNode::):
        (KJS::RightShiftNode::):
        (KJS::UnsignedRightShiftNode::):
        (KJS::LessNode::):
        (KJS::GreaterNode::):
        (KJS::LessEqNode::):
        (KJS::GreaterEqNode::):
        (KJS::InstanceOfNode::):
        (KJS::InNode::):
        (KJS::EqualNode::):
        (KJS::NotEqualNode::):
        (KJS::StrictEqualNode::):
        (KJS::NotStrictEqualNode::):
        (KJS::BitAndNode::):
        (KJS::BitOrNode::):
        (KJS::BitXOrNode::):
        (KJS::LogicalAndNode::):
        (KJS::LogicalOrNode::):
        (KJS::ConditionalNode::):
        (KJS::ReadModifyResolveNode::):
        (KJS::AssignResolveNode::):
        (KJS::ReadModifyBracketNode::):
        (KJS::AssignBracketNode::):
        (KJS::AssignDotNode::):
        (KJS::ReadModifyDotNode::):
        (KJS::AssignErrorNode::):
        (KJS::CommaNode::):
        (KJS::VarDeclCommaNode::):
        (KJS::ConstStatementNode::):
        (KJS::SourceElements::SourceElements):
        (KJS::EmptyStatementNode::):
        (KJS::DebuggerStatementNode::):
        (KJS::ExprStatementNode::):
        (KJS::VarStatementNode::):
        (KJS::IfNode::):
        (KJS::IfElseNode::):
        (KJS::DoWhileNode::):
        (KJS::WhileNode::):
        (KJS::ForNode::):
        (KJS::ContinueNode::):
        (KJS::BreakNode::):
        (KJS::ReturnNode::):
        (KJS::WithNode::):
        (KJS::LabelNode::):
        (KJS::ThrowNode::):
        (KJS::TryNode::):
        (KJS::ParameterNode::):
        (KJS::FuncExprNode::):
        (KJS::FuncDeclNode::):
        (KJS::CaseClauseNode::):
        (KJS::ClauseListNode::):
        (KJS::CaseBlockNode::):
        (KJS::SwitchNode::):
        Changed ParserRefCounted to hold a JSGlobalData pointer, and used it to replace
        threadInstance calls.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34791 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d81ad203
2008-06-25 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff.
Remove more threadInstance() calls.
* kjs/JSFunction.cpp:
(KJS::JSFunction::getParameterName):
(KJS::IndexToNameMap::unMap):
(KJS::Arguments::deleteProperty):
* kjs/JSFunction.h:
Access nullIdentifier without going to thread specific storage.
* JavaScriptCore.exp:
* kjs/JSGlobalData.cpp:
(KJS::JSGlobalData::JSGlobalData):
* kjs/JSGlobalData.h:
* kjs/Parser.cpp:
(KJS::Parser::parse):
* kjs/Parser.h:
(KJS::ParserRefCountedData::ParserRefCountedData):
(KJS::Parser::parse):
* kjs/grammar.y:
* kjs/nodes.cpp:
(KJS::ParserRefCounted::ParserRefCounted):
(KJS::ParserRefCounted::ref):
(KJS::ParserRefCounted::deref):
(KJS::ParserRefCounted::hasOneRef):
(KJS::ParserRefCounted::deleteNewObjects):
(KJS::Node::Node):
(KJS::StatementNode::StatementNode):
(KJS::BreakpointCheckStatement::BreakpointCheckStatement):
(KJS::ConstDeclNode::ConstDeclNode):
(KJS::BlockNode::BlockNode):
(KJS::ForInNode::ForInNode):
(KJS::ScopeNode::ScopeNode):
(KJS::ProgramNode::ProgramNode):
(KJS::ProgramNode::create):
(KJS::EvalNode::EvalNode):
(KJS::EvalNode::create):
(KJS::FunctionBodyNode::FunctionBodyNode):
(KJS::FunctionBodyNode::create):
* kjs/nodes.h:
(KJS::ExpressionNode::):
(KJS::NullNode::):
(KJS::BooleanNode::):
(KJS::NumberNode::):
(KJS::ImmediateNumberNode::):
(KJS::StringNode::):
(KJS::RegExpNode::):
(KJS::ThisNode::):
(KJS::ResolveNode::):
(KJS::ElementNode::):
(KJS::ArrayNode::):
(KJS::PropertyNode::):
(KJS::PropertyListNode::):
(KJS::ObjectLiteralNode::):
(KJS::BracketAccessorNode::):
(KJS::DotAccessorNode::):
(KJS::ArgumentListNode::):
(KJS::ArgumentsNode::):
(KJS::NewExprNode::):
(KJS::EvalFunctionCallNode::):
(KJS::FunctionCallValueNode::):
(KJS::FunctionCallResolveNode::):
(KJS::FunctionCallBracketNode::):
(KJS::FunctionCallDotNode::):
(KJS::PrePostResolveNode::):
(KJS::PostIncResolveNode::):
(KJS::PostDecResolveNode::):
(KJS::PostfixBracketNode::):
(KJS::PostIncBracketNode::):
(KJS::PostDecBracketNode::):
(KJS::PostfixDotNode::):
(KJS::PostIncDotNode::):
(KJS::PostDecDotNode::):
(KJS::PostfixErrorNode::):
(KJS::DeleteResolveNode::):
(KJS::DeleteBracketNode::):
(KJS::DeleteDotNode::):
(KJS::DeleteValueNode::):
(KJS::VoidNode::):
(KJS::TypeOfResolveNode::):
(KJS::TypeOfValueNode::):
(KJS::PreIncResolveNode::):
(KJS::PreDecResolveNode::):
(KJS::PrefixBracketNode::):
(KJS::PreIncBracketNode::):
(KJS::PreDecBracketNode::):
(KJS::PrefixDotNode::):
(KJS::PreIncDotNode::):
(KJS::PreDecDotNode::):
(KJS::PrefixErrorNode::):
(KJS::UnaryOpNode::UnaryOpNode):
(KJS::UnaryPlusNode::):
(KJS::NegateNode::):
(KJS::BitwiseNotNode::):
(KJS::LogicalNotNode::):
(KJS::BinaryOpNode::BinaryOpNode):
(KJS::ReverseBinaryOpNode::ReverseBinaryOpNode):
(KJS::MultNode::):
(KJS::DivNode::):
(KJS::ModNode::):
(KJS::AddNode::):
(KJS::SubNode::):
(KJS::LeftShiftNode::):
(KJS::RightShiftNode::):
(KJS::UnsignedRightShiftNode::):
(KJS::LessNode::):
(KJS::GreaterNode::):
(KJS::LessEqNode::):
(KJS::GreaterEqNode::):
(KJS::InstanceOfNode::):
(KJS::InNode::):
(KJS::EqualNode::):
(KJS::NotEqualNode::):
(KJS::StrictEqualNode::):
(KJS::NotStrictEqualNode::):
(KJS::BitAndNode::):
(KJS::BitOrNode::):
(KJS::BitXOrNode::):
(KJS::LogicalAndNode::):
(KJS::LogicalOrNode::):
(KJS::ConditionalNode::):
(KJS::ReadModifyResolveNode::):
(KJS::AssignResolveNode::):
(KJS::ReadModifyBracketNode::):
(KJS::AssignBracketNode::):
(KJS::AssignDotNode::):
(KJS::ReadModifyDotNode::):
(KJS::AssignErrorNode::):
(KJS::CommaNode::):
(KJS::VarDeclCommaNode::):
(KJS::ConstStatementNode::):
(KJS::SourceElements::SourceElements):
(KJS::EmptyStatementNode::):
(KJS::DebuggerStatementNode::):
(KJS::ExprStatementNode::):
(KJS::VarStatementNode::):
(KJS::IfNode::):
(KJS::IfElseNode::):
(KJS::DoWhileNode::):
(KJS::WhileNode::):
(KJS::ForNode::):
(KJS::ContinueNode::):
(KJS::BreakNode::):
(KJS::ReturnNode::):
(KJS::WithNode::):
(KJS::LabelNode::):
(KJS::ThrowNode::):
(KJS::TryNode::):
(KJS::ParameterNode::):
(KJS::FuncExprNode::):
(KJS::FuncDeclNode::):
(KJS::CaseClauseNode::):
(KJS::ClauseListNode::):
(KJS::CaseBlockNode::):
(KJS::SwitchNode::):
Changed ParserRefCounted to hold a JSGlobalData pointer, and used it to replace
threadInstance calls.
2008-06-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Alexey Proskuryakov.
......
......@@ -91,7 +91,7 @@ __ZN3KJS11Interpreter8evaluateEPNS_9ExecStateERNS_10ScopeChainERKNS_7UStringEiS7
__ZN3KJS11JSImmediate8toObjectEPKNS_7JSValueEPNS_9ExecStateE
__ZN3KJS11JSImmediate8toStringEPKNS_7JSValueE
__ZN3KJS11ProfileNode4sortEPFbRKN3WTF6RefPtrIS0_EES5_E
__ZN3KJS11ProgramNode6createEPNS_14SourceElementsEPN3WTF6VectorISt4pairINS_10IdentifierEjELm16EEEPNS4_INS3_6RefPtrINS_12FuncDeclNodeEEELm16EEEbb
__ZN3KJS11ProgramNode6createEPNS_12JSGlobalDataEPNS_14SourceElementsEPN3WTF6VectorISt4pairINS_10IdentifierEjELm16EEEPNS6_INS5_6RefPtrINS_12FuncDeclNodeEEELm16EEEbb
__ZN3KJS11PropertyMap11getLocationERKNS_10IdentifierE
__ZN3KJS11PropertyMap11getLocationERKNS_10IdentifierERb
__ZN3KJS11PropertyMap3putERKNS_10IdentifierEPNS_7JSValueEjb
......
......@@ -163,7 +163,7 @@ const Identifier& JSFunction::getParameterName(int index)
Vector<Identifier>& parameters = body->parameters();
if (static_cast<size_t>(index) >= body->parameters().size())
return JSGlobalData::threadInstance().propertyNames->nullIdentifier;
return _scope.globalObject()->globalData()->propertyNames->nullIdentifier;
const Identifier& name = parameters[index];
......@@ -171,7 +171,7 @@ const Identifier& JSFunction::getParameterName(int index)
size_t size = parameters.size();
for (size_t i = index + 1; i < size; ++i)
if (parameters[i] == name)
return JSGlobalData::threadInstance().propertyNames->nullIdentifier;
return _scope.globalObject()->globalData()->propertyNames->nullIdentifier;
return name;
}
......@@ -251,14 +251,14 @@ bool IndexToNameMap::isMapped(const Identifier& index) const
return true;
}
void IndexToNameMap::unMap(const Identifier& index)
void IndexToNameMap::unMap(ExecState* exec, const Identifier& index)
{
bool indexIsNumber;
unsigned indexAsNumber = index.toStrictUInt32(&indexIsNumber);
ASSERT(indexIsNumber && indexAsNumber < size);
_map[indexAsNumber] = JSGlobalData::threadInstance().propertyNames->nullIdentifier;
_map[indexAsNumber] = exec->propertyNames().nullIdentifier;
}
Identifier& IndexToNameMap::operator[](const Identifier& index)
......@@ -327,7 +327,7 @@ void Arguments::put(ExecState* exec, const Identifier& propertyName, JSValue* va
bool Arguments::deleteProperty(ExecState* exec, const Identifier& propertyName)
{
if (indexToNameMap.isMapped(propertyName)) {
indexToNameMap.unMap(propertyName);
indexToNameMap.unMap(exec, propertyName);
return true;
} else {
return JSObject::deleteProperty(exec, propertyName);
......
......@@ -97,7 +97,7 @@ namespace KJS {
Identifier& operator[](const Identifier& index);
bool isMapped(const Identifier& index) const;
void unMap(const Identifier& index);
void unMap(ExecState* exec, const Identifier& index);
private:
unsigned size;
......
......@@ -77,6 +77,8 @@ JSGlobalData::JSGlobalData()
#endif
, identifierTable(createIdentifierTable())
, propertyNames(new CommonIdentifiers(this))
, newTrackedObjects(0)
, trackedObjectExtraRefCounts(0)
, lexer(new Lexer(this))
, parser(new Parser)
, head(0)
......
......@@ -72,8 +72,9 @@ namespace KJS {
CommonIdentifiers* propertyNames;
const ArgList emptyList; // Lists are supposed to be allocated on the stack to have their elements properly marked, which is not the case here - but this list has nothing to mark.
HashSet<ParserRefCounted*> newTrackedObjects;
HashCountedSet<ParserRefCounted*> trackedObjectExtraRefCounts;
// Tracked object sets are transient, only needed when parsing.
HashSet<ParserRefCounted*>* newTrackedObjects;
HashCountedSet<ParserRefCounted*>* trackedObjectExtraRefCounts;
Lexer* lexer;
Parser* parser;
......
......@@ -73,7 +73,7 @@ void Parser::parse(ExecState* exec, const UString& sourceURL, int startingLineNu
bool lexError = lexer.sawError();
lexer.clear();
ParserRefCounted::deleteNewObjects();
ParserRefCounted::deleteNewObjects(&exec->globalData());
if (parseError || lexError) {
*errLine = lexer.lineNo();
......
......@@ -39,6 +39,11 @@ namespace KJS {
class UString;
template <typename T> struct ParserRefCountedData : ParserRefCounted {
ParserRefCountedData(JSGlobalData* globalData)
: ParserRefCounted(globalData)
{
}
T data;
};
......@@ -83,7 +88,8 @@ namespace KJS {
m_sourceURL = UString();
return 0;
}
RefPtr<ParsedNode> node = ParsedNode::create(m_sourceElements.release().get(),
RefPtr<ParsedNode> node = ParsedNode::create(&exec->globalData(),
m_sourceElements.release().get(),
m_varDeclarations ? &m_varDeclarations->data : 0,
m_funcDeclarations ? &m_funcDeclarations->data : 0,
m_usesEval,
......
This diff is collapsed.
......@@ -106,18 +106,16 @@ static ParserRefCountedCounter parserRefCountedCounter;
#endif
static HashSet<ParserRefCounted*>* newTrackedObjects;
static HashCountedSet<ParserRefCounted*>* trackedObjectExtraRefCounts;
ParserRefCounted::ParserRefCounted()
ParserRefCounted::ParserRefCounted(JSGlobalData* globalData)
: m_globalData(globalData)
{
#ifndef NDEBUG
ParserRefCountedCounter::increment();
#endif
if (!newTrackedObjects)
newTrackedObjects = new HashSet<ParserRefCounted*>;
newTrackedObjects->add(this);
ASSERT(newTrackedObjects->contains(this));
if (!m_globalData->newTrackedObjects)
m_globalData->newTrackedObjects = new HashSet<ParserRefCounted*>;
m_globalData->newTrackedObjects->add(this);
ASSERT(m_globalData->newTrackedObjects->contains(this));
}
ParserRefCounted::~ParserRefCounted()
......@@ -130,78 +128,80 @@ ParserRefCounted::~ParserRefCounted()
void ParserRefCounted::ref()
{
// bumping from 0 to 1 is just removing from the new nodes set
if (newTrackedObjects) {
HashSet<ParserRefCounted*>::iterator it = newTrackedObjects->find(this);
if (it != newTrackedObjects->end()) {
newTrackedObjects->remove(it);
ASSERT(!trackedObjectExtraRefCounts || !trackedObjectExtraRefCounts->contains(this));
if (m_globalData->newTrackedObjects) {
HashSet<ParserRefCounted*>::iterator it = m_globalData->newTrackedObjects->find(this);
if (it != m_globalData->newTrackedObjects->end()) {
m_globalData->newTrackedObjects->remove(it);
ASSERT(!m_globalData->trackedObjectExtraRefCounts || !m_globalData->trackedObjectExtraRefCounts->contains(this));
return;
}
}
ASSERT(!newTrackedObjects || !newTrackedObjects->contains(this));
ASSERT(!m_globalData->newTrackedObjects || !m_globalData->newTrackedObjects->contains(this));
if (!trackedObjectExtraRefCounts)
trackedObjectExtraRefCounts = new HashCountedSet<ParserRefCounted*>;
trackedObjectExtraRefCounts->add(this);
if (!m_globalData->trackedObjectExtraRefCounts)
m_globalData->trackedObjectExtraRefCounts = new HashCountedSet<ParserRefCounted*>;
m_globalData->trackedObjectExtraRefCounts->add(this);
}
void ParserRefCounted::deref()
{
ASSERT(!newTrackedObjects || !newTrackedObjects->contains(this));
ASSERT(!m_globalData->newTrackedObjects || !m_globalData->newTrackedObjects->contains(this));
if (!trackedObjectExtraRefCounts) {
if (!m_globalData->trackedObjectExtraRefCounts) {
delete this;
return;
}
HashCountedSet<ParserRefCounted*>::iterator it = trackedObjectExtraRefCounts->find(this);
if (it == trackedObjectExtraRefCounts->end())
HashCountedSet<ParserRefCounted*>::iterator it = m_globalData->trackedObjectExtraRefCounts->find(this);
if (it == m_globalData->trackedObjectExtraRefCounts->end())
delete this;
else
trackedObjectExtraRefCounts->remove(it);
m_globalData->trackedObjectExtraRefCounts->remove(it);
}
bool ParserRefCounted::hasOneRef()
{
if (newTrackedObjects && newTrackedObjects->contains(this)) {
ASSERT(!trackedObjectExtraRefCounts || !trackedObjectExtraRefCounts->contains(this));
if (m_globalData->newTrackedObjects && m_globalData->newTrackedObjects->contains(this)) {
ASSERT(!m_globalData->trackedObjectExtraRefCounts || !m_globalData->trackedObjectExtraRefCounts->contains(this));
return false;
}
ASSERT(!newTrackedObjects || !newTrackedObjects->contains(this));
ASSERT(!m_globalData->newTrackedObjects || !m_globalData->newTrackedObjects->contains(this));
if (!trackedObjectExtraRefCounts)
if (!m_globalData->trackedObjectExtraRefCounts)
return true;
return !trackedObjectExtraRefCounts->contains(this);
return !m_globalData->trackedObjectExtraRefCounts->contains(this);
}
void ParserRefCounted::deleteNewObjects()
void ParserRefCounted::deleteNewObjects(JSGlobalData* globalData)
{
if (!newTrackedObjects)
if (!globalData->newTrackedObjects)
return;
#ifndef NDEBUG
HashSet<ParserRefCounted*>::iterator end = newTrackedObjects->end();
for (HashSet<ParserRefCounted*>::iterator it = newTrackedObjects->begin(); it != end; ++it)
ASSERT(!trackedObjectExtraRefCounts || !trackedObjectExtraRefCounts->contains(*it));
HashSet<ParserRefCounted*>::iterator end = globalData->newTrackedObjects->end();
for (HashSet<ParserRefCounted*>::iterator it = globalData->newTrackedObjects->begin(); it != end; ++it)
ASSERT(!globalData->trackedObjectExtraRefCounts || !globalData->trackedObjectExtraRefCounts->contains(*it));
#endif
deleteAllValues(*newTrackedObjects);
delete newTrackedObjects;
newTrackedObjects = 0;
deleteAllValues(*globalData->newTrackedObjects);
delete globalData->newTrackedObjects;
globalData->newTrackedObjects = 0;
}
Node::Node()
: m_expectedReturnType(ObjectType)
Node::Node(JSGlobalData* globalData)
: ParserRefCounted(globalData)
, m_expectedReturnType(ObjectType)
{
m_line = JSGlobalData::threadInstance().lexer->lineNo();
m_line = globalData->lexer->lineNo();
}
Node::Node(JSType expectedReturn)
: m_expectedReturnType(expectedReturn)
Node::Node(JSGlobalData* globalData, JSType expectedReturn)
: ParserRefCounted(globalData)
, m_expectedReturnType(expectedReturn)
{
m_line = JSGlobalData::threadInstance().lexer->lineNo();
m_line = globalData->lexer->lineNo();
}
static void substitute(UString& string, const UString& substring) KJS_FAST_CALL;
......@@ -247,8 +247,9 @@ RegisterID* Node::emitThrowError(CodeGenerator& generator, ErrorType e, const ch
// ------------------------------ StatementNode --------------------------------
StatementNode::StatementNode()
: m_lastLine(-1)
StatementNode::StatementNode(JSGlobalData* globalData)
: Node(globalData)
, m_lastLine(-1)
{
m_line = -1;
}
......@@ -271,8 +272,9 @@ void SourceElements::append(PassRefPtr<StatementNode> statement)
// ------------------------------ BreakpointCheckStatement --------------------------------
BreakpointCheckStatement::BreakpointCheckStatement(PassRefPtr<StatementNode> statement)
: m_statement(statement)
BreakpointCheckStatement::BreakpointCheckStatement(JSGlobalData* globalData, PassRefPtr<StatementNode> statement)
: StatementNode(globalData)
, m_statement(statement)
{
ASSERT(m_statement);
}
......@@ -1022,8 +1024,9 @@ RegisterID* CommaNode::emitCode(CodeGenerator& generator, RegisterID* dst)
// ------------------------------ ConstDeclNode ----------------------------------
ConstDeclNode::ConstDeclNode(const Identifier& ident, ExpressionNode* init)
: m_ident(ident)
ConstDeclNode::ConstDeclNode(JSGlobalData* globalData, const Identifier& ident, ExpressionNode* init)
: ExpressionNode(globalData)
, m_ident(ident)
, m_init(init)
{
}
......@@ -1106,7 +1109,8 @@ static inline Node* statementListInitializeVariableAccessStack(StatementVector&
// ------------------------------ BlockNode ------------------------------------
BlockNode::BlockNode(SourceElements* children)
BlockNode::BlockNode(JSGlobalData* globalData, SourceElements* children)
: StatementNode(globalData)
{
if (children)
children->releaseContentsIntoVector(m_children);
......@@ -1264,8 +1268,9 @@ RegisterID* ForNode::emitCode(CodeGenerator& generator, RegisterID* dst)
// ------------------------------ ForInNode ------------------------------------
ForInNode::ForInNode(ExpressionNode* l, ExpressionNode* expr, StatementNode* statement)
: m_init(0L)
ForInNode::ForInNode(JSGlobalData* globalData, ExpressionNode* l, ExpressionNode* expr, StatementNode* statement)
: StatementNode(globalData)
, m_init(0L)
, m_lexpr(l)
, m_expr(expr)
, m_statement(statement)
......@@ -1273,15 +1278,16 @@ ForInNode::ForInNode(ExpressionNode* l, ExpressionNode* expr, StatementNode* sta
{
}
ForInNode::ForInNode(const Identifier& ident, ExpressionNode* in, ExpressionNode* expr, StatementNode* statement)
: m_ident(ident)
, m_lexpr(new ResolveNode(ident))
ForInNode::ForInNode(JSGlobalData* globalData, const Identifier& ident, ExpressionNode* in, ExpressionNode* expr, StatementNode* statement)
: StatementNode(globalData)
, m_ident(ident)
, m_lexpr(new ResolveNode(globalData, ident))
, m_expr(expr)
, m_statement(statement)
, m_identIsVarDecl(true)
{
if (in)
m_init = new AssignResolveNode(ident, in, true);
m_init = new AssignResolveNode(globalData,ident, in, true);
// for( var foo = bar in baz )
}
......@@ -1565,10 +1571,10 @@ RegisterID* TryNode::emitCode(CodeGenerator& generator, RegisterID* dst)
// ------------------------------ FunctionBodyNode -----------------------------
ScopeNode::ScopeNode(SourceElements* children, VarStack* varStack, FunctionStack* funcStack, bool usesEval, bool needsClosure)
: BlockNode(children)
, m_sourceURL(JSGlobalData::threadInstance().parser->sourceURL())
, m_sourceId(JSGlobalData::threadInstance().parser->sourceId())
ScopeNode::ScopeNode(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, bool usesEval, bool needsClosure)
: BlockNode(globalData, children)
, m_sourceURL(globalData->parser->sourceURL())
, m_sourceId(globalData->parser->sourceId())
, m_usesEval(usesEval)
, m_needsClosure(needsClosure)
{
......@@ -1580,20 +1586,20 @@ ScopeNode::ScopeNode(SourceElements* children, VarStack* varStack, FunctionStack
// ------------------------------ ProgramNode -----------------------------
ProgramNode::ProgramNode(SourceElements* children, VarStack* varStack, FunctionStack* funcStack, bool usesEval, bool needsClosure)
: ScopeNode(children, varStack, funcStack, usesEval, needsClosure)
ProgramNode::ProgramNode(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, bool usesEval, bool needsClosure)
: ScopeNode(globalData, children, varStack, funcStack, usesEval, needsClosure)
{
}
ProgramNode* ProgramNode::create(SourceElements* children, VarStack* varStack, FunctionStack* funcStack, bool usesEval, bool needsClosure)
ProgramNode* ProgramNode::create(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, bool usesEval, bool needsClosure)
{
return new ProgramNode(children, varStack, funcStack, usesEval, needsClosure);
return new ProgramNode(globalData, children, varStack, funcStack, usesEval, needsClosure);
}
// ------------------------------ EvalNode -----------------------------
EvalNode::EvalNode(SourceElements* children, VarStack* varStack, FunctionStack* funcStack, bool usesEval, bool needsClosure)
: ScopeNode(children, varStack, funcStack, usesEval, needsClosure)
EvalNode::EvalNode(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, bool usesEval, bool needsClosure)
: ScopeNode(globalData, children, varStack, funcStack, usesEval, needsClosure)
{
}
......@@ -1623,15 +1629,15 @@ void EvalNode::generateCode(ScopeChainNode* sc)
generator.generate();
}
EvalNode* EvalNode::create(SourceElements* children, VarStack* varStack, FunctionStack* funcStack, bool usesEval, bool needsClosure)
EvalNode* EvalNode::create(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, bool usesEval, bool needsClosure)
{
return new EvalNode(children, varStack, funcStack, usesEval, needsClosure);
return new EvalNode(globalData, children, varStack, funcStack, usesEval, needsClosure);
}
// ------------------------------ FunctionBodyNode -----------------------------
FunctionBodyNode::FunctionBodyNode(SourceElements* children, VarStack* varStack, FunctionStack* funcStack, bool usesEval, bool needsClosure)
: ScopeNode(children, varStack, funcStack, usesEval, needsClosure)
FunctionBodyNode::FunctionBodyNode(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, bool usesEval, bool needsClosure)
: ScopeNode(globalData, children, varStack, funcStack, usesEval, needsClosure)
{
}
......@@ -1641,9 +1647,9 @@ void FunctionBodyNode::mark()
m_code->mark();
}
FunctionBodyNode* FunctionBodyNode::create(SourceElements* children, VarStack* varStack, FunctionStack* funcStack, bool usesEval, bool needsClosure)
FunctionBodyNode* FunctionBodyNode::create(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, bool usesEval, bool needsClosure)
{
return new FunctionBodyNode(children, varStack, funcStack, usesEval, needsClosure);
return new FunctionBodyNode(globalData, children, varStack, funcStack, usesEval, needsClosure);
}
void FunctionBodyNode::generateCode(ScopeChainNode* sc)
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment