Commit 448a8d3d authored by barraclough@apple.com's avatar barraclough@apple.com

This caused a performance regression, by breaking the code

generator's logic to calculate the skip level for resolving
variables (traced by rdar:7683350)  Reverting for now.

Reviewed by NOBODY (reverting r54510).

* parser/Grammar.y:
* parser/NodeConstructors.h:
(JSC::ContinueNode::ContinueNode):
(JSC::BreakNode::BreakNode):
(JSC::ForInNode::ForInNode):
* runtime/CommonIdentifiers.cpp:
(JSC::CommonIdentifiers::CommonIdentifiers):
* runtime/CommonIdentifiers.h:
* runtime/FunctionPrototype.cpp:
(JSC::FunctionPrototype::FunctionPrototype):
* runtime/Identifier.cpp:
(JSC::Identifier::add):
* runtime/PropertyNameArray.cpp:
(JSC::PropertyNameArray::add):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55751 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ec772ba1
2010-03-09 Gavin Barraclough <barraclough@apple.com>
Reviewed by NOBODY (reverting r54510).
This caused a performance regression, by breaking the code
generator's logic to calculate the skip level for resolving
variables (traced by rdar:7683350) Reverting for now.
* parser/Grammar.y:
* parser/NodeConstructors.h:
(JSC::ContinueNode::ContinueNode):
(JSC::BreakNode::BreakNode):
(JSC::ForInNode::ForInNode):
* runtime/CommonIdentifiers.cpp:
(JSC::CommonIdentifiers::CommonIdentifiers):
* runtime/CommonIdentifiers.h:
* runtime/FunctionPrototype.cpp:
(JSC::FunctionPrototype::FunctionPrototype):
* runtime/Identifier.cpp:
(JSC::Identifier::add):
* runtime/PropertyNameArray.cpp:
(JSC::PropertyNameArray::add):
2010-03-09 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
......
......@@ -1147,7 +1147,7 @@ ThrowStatement:
;
TryStatement:
TRY Block FINALLY Block { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, GLOBAL_DATA->propertyNames->emptyIdentifier, false, 0, $4.m_node),
TRY Block FINALLY Block { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, GLOBAL_DATA->propertyNames->nullIdentifier, false, 0, $4.m_node),
mergeDeclarationLists($2.m_varDeclarations, $4.m_varDeclarations),
mergeDeclarationLists($2.m_funcDeclarations, $4.m_funcDeclarations),
$2.m_features | $4.m_features,
......@@ -1188,10 +1188,10 @@ FunctionDeclaration:
;
FunctionExpr:
FUNCTION '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->emptyIdentifier, $5, GLOBAL_DATA->lexer->sourceCode($4, $6, @4.first_line)), ClosureFeature, 0); setStatementLocation($5, @4, @6); }
FUNCTION '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $5, GLOBAL_DATA->lexer->sourceCode($4, $6, @4.first_line)), ClosureFeature, 0); setStatementLocation($5, @4, @6); }
| FUNCTION '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE
{
$$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->emptyIdentifier, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line), $3.m_node.head), $3.m_features | ClosureFeature, 0);
$$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line), $3.m_node.head), $3.m_features | ClosureFeature, 0);
if ($3.m_features & ArgumentsFeature)
$6->setUsesArguments();
setStatementLocation($6, @5, @7);
......@@ -1981,7 +1981,7 @@ static PropertyNode* makeGetterOrSetterPropertyNode(JSGlobalData* globalData, co
type = PropertyNode::Setter;
else
return 0;
return new (globalData) PropertyNode(globalData, name, new (globalData) FuncExprNode(globalData, globalData->propertyNames->emptyIdentifier, body, source, params), type);
return new (globalData) PropertyNode(globalData, name, new (globalData) FuncExprNode(globalData, globalData->propertyNames->nullIdentifier, body, source, params), type);
}
static ExpressionNode* makeNegateNode(JSGlobalData* globalData, ExpressionNode* n)
......
......@@ -741,7 +741,7 @@ namespace JSC {
inline ContinueNode::ContinueNode(JSGlobalData* globalData)
: StatementNode(globalData)
, m_ident(globalData->propertyNames->emptyIdentifier)
, m_ident(globalData->propertyNames->nullIdentifier)
{
}
......@@ -753,7 +753,7 @@ namespace JSC {
inline BreakNode::BreakNode(JSGlobalData* globalData)
: StatementNode(globalData)
, m_ident(globalData->propertyNames->emptyIdentifier)
, m_ident(globalData->propertyNames->nullIdentifier)
{
}
......@@ -877,7 +877,7 @@ namespace JSC {
inline ForInNode::ForInNode(JSGlobalData* globalData, ExpressionNode* l, ExpressionNode* expr, StatementNode* statement)
: StatementNode(globalData)
, m_ident(globalData->propertyNames->emptyIdentifier)
, m_ident(globalData->propertyNames->nullIdentifier)
, m_init(0)
, m_lexpr(l)
, m_expr(expr)
......
......@@ -28,7 +28,8 @@ static const char* const nullCString = 0;
#define INITIALIZE_PROPERTY_NAME(name) , name(globalData, #name)
CommonIdentifiers::CommonIdentifiers(JSGlobalData* globalData)
: emptyIdentifier(globalData, "")
: nullIdentifier(globalData, nullCString)
, emptyIdentifier(globalData, "")
, underscoreProto(globalData, "__proto__")
, thisIdentifier(globalData, "this")
JSC_COMMON_IDENTIFIERS_EACH_PROPERTY_NAME(INITIALIZE_PROPERTY_NAME)
......
......@@ -90,6 +90,7 @@ namespace JSC {
friend class JSGlobalData;
public:
const Identifier nullIdentifier;
const Identifier emptyIdentifier;
const Identifier underscoreProto;
const Identifier thisIdentifier;
......
......@@ -39,7 +39,7 @@ static JSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*, JSObject*, JSVal
static JSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*, JSObject*, JSValue, const ArgList&);
FunctionPrototype::FunctionPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure)
: InternalFunction(&exec->globalData(), structure, exec->propertyNames().emptyIdentifier)
: InternalFunction(&exec->globalData(), structure, exec->propertyNames().nullIdentifier)
{
putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum);
}
......
......@@ -124,8 +124,11 @@ struct CStringTranslator {
PassRefPtr<UString::Rep> Identifier::add(JSGlobalData* globalData, const char* c)
{
ASSERT(c);
if (!c) {
UString::Rep* rep = UString::null().rep();
rep->hash();
return rep;
}
if (!c[0]) {
UString::Rep::empty().hash();
return &UString::Rep::empty();
......
......@@ -30,7 +30,7 @@ static const size_t setThreshold = 20;
void PropertyNameArray::add(UString::Rep* identifier)
{
ASSERT(identifier == &UString::Rep::empty() || identifier->isIdentifier());
ASSERT(identifier == UString::null().rep() || identifier == &UString::Rep::empty() || identifier->isIdentifier());
size_t size = m_data->propertyNameVector().size();
if (size < setThreshold) {
......
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