Changeset 47412 in webkit for trunk/JavaScriptCore/bytecode/CodeBlock.cpp
- Timestamp:
- Aug 17, 2009, 10:34:52 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/bytecode/CodeBlock.cpp
r47089 r47412 1249 1249 } 1250 1250 1251 CodeBlock::CodeBlock( ScopeNode* ownerNode)1251 CodeBlock::CodeBlock(ExecutableBase* ownerExecutable) 1252 1252 : m_numCalleeRegisters(0) 1253 1253 , m_numVars(0) 1254 1254 , m_numParameters(0) 1255 , m_owner Node(ownerNode)1255 , m_ownerExecutable(ownerExecutable) 1256 1256 , m_globalData(0) 1257 1257 #ifndef NDEBUG … … 1271 1271 } 1272 1272 1273 CodeBlock::CodeBlock( ScopeNode* ownerNode, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset)1273 CodeBlock::CodeBlock(ExecutableBase* ownerExecutable, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset) 1274 1274 : m_numCalleeRegisters(0) 1275 1275 , m_numVars(0) 1276 1276 , m_numParameters(0) 1277 , m_owner Node(ownerNode)1277 , m_ownerExecutable(ownerExecutable) 1278 1278 , m_globalData(0) 1279 1279 #ifndef NDEBUG 1280 1280 , m_instructionCount(0) 1281 1281 #endif 1282 , m_needsFullScopeChain(owner Node->needsActivation())1283 , m_usesEval(owner Node->usesEval())1282 , m_needsFullScopeChain(ownerExecutable->needsActivation()) 1283 , m_usesEval(ownerExecutable->usesEval()) 1284 1284 , m_isNumericCompareFunction(false) 1285 1285 , m_codeType(codeType) … … 1438 1438 } 1439 1439 1440 for (size_t i = 0; i < m_functions.size(); ++i) 1441 m_functions[i]->markAggregate(markStack); 1442 1443 if (m_rareData) 1444 m_rareData->m_evalCodeCache.markAggregate(markStack); 1440 for (size_t i = 0; i < m_functionExprs.size(); ++i) 1441 m_functionExprs[i]->markAggregate(markStack); 1442 for (size_t i = 0; i < m_functionDecls.size(); ++i) 1443 m_functionDecls[i]->markAggregate(markStack); 1445 1444 } 1446 1445 … … 1464 1463 } 1465 1464 1466 switch (m_codeType) { 1467 case FunctionCode: { 1468 FunctionBodyNode* ownerFunctionBodyNode = static_cast<FunctionBodyNode*>(m_ownerNode); 1469 RefPtr<FunctionBodyNode> newFunctionBody = m_globalData->parser->reparse<FunctionBodyNode>(m_globalData, ownerFunctionBodyNode); 1470 ASSERT(newFunctionBody); 1471 newFunctionBody->finishParsing(ownerFunctionBodyNode->copyParameters(), ownerFunctionBodyNode->parameterCount(), ownerFunctionBodyNode->ident()); 1472 1473 m_globalData->scopeNodeBeingReparsed = newFunctionBody.get(); 1474 1475 CodeBlock& newCodeBlock = newFunctionBody->bytecodeForExceptionInfoReparse(scopeChain, this); 1476 ASSERT(newCodeBlock.m_exceptionInfo); 1477 ASSERT(newCodeBlock.m_instructionCount == m_instructionCount); 1478 1479 #if ENABLE(JIT) 1480 JIT::compile(m_globalData, &newCodeBlock); 1481 ASSERT(newFunctionBody->generatedJITCode().size() == ownerNode()->generatedJITCode().size()); 1482 #endif 1483 1484 m_exceptionInfo.set(newCodeBlock.m_exceptionInfo.release()); 1485 1486 m_globalData->scopeNodeBeingReparsed = 0; 1487 1488 break; 1489 } 1490 case EvalCode: { 1491 EvalNode* ownerEvalNode = static_cast<EvalNode*>(m_ownerNode); 1492 RefPtr<EvalNode> newEvalBody = m_globalData->parser->reparse<EvalNode>(m_globalData, ownerEvalNode); 1493 1494 m_globalData->scopeNodeBeingReparsed = newEvalBody.get(); 1495 1496 EvalCodeBlock& newCodeBlock = newEvalBody->bytecodeForExceptionInfoReparse(scopeChain, this); 1497 ASSERT(newCodeBlock.m_exceptionInfo); 1498 ASSERT(newCodeBlock.m_instructionCount == m_instructionCount); 1499 1500 #if ENABLE(JIT) 1501 JIT::compile(m_globalData, &newCodeBlock); 1502 ASSERT(newEvalBody->generatedJITCode().size() == ownerNode()->generatedJITCode().size()); 1503 #endif 1504 1505 m_exceptionInfo.set(newCodeBlock.m_exceptionInfo.release()); 1506 1507 m_globalData->scopeNodeBeingReparsed = 0; 1508 1509 break; 1510 } 1511 default: 1512 // CodeBlocks for Global code blocks are transient and therefore to not gain from 1513 // from throwing out there exception information. 1514 ASSERT_NOT_REACHED(); 1515 } 1465 m_exceptionInfo.set(m_ownerExecutable->reparseExceptionInfo(m_globalData, scopeChain, this)); 1516 1466 } 1517 1467 … … 1544 1494 1545 1495 if (!m_exceptionInfo->m_lineInfo.size()) 1546 return m_owner Node->source().firstLine(); // Empty function1496 return m_ownerExecutable->source().firstLine(); // Empty function 1547 1497 1548 1498 int low = 0; … … 1557 1507 1558 1508 if (!low) 1559 return m_owner Node->source().firstLine();1509 return m_ownerExecutable->source().firstLine(); 1560 1510 return m_exceptionInfo->m_lineInfo[low - 1].lineNumber; 1561 1511 } … … 1697 1647 return false; 1698 1648 return true; 1699 }1700 #endif1701 1702 #if ENABLE(JIT)1703 void CodeBlock::setJITCode(JITCode jitCode)1704 {1705 ASSERT(m_codeType != NativeCode);1706 ownerNode()->setJITCode(jitCode);1707 #if !ENABLE(OPCODE_SAMPLING)1708 if (!BytecodeGenerator::dumpsGeneratedCode())1709 m_instructions.clear();1710 #endif1711 1649 } 1712 1650 #endif … … 1727 1665 1728 1666 m_identifiers.shrinkToFit(); 1729 m_functions.shrinkToFit(); 1667 m_functionDecls.shrinkToFit(); 1668 m_functionExprs.shrinkToFit(); 1730 1669 m_constantRegisters.shrinkToFit(); 1731 1670
Note:
See TracChangeset
for help on using the changeset viewer.