Changeset 47627 in webkit for trunk/JavaScriptCore/bytecode/CodeBlock.h
- Timestamp:
- Aug 21, 2009, 12:48:59 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/bytecode/CodeBlock.h
r47597 r47627 262 262 friend class JIT; 263 263 protected: 264 CodeBlock(ExecutableBase* ownerExecutable, CodeType, PassRefPtr<SourceProvider>, unsigned sourceOffset );264 CodeBlock(ExecutableBase* ownerExecutable, CodeType, PassRefPtr<SourceProvider>, unsigned sourceOffset, SymbolTable* symbolTable); 265 265 public: 266 ~CodeBlock();266 virtual ~CodeBlock(); 267 267 268 268 void markAggregate(MarkStack&); … … 467 467 468 468 469 SymbolTable& symbolTable() { return m_symbolTable; } 469 SymbolTable* symbolTable() { return m_symbolTable; } 470 SharedSymbolTable* sharedSymbolTable() { ASSERT(m_codeType == FunctionCode); return static_cast<SharedSymbolTable*>(m_symbolTable); } 470 471 471 472 EvalCodeCache& evalCodeCache() { createRareDataIfNecessary(); return m_rareData->m_evalCodeCache; } … … 531 532 Vector<RefPtr<FunctionExecutable> > m_functionExprs; 532 533 533 SymbolTable m_symbolTable;534 SymbolTable* m_symbolTable; 534 535 535 536 OwnPtr<ExceptionInfo> m_exceptionInfo; … … 561 562 public: 562 563 GlobalCodeBlock(ExecutableBase* ownerExecutable, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, JSGlobalObject* globalObject) 563 : CodeBlock(ownerExecutable, codeType, sourceProvider, sourceOffset )564 : CodeBlock(ownerExecutable, codeType, sourceProvider, sourceOffset, &m_unsharedSymbolTable) 564 565 , m_globalObject(globalObject) 565 566 { … … 577 578 private: 578 579 JSGlobalObject* m_globalObject; // For program and eval nodes, the global object that marks the constant pool. 580 SymbolTable m_unsharedSymbolTable; 579 581 }; 580 582 … … 612 614 class FunctionCodeBlock : public CodeBlock { 613 615 public: 616 // Rather than using the usual RefCounted::create idiom for SharedSymbolTable we just use new 617 // as we need to initialise the CodeBlock before we could initialise any RefPtr to hold the shared 618 // symbol table, so we just pass as a raw pointer with a ref count of 1. We then manually deref 619 // in the destructor. 614 620 FunctionCodeBlock(FunctionExecutable* ownerExecutable, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset) 615 : CodeBlock(ownerExecutable, codeType, sourceProvider, sourceOffset) 616 { 621 : CodeBlock(ownerExecutable, codeType, sourceProvider, sourceOffset, new SharedSymbolTable) 622 { 623 } 624 ~FunctionCodeBlock() 625 { 626 sharedSymbolTable()->deref(); 617 627 } 618 628 };
Note:
See TracChangeset
for help on using the changeset viewer.