diff options
Diffstat (limited to 'Source/JavaScriptCore/bytecode/Instruction.h')
-rw-r--r-- | Source/JavaScriptCore/bytecode/Instruction.h | 59 |
1 files changed, 28 insertions, 31 deletions
diff --git a/Source/JavaScriptCore/bytecode/Instruction.h b/Source/JavaScriptCore/bytecode/Instruction.h index da0821d..d9cbb11 100644 --- a/Source/JavaScriptCore/bytecode/Instruction.h +++ b/Source/JavaScriptCore/bytecode/Instruction.h @@ -33,6 +33,7 @@ #include "Opcode.h" #include "PropertySlot.h" #include "Structure.h" +#include "StructureChain.h" #include <wtf/VectorTraits.h> #define POLYMORPHIC_LIST_CACHE_SIZE 8 @@ -60,45 +61,45 @@ namespace JSC { struct PolymorphicStubInfo { bool isChain; PolymorphicAccessStructureListStubRoutineType stubRoutine; - Structure* base; + WriteBarrier<Structure> base; union { - Structure* proto; + WriteBarrierBase<Structure> proto; WriteBarrierBase<StructureChain> chain; } u; - void set(PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base) + void set(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base) { stubRoutine = _stubRoutine; - base = _base; - u.proto = 0; + base.set(globalData, owner, _base); + u.proto.clear(); isChain = false; } - void set(PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base, Structure* _proto) + void set(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base, Structure* _proto) { stubRoutine = _stubRoutine; - base = _base; - u.proto = _proto; + base.set(globalData, owner, _base); + u.proto.set(globalData, owner, _proto); isChain = false; } void set(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base, StructureChain* _chain) { stubRoutine = _stubRoutine; - base = _base; + base.set(globalData, owner, _base); u.chain.set(globalData, owner, _chain); isChain = true; } } list[POLYMORPHIC_LIST_CACHE_SIZE]; - PolymorphicAccessStructureList(PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase) + PolymorphicAccessStructureList(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase) { - list[0].set(stubRoutine, firstBase); + list[0].set(globalData, owner, stubRoutine, firstBase); } - PolymorphicAccessStructureList(PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase, Structure* firstProto) + PolymorphicAccessStructureList(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase, Structure* firstProto) { - list[0].set(stubRoutine, firstBase, firstProto); + list[0].set(globalData, owner, stubRoutine, firstBase, firstProto); } PolymorphicAccessStructureList(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase, StructureChain* firstChain) @@ -106,28 +107,16 @@ namespace JSC { list[0].set(globalData, owner, stubRoutine, firstBase, firstChain); } - void derefStructures(int count) - { - for (int i = 0; i < count; ++i) { - PolymorphicStubInfo& info = list[i]; - - ASSERT(info.base); - info.base->deref(); - - if (info.u.proto) { - if (!info.isChain) - info.u.proto->deref(); - } - } - } - void markAggregate(MarkStack& markStack, int count) { for (int i = 0; i < count; ++i) { PolymorphicStubInfo& info = list[i]; ASSERT(info.base); - if (info.u.proto && info.isChain) + markStack.append(&info.base); + if (info.u.proto && !info.isChain) + markStack.append(&info.u.proto); + if (info.u.chain && info.isChain) markStack.append(&info.u.chain); } } @@ -152,7 +141,11 @@ namespace JSC { u.operand = operand; } - Instruction(Structure* structure) { u.structure = structure; } + Instruction(JSGlobalData& globalData, JSCell* owner, Structure* structure) + { + u.structure.clear(); + u.structure.set(globalData, owner, structure); + } Instruction(JSGlobalData& globalData, JSCell* owner, StructureChain* structureChain) { u.structureChain.clear(); @@ -169,12 +162,16 @@ namespace JSC { union { Opcode opcode; int operand; - Structure* structure; + WriteBarrierBase<Structure> structure; WriteBarrierBase<StructureChain> structureChain; WriteBarrierBase<JSCell> jsCell; PolymorphicAccessStructureList* polymorphicStructures; PropertySlot::GetValueFunc getterFunc; } u; + + private: + Instruction(StructureChain*); + Instruction(Structure*); }; } // namespace JSC |