Changeset 47412 in webkit for trunk/JavaScriptCore/bytecompiler
- Timestamp:
- Aug 17, 2009, 10:34:52 PM (16 years ago)
- Location:
- trunk/JavaScriptCore/bytecompiler
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r47236 r47412 274 274 for (size_t i = 0; i < functionStack.size(); ++i) { 275 275 FunctionBodyNode* function = functionStack[i]; 276 globalObject->putWithAttributes(exec, function->ident(), function->make(exec, scopeChain.node()), DontDelete);276 globalObject->putWithAttributes(exec, function->ident(), new (exec) JSFunction(exec, adoptRef(new FunctionExecutable(function->ident(), function)), scopeChain.node()), DontDelete); 277 277 } 278 278 for (size_t i = 0; i < varStack.size(); ++i) { … … 398 398 m_codeBlock->m_numParameters = 1; // Allocate space for "this" 399 399 400 const DeclarationStacks::FunctionStack& functionStack = evalNode->functionStack(); 401 for (size_t i = 0; i < functionStack.size(); ++i) { 402 FunctionBodyNode* function = functionStack[i]; 403 m_codeBlock->addFunctionDecl(adoptRef(new FunctionExecutable(function->ident(), function))); 404 } 405 400 406 preserveLastVar(); 401 407 } … … 765 771 instructions().append(target->offsetFrom(instructions().size())); 766 772 return target; 767 }768 769 unsigned BytecodeGenerator::addConstant(FunctionBodyNode* n)770 {771 // No need to explicitly unique function body nodes -- they're unique already.772 return m_codeBlock->addFunction(n);773 773 } 774 774 … … 1309 1309 } 1310 1310 1311 RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, FunctionBodyNode* body) 1312 { 1311 RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, FunctionBodyNode* function) 1312 { 1313 unsigned index = m_codeBlock->addFunctionDecl(adoptRef(new FunctionExecutable(function->ident(), function))); 1314 1313 1315 emitOpcode(op_new_func); 1314 1316 instructions().append(dst->index()); 1315 instructions().append( addConstant(body));1317 instructions().append(index); 1316 1318 return dst; 1317 1319 } … … 1328 1330 RegisterID* BytecodeGenerator::emitNewFunctionExpression(RegisterID* r0, FuncExprNode* n) 1329 1331 { 1332 FunctionBodyNode* function = n->body(); 1333 unsigned index = m_codeBlock->addFunctionExpr(adoptRef(new FunctionExecutable(function->ident(), function))); 1334 1330 1335 emitOpcode(op_new_func_exp); 1331 1336 instructions().append(r0->index()); 1332 instructions().append( addConstant(n->body()));1337 instructions().append(index); 1333 1338 return r0; 1334 1339 } -
trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r47265 r47412 414 414 } 415 415 416 unsigned addConstant(FunctionBodyNode*);417 416 unsigned addConstant(const Identifier&); 418 417 RegisterID* addConstantValue(JSValue);
Note:
See TracChangeset
for help on using the changeset viewer.