Changeset 174401 in webkit for trunk/Source/JavaScriptCore/bytecompiler
- Timestamp:
- Oct 7, 2014, 11:57:57 AM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore/bytecompiler
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r174294 r174401 251 251 instructions().append(m_lexicalEnvironmentRegister->index()); 252 252 } 253 253 RegisterID* scratch = addVar(); 254 254 m_symbolTable->setCaptureStart(virtualRegisterForLocal(m_codeBlock->m_numVars).offset()); 255 255 … … 333 333 if (functionBody->captures(ident) || shouldCaptureAllTheThings) { 334 334 m_functions.add(ident.impl()); 335 // We rely on still allocating stack space for captured variables 336 // here. 337 RegisterID* newFunction = emitNewFunction(addVar(ident, IsVariable, IsWatchable), IsCaptured, function); 338 initializeCapturedVariable(newFunction, ident, newFunction); 335 emitNewFunction(scratch, function); 336 initializeCapturedVariable(addVar(ident, IsVariable, IsWatchable), ident, scratch); 339 337 } 340 338 } … … 360 358 // as this would complicate lazy instantiation of actual arguments. 361 359 if (!canLazilyCreateFunctions || ident == propertyNames().arguments) 362 emitNewFunction(reg.get(), NotCaptured,function);360 emitNewFunction(reg.get(), function); 363 361 else { 364 362 emitInitLazyRegister(reg.get()); … … 1658 1656 } 1659 1657 1660 RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, CaptureMode captureMode,FunctionBodyNode* function)1661 { 1662 return emitNewFunctionInternal(dst, captureMode,m_codeBlock->addFunctionDecl(makeFunction(function)), false);1658 RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, FunctionBodyNode* function) 1659 { 1660 return emitNewFunctionInternal(dst, m_codeBlock->addFunctionDecl(makeFunction(function)), false); 1663 1661 } 1664 1662 … … 1668 1666 if (ptr.isNewEntry) 1669 1667 ptr.iterator->value = m_codeBlock->addFunctionDecl(makeFunction(function)); 1670 return emitNewFunctionInternal(dst, NotCaptured,ptr.iterator->value, true);1671 } 1672 1673 RegisterID* BytecodeGenerator::emitNewFunctionInternal(RegisterID* dst, CaptureMode captureMode,unsigned index, bool doNullCheck)1674 { 1675 emitOpcode( captureMode == IsCaptured ? op_new_captured_func :op_new_func);1668 return emitNewFunctionInternal(dst, ptr.iterator->value, true); 1669 } 1670 1671 RegisterID* BytecodeGenerator::emitNewFunctionInternal(RegisterID* dst, unsigned index, bool doNullCheck) 1672 { 1673 emitOpcode(op_new_func); 1676 1674 instructions().append(dst->index()); 1677 1675 instructions().append(index); 1678 if (captureMode == IsCaptured) { 1679 ASSERT(!doNullCheck); 1680 instructions().append(watchableVariable(dst->index())); 1681 } else 1682 instructions().append(doNullCheck); 1676 instructions().append(doNullCheck); 1683 1677 return dst; 1684 1678 } -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r174226 r174401 450 450 RegisterID* emitNewArray(RegisterID* dst, ElementNode*, unsigned length); // stops at first elision 451 451 452 RegisterID* emitNewFunction(RegisterID* dst, CaptureMode,FunctionBodyNode*);452 RegisterID* emitNewFunction(RegisterID* dst, FunctionBodyNode*); 453 453 RegisterID* emitLazyNewFunction(RegisterID* dst, FunctionBodyNode* body); 454 RegisterID* emitNewFunctionInternal(RegisterID* dst, CaptureMode,unsigned index, bool shouldNullCheck);454 RegisterID* emitNewFunctionInternal(RegisterID* dst, unsigned index, bool shouldNullCheck); 455 455 RegisterID* emitNewFunctionExpression(RegisterID* dst, FuncExprNode* func); 456 456 RegisterID* emitNewRegExp(RegisterID* dst, RegExp*);
Note:
See TracChangeset
for help on using the changeset viewer.