Changeset 54510 in webkit
- Timestamp:
- Feb 8, 2010, 2:26:59 PM (16 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r54481 r54510 1 2010-02-08 Gavin Barraclough <[email protected]> 2 3 Reviewed by Sam Weinig. 4 5 Use an empty identifier instead of a null identifier for parse 6 tokens without an identifier. 7 8 This helps encapsulate the null UStringImpl within UString. 9 10 * parser/Grammar.y: 11 * parser/NodeConstructors.h: 12 (JSC::ContinueNode::ContinueNode): 13 (JSC::BreakNode::BreakNode): 14 (JSC::ForInNode::ForInNode): 15 * runtime/CommonIdentifiers.cpp: 16 (JSC::CommonIdentifiers::CommonIdentifiers): 17 * runtime/CommonIdentifiers.h: 18 * runtime/FunctionPrototype.cpp: 19 (JSC::FunctionPrototype::FunctionPrototype): 20 1 21 2010-02-08 Gustavo Noronha Silva <[email protected]> 2 22 -
trunk/JavaScriptCore/parser/Grammar.y
r52791 r54510 1148 1148 1149 1149 TryStatement: 1150 TRY Block FINALLY Block { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, GLOBAL_DATA->propertyNames-> nullIdentifier, false, 0, $4.m_node),1150 TRY Block FINALLY Block { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, GLOBAL_DATA->propertyNames->emptyIdentifier, false, 0, $4.m_node), 1151 1151 mergeDeclarationLists($2.m_varDeclarations, $4.m_varDeclarations), 1152 1152 mergeDeclarationLists($2.m_funcDeclarations, $4.m_funcDeclarations), … … 1189 1189 1190 1190 FunctionExpr: 1191 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); }1191 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); } 1192 1192 | FUNCTION '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE 1193 1193 { 1194 $$ = 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);1194 $$ = 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); 1195 1195 if ($3.m_features & ArgumentsFeature) 1196 1196 $6->setUsesArguments(); … … 1982 1982 else 1983 1983 return 0; 1984 return new (globalData) PropertyNode(globalData, name, new (globalData) FuncExprNode(globalData, globalData->propertyNames-> nullIdentifier, body, source, params), type);1984 return new (globalData) PropertyNode(globalData, name, new (globalData) FuncExprNode(globalData, globalData->propertyNames->emptyIdentifier, body, source, params), type); 1985 1985 } 1986 1986 -
trunk/JavaScriptCore/parser/NodeConstructors.h
r47664 r54510 742 742 inline ContinueNode::ContinueNode(JSGlobalData* globalData) 743 743 : StatementNode(globalData) 744 , m_ident(globalData->propertyNames-> nullIdentifier)744 , m_ident(globalData->propertyNames->emptyIdentifier) 745 745 { 746 746 } … … 754 754 inline BreakNode::BreakNode(JSGlobalData* globalData) 755 755 : StatementNode(globalData) 756 , m_ident(globalData->propertyNames-> nullIdentifier)756 , m_ident(globalData->propertyNames->emptyIdentifier) 757 757 { 758 758 } … … 878 878 inline ForInNode::ForInNode(JSGlobalData* globalData, ExpressionNode* l, ExpressionNode* expr, StatementNode* statement) 879 879 : StatementNode(globalData) 880 , m_ident(globalData->propertyNames-> nullIdentifier)880 , m_ident(globalData->propertyNames->emptyIdentifier) 881 881 , m_init(0) 882 882 , m_lexpr(l) -
trunk/JavaScriptCore/runtime/CommonIdentifiers.cpp
r44813 r54510 29 29 30 30 CommonIdentifiers::CommonIdentifiers(JSGlobalData* globalData) 31 : nullIdentifier(globalData, nullCString) 32 , emptyIdentifier(globalData, "") 31 : emptyIdentifier(globalData, "") 33 32 , underscoreProto(globalData, "__proto__") 34 33 , thisIdentifier(globalData, "this") -
trunk/JavaScriptCore/runtime/CommonIdentifiers.h
r53170 r54510 91 91 92 92 public: 93 const Identifier nullIdentifier;94 93 const Identifier emptyIdentifier; 95 94 const Identifier underscoreProto; -
trunk/JavaScriptCore/runtime/FunctionPrototype.cpp
r52028 r54510 39 39 40 40 FunctionPrototype::FunctionPrototype(ExecState* exec, NonNullPassRefPtr<Structure> structure) 41 : InternalFunction(&exec->globalData(), structure, exec->propertyNames(). nullIdentifier)41 : InternalFunction(&exec->globalData(), structure, exec->propertyNames().emptyIdentifier) 42 42 { 43 43 putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 0), DontDelete | ReadOnly | DontEnum); -
trunk/JavaScriptCore/runtime/Identifier.cpp
r54464 r54510 124 124 PassRefPtr<UString::Rep> Identifier::add(JSGlobalData* globalData, const char* c) 125 125 { 126 if (!c) { 127 UString::Rep* rep = UString::null().rep(); 128 rep->hash(); 129 return rep; 130 } 126 ASSERT(c); 127 131 128 if (!c[0]) { 132 129 UString::Rep::empty().hash(); -
trunk/JavaScriptCore/runtime/PropertyNameArray.cpp
r54464 r54510 31 31 void PropertyNameArray::add(UString::Rep* identifier) 32 32 { 33 ASSERT(identifier == UString::null().rep() || identifier ==&UString::Rep::empty() || identifier->isIdentifier());33 ASSERT(identifier == &UString::Rep::empty() || identifier->isIdentifier()); 34 34 35 35 size_t size = m_data->propertyNameVector().size();
Note:
See TracChangeset
for help on using the changeset viewer.