]>
Commit | Line | Data |
---|---|---|
9dae56ea A |
1 | /* |
2 | * Copyright (C) 2008 Apple Inc. All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions | |
6 | * are met: | |
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. | |
12 | * | |
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. | |
24 | */ | |
25 | ||
26 | #ifndef StructureStubInfo_h | |
27 | #define StructureStubInfo_h | |
28 | ||
ba379fdc A |
29 | #if ENABLE(JIT) |
30 | ||
9dae56ea | 31 | #include "Instruction.h" |
ba379fdc | 32 | #include "MacroAssembler.h" |
9dae56ea A |
33 | #include "Opcode.h" |
34 | #include "Structure.h" | |
35 | ||
36 | namespace JSC { | |
37 | ||
f9bf01c6 A |
38 | enum AccessType { |
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, | |
46 | access_get_by_id, | |
47 | access_put_by_id, | |
48 | access_get_by_id_generic, | |
49 | access_put_by_id_generic, | |
50 | access_get_array_length, | |
51 | access_get_string_length, | |
52 | }; | |
53 | ||
9dae56ea | 54 | struct StructureStubInfo { |
f9bf01c6 A |
55 | StructureStubInfo(AccessType accessType) |
56 | : accessType(accessType) | |
57 | , seen(false) | |
9dae56ea A |
58 | { |
59 | } | |
60 | ||
14957cd0 | 61 | void initGetByIdSelf(JSGlobalData& globalData, JSCell* owner, Structure* baseObjectStructure) |
9dae56ea | 62 | { |
f9bf01c6 | 63 | accessType = access_get_by_id_self; |
9dae56ea | 64 | |
14957cd0 | 65 | u.getByIdSelf.baseObjectStructure.set(globalData, owner, baseObjectStructure); |
9dae56ea A |
66 | } |
67 | ||
14957cd0 | 68 | void initGetByIdProto(JSGlobalData& globalData, JSCell* owner, Structure* baseObjectStructure, Structure* prototypeStructure) |
9dae56ea | 69 | { |
f9bf01c6 | 70 | accessType = access_get_by_id_proto; |
9dae56ea | 71 | |
14957cd0 A |
72 | u.getByIdProto.baseObjectStructure.set(globalData, owner, baseObjectStructure); |
73 | u.getByIdProto.prototypeStructure.set(globalData, owner, prototypeStructure); | |
9dae56ea A |
74 | } |
75 | ||
14957cd0 | 76 | void initGetByIdChain(JSGlobalData& globalData, JSCell* owner, Structure* baseObjectStructure, StructureChain* chain) |
9dae56ea | 77 | { |
f9bf01c6 | 78 | accessType = access_get_by_id_chain; |
9dae56ea | 79 | |
14957cd0 A |
80 | u.getByIdChain.baseObjectStructure.set(globalData, owner, baseObjectStructure); |
81 | u.getByIdChain.chain.set(globalData, owner, chain); | |
9dae56ea A |
82 | } |
83 | ||
84 | void initGetByIdSelfList(PolymorphicAccessStructureList* structureList, int listSize) | |
85 | { | |
f9bf01c6 | 86 | accessType = access_get_by_id_self_list; |
9dae56ea A |
87 | |
88 | u.getByIdProtoList.structureList = structureList; | |
89 | u.getByIdProtoList.listSize = listSize; | |
90 | } | |
91 | ||
92 | void initGetByIdProtoList(PolymorphicAccessStructureList* structureList, int listSize) | |
93 | { | |
f9bf01c6 | 94 | accessType = access_get_by_id_proto_list; |
9dae56ea A |
95 | |
96 | u.getByIdProtoList.structureList = structureList; | |
97 | u.getByIdProtoList.listSize = listSize; | |
98 | } | |
99 | ||
100 | // PutById* | |
101 | ||
14957cd0 | 102 | void initPutByIdTransition(JSGlobalData& globalData, JSCell* owner, Structure* previousStructure, Structure* structure, StructureChain* chain) |
9dae56ea | 103 | { |
f9bf01c6 | 104 | accessType = access_put_by_id_transition; |
9dae56ea | 105 | |
14957cd0 A |
106 | u.putByIdTransition.previousStructure.set(globalData, owner, previousStructure); |
107 | u.putByIdTransition.structure.set(globalData, owner, structure); | |
108 | u.putByIdTransition.chain.set(globalData, owner, chain); | |
9dae56ea A |
109 | } |
110 | ||
14957cd0 | 111 | void initPutByIdReplace(JSGlobalData& globalData, JSCell* owner, Structure* baseObjectStructure) |
9dae56ea | 112 | { |
f9bf01c6 | 113 | accessType = access_put_by_id_replace; |
9dae56ea | 114 | |
14957cd0 | 115 | u.putByIdReplace.baseObjectStructure.set(globalData, owner, baseObjectStructure); |
9dae56ea A |
116 | } |
117 | ||
118 | void deref(); | |
14957cd0 | 119 | void visitAggregate(SlotVisitor&); |
9dae56ea | 120 | |
f9bf01c6 A |
121 | bool seenOnce() |
122 | { | |
123 | return seen; | |
124 | } | |
125 | ||
126 | void setSeen() | |
127 | { | |
128 | seen = true; | |
129 | } | |
130 | ||
131 | int accessType : 31; | |
132 | int seen : 1; | |
133 | ||
9dae56ea A |
134 | union { |
135 | struct { | |
14957cd0 | 136 | WriteBarrierBase<Structure> baseObjectStructure; |
9dae56ea A |
137 | } getByIdSelf; |
138 | struct { | |
14957cd0 A |
139 | WriteBarrierBase<Structure> baseObjectStructure; |
140 | WriteBarrierBase<Structure> prototypeStructure; | |
9dae56ea A |
141 | } getByIdProto; |
142 | struct { | |
14957cd0 A |
143 | WriteBarrierBase<Structure> baseObjectStructure; |
144 | WriteBarrierBase<StructureChain> chain; | |
9dae56ea A |
145 | } getByIdChain; |
146 | struct { | |
147 | PolymorphicAccessStructureList* structureList; | |
148 | int listSize; | |
149 | } getByIdSelfList; | |
150 | struct { | |
151 | PolymorphicAccessStructureList* structureList; | |
152 | int listSize; | |
153 | } getByIdProtoList; | |
154 | struct { | |
14957cd0 A |
155 | WriteBarrierBase<Structure> previousStructure; |
156 | WriteBarrierBase<Structure> structure; | |
157 | WriteBarrierBase<StructureChain> chain; | |
9dae56ea A |
158 | } putByIdTransition; |
159 | struct { | |
14957cd0 | 160 | WriteBarrierBase<Structure> baseObjectStructure; |
9dae56ea A |
161 | } putByIdReplace; |
162 | } u; | |
163 | ||
ba379fdc A |
164 | CodeLocationLabel stubRoutine; |
165 | CodeLocationCall callReturnLocation; | |
166 | CodeLocationLabel hotPathBegin; | |
9dae56ea | 167 | }; |
9dae56ea A |
168 | |
169 | } // namespace JSC | |
170 | ||
ba379fdc A |
171 | #endif |
172 | ||
9dae56ea | 173 | #endif // StructureStubInfo_h |