X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/14957cd040308e3eeec43d26bae5d76da13fcd85..HEAD:/bytecode/StructureStubInfo.cpp diff --git a/bytecode/StructureStubInfo.cpp b/bytecode/StructureStubInfo.cpp index 9dd41a6..5ea530c 100644 --- a/bytecode/StructureStubInfo.cpp +++ b/bytecode/StructureStubInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2014 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,7 +27,8 @@ #include "StructureStubInfo.h" #include "JSObject.h" -#include "ScopeChain.h" +#include "PolymorphicGetByIdList.h" +#include "PolymorphicPutByIdList.h" namespace JSC { @@ -35,77 +36,69 @@ namespace JSC { void StructureStubInfo::deref() { switch (accessType) { - case access_get_by_id_self_list: { - PolymorphicAccessStructureList* polymorphicStructures = u.getByIdSelfList.structureList; - delete polymorphicStructures; + case access_get_by_id_list: { + delete u.getByIdList.list; return; } - case access_get_by_id_proto_list: { - PolymorphicAccessStructureList* polymorphicStructures = u.getByIdProtoList.structureList; + case access_put_by_id_list: + delete u.putByIdList.list; + return; + case access_in_list: { + PolymorphicAccessStructureList* polymorphicStructures = u.inList.structureList; delete polymorphicStructures; return; } case access_get_by_id_self: - case access_get_by_id_proto: - case access_get_by_id_chain: - case access_put_by_id_transition: + case access_put_by_id_transition_normal: + case access_put_by_id_transition_direct: case access_put_by_id_replace: - case access_get_by_id: - case access_put_by_id: - case access_get_by_id_generic: - case access_put_by_id_generic: - case access_get_array_length: - case access_get_string_length: + case access_unset: // These instructions don't have to release any allocated memory return; default: - ASSERT_NOT_REACHED(); + RELEASE_ASSERT_NOT_REACHED(); } } -void StructureStubInfo::visitAggregate(SlotVisitor& visitor) +bool StructureStubInfo::visitWeakReferences(RepatchBuffer& repatchBuffer) { switch (accessType) { case access_get_by_id_self: - visitor.append(&u.getByIdSelf.baseObjectStructure); - return; - case access_get_by_id_proto: - visitor.append(&u.getByIdProto.baseObjectStructure); - visitor.append(&u.getByIdProto.prototypeStructure); - return; - case access_get_by_id_chain: - visitor.append(&u.getByIdChain.baseObjectStructure); - visitor.append(&u.getByIdChain.chain); - return; - case access_get_by_id_self_list: { - PolymorphicAccessStructureList* polymorphicStructures = u.getByIdSelfList.structureList; - polymorphicStructures->visitAggregate(visitor, u.getByIdSelfList.listSize); - return; + if (!Heap::isMarked(u.getByIdSelf.baseObjectStructure.get())) + return false; + break; + case access_get_by_id_list: { + if (!u.getByIdList.list->visitWeak(repatchBuffer)) + return false; + break; } - case access_get_by_id_proto_list: { - PolymorphicAccessStructureList* polymorphicStructures = u.getByIdProtoList.structureList; - polymorphicStructures->visitAggregate(visitor, u.getByIdProtoList.listSize); - return; - } - case access_put_by_id_transition: - visitor.append(&u.putByIdTransition.previousStructure); - visitor.append(&u.putByIdTransition.structure); - visitor.append(&u.putByIdTransition.chain); - return; + case access_put_by_id_transition_normal: + case access_put_by_id_transition_direct: + if (!Heap::isMarked(u.putByIdTransition.previousStructure.get()) + || !Heap::isMarked(u.putByIdTransition.structure.get()) + || !Heap::isMarked(u.putByIdTransition.chain.get())) + return false; + break; case access_put_by_id_replace: - visitor.append(&u.putByIdReplace.baseObjectStructure); - return; - case access_get_by_id: - case access_put_by_id: - case access_get_by_id_generic: - case access_put_by_id_generic: - case access_get_array_length: - case access_get_string_length: - // These instructions don't need to mark anything - return; + if (!Heap::isMarked(u.putByIdReplace.baseObjectStructure.get())) + return false; + break; + case access_put_by_id_list: + if (!u.putByIdList.list->visitWeak(repatchBuffer)) + return false; + break; + case access_in_list: { + PolymorphicAccessStructureList* polymorphicStructures = u.inList.structureList; + if (!polymorphicStructures->visitWeak(u.inList.listSize)) + return false; + break; + } default: - ASSERT_NOT_REACHED(); + // The rest of the instructions don't require references, so there is no need to + // do anything. + break; } + return true; } #endif