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 source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
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