Changeset 47775 in webkit for trunk/JavaScriptCore/runtime/Executable.cpp
- Timestamp:
- Aug 26, 2009, 12:46:47 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/Executable.cpp
r47738 r47775 57 57 FunctionExecutable::~FunctionExecutable() 58 58 { 59 for (int i = 0; i < m_parameterCount; ++i)60 m_parameters[i].~Identifier();61 fastFree(m_parameters);62 59 delete m_codeBlock; 63 60 } … … 121 118 if (m_forceUsesArguments) 122 119 body->setUsesArguments(); 123 body->finishParsing( copyParameters(), m_parameterCount, m_name);120 body->finishParsing(m_parameters, m_name); 124 121 recordParse(body->features(), body->lineNo(), body->lastLine()); 125 122 … … 186 183 if (m_forceUsesArguments) 187 184 newFunctionBody->setUsesArguments(); 188 newFunctionBody->finishParsing( copyParameters(), m_parameterCount, m_name);185 newFunctionBody->finishParsing(m_parameters, m_name); 189 186 190 187 ScopeChain scopeChain(scopeChainNode); … … 263 260 FunctionBodyNode* body = static_cast<FuncExprNode*>(funcExpr)->body(); 264 261 ASSERT(body); 265 return adoptRef(new FunctionExecutable(functionName, body->source(), body->usesArguments(), body->copyParameters(), body->parameterCount(), body->lineNo(), body->lastLine())); 266 } 267 268 Identifier* FunctionExecutable::copyParameters() 269 { 270 // This code uses the internal vector copier to make copy-constructed copies of the data in the array 271 // (the array contains Identfiers which reference count Ustring::Reps, which must be ref'ed correctly). 272 Identifier* parameters = static_cast<Identifier*>(fastMalloc(m_parameterCount * sizeof(Identifier))); 273 WTF::VectorCopier<false, Identifier>::uninitializedCopy(m_parameters, m_parameters + m_parameterCount, parameters); 274 return parameters; 262 return FunctionExecutable::create(functionName, body->source(), body->usesArguments(), body->parameters(), body->lineNo(), body->lastLine()); 275 263 } 276 264 277 265 UString FunctionExecutable::paramString() const 278 266 { 267 FunctionParameters& parameters = *m_parameters; 279 268 UString s(""); 280 for ( int pos = 0; pos < m_parameterCount; ++pos) {269 for (size_t pos = 0; pos < parameters.size(); ++pos) { 281 270 if (!s.isEmpty()) 282 271 s += ", "; 283 s += m_parameters[pos].ustring();272 s += parameters[pos].ustring(); 284 273 } 285 274
Note:
See TracChangeset
for help on using the changeset viewer.