Changeset 80598 in webkit for trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
- Timestamp:
- Mar 8, 2011, 3:17:32 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r79211 r80598 249 249 CodeBlock(ScriptExecutable* ownerExecutable, CodeType, JSGlobalObject*, PassRefPtr<SourceProvider>, unsigned sourceOffset, SymbolTable* symbolTable, bool isConstructor); 250 250 251 DeprecatedPtr<JSGlobalObject> m_globalObject;251 WriteBarrier<JSGlobalObject> m_globalObject; 252 252 Heap* m_heap; 253 253 … … 360 360 #endif 361 361 362 ScriptExecutable* ownerExecutable() const { return m_ownerExecutable ; }362 ScriptExecutable* ownerExecutable() const { return m_ownerExecutable.get(); } 363 363 364 364 void setGlobalData(JSGlobalData* globalData) { m_globalData = globalData; } … … 473 473 474 474 size_t numberOfConstantRegisters() const { return m_constantRegisters.size(); } 475 void addConstantRegister(const Register& r) { return m_constantRegisters.append(r); } 476 Register& constantRegister(int index) { return m_constantRegisters[index - FirstConstantRegisterIndex]; } 475 void addConstant(JSValue v) 476 { 477 m_constantRegisters.append(WriteBarrier<Unknown>()); 478 m_constantRegisters.last().set(m_globalObject->globalData(), m_ownerExecutable.get(), v); 479 } 480 WriteBarrier<Unknown>& constantRegister(int index) { return m_constantRegisters[index - FirstConstantRegisterIndex]; } 477 481 ALWAYS_INLINE bool isConstantRegisterIndex(int index) const { return index >= FirstConstantRegisterIndex; } 478 ALWAYS_INLINE JSValue getConstant(int index) const { return m_constantRegisters[index - FirstConstantRegisterIndex].jsValue(); } 479 480 unsigned addFunctionDecl(NonNullPassRefPtr<FunctionExecutable> n) { unsigned size = m_functionDecls.size(); m_functionDecls.append(n); return size; } 482 ALWAYS_INLINE JSValue getConstant(int index) const { return m_constantRegisters[index - FirstConstantRegisterIndex].get(); } 483 484 unsigned addFunctionDecl(FunctionExecutable* n) 485 { 486 unsigned size = m_functionDecls.size(); 487 m_functionDecls.append(WriteBarrier<FunctionExecutable>()); 488 m_functionDecls.last().set(m_globalObject->globalData(), m_ownerExecutable.get(), n); 489 return size; 490 } 481 491 FunctionExecutable* functionDecl(int index) { return m_functionDecls[index].get(); } 482 492 int numberOfFunctionDecls() { return m_functionDecls.size(); } 483 unsigned addFunctionExpr(NonNullPassRefPtr<FunctionExecutable> n) { unsigned size = m_functionExprs.size(); m_functionExprs.append(n); return size; } 493 unsigned addFunctionExpr(FunctionExecutable* n) 494 { 495 unsigned size = m_functionExprs.size(); 496 m_functionExprs.append(WriteBarrier<FunctionExecutable>()); 497 m_functionExprs.last().set(m_globalObject->globalData(), m_ownerExecutable.get(), n); 498 return size; 499 } 484 500 FunctionExecutable* functionExpr(int index) { return m_functionExprs[index].get(); } 485 501 … … 537 553 } 538 554 539 ScriptExecutable*m_ownerExecutable;555 WriteBarrier<ScriptExecutable> m_ownerExecutable; 540 556 JSGlobalData* m_globalData; 541 557 … … 575 591 // Constant Pool 576 592 Vector<Identifier> m_identifiers; 577 Vector<Register> m_constantRegisters; 578 Vector<RefPtr<FunctionExecutable> > m_functionDecls; 579 Vector<RefPtr<FunctionExecutable> > m_functionExprs; 593 COMPILE_ASSERT(sizeof(Register) == sizeof(WriteBarrier<Unknown>), Register_must_be_same_size_as_WriteBarrier_Unknown); 594 Vector<WriteBarrier<Unknown> > m_constantRegisters; 595 Vector<WriteBarrier<FunctionExecutable> > m_functionDecls; 596 Vector<WriteBarrier<FunctionExecutable> > m_functionExprs; 580 597 581 598 SymbolTable* m_symbolTable; … … 618 635 : CodeBlock(ownerExecutable, codeType, globalObject, sourceProvider, sourceOffset, &m_unsharedSymbolTable, false) 619 636 { 620 m_heap->codeBlocks().add(this);621 }622 623 ~GlobalCodeBlock()624 {625 m_heap->codeBlocks().remove(this);626 637 } 627 638 … … 681 692 CodeBlock* codeBlock = this->codeBlock(); 682 693 if (codeBlock->isConstantRegisterIndex(index)) 683 return codeBlock->constantRegister(index);694 return *reinterpret_cast<Register*>(&codeBlock->constantRegister(index)); 684 695 return this[index]; 685 696 }
Note:
See TracChangeset
for help on using the changeset viewer.