Changeset 82849 in webkit
- Timestamp:
- Apr 4, 2011 11:41:15 AM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r82718 r82849 1 2011-04-01 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Geoffrey Garen. 4 5 Make StructureChain GC allocated 6 https://bugs.webkit.org/show_bug.cgi?id=56695 7 8 Make StructureChain GC allocated, and make the various owners 9 mark it correctly. 10 11 * JavaScriptCore.exp: 12 * bytecode/CodeBlock.cpp: 13 (JSC::CodeBlock::dump): 14 (JSC::CodeBlock::derefStructures): 15 (JSC::CodeBlock::refStructures): 16 (JSC::CodeBlock::markAggregate): 17 * bytecode/Instruction.h: 18 (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set): 19 (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList): 20 (JSC::PolymorphicAccessStructureList::derefStructures): 21 (JSC::PolymorphicAccessStructureList::markAggregate): 22 (JSC::Instruction::Instruction): 23 * bytecode/StructureStubInfo.cpp: 24 (JSC::StructureStubInfo::deref): 25 (JSC::StructureStubInfo::markAggregate): 26 * bytecode/StructureStubInfo.h: 27 (JSC::StructureStubInfo::initGetByIdChain): 28 (JSC::StructureStubInfo::initPutByIdTransition): 29 * bytecompiler/BytecodeGenerator.cpp: 30 (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall): 31 (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply): 32 * collector/handles/Handle.h: 33 (JSC::HandleConverter::operator->): 34 (JSC::HandleConverter::operator*): 35 * interpreter/Interpreter.cpp: 36 (JSC::Interpreter::privateExecute): 37 * jit/JITOpcodes.cpp: 38 (JSC::JIT::emit_op_jneq_ptr): 39 * jit/JITOpcodes32_64.cpp: 40 (JSC::JIT::emit_op_jneq_ptr): 41 * jit/JITPropertyAccess.cpp: 42 (JSC::JIT::privateCompileGetByIdChainList): 43 * jit/JITPropertyAccess32_64.cpp: 44 (JSC::JIT::privateCompileGetByIdChainList): 45 * jit/JITStubs.cpp: 46 (JSC::JITThunks::tryCachePutByID): 47 (JSC::JITThunks::tryCacheGetByID): 48 (JSC::getPolymorphicAccessStructureListSlot): 49 (JSC::DEFINE_STUB_FUNCTION): 50 * runtime/JSCell.h: 51 * runtime/JSGlobalData.cpp: 52 (JSC::JSGlobalData::JSGlobalData): 53 * runtime/JSGlobalData.h: 54 * runtime/JSGlobalObject.cpp: 55 (JSC::markIfNeeded): 56 * runtime/JSGlobalObject.h: 57 (JSC::Structure::prototypeChain): 58 * runtime/JSObject.h: 59 (JSC::JSObject::putDirectInternal): 60 (JSC::JSObject::markChildrenDirect): 61 * runtime/JSPropertyNameIterator.cpp: 62 (JSC::JSPropertyNameIterator::create): 63 (JSC::JSPropertyNameIterator::get): 64 (JSC::JSPropertyNameIterator::markChildren): 65 * runtime/JSPropertyNameIterator.h: 66 (JSC::JSPropertyNameIterator::setCachedPrototypeChain): 67 * runtime/JSZombie.cpp: 68 (JSC::JSZombie::leakedZombieStructure): 69 * runtime/JSZombie.h: 70 * runtime/MarkStack.h: 71 (JSC::MarkStack::append): 72 * runtime/MarkedBlock.cpp: 73 (JSC::MarkedBlock::sweep): 74 * runtime/Structure.cpp: 75 (JSC::Structure::addPropertyTransition): 76 * runtime/Structure.h: 77 (JSC::Structure::markAggregate): 78 * runtime/StructureChain.cpp: 79 (JSC::StructureChain::StructureChain): 80 (JSC::StructureChain::~StructureChain): 81 (JSC::StructureChain::markChildren): 82 * runtime/StructureChain.h: 83 (JSC::StructureChain::create): 84 (JSC::StructureChain::createStructure): 85 * runtime/WriteBarrier.h: 86 (JSC::WriteBarrierBase::get): 87 (JSC::WriteBarrierBase::operator*): 88 (JSC::WriteBarrierBase::operator->): 89 1 90 2011-04-01 Geoffrey Garen <ggaren@apple.com> 2 91 -
trunk/Source/JavaScriptCore/JavaScriptCore.exp
r82173 r82849 315 315 __ZN3JSC9Structure17stopIgnoringLeaksEv 316 316 __ZN3JSC9Structure18startIgnoringLeaksEv 317 __ZN3JSC9Structure21addPropertyTransitionE PS0_RKNS_10IdentifierEjPNS_6JSCellERm317 __ZN3JSC9Structure21addPropertyTransitionERNS_12JSGlobalDataEPS0_RKNS_10IdentifierEjPNS_6JSCellERm 318 318 __ZN3JSC9Structure22materializePropertyMapEv 319 319 __ZN3JSC9Structure25changePrototypeTransitionEPS0_NS_7JSValueE -
trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
r82173 r82849 52 52 ?addBytes@SHA1@WTF@@QAEXPBEI@Z 53 53 ?addCurrentThread@MachineThreads@JSC@@QAEXXZ 54 ?addPropertyTransition@Structure@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@ PAV12@ABVIdentifier@2@IPAVJSCell@2@AAI@Z54 ?addPropertyTransition@Structure@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@AAVJSGlobalData@2@PAV12@ABVIdentifier@2@IPAVJSCell@2@AAI@Z 55 55 ?addPropertyTransitionToExistingStructure@Structure@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@PAV12@ABVIdentifier@2@IPAVJSCell@2@AAI@Z 56 56 ?addPropertyWithoutTransition@Structure@JSC@@QAEIABVIdentifier@2@IPAVJSCell@2@@Z -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r82519 r82849 732 732 int r0 = (++it)->u.operand; 733 733 int id0 = (++it)->u.operand; 734 JSValue scope = JSValue((++it)->u.jsCell );734 JSValue scope = JSValue((++it)->u.jsCell.get()); 735 735 ++it; 736 736 int depth = (++it)->u.operand; … … 1438 1438 if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_chain)) { 1439 1439 vPC[4].u.structure->deref(); 1440 vPC[5].u.structureChain->deref();1441 1440 return; 1442 1441 } … … 1444 1443 vPC[4].u.structure->deref(); 1445 1444 vPC[5].u.structure->deref(); 1446 vPC[6].u.structureChain->deref();1447 1445 return; 1448 1446 } … … 1487 1485 if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_chain)) { 1488 1486 vPC[4].u.structure->ref(); 1489 vPC[5].u.structureChain->ref();1490 1487 return; 1491 1488 } … … 1493 1490 vPC[4].u.structure->ref(); 1494 1491 vPC[5].u.structure->ref(); 1495 vPC[6].u.structureChain->ref();1496 1492 return; 1497 1493 } … … 1528 1524 markStack.append(&callLinkInfo(i).callee); 1529 1525 #endif 1526 #if ENABLE(INTERPRETER) 1527 Interpreter* interpreter = m_globalData->interpreter; 1528 for (size_t size = m_propertyAccessInstructions.size(), i = 0; i < size; ++i) { 1529 Instruction* vPC = &m_instructions[m_propertyAccessInstructions[i]]; 1530 if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_chain)) 1531 markStack.append(&vPC[5].u.structureChain); 1532 else if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_transition)) 1533 markStack.append(&vPC[6].u.structureChain); 1534 } 1535 #endif 1536 #if ENABLE(JIT) 1537 for (size_t size = m_globalResolveInfos.size(), i = 0; i < size; ++i) { 1538 if (Structure* structure = m_globalResolveInfos[i].structure) 1539 structure->markAggregate(markStack); 1540 } 1541 1542 for (size_t size = m_structureStubInfos.size(), i = 0; i < size; ++i) 1543 m_structureStubInfos[i].markAggregate(markStack); 1544 1545 for (size_t size = m_methodCallLinkInfos.size(), i = 0; i < size; ++i) { 1546 if (Structure* structure = m_methodCallLinkInfos[i].cachedStructure) { 1547 // Both members must be filled at the same time 1548 structure->markAggregate(markStack); 1549 ASSERT(!!m_methodCallLinkInfos[i].cachedPrototypeStructure); 1550 m_methodCallLinkInfos[i].cachedPrototypeStructure->markAggregate(markStack); 1551 } 1552 } 1553 #endif 1530 1554 } 1531 1555 -
trunk/Source/JavaScriptCore/bytecode/Instruction.h
r82519 r82849 34 34 #include "PropertySlot.h" 35 35 #include "Structure.h" 36 #include "StructureChain.h" 36 37 #include <wtf/VectorTraits.h> 37 38 … … 64 65 union { 65 66 Structure* proto; 66 StructureChain*chain;67 WriteBarrierBase<StructureChain> chain; 67 68 } u; 68 69 … … 83 84 } 84 85 85 void set( PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base, StructureChain* _chain)86 void set(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base, StructureChain* _chain) 86 87 { 87 88 stubRoutine = _stubRoutine; 88 89 base = _base; 89 u.chain = _chain;90 u.chain.set(globalData, owner, _chain); 90 91 isChain = true; 91 92 } … … 102 103 } 103 104 104 PolymorphicAccessStructureList( PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase, StructureChain* firstChain)105 PolymorphicAccessStructureList(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase, StructureChain* firstChain) 105 106 { 106 list[0].set( stubRoutine, firstBase, firstChain);107 list[0].set(globalData, owner, stubRoutine, firstBase, firstChain); 107 108 } 108 109 … … 116 117 117 118 if (info.u.proto) { 118 if (info.isChain) 119 info.u.chain->deref(); 120 else 119 if (!info.isChain) 121 120 info.u.proto->deref(); 122 121 } 122 } 123 } 124 125 void markAggregate(MarkStack& markStack, int count) 126 { 127 for (int i = 0; i < count; ++i) { 128 PolymorphicStubInfo& info = list[i]; 129 ASSERT(info.base); 130 131 if (info.u.chain && info.isChain) 132 markStack.append(&info.u.chain); 123 133 } 124 134 } … … 131 141 // We have to initialize one of the pointer members to ensure that 132 142 // the entire struct is initialized, when opcode is not a pointer. 133 u.jsCell = 0;143 u.jsCell.clear(); 134 144 #endif 135 145 u.opcode = opcode; … … 140 150 // We have to initialize one of the pointer members to ensure that 141 151 // the entire struct is initialized in 64-bit. 142 u.jsCell = 0;152 u.jsCell.clear(); 143 153 u.operand = operand; 144 154 } 145 155 146 156 Instruction(Structure* structure) { u.structure = structure; } 147 Instruction(StructureChain* structureChain) { u.structureChain = structureChain; } 148 Instruction(JSCell* jsCell) { u.jsCell = jsCell; } 157 Instruction(JSGlobalData& globalData, JSCell* owner, StructureChain* structureChain) 158 { 159 u.structureChain.clear(); 160 u.structureChain.set(globalData, owner, structureChain); 161 } 162 Instruction(JSGlobalData& globalData, JSCell* owner, JSCell* jsCell) 163 { 164 u.jsCell.clear(); 165 u.jsCell.set(globalData, owner, jsCell); 166 } 149 167 Instruction(PolymorphicAccessStructureList* polymorphicStructures) { u.polymorphicStructures = polymorphicStructures; } 150 168 Instruction(PropertySlot::GetValueFunc getterFunc) { u.getterFunc = getterFunc; } … … 154 172 int operand; 155 173 Structure* structure; 156 StructureChain*structureChain;157 JSCell*jsCell;174 WriteBarrierBase<StructureChain> structureChain; 175 WriteBarrierBase<JSCell> jsCell; 158 176 PolymorphicAccessStructureList* polymorphicStructures; 159 177 PropertySlot::GetValueFunc getterFunc; -
trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp
r82519 r82849 45 45 case access_get_by_id_chain: 46 46 u.getByIdChain.baseObjectStructure->deref(); 47 u.getByIdChain.chain->deref();48 47 return; 49 48 case access_get_by_id_self_list: { … … 61 60 case access_put_by_id_transition: 62 61 u.putByIdTransition.previousStructure->deref(); 63 u.putByIdTransition.structure->deref();64 u.putByIdTransition.chain->deref();65 62 return; 66 63 case access_put_by_id_replace: … … 79 76 } 80 77 } 78 79 void StructureStubInfo::markAggregate(MarkStack& markStack) 80 { 81 switch (accessType) { 82 case access_get_by_id_self: 83 u.getByIdSelf.baseObjectStructure->markAggregate(markStack); 84 return; 85 case access_get_by_id_proto: 86 u.getByIdProto.baseObjectStructure->markAggregate(markStack); 87 u.getByIdProto.prototypeStructure->markAggregate(markStack); 88 return; 89 case access_get_by_id_chain: 90 u.getByIdChain.baseObjectStructure->markAggregate(markStack); 91 markStack.append(&u.getByIdChain.chain); 92 return; 93 case access_get_by_id_self_list: { 94 PolymorphicAccessStructureList* polymorphicStructures = u.getByIdSelfList.structureList; 95 polymorphicStructures->markAggregate(markStack, u.getByIdSelfList.listSize); 96 return; 97 } 98 case access_get_by_id_proto_list: { 99 PolymorphicAccessStructureList* polymorphicStructures = u.getByIdProtoList.structureList; 100 polymorphicStructures->markAggregate(markStack, u.getByIdProtoList.listSize); 101 return; 102 } 103 case access_put_by_id_transition: 104 u.putByIdTransition.previousStructure->markAggregate(markStack); 105 u.putByIdTransition.structure->markAggregate(markStack); 106 markStack.append(&u.putByIdTransition.chain); 107 return; 108 case access_put_by_id_replace: 109 u.putByIdReplace.baseObjectStructure->markAggregate(markStack); 110 return; 111 case access_get_by_id: 112 case access_put_by_id: 113 case access_get_by_id_generic: 114 case access_put_by_id_generic: 115 case access_get_array_length: 116 case access_get_string_length: 117 // These instructions don't ref their Structures. 118 return; 119 default: 120 ASSERT_NOT_REACHED(); 121 } 122 } 81 123 #endif 82 124 -
trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.h
r82519 r82849 78 78 } 79 79 80 void initGetByIdChain( Structure* baseObjectStructure, StructureChain* chain)80 void initGetByIdChain(JSGlobalData& globalData, JSCell* owner, Structure* baseObjectStructure, StructureChain* chain) 81 81 { 82 82 accessType = access_get_by_id_chain; … … 85 85 baseObjectStructure->ref(); 86 86 87 u.getByIdChain.chain = chain; 88 chain->ref(); 87 u.getByIdChain.chain.set(globalData, owner, chain); 89 88 } 90 89 … … 107 106 // PutById* 108 107 109 void initPutByIdTransition( Structure* previousStructure, Structure* structure, StructureChain* chain)108 void initPutByIdTransition(JSGlobalData& globalData, JSCell* owner, Structure* previousStructure, Structure* structure, StructureChain* chain) 110 109 { 111 110 accessType = access_put_by_id_transition; … … 117 116 structure->ref(); 118 117 119 u.putByIdTransition.chain = chain; 120 chain->ref(); 118 u.putByIdTransition.chain.set(globalData, owner, chain); 121 119 } 122 120 … … 130 128 131 129 void deref(); 130 void markAggregate(MarkStack&); 132 131 133 132 bool seenOnce() … … 154 153 struct { 155 154 Structure* baseObjectStructure; 156 StructureChain*chain;155 WriteBarrierBase<StructureChain> chain; 157 156 } getByIdChain; 158 157 struct { … … 167 166 Structure* previousStructure; 168 167 Structure* structure; 169 StructureChain*chain;168 WriteBarrierBase<StructureChain> chain; 170 169 } putByIdTransition; 171 170 struct { -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r82519 r82849 926 926 emitOpcode(op_jneq_ptr); 927 927 instructions().append(cond->index()); 928 instructions().append( m_scopeChain->globalObject->callFunction());928 instructions().append(Instruction(*m_globalData, m_codeBlock->ownerExecutable(), m_scopeChain->globalObject->callFunction())); 929 929 instructions().append(target->bind(begin, instructions().size())); 930 930 return target; … … 937 937 emitOpcode(op_jneq_ptr); 938 938 instructions().append(cond->index()); 939 instructions().append( m_scopeChain->globalObject->applyFunction());939 instructions().append(Instruction(*m_globalData, m_codeBlock->ownerExecutable(), m_scopeChain->globalObject->applyFunction())); 940 940 instructions().append(target->bind(begin, instructions().size())); 941 941 return target; -
trunk/Source/JavaScriptCore/collector/handles/Handle.h
r81188 r82849 105 105 106 106 template <typename Base, typename T> struct HandleConverter { 107 T* operator->() { return static_cast<Base*>(this)->get(); } 108 const T* operator->() const { return static_cast<const Base*>(this)->get(); } 109 T* operator*() { return static_cast<Base*>(this)->get(); } 110 const T* operator*() const { return static_cast<const Base*>(this)->get(); } 107 T* operator->() 108 { 109 #if ENABLE(JSC_ZOMBIES) 110 ASSERT(!static_cast<const Base*>(this)->get() || !static_cast<const Base*>(this)->get()->isZombie()); 111 #endif 112 return static_cast<Base*>(this)->get(); 113 } 114 const T* operator->() const 115 { 116 #if ENABLE(JSC_ZOMBIES) 117 ASSERT(!static_cast<const Base*>(this)->get() || !static_cast<const Base*>(this)->get()->isZombie()); 118 #endif 119 return static_cast<const Base*>(this)->get(); 120 } 121 122 T* operator*() 123 { 124 #if ENABLE(JSC_ZOMBIES) 125 ASSERT(!static_cast<const Base*>(this)->get() || !static_cast<const Base*>(this)->get()->isZombie()); 126 #endif 127 return static_cast<Base*>(this)->get(); 128 } 129 const T* operator*() const 130 { 131 #if ENABLE(JSC_ZOMBIES) 132 ASSERT(!static_cast<const Base*>(this)->get() || !static_cast<const Base*>(this)->get()->isZombie()); 133 #endif 134 return static_cast<const Base*>(this)->get(); 135 } 111 136 }; 112 137 … … 119 144 120 145 private: 121 JSValue jsValue() const { return static_cast<const Base*>(this)->get(); } 146 JSValue jsValue() const 147 { 148 #if ENABLE(JSC_ZOMBIES) 149 ASSERT(!static_cast<const Base*>(this)->get() || !static_cast<const Base*>(this)->get().isZombie()); 150 #endif 151 return static_cast<const Base*>(this)->get(); 152 } 122 153 }; 123 154 -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r82519 r82849 3538 3538 */ 3539 3539 int src = vPC[1].u.operand; 3540 JSValue ptr = JSValue(vPC[2].u.jsCell);3541 3540 int target = vPC[3].u.operand; 3542 3541 JSValue srcValue = callFrame->r(src).jsValue(); 3543 if (srcValue != ptr) {3542 if (srcValue != vPC[2].u.jsCell.get()) { 3544 3543 vPC += target; 3545 3544 NEXT_INSTRUCTION(); -
trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp
r82519 r82849 763 763 { 764 764 unsigned src = currentInstruction[1].u.operand; 765 JSCell* ptr = currentInstruction[2].u.jsCell ;765 JSCell* ptr = currentInstruction[2].u.jsCell.get(); 766 766 unsigned target = currentInstruction[3].u.operand; 767 767 -
trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
r82519 r82849 980 980 { 981 981 unsigned src = currentInstruction[1].u.operand; 982 JSCell* ptr = currentInstruction[2].u.jsCell ;982 JSCell* ptr = currentInstruction[2].u.jsCell.get(); 983 983 unsigned target = currentInstruction[3].u.operand; 984 984 -
trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp
r82519 r82849 980 980 // Track the stub we have created so that it will be deleted later. 981 981 structure->ref(); 982 chain->ref(); 983 prototypeStructures->list[currentIndex].set(entryLabel, structure, chain); 982 prototypeStructures->list[currentIndex].set(callFrame->globalData(), m_codeBlock->ownerExecutable(), entryLabel, structure, chain); 984 983 985 984 // Finally patch the jump to slow case back in the hot path to jump here instead. -
trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
r82519 r82849 1008 1008 // Track the stub we have created so that it will be deleted later. 1009 1009 structure->ref(); 1010 chain->ref(); 1011 prototypeStructures->list[currentIndex].set(entryLabel, structure, chain); 1010 prototypeStructures->list[currentIndex].set(callFrame->globalData(), m_codeBlock->ownerExecutable(), entryLabel, structure, chain); 1012 1011 1013 1012 // Finally patch the jump to slow case back in the hot path to jump here instead. -
trunk/Source/JavaScriptCore/jit/JITStubs.cpp
r82519 r82849 772 772 773 773 StructureChain* prototypeChain = structure->prototypeChain(callFrame); 774 stubInfo->initPutByIdTransition( structure->previousID(), structure, prototypeChain);774 stubInfo->initPutByIdTransition(callFrame->globalData(), codeBlock->ownerExecutable(), structure->previousID(), structure, prototypeChain); 775 775 JIT::compilePutByIdTransition(callFrame->scopeChain()->globalData, codeBlock, stubInfo, structure->previousID(), structure, slot.cachedOffset(), prototypeChain, returnAddress, direct); 776 776 return; … … 867 867 868 868 StructureChain* prototypeChain = structure->prototypeChain(callFrame); 869 stubInfo->initGetByIdChain( structure, prototypeChain);869 stubInfo->initGetByIdChain(callFrame->globalData(), codeBlock->ownerExecutable(), structure, prototypeChain); 870 870 JIT::compileGetByIdChain(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, structure, prototypeChain, count, propertyName, slot, offset, returnAddress); 871 871 } … … 1554 1554 } 1555 1555 1556 static PolymorphicAccessStructureList* getPolymorphicAccessStructureListSlot( StructureStubInfo* stubInfo, int& listIndex)1556 static PolymorphicAccessStructureList* getPolymorphicAccessStructureListSlot(JSGlobalData& globalData, ScriptExecutable* owner, StructureStubInfo* stubInfo, int& listIndex) 1557 1557 { 1558 1558 PolymorphicAccessStructureList* prototypeStructureList = 0; … … 1566 1566 break; 1567 1567 case access_get_by_id_chain: 1568 prototypeStructureList = new PolymorphicAccessStructureList( stubInfo->stubRoutine, stubInfo->u.getByIdChain.baseObjectStructure, stubInfo->u.getByIdChain.chain);1568 prototypeStructureList = new PolymorphicAccessStructureList(globalData, owner, stubInfo->stubRoutine, stubInfo->u.getByIdChain.baseObjectStructure, stubInfo->u.getByIdChain.chain.get()); 1569 1569 stubInfo->stubRoutine = CodeLocationLabel(); 1570 1570 stubInfo->initGetByIdProtoList(prototypeStructureList, 2); … … 1654 1654 1655 1655 int listIndex; 1656 PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot( stubInfo, listIndex);1656 PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot(callFrame->globalData(), codeBlock->ownerExecutable(), stubInfo, listIndex); 1657 1657 if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE) { 1658 1658 JIT::compileGetByIdProtoList(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, slotBaseObject->structure(), propertyName, slot, offset); … … 1664 1664 ASSERT(!baseValue.asCell()->structure()->isDictionary()); 1665 1665 int listIndex; 1666 PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot( stubInfo, listIndex);1666 PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot(callFrame->globalData(), codeBlock->ownerExecutable(), stubInfo, listIndex); 1667 1667 1668 1668 if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE) { -
trunk/Source/JavaScriptCore/runtime/JSCell.h
r82519 r82849 69 69 friend class MarkedBlock; 70 70 friend class ScopeChainNode; 71 friend class StructureChain; 71 72 72 73 private: -
trunk/Source/JavaScriptCore/runtime/JSGlobalData.cpp
r82519 r82849 185 185 functionExecutableStructure = FunctionExecutable::createStructure(*this, jsNull()); 186 186 dummyMarkableCellStructure = JSCell::createDummyStructure(*this); 187 structureChainStructure = StructureChain::createStructure(*this, jsNull()); 187 188 188 189 interpreter = new Interpreter(*this); -
trunk/Source/JavaScriptCore/runtime/JSGlobalData.h
r82519 r82849 162 162 RefPtr<Structure> functionExecutableStructure; 163 163 RefPtr<Structure> dummyMarkableCellStructure; 164 RefPtr<Structure> structureChainStructure; 164 165 165 166 static void storeVPtrs(); -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r82519 r82849 87 87 static inline void markIfNeeded(MarkStack& markStack, const RefPtr<Structure>& s) 88 88 { 89 if (s && s->storedPrototype())90 markStack.append(s->storedPrototypeSlot());89 if (s) 90 s->markAggregate(markStack); 91 91 } 92 92 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r82519 r82849 29 29 #include "NumberPrototype.h" 30 30 #include "StringPrototype.h" 31 #include "StructureChain.h" 31 32 #include <wtf/HashSet.h> 32 33 #include <wtf/OwnPtr.h> … … 363 364 if (!isValid(exec, m_cachedPrototypeChain.get())) { 364 365 JSValue prototype = prototypeForLookup(exec); 365 m_cachedPrototypeChain = StructureChain::create(prototype.isNull() ? 0 : asObject(prototype)->structure());366 m_cachedPrototypeChain.set(exec->globalData(), StructureChain::create(exec->globalData(), prototype.isNull() ? 0 : asObject(prototype)->structure()), 0); 366 367 } 367 368 return m_cachedPrototypeChain.get(); -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r82519 r82849 646 646 return false; 647 647 648 RefPtr<Structure> structure = Structure::addPropertyTransition( m_structure, propertyName, attributes, specificFunction, offset);648 RefPtr<Structure> structure = Structure::addPropertyTransition(globalData, m_structure, propertyName, attributes, specificFunction, offset); 649 649 650 650 if (currentCapacity != structure->propertyStorageCapacity()) … … 816 816 JSCell::markChildren(markStack); 817 817 818 m arkStack.append(m_structure->storedPrototypeSlot());818 m_structure->markAggregate(markStack); 819 819 PropertyStorage storage = propertyStorage(); 820 820 size_t storageSize = m_structure->propertyStorageSize(); -
trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
r82519 r82849 78 78 } 79 79 80 jsPropertyNameIterator->setCachedPrototypeChain( structureChain);80 jsPropertyNameIterator->setCachedPrototypeChain(exec->globalData(), structureChain); 81 81 jsPropertyNameIterator->setCachedStructure(o->structure()); 82 82 o->structure()->setEnumerationCache(exec->globalData(), jsPropertyNameIterator); … … 87 87 { 88 88 JSValue identifier = m_jsStrings[i].get(); 89 if (m_cachedStructure == base->structure() && m_cachedPrototypeChain == base->structure()->prototypeChain(exec))89 if (m_cachedStructure == base->structure() && m_cachedPrototypeChain.get() == base->structure()->prototypeChain(exec)) 90 90 return identifier; 91 91 … … 98 98 { 99 99 markStack.appendValues(m_jsStrings.get(), m_jsStringsSize, MayContainNullValues); 100 if (m_cachedPrototypeChain) 101 markStack.append(&m_cachedPrototypeChain); 100 102 } 101 103 -
trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h
r82519 r82849 74 74 Structure* cachedStructure() { return m_cachedStructure.get(); } 75 75 76 void setCachedPrototypeChain( NonNullPassRefPtr<StructureChain> cachedPrototypeChain) { m_cachedPrototypeChain = cachedPrototypeChain; }76 void setCachedPrototypeChain(JSGlobalData& globalData, StructureChain* cachedPrototypeChain) { m_cachedPrototypeChain.set(globalData, this, cachedPrototypeChain); } 77 77 StructureChain* cachedPrototypeChain() { return m_cachedPrototypeChain.get(); } 78 78 … … 85 85 86 86 RefPtr<Structure> m_cachedStructure; 87 RefPtr<StructureChain> m_cachedPrototypeChain;87 WriteBarrier<StructureChain> m_cachedPrototypeChain; 88 88 uint32_t m_numCacheableSlots; 89 89 uint32_t m_jsStringsSize; -
trunk/Source/JavaScriptCore/runtime/JSZombie.cpp
r81040 r82849 36 36 const ClassInfo JSZombie::s_info = { "Zombie", 0, 0, 0 }; 37 37 38 Structure* JSZombie::leakedZombieStructure() { 38 Structure* JSZombie::leakedZombieStructure(JSGlobalData& globalData) 39 { 39 40 static Structure* structure = 0; 40 41 if (!structure) { 41 42 Structure::startIgnoringLeaks(); 42 structure = Structure::create( jsNull(), TypeInfo(UnspecifiedType), 0, &s_info).leakRef();43 structure = Structure::create(globalData, jsNull(), TypeInfo(UnspecifiedType), 0, &s_info).leakRef(); 43 44 Structure::stopIgnoringLeaks(); 44 45 } -
trunk/Source/JavaScriptCore/runtime/JSZombie.h
r81272 r82849 42 42 43 43 virtual bool isZombie() const { return true; } 44 static Structure* leakedZombieStructure( );44 static Structure* leakedZombieStructure(JSGlobalData&); 45 45 46 46 virtual bool isGetterSetter() const { ASSERT_NOT_REACHED(); return false; } -
trunk/Source/JavaScriptCore/runtime/MarkStack.h
r82519 r82849 216 216 template <typename T> inline void MarkStack::append(DeprecatedPtr<T>* slot) 217 217 { 218 internalAppend( slot->get());218 internalAppend(*slot->slot()); 219 219 } 220 220 221 221 template <typename T> inline void MarkStack::append(WriteBarrierBase<T>* slot) 222 222 { 223 internalAppend( slot->get());223 internalAppend(*slot->slot()); 224 224 } 225 225 -
trunk/Source/JavaScriptCore/runtime/MarkedBlock.cpp
r81040 r82849 79 79 const ClassInfo* info = cell->classInfo(); 80 80 cell->~JSCell(); 81 new (cell) JSZombie(info, JSZombie::leakedZombieStructure( ));81 new (cell) JSZombie(info, JSZombie::leakedZombieStructure(*m_heap->globalData())); 82 82 m_marks.set(i); 83 83 } -
trunk/Source/JavaScriptCore/runtime/Structure.cpp
r80378 r82849 368 368 } 369 369 370 PassRefPtr<Structure> Structure::addPropertyTransition( Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset)370 PassRefPtr<Structure> Structure::addPropertyTransition(JSGlobalData& globalData, Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset) 371 371 { 372 372 // If we have a specific function, we may have got to this point if there is … … 400 400 RefPtr<Structure> transition = create(structure); 401 401 402 transition->m_cachedPrototypeChain = structure->m_cachedPrototypeChain;402 transition->m_cachedPrototypeChain.set(globalData, structure->m_cachedPrototypeChain.get(), 0); 403 403 transition->m_previous = structure; 404 404 transition->m_nameInPrevious = propertyName.impl(); -
trunk/Source/JavaScriptCore/runtime/Structure.h
r82519 r82849 33 33 #include "PropertyNameArray.h" 34 34 #include "Protect.h" 35 #include "StructureChain.h"36 35 #include "StructureTransitionTable.h" 37 36 #include "JSTypeInfo.h" … … 47 46 class PropertyNameArray; 48 47 class PropertyNameArrayData; 48 class StructureChain; 49 49 50 50 struct ClassInfo; … … 74 74 static void dumpStatistics(); 75 75 76 static PassRefPtr<Structure> addPropertyTransition( Structure*, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset);76 static PassRefPtr<Structure> addPropertyTransition(JSGlobalData&, Structure*, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset); 77 77 static PassRefPtr<Structure> addPropertyTransitionToExistingStructure(Structure*, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset); 78 78 static PassRefPtr<Structure> removePropertyTransition(Structure*, const Identifier& propertyName, size_t& offset); … … 105 105 106 106 JSValue storedPrototype() const { return m_prototype.get(); } 107 DeprecatedPtr<Unknown>* storedPrototypeSlot() { return &m_prototype; }108 107 JSValue prototypeForLookup(ExecState*) const; 109 108 StructureChain* prototypeChain(ExecState*) const; 109 void markAggregate(MarkStack& markStack) 110 { 111 if (m_prototype) 112 markStack.append(&m_prototype); 113 } 110 114 111 115 Structure* previousID() const { return m_previous.get(); } … … 211 215 212 216 DeprecatedPtr<Unknown> m_prototype; 213 mutable RefPtr<StructureChain> m_cachedPrototypeChain;217 mutable WeakGCPtr<StructureChain> m_cachedPrototypeChain; 214 218 215 219 RefPtr<Structure> m_previous; -
trunk/Source/JavaScriptCore/runtime/StructureChain.cpp
r82519 r82849 33 33 namespace JSC { 34 34 35 StructureChain::StructureChain(Structure* head) 35 StructureChain::StructureChain(NonNullPassRefPtr<Structure> structure, Structure* head) 36 : JSCell(structure.releaseRef()) 36 37 { 37 38 size_t size = 0; … … 47 48 } 48 49 50 StructureChain::~StructureChain() 51 { 52 } 53 54 void StructureChain::markChildren(MarkStack& markStack) 55 { 56 size_t i = 0; 57 while (m_vector[i]) 58 m_vector[i++]->markAggregate(markStack); 59 } 60 49 61 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/StructureChain.h
r82519 r82849 27 27 #define StructureChain_h 28 28 29 #include "JSCell.h" 30 29 31 #include <wtf/OwnArrayPtr.h> 30 32 #include <wtf/PassRefPtr.h> … … 36 38 class Structure; 37 39 38 class StructureChain : public RefCounted<StructureChain>{40 class StructureChain : public JSCell { 39 41 friend class JIT; 40 42 41 43 public: 42 static PassRefPtr<StructureChain> create(Structure* head) { return adoptRef(new StructureChain(head)); }44 static StructureChain* create(JSGlobalData& globalData, Structure* head) { return new (&globalData) StructureChain(globalData.structureChainStructure, head); } 43 45 RefPtr<Structure>* head() { return m_vector.get(); } 46 void markChildren(MarkStack&); 47 48 static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(CompoundType, OverridesMarkChildren), 0, 0); } 44 49 45 50 private: 46 StructureChain( Structure* head);47 51 StructureChain(NonNullPassRefPtr<Structure>, Structure* head); 52 ~StructureChain(); 48 53 OwnArrayPtr<RefPtr<Structure> > m_vector; 49 54 }; -
trunk/Source/JavaScriptCore/runtime/WriteBarrier.h
r81191 r82849 95 95 void set(JSGlobalData&, const JSCell*, T* value) { this->m_cell = reinterpret_cast<JSCell*>(value); } 96 96 97 T* get() const { return reinterpret_cast<T*>(m_cell); } 98 T* operator*() const { return static_cast<T*>(m_cell); } 99 T* operator->() const { return static_cast<T*>(m_cell); } 97 T* get() const 98 { 99 return reinterpret_cast<T*>(m_cell); 100 } 101 102 T* operator*() const 103 { 104 return static_cast<T*>(m_cell); 105 } 106 107 T* operator->() const 108 { 109 return static_cast<T*>(m_cell); 110 } 111 100 112 void clear() { m_cell = 0; } 101 113 … … 117 129 void set(JSGlobalData&, const JSCell*, JSValue value) { m_value = JSValue::encode(value); } 118 130 void setWithoutWriteBarrier(JSValue value) { m_value = JSValue::encode(value); } 119 JSValue get() const { return JSValue::decode(m_value); } 131 JSValue get() const 132 { 133 #if ENABLE(JSC_ZOMBIES) 134 ASSERT(!JSValue::decode(m_value) || !JSValue::decode(m_value).isZombie()); 135 #endif 136 return JSValue::decode(m_value); 137 } 120 138 void clear() { m_value = JSValue::encode(JSValue()); } 121 139 void setUndefined() { m_value = JSValue::encode(jsUndefined()); } -
trunk/Source/WebCore/ChangeLog
r82847 r82849 1 2011-04-01 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Geoffrey Garen. 4 5 Make StructureChain GC allocated 6 https://bugs.webkit.org/show_bug.cgi?id=56695 7 8 Update for new Structure marking function 9 10 * bindings/js/JSDOMGlobalObject.cpp: 11 (WebCore::JSDOMGlobalObject::markChildren): 12 1 13 2011-04-04 Pavel Feldman <pfeldman@google.com> 2 14 -
trunk/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp
r80742 r82849 57 57 JSDOMStructureMap::iterator end = structures().end(); 58 58 for (JSDOMStructureMap::iterator it = structures().begin(); it != end; ++it) 59 markStack.append(it->second->storedPrototypeSlot());59 it->second->markAggregate(markStack); 60 60 61 61 JSDOMConstructorMap::iterator end2 = constructors().end();
Note: See TracChangeset
for help on using the changeset viewer.