Changeset 82500 in webkit


Ignore:
Timestamp:
Mar 30, 2011 2:39:20 PM (13 years ago)
Author:
oliver@apple.com
Message:

2011-03-30 Oliver Hunt <oliver@apple.com>

Reviewed by Geoffrey Garen.

Make StructureChain GC allocated
https://bugs.webkit.org/show_bug.cgi?id=56695

Make StructureChain GC allocated, and make the various owners
mark it correctly.

  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): (JSC::CodeBlock::derefStructures): (JSC::CodeBlock::refStructures): (JSC::CodeBlock::markAggregate):
  • bytecode/Instruction.h: (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set): (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList): (JSC::PolymorphicAccessStructureList::derefStructures): (JSC::PolymorphicAccessStructureList::markAggregate): (JSC::Instruction::Instruction):
  • bytecode/StructureStubInfo.cpp: (JSC::StructureStubInfo::deref): (JSC::StructureStubInfo::markAggregate):
  • bytecode/StructureStubInfo.h: (JSC::StructureStubInfo::initGetByIdChain): (JSC::StructureStubInfo::initPutByIdTransition):
  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall): (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply):
  • interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute):
  • jit/JITOpcodes.cpp: (JSC::JIT::emit_op_jneq_ptr):
  • jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_jneq_ptr):
  • jit/JITPropertyAccess.cpp: (JSC::JIT::privateCompileGetByIdChainList):
  • jit/JITPropertyAccess32_64.cpp: (JSC::JIT::privateCompileGetByIdChainList):
  • jit/JITStubs.cpp: (JSC::getPolymorphicAccessStructureListSlot): (JSC::DEFINE_STUB_FUNCTION):
  • runtime/JSCell.h:
  • runtime/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData):
  • runtime/JSGlobalData.h:
  • runtime/JSGlobalObject.cpp: (JSC::markIfNeeded):
  • runtime/JSGlobalObject.h: (JSC::Structure::prototypeChain):
  • runtime/JSObject.h: (JSC::JSObject::markChildrenDirect):
  • runtime/JSPropertyNameIterator.cpp: (JSC::JSPropertyNameIterator::create): (JSC::JSPropertyNameIterator::get): (JSC::JSPropertyNameIterator::markChildren):
  • runtime/JSPropertyNameIterator.h: (JSC::JSPropertyNameIterator::setCachedPrototypeChain):
  • runtime/MarkStack.h: (JSC::MarkStack::append):
  • runtime/Structure.h: (JSC::Structure::cachedPrototypeChainSlot):
  • runtime/StructureChain.cpp: (JSC::StructureChain::StructureChain):
  • runtime/StructureChain.h: (JSC::StructureChain::create): (JSC::StructureChain::createStructure):
Location:
trunk/Source/JavaScriptCore
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r82493 r82500  
     12011-03-30  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        * bytecode/CodeBlock.cpp:
     12        (JSC::CodeBlock::dump):
     13        (JSC::CodeBlock::derefStructures):
     14        (JSC::CodeBlock::refStructures):
     15        (JSC::CodeBlock::markAggregate):
     16        * bytecode/Instruction.h:
     17        (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
     18        (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
     19        (JSC::PolymorphicAccessStructureList::derefStructures):
     20        (JSC::PolymorphicAccessStructureList::markAggregate):
     21        (JSC::Instruction::Instruction):
     22        * bytecode/StructureStubInfo.cpp:
     23        (JSC::StructureStubInfo::deref):
     24        (JSC::StructureStubInfo::markAggregate):
     25        * bytecode/StructureStubInfo.h:
     26        (JSC::StructureStubInfo::initGetByIdChain):
     27        (JSC::StructureStubInfo::initPutByIdTransition):
     28        * bytecompiler/BytecodeGenerator.cpp:
     29        (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall):
     30        (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply):
     31        * interpreter/Interpreter.cpp:
     32        (JSC::Interpreter::privateExecute):
     33        * jit/JITOpcodes.cpp:
     34        (JSC::JIT::emit_op_jneq_ptr):
     35        * jit/JITOpcodes32_64.cpp:
     36        (JSC::JIT::emit_op_jneq_ptr):
     37        * jit/JITPropertyAccess.cpp:
     38        (JSC::JIT::privateCompileGetByIdChainList):
     39        * jit/JITPropertyAccess32_64.cpp:
     40        (JSC::JIT::privateCompileGetByIdChainList):
     41        * jit/JITStubs.cpp:
     42        (JSC::getPolymorphicAccessStructureListSlot):
     43        (JSC::DEFINE_STUB_FUNCTION):
     44        * runtime/JSCell.h:
     45        * runtime/JSGlobalData.cpp:
     46        (JSC::JSGlobalData::JSGlobalData):
     47        * runtime/JSGlobalData.h:
     48        * runtime/JSGlobalObject.cpp:
     49        (JSC::markIfNeeded):
     50        * runtime/JSGlobalObject.h:
     51        (JSC::Structure::prototypeChain):
     52        * runtime/JSObject.h:
     53        (JSC::JSObject::markChildrenDirect):
     54        * runtime/JSPropertyNameIterator.cpp:
     55        (JSC::JSPropertyNameIterator::create):
     56        (JSC::JSPropertyNameIterator::get):
     57        (JSC::JSPropertyNameIterator::markChildren):
     58        * runtime/JSPropertyNameIterator.h:
     59        (JSC::JSPropertyNameIterator::setCachedPrototypeChain):
     60        * runtime/MarkStack.h:
     61        (JSC::MarkStack::append):
     62        * runtime/Structure.h:
     63        (JSC::Structure::cachedPrototypeChainSlot):
     64        * runtime/StructureChain.cpp:
     65        (JSC::StructureChain::StructureChain):
     66        * runtime/StructureChain.h:
     67        (JSC::StructureChain::create):
     68        (JSC::StructureChain::createStructure):
     69
    1702011-03-30  Steve Falkenburg  <sfalken@apple.com>
    271
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r81380 r82500  
    732732            int r0 = (++it)->u.operand;
    733733            int id0 = (++it)->u.operand;
    734             JSValue scope = JSValue((++it)->u.jsCell);
     734            JSValue scope = JSValue((++it)->u.jsCell.get());
    735735            ++it;
    736736            int depth = (++it)->u.operand;
     
    14381438    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)) {
    14391439        vPC[4].u.structure->deref();
    1440         vPC[5].u.structureChain->deref();
    14411440        return;
    14421441    }
     
    14441443        vPC[4].u.structure->deref();
    14451444        vPC[5].u.structure->deref();
    1446         vPC[6].u.structureChain->deref();
    14471445        return;
    14481446    }
     
    14871485    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)) {
    14881486        vPC[4].u.structure->ref();
    1489         vPC[5].u.structureChain->ref();
    14901487        return;
    14911488    }
     
    14931490        vPC[4].u.structure->ref();
    14941491        vPC[5].u.structure->ref();
    1495         vPC[6].u.structureChain->ref();
    14961492        return;
    14971493    }
     
    15281524            markStack.append(&callLinkInfo(i).callee);
    15291525#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_structureStubInfos.size(), i = 0; i < size; ++i)
     1538        m_structureStubInfos[i].markAggregate(markStack);
     1539#endif
    15301540}
    15311541
  • trunk/Source/JavaScriptCore/bytecode/Instruction.h

    r76248 r82500  
    6464            union {
    6565                Structure* proto;
    66                 StructureChain* chain;
     66                WriteBarrierBase<StructureChain> chain;
    6767            } u;
    6868
     
    8383            }
    8484           
    85             void set(PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base, StructureChain* _chain)
     85            void set(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base, StructureChain* _chain)
    8686            {
    8787                stubRoutine = _stubRoutine;
    8888                base = _base;
    89                 u.chain = _chain;
     89                u.chain.set(globalData, owner, _chain);
    9090                isChain = true;
    9191            }
     
    102102        }
    103103
    104         PolymorphicAccessStructureList(PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase, StructureChain* firstChain)
     104        PolymorphicAccessStructureList(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase, StructureChain* firstChain)
    105105        {
    106             list[0].set(stubRoutine, firstBase, firstChain);
     106            list[0].set(globalData, owner, stubRoutine, firstBase, firstChain);
    107107        }
    108108
     
    116116
    117117                if (info.u.proto) {
    118                     if (info.isChain)
    119                         info.u.chain->deref();
    120                     else
     118                    if (!info.isChain)
    121119                        info.u.proto->deref();
    122120                }
     121            }
     122        }
     123
     124        void markAggregate(MarkStack& markStack, int count)
     125        {
     126            for (int i = 0; i < count; ++i) {
     127                PolymorphicStubInfo& info = list[i];
     128                ASSERT(info.base);
     129               
     130                if (info.u.proto && info.isChain)
     131                    markStack.append(&info.u.chain);
    123132            }
    124133        }
     
    131140            // We have to initialize one of the pointer members to ensure that
    132141            // the entire struct is initialized, when opcode is not a pointer.
    133             u.jsCell = 0;
     142            u.jsCell.clear();
    134143#endif
    135144            u.opcode = opcode;
     
    140149            // We have to initialize one of the pointer members to ensure that
    141150            // the entire struct is initialized in 64-bit.
    142             u.jsCell = 0;
     151            u.jsCell.clear();
    143152            u.operand = operand;
    144153        }
    145154
    146155        Instruction(Structure* structure) { u.structure = structure; }
    147         Instruction(StructureChain* structureChain) { u.structureChain = structureChain; }
    148         Instruction(JSCell* jsCell) { u.jsCell = jsCell; }
     156        Instruction(JSGlobalData& globalData, JSCell* owner, StructureChain* structureChain)
     157        {
     158            u.structureChain.clear();
     159            u.structureChain.set(globalData, owner, structureChain);
     160        }
     161        Instruction(JSGlobalData& globalData, JSCell* owner, JSCell* jsCell)
     162        {
     163            u.jsCell.clear();
     164            u.jsCell.set(globalData, owner, jsCell);
     165        }
    149166        Instruction(PolymorphicAccessStructureList* polymorphicStructures) { u.polymorphicStructures = polymorphicStructures; }
    150167        Instruction(PropertySlot::GetValueFunc getterFunc) { u.getterFunc = getterFunc; }
     
    154171            int operand;
    155172            Structure* structure;
    156             StructureChain* structureChain;
    157             JSCell* jsCell;
     173            WriteBarrierBase<StructureChain> structureChain;
     174            WriteBarrierBase<JSCell> jsCell;
    158175            PolymorphicAccessStructureList* polymorphicStructures;
    159176            PropertySlot::GetValueFunc getterFunc;
  • trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp

    r81040 r82500  
    4545    case access_get_by_id_chain:
    4646        u.getByIdChain.baseObjectStructure->deref();
    47         u.getByIdChain.chain->deref();
    4847        return;
    4948    case access_get_by_id_self_list: {
     
    6261        u.putByIdTransition.previousStructure->deref();
    6362        u.putByIdTransition.structure->deref();
    64         u.putByIdTransition.chain->deref();
    6563        return;
    6664    case access_put_by_id_replace:
     
    7977    }
    8078}
     79
     80void StructureStubInfo::markAggregate(MarkStack& markStack)
     81{
     82    switch (accessType) {
     83    case access_get_by_id_self:
     84        return;
     85    case access_get_by_id_proto:
     86        return;
     87    case access_get_by_id_chain:
     88        return;
     89    case access_get_by_id_self_list: {
     90        PolymorphicAccessStructureList* polymorphicStructures = u.getByIdSelfList.structureList;
     91        polymorphicStructures->markAggregate(markStack, u.getByIdSelfList.listSize);
     92        return;
     93    }
     94    case access_get_by_id_proto_list: {
     95        PolymorphicAccessStructureList* polymorphicStructures = u.getByIdProtoList.structureList;
     96        polymorphicStructures->markAggregate(markStack, u.getByIdProtoList.listSize);
     97        return;
     98    }
     99    case access_put_by_id_transition:
     100        return;
     101    case access_put_by_id_replace:
     102        return;
     103    case access_get_by_id:
     104    case access_put_by_id:
     105    case access_get_by_id_generic:
     106    case access_put_by_id_generic:
     107    case access_get_array_length:
     108    case access_get_string_length:
     109        // These instructions don't ref their Structures.
     110        return;
     111    default:
     112        ASSERT_NOT_REACHED();
     113    }
     114}
    81115#endif
    82116
  • trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.h

    r81380 r82500  
    8686
    8787            u.getByIdChain.chain = chain;
    88             chain->ref();
    8988        }
    9089
     
    118117
    119118            u.putByIdTransition.chain = chain;
    120             chain->ref();
    121119        }
    122120
     
    130128
    131129        void deref();
     130        void markAggregate(MarkStack&);
    132131
    133132        bool seenOnce()
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r82173 r82500  
    926926    emitOpcode(op_jneq_ptr);
    927927    instructions().append(cond->index());
    928     instructions().append(m_scopeChain->globalObject->callFunction());
     928    instructions().append(Instruction(*m_globalData, m_codeBlock->ownerExecutable(), m_scopeChain->globalObject->callFunction()));
    929929    instructions().append(target->bind(begin, instructions().size()));
    930930    return target;
     
    937937    emitOpcode(op_jneq_ptr);
    938938    instructions().append(cond->index());
    939     instructions().append(m_scopeChain->globalObject->applyFunction());
     939    instructions().append(Instruction(*m_globalData, m_codeBlock->ownerExecutable(), m_scopeChain->globalObject->applyFunction()));
    940940    instructions().append(target->bind(begin, instructions().size()));
    941941    return target;
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r81904 r82500  
    35383538         */
    35393539        int src = vPC[1].u.operand;
    3540         JSValue ptr = JSValue(vPC[2].u.jsCell);
    35413540        int target = vPC[3].u.operand;
    35423541        JSValue srcValue = callFrame->r(src).jsValue();
    3543         if (srcValue != ptr) {
     3542        if (srcValue != vPC[2].u.jsCell.get()) {
    35443543            vPC += target;
    35453544            NEXT_INSTRUCTION();
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r82130 r82500  
    763763{
    764764    unsigned src = currentInstruction[1].u.operand;
    765     JSCell* ptr = currentInstruction[2].u.jsCell;
     765    JSCell* ptr = currentInstruction[2].u.jsCell.get();
    766766    unsigned target = currentInstruction[3].u.operand;
    767767   
  • trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp

    r82130 r82500  
    980980{
    981981    unsigned src = currentInstruction[1].u.operand;
    982     JSCell* ptr = currentInstruction[2].u.jsCell;
     982    JSCell* ptr = currentInstruction[2].u.jsCell.get();
    983983    unsigned target = currentInstruction[3].u.operand;
    984984
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp

    r82139 r82500  
    980980    // Track the stub we have created so that it will be deleted later.
    981981    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);
    984983
    985984    // Finally patch the jump to slow case back in the hot path to jump here instead.
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp

    r82139 r82500  
    10081008    // Track the stub we have created so that it will be deleted later.
    10091009    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);
    10121011   
    10131012    // Finally patch the jump to slow case back in the hot path to jump here instead.
  • trunk/Source/JavaScriptCore/jit/JITStubs.cpp

    r81311 r82500  
    15541554}
    15551555
    1556 static PolymorphicAccessStructureList* getPolymorphicAccessStructureListSlot(StructureStubInfo* stubInfo, int& listIndex)
     1556static PolymorphicAccessStructureList* getPolymorphicAccessStructureListSlot(JSGlobalData& globalData, ScriptExecutable* owner, StructureStubInfo* stubInfo, int& listIndex)
    15571557{
    15581558    PolymorphicAccessStructureList* prototypeStructureList = 0;
     
    15661566        break;
    15671567    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);
    15691569        stubInfo->stubRoutine = CodeLocationLabel();
    15701570        stubInfo->initGetByIdProtoList(prototypeStructureList, 2);
     
    16541654
    16551655        int listIndex;
    1656         PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot(stubInfo, listIndex);
     1656        PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot(callFrame->globalData(), codeBlock->ownerExecutable(), stubInfo, listIndex);
    16571657        if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE) {
    16581658            JIT::compileGetByIdProtoList(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, slotBaseObject->structure(), propertyName, slot, offset);
     
    16641664        ASSERT(!baseValue.asCell()->structure()->isDictionary());
    16651665        int listIndex;
    1666         PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot(stubInfo, listIndex);
     1666        PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot(callFrame->globalData(), codeBlock->ownerExecutable(), stubInfo, listIndex);
    16671667       
    16681668        if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE) {
  • trunk/Source/JavaScriptCore/runtime/JSCell.h

    r82173 r82500  
    6969        friend class MarkedBlock;
    7070        friend class ScopeChainNode;
     71        friend class StructureChain;
    7172
    7273    private:
  • trunk/Source/JavaScriptCore/runtime/JSGlobalData.cpp

    r81751 r82500  
    185185    functionExecutableStructure = FunctionExecutable::createStructure(*this, jsNull());
    186186    dummyMarkableCellStructure = JSCell::createDummyStructure(*this);
     187    structureChainStructure = StructureChain::createStructure(*this, jsNull());
    187188
    188189    interpreter = new Interpreter(*this);
  • trunk/Source/JavaScriptCore/runtime/JSGlobalData.h

    r81191 r82500  
    162162        RefPtr<Structure> functionExecutableStructure;
    163163        RefPtr<Structure> dummyMarkableCellStructure;
     164        RefPtr<Structure> structureChainStructure;
    164165
    165166        static void storeVPtrs();
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r81904 r82500  
    8989    if (s && s->storedPrototype())
    9090        markStack.append(s->storedPrototypeSlot());
     91    if (s && *s->cachedPrototypeChainSlot())
     92        markStack.append(s->cachedPrototypeChainSlot());
    9193}
    9294
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r81904 r82500  
    2929#include "NumberPrototype.h"
    3030#include "StringPrototype.h"
     31#include "StructureChain.h"
    3132#include <wtf/HashSet.h>
    3233#include <wtf/OwnPtr.h>
     
    363364        if (!isValid(exec, m_cachedPrototypeChain.get())) {
    364365            JSValue prototype = prototypeForLookup(exec);
    365             m_cachedPrototypeChain = StructureChain::create(prototype.isNull() ? 0 : asObject(prototype)->structure());
     366            m_cachedPrototypeChain = StructureChain::create(exec->globalData(), prototype.isNull() ? 0 : asObject(prototype)->structure());
    366367        }
    367368        return m_cachedPrototypeChain.get();
  • trunk/Source/JavaScriptCore/runtime/JSObject.h

    r82173 r82500  
    815815{
    816816    JSCell::markChildren(markStack);
    817 
     817   
    818818    markStack.append(m_structure->storedPrototypeSlot());
     819    if (*m_structure->cachedPrototypeChainSlot())
     820        markStack.append(m_structure->cachedPrototypeChainSlot());
    819821    PropertyStorage storage = propertyStorage();
    820822    size_t storageSize = m_structure->propertyStorageSize();
  • trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp

    r78634 r82500  
    7878    }
    7979
    80     jsPropertyNameIterator->setCachedPrototypeChain(structureChain);
     80    jsPropertyNameIterator->setCachedPrototypeChain(exec->globalData(), structureChain);
    8181    jsPropertyNameIterator->setCachedStructure(o->structure());
    8282    o->structure()->setEnumerationCache(exec->globalData(), jsPropertyNameIterator);
     
    8787{
    8888    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))
    9090        return identifier;
    9191
     
    9898{
    9999    markStack.appendValues(m_jsStrings.get(), m_jsStringsSize, MayContainNullValues);
     100    if (m_cachedPrototypeChain)
     101        markStack.append(&m_cachedPrototypeChain);
    100102}
    101103
  • trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h

    r81272 r82500  
    7474        Structure* cachedStructure() { return m_cachedStructure.get(); }
    7575
    76         void setCachedPrototypeChain(NonNullPassRefPtr<StructureChain> cachedPrototypeChain) { m_cachedPrototypeChain = cachedPrototypeChain; }
     76        void setCachedPrototypeChain(JSGlobalData& globalData, StructureChain* cachedPrototypeChain) { m_cachedPrototypeChain.set(globalData, this, cachedPrototypeChain); }
    7777        StructureChain* cachedPrototypeChain() { return m_cachedPrototypeChain.get(); }
    7878
     
    8585
    8686        RefPtr<Structure> m_cachedStructure;
    87         RefPtr<StructureChain> m_cachedPrototypeChain;
     87        WriteBarrier<StructureChain> m_cachedPrototypeChain;
    8888        uint32_t m_numCacheableSlots;
    8989        uint32_t m_jsStringsSize;
  • trunk/Source/JavaScriptCore/runtime/MarkStack.h

    r81262 r82500  
    216216    template <typename T> inline void MarkStack::append(DeprecatedPtr<T>* slot)
    217217    {
    218         internalAppend(slot->get());
     218        internalAppend(*slot->slot());
    219219    }
    220220   
    221221    template <typename T> inline void MarkStack::append(WriteBarrierBase<T>* slot)
    222222    {
    223         internalAppend(slot->get());
     223        internalAppend(*slot->slot());
    224224    }
    225225
  • trunk/Source/JavaScriptCore/runtime/Structure.h

    r81272 r82500  
    3333#include "PropertyNameArray.h"
    3434#include "Protect.h"
    35 #include "StructureChain.h"
    3635#include "StructureTransitionTable.h"
    3736#include "JSTypeInfo.h"
     
    4746    class PropertyNameArray;
    4847    class PropertyNameArrayData;
     48    class StructureChain;
    4949
    5050    struct ClassInfo;
     
    108108        JSValue prototypeForLookup(ExecState*) const;
    109109        StructureChain* prototypeChain(ExecState*) const;
     110        DeprecatedPtr<StructureChain>* cachedPrototypeChainSlot() { return &m_cachedPrototypeChain; }
    110111
    111112        Structure* previousID() const { return m_previous.get(); }
     
    211212
    212213        DeprecatedPtr<Unknown> m_prototype;
    213         mutable RefPtr<StructureChain> m_cachedPrototypeChain;
     214        mutable DeprecatedPtr<StructureChain> m_cachedPrototypeChain;
    214215
    215216        RefPtr<Structure> m_previous;
  • trunk/Source/JavaScriptCore/runtime/StructureChain.cpp

    r77785 r82500  
    3333namespace JSC {
    3434
    35 StructureChain::StructureChain(Structure* head)
     35StructureChain::StructureChain(NonNullPassRefPtr<Structure> structure, Structure* head)
     36    : JSCell(structure.releaseRef())
    3637{
    3738    size_t size = 0;
  • trunk/Source/JavaScriptCore/runtime/StructureChain.h

    r49734 r82500  
    2727#define StructureChain_h
    2828
     29#include "JSCell.h"
     30
    2931#include <wtf/OwnArrayPtr.h>
    3032#include <wtf/PassRefPtr.h>
     
    3638    class Structure;
    3739
    38     class StructureChain : public RefCounted<StructureChain> {
     40    class StructureChain : public JSCell {
    3941        friend class JIT;
    4042
    4143    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); }
    4345        RefPtr<Structure>* head() { return m_vector.get(); }
    4446
     47        static PassRefPtr<Structure> createStructure(JSGlobalData& globalData, JSValue prototype) { return Structure::create(globalData, prototype, TypeInfo(CompoundType, OverridesMarkChildren), 0, 0); }
    4548    private:
    46         StructureChain(Structure* head);
     49        StructureChain(NonNullPassRefPtr<Structure>, Structure* head);
    4750
    4851        OwnArrayPtr<RefPtr<Structure> > m_vector;
Note: See TracChangeset for help on using the changeset viewer.