2 * Copyright (C) 2008 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 #ifndef StructureStubInfo_h
27 #define StructureStubInfo_h
31 #include "Instruction.h"
32 #include "MacroAssembler.h"
34 #include "Structure.h"
39 access_get_by_id_self,
40 access_get_by_id_proto,
41 access_get_by_id_chain,
42 access_get_by_id_self_list,
43 access_get_by_id_proto_list,
44 access_put_by_id_transition,
45 access_put_by_id_replace,
47 access_get_by_id_generic,
48 access_put_by_id_generic,
49 access_get_array_length,
50 access_get_string_length,
53 struct StructureStubInfo {
55 : accessType(access_unset)
60 void initGetByIdSelf(JSGlobalData& globalData, JSCell* owner, Structure* baseObjectStructure)
62 accessType = access_get_by_id_self;
64 u.getByIdSelf.baseObjectStructure.set(globalData, owner, baseObjectStructure);
67 void initGetByIdProto(JSGlobalData& globalData, JSCell* owner, Structure* baseObjectStructure, Structure* prototypeStructure)
69 accessType = access_get_by_id_proto;
71 u.getByIdProto.baseObjectStructure.set(globalData, owner, baseObjectStructure);
72 u.getByIdProto.prototypeStructure.set(globalData, owner, prototypeStructure);
75 void initGetByIdChain(JSGlobalData& globalData, JSCell* owner, Structure* baseObjectStructure, StructureChain* chain)
77 accessType = access_get_by_id_chain;
79 u.getByIdChain.baseObjectStructure.set(globalData, owner, baseObjectStructure);
80 u.getByIdChain.chain.set(globalData, owner, chain);
83 void initGetByIdSelfList(PolymorphicAccessStructureList* structureList, int listSize)
85 accessType = access_get_by_id_self_list;
87 u.getByIdProtoList.structureList = structureList;
88 u.getByIdProtoList.listSize = listSize;
91 void initGetByIdProtoList(PolymorphicAccessStructureList* structureList, int listSize)
93 accessType = access_get_by_id_proto_list;
95 u.getByIdProtoList.structureList = structureList;
96 u.getByIdProtoList.listSize = listSize;
101 void initPutByIdTransition(JSGlobalData& globalData, JSCell* owner, Structure* previousStructure, Structure* structure, StructureChain* chain)
103 accessType = access_put_by_id_transition;
105 u.putByIdTransition.previousStructure.set(globalData, owner, previousStructure);
106 u.putByIdTransition.structure.set(globalData, owner, structure);
107 u.putByIdTransition.chain.set(globalData, owner, chain);
110 void initPutByIdReplace(JSGlobalData& globalData, JSCell* owner, Structure* baseObjectStructure)
112 accessType = access_put_by_id_replace;
114 u.putByIdReplace.baseObjectStructure.set(globalData, owner, baseObjectStructure);
118 void visitAggregate(SlotVisitor&);
137 int16_t deltaCallToDone;
138 int16_t deltaCallToStructCheck;
139 int16_t deltaCallToSlowCase;
144 int16_t deltaCheckImmToCall;
145 int16_t deltaCallToLoadOrStore;
148 WriteBarrierBase<Structure> baseObjectStructure;
151 WriteBarrierBase<Structure> baseObjectStructure;
152 WriteBarrierBase<Structure> prototypeStructure;
155 WriteBarrierBase<Structure> baseObjectStructure;
156 WriteBarrierBase<StructureChain> chain;
159 PolymorphicAccessStructureList* structureList;
163 PolymorphicAccessStructureList* structureList;
167 WriteBarrierBase<Structure> previousStructure;
168 WriteBarrierBase<Structure> structure;
169 WriteBarrierBase<StructureChain> chain;
172 WriteBarrierBase<Structure> baseObjectStructure;
176 MacroAssemblerCodeRef stubRoutine;
177 CodeLocationCall callReturnLocation;
178 CodeLocationLabel hotPathBegin;
185 #endif // StructureStubInfo_h